apps-dba journal

A working journal for Oracle DBAs.

September 25, 2026

Oracle DBA Lesson 18 — Inspect a PDB with SQL Developer

SQL Developer is another client for the same PDB you already open with SQL*Plus. This lesson connects to LABPDB as COURSE_READER, confirms the container, browses COURSE_OWNER.EMPLOYEES, and runs a short query — so the GUI and the CLI are clearly looking at one database, not two copies of the data.

Companion video

Oracle DBA Lesson 18 — Inspect a PDB with SQL Developer

Watch on YouTube →

Why a second client

SQL*Plus is built for scripts and spool files. SQL Developer is built for browsing objects, editing worksheets, and reviewing DDL before you run it. Neither owns the data. A connection is just a session into a service — here the PDB service for LABPDB.

If the listener answers but the service name is wrong, you never reach the PDB you meant. Prefer Service name over SID for a CDB/PDB layout.

New connection fields that matter

In New / Select Database Connection, set Connection Type to Basic, choose Service name, and fill hostname, port (often 1521), and the PDB service. Role stays default unless you truly need SYSDBA. Use Test before Connect so a bad service fails fast.

Connection name : LABPDB / COURSE_READER
Username        : COURSE_READER
Connection Type : Basic
Role            : default
Hostname        : dbhost.example.test   (or your lab host)
Port            : 1521
Service name    : LABPDB      (PDB service — not the CDB SID)

Confirm the container in the worksheet

After Connect, open a SQL Worksheet on that connection and ask the session who it is and which container it is in. That habit catches a connection that landed in CDB$ROOT by mistake.

SELECT USER AS current_user,
       SYS_CONTEXT('USERENV', 'CON_NAME')
         AS container_name
FROM   dual;

SYS_CONTEXT('USERENV','CON_NAME') returns the container name for the current session. In SQL*Plus you may also use SHOW CON_NAME; both answer the same question from different clients.

Browse the table, then query it

Under Connections, expand Other Users → COURSE_OWNER → Tables → EMPLOYEES. The Columns tab shows names and datatypes (for example EMPLOYEE_ID NUMBER, EMPLOYEE_NAME VARCHAR2(80)). The Data tab samples rows. Privilege still rules what you see: a reader account may select rows it cannot alter.

Run an explicit query when you want a stable result set, not only a GUI browse:

SELECT employee_id, employee_name
FROM   course_owner.employees
ORDER  BY employee_id;

DDL preview before change

When you create objects from the DBA navigator (for example a tablespace), SQL Developer can show the generated SQL on a DDL or SQL preview tab before Apply. Keep that text with the target container and a verification query. Copying SQL alone is not proof the change succeeded — re-query the data dictionary in the same PDB.

ORA-01031 in plain terms

ORA-01031: insufficient privileges means the session user lacks the privilege for that statement. Fix the grant or connect as a user that has it. The error is about authorization, not a broken SQL Developer install.

Takeaways

  • SQL Developer and SQL*Plus are clients of the same PDB service.
  • Use Service name for PDB connections; confirm with SYS_CONTEXT or SHOW CON_NAME.
  • Browse for orientation; worksheet SQL for results you can repeat.
  • Read generated DDL, then verify in the dictionary — do not trust Apply alone.

No comments:

Post a Comment

Oracle DBA Lesson 18 — Inspect a PDB with SQL Developer

SQL Developer is another client for the same PDB you already open with SQL*Plus. This lesson connects to LABPDB as COURSE_READER , co...