I found out the following two contradicting statements in the Oracle DBA guide.

For an Oracle RAC CDB, you can use the instances clause in the pdb_save_or_discard_state clause to specify the instances on which a PDB's open mode is preserved in the following ways: ...

Then it goes on to say this :

For a PDB in an Oracle RAC CDB, SAVE STATE and DISCARD STATE only affect the mode of the current instance. They do not affect the mode of other instances, even if more than one instance is specified in the instances clause.

How do I save the PDB state in all instances in a RAC environment without connecting to all of them seperately?

Does the srvctl utlity does this automatically when I am using it to bounce the CDB as below:

srvctl stop db -d cdb_name
srvctl start db -d cdb_name
  • Apparently srvctl utility doesn't preserve state. It opens the PDBs in read write mode even when the PDB was in mounted state before bouncing the CDB. – Newstein Nov 9 '17 at 15:01

Depends on where you use the command.

It works on all instances from the root container:

srvctl start database -db wagon

SQL> select inst_id, con_id, name, recovery_status, open_mode from gv$pdbs where name = 'PDB1';

   INST_ID     CON_ID NAME       RECOVERY OPEN_MODE
---------- ---------- ---------- -------- ----------
         2          3 PDB1       ENABLED  MOUNTED
         1          3 PDB1       ENABLED  MOUNTED

SQL> alter pluggable database pdb1 open instances=all;

Pluggable database altered.

SQL> select inst_id, con_id, name, recovery_status, open_mode from gv$pdbs where name = 'PDB1';

   INST_ID     CON_ID NAME       RECOVERY OPEN_MODE
---------- ---------- ---------- -------- ----------
         1          3 PDB1       ENABLED  READ WRITE
         2          3 PDB1       ENABLED  READ WRITE

SQL> alter pluggable database pdb1 save state instances=all;

Pluggable database altered.

srvctl stop database -db wagon; srvctl start database -db wagon

SQL> select inst_id, con_id, name, recovery_status, open_mode from gv$pdbs where name = 'PDB1';

   INST_ID     CON_ID NAME       RECOVERY OPEN_MODE
---------- ---------- ---------- -------- ----------
         1          3 PDB1       ENABLED  READ WRITE
         2          3 PDB1       ENABLED  READ WRITE

But it does not work on all instances when issued from the PDB itself:

SQL> alter session set container=pdb1;

Session altered.

SQL> alter pluggable database pdb1 close instances=all;

Pluggable database altered.

SQL> alter pluggable database pdb1 save state instances=all;

Pluggable database altered.

srvctl stop database -db wagon; srvctl start database -db wagon

SQL> select inst_id, con_id, name, recovery_status, open_mode from gv$pdbs where name = 'PDB1';

   INST_ID     CON_ID NAME       RECOVERY OPEN_MODE
---------- ---------- ---------- -------- ----------
         2          3 PDB1       ENABLED  READ WRITE
         1          3 PDB1       ENABLED  MOUNTED
  • In the first example. The PDB is in Read Write state before bouncing the db. From what I observed the srvctl utility opens the pdbs in read write by default after bouncing. Can you try bouncing the cdb with the pdb in mount state. – Newstein Nov 9 '17 at 17:18
  • @Newstein Exactly what I did in 2nd example, I just did not list the state after closing the PDB. – Balazs Papp Nov 9 '17 at 17:21
  • So the states shown in 2nd example is after bouncing the cdb using srvctl? Can you please try the 2nd example from the root container? – Newstein Nov 9 '17 at 17:34
  • @Newstein Yes, I forgot to copy the whole output, updated. – Balazs Papp Nov 9 '17 at 17:37
  • Can you please try the 2nd example from the root container. The documentation says For a PDB in an Oracle RAC CDB, SAVE STATE and DISCARD STATE only affect the mode of the current instance. They do not affect the mode of other instances, even if more than one instance is specified in the instances clause. I want to see whether the state is preserved in both instances. – Newstein Nov 9 '17 at 17:49

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.