How to Resolve ORA-65000: missing or invalid pluggable database name

  • by

ORA-65000

Tried to close a pluggable database (PDB) and got error ORA-65000.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> alter pluggable database close immediate;
alter pluggable database close immediate
*
ERROR at line 1:
ORA-65000: missing or invalid pluggable database name

Basically, the above ALTER PLUGGABLE DATABASE statement is legitimate in some conditions, because you don't have to provide any PDB name when the session is already in a specific PDB container.

On the other side, if the session is in the CDB (root container), ORA-65000 means that DB needs to know which PDB should be performed in ALTER PLUGGABLE DATABASE statement, you should specify one for it.

In the above, SQL parser found a keyword CLOSE where a PDB name should be specified. That's right, we missed the PDB name.

Solutions

1. Provide a PDB Name

That is to say, we need to provide PDB name in order to let DB know which PDB should be used.

SQL> alter pluggable database orclpdb close immediate;

Pluggable database altered.

2. Get into the PDB Container

If we don't or can't provide an explicit PDB name, we should get into the right PDB container first.

SQL> alter session set container=ORCLPDB;

Session altered.

SQL> show con_name;

CON_NAME
------------------------------
ORCLPDB

Then do the same statement.

SQL> alter pluggable database close immediate;

Pluggable database altered.

The key is to know where you are, then do the proper action.

Leave a Reply

Your email address will not be published. Required fields are marked *