ORA-65054: Cannot open a pluggable database in the desired mode

In RAC environment, we cannot open PDB with the following messages:

SQL> alter pluggable database open instances=all;

*
ERROR at line 1:
ORA-65054: Cannot open a pluggable database in the desired mode.

Check CDB still in Mount status:

SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> show con_name

CON_NAME
——————————
CDB$ROOT

QL> select name,open_mode from v$database;

NAME    OPEN_MODE
------  ---------
TESTDB  MOUNTED


SQL> alter database open ;

*
ERROR at line 1:
ORA-65054: Cannot open a pluggable database in the desired mode.

CAUSE and SOLUTION

Subscribe to get access

Read more of this content when you subscribe today.

How to Open Seed Database to Read Write Mode

In CDB database environment, the seed database is always in “READ ONLY” mode. The mode changes only by applying patches using “datapatch”.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TESTPDB                        READ WRITE NO

Under the guidance of Oracle Support for specific purpose, the following instructions can be followed to open seed database “PDB$SEED” in “READ WRITE” mode.

Set hidden parameter “_oracle_script” at session level

SQL> alter session set "_oracle_script"=TRUE;

Session altered.

Close and then open seed database

SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.

SQL>  alter pluggable database pdb$seed open read write instances=all;

Pluggable database altered.

Run the script Oracle support provided

SQL> alter session set container=PDB$SEED;

Session altered.

SQL>  @?/rdbms/admin/catclust.sql
...
..
.

Close and then open seed database in READ ONLY mode

SQL> connect / as sysdba
SQL> alter session set "_oracle_script"=TRUE;

Session altered.

SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.

SQL> connect / as sysdba
SQL> alter session set "_oracle_script"=TRUE;

SQL>  alter pluggable database pdb$seed open read only instances=all;

Pluggable database altered.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TESTPDB                        READ WRITE NO

Per Development, setting _ORACLE_SCRIPT to TRUE is something to be used only by Oracle internally.  There may be a case where a note says to use it explicitly, but you should not use it outside the context of that note.  In general is not to be set explicitly by users.

ORA-65025 when Renaming Global_Name in PDB

SQL>select * from global_name;

GLOBAL_NAME
--------------------------------------------------
OLDNAME

SQL>  alter pluggable database rename global_name to NEWNAME;
 alter pluggable database rename global_name to NEWNAME
                                                *
ERROR at line 1:
ORA-65045: pluggable database not in a restricted mode

SOLUTION

Open PDB in restricted mode, and close all other instances in RAC environment.

SQL> alter pluggable database OLDNAME open restricted;

Pluggable database altered.

SQL>alter pluggable database rename global_name to NEWNAME;

Pluggable database altered

SQL>select * from global_name;

GLOBAL_NAME
--------------------------------------------------
NEWNAME

How to Create Service on Non-RAC PDB

As we know, we can use ‘srvctl’ utility to create a service for a RAC database. Now I demonstrate how to create a service for a standalone CDB/PDB database.

For non CDB/PDB database, we can use ‘service_name’ parameter to specify service names.

SQL> show parameter service_name;

 NAME             TYPE    VALUE
 --------------- ------- ------------------
 service_names   string  HR,STOCK,INVENTORY

Subscribe to get access

Read more of this content when you subscribe today.

How to Rename CDB PDB and Change DBID in Oracle Multitenant Architecture

Sometimes DBAs have to change CDB/PDB names to meet the organization’s naming standards, and change the DBID of a cloned database to make sure database registered in RMAN recovery catalog.

This post illustrates how to rename CDB/PDB, change DBID, and move and rename datafiles/tempfiles/controlfiles of CDB/PDB.

Subscribe to get access

Read more of this content when you subscribe today.