4

Click here to load reader

Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs

  • Upload
    marco-v

  • View
    1.123

  • Download
    2

Embed Size (px)

DESCRIPTION

Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs http://dbaworkshop.blogspot.it/2013/07/Pluggable-database-limitations-of-the-open-mode-of-the-CDB-imposed-on-the-open-mode-of-PDBs.html

Citation preview

Page 1: Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs

Articles from Database administratorworkshop

Pluggable database: limitations of the open mode ofthe CDB imposed on the open mode of PDBs

The open mode of the container database imposes limitations on the open mode ofPDBs.For example, the root must be open before any PDBs can be open. Therefore, youmight need to change the open mode of the root before changing the open mode ofa PDB. Let's start.

Verify you are connected to the root container. view plainprint?

1. SQL> SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL; 2. 3. SYS_CONTEXT('USERENV','CON_NAME') 4. -------------------------------------------------------------------------------- 5. CDB$ROOT

Verify the open mode from the V$DATABASE view. view plainprint?

1. SQL> select name, con_id, open_mode from v$database; 2. 3. NAME CON_ID OPEN_MODE 4. --------- ---------- -------------------- 5. CDB001 0 READ WRITE

I've two pluggable databases in the current container: I want to close the pluggabledatabase called PDB001. view plainprint?

1. SQL> alter pluggable database PDB001 close immediate; 2. 3. Pluggable database altered.

Verify the open mode from the V$PDBS view.One of my pluggable databases (PDB002) is available in READ WRITE mode, thesecond (PDB001) is in MOUNTED mode. The seed (PDB$SEED) is a templatethat you can use to create new PDBs and is always in READ ONLY mode. view plainprint?

1. SQL> select name, con_id, open_mode from v$pdbs;

Page 2: Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs

2. 3. NAME CON_ID OPEN_MODE 4. ------------------------------ ---------- ---------- 5. PDB$SEED 2 READ ONLY 6. PDB001 3 MOUNTED 7. PDB002 4 READ WRITE

What does it happen to pluggable databases when you shutdown the root containerand open it again in MOUNT mode ? view plainprint?

1. SQL> shutdown immediate; 2. Database closed. 3. Database dismounted. 4. ORACLE instance shut down. 5. SQL> startup mount; 6. ORACLE instance started. 7. 8. Total System Global Area 626327552 bytes 9. Fixed Size 2291472 bytes

10. Variable Size 473958640 bytes 11. Database Buffers 146800640 bytes 12. Redo Buffers 3276800 bytes 13. Database mounted.

The root container is in MOUNTED mode as expected. view plainprint?

1. SQL> select name, con_id, open_mode from v$database; 2. 3. NAME CON_ID OPEN_MODE 4. --------- ---------- -------------------- 5. CDB001 0 MOUNTED 6. 7. SQL> SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL; 8. 9. SYS_CONTEXT('USERENV','CON_NAME')

10. -------------------------------------------------------------------------------- 11. CDB$ROOT

The three pluggable databases are all in MOUNTED mode too.view plainprint?

1. SQL> select name, con_id, open_mode from v$pdbs; 2. 3. NAME CON_ID OPEN_MODE 4. ------------------------------ ---------- ---------- 5. PDB$SEED 2 MOUNTED 6. PDB001 3 MOUNTED

Page 3: Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs

7. PDB002 4 MOUNTED

You cannot open a pluggable database if the container is not open. view plainprint?

1. SQL> alter pluggable database PDB001 open read write; 2. alter pluggable database PDB001 open read write 3. * 4. ERROR at line 1: 5. ORA-01109: database not open

Open first the CDB instance containing the root, the seed and its pluggabledatabases. view plainprint?

1. SQL> alter database open; 2. 3. Database altered. 4. 5. SQL> select name, con_id, open_mode from v$database; 6. 7. NAME CON_ID OPEN_MODE 8. --------- ---------- -------------------- 9. CDB001 0 READ WRITE

The seed database is now put in READ ONLY mode; the other two pluggabledatabases are still in MOUNTED mode. So they don't start automatically and youhave to take care of this.view plainprint?

1. SQL> select name, con_id, open_mode from v$pdbs; 2. 3. NAME CON_ID OPEN_MODE 4. ------------------------------ ---------- ---------- 5. PDB$SEED 2 READ ONLY 6. PDB001 3 MOUNTED 7. PDB002 4 MOUNTED

You can now open pluggable databases as you want. I'm going to open a pluggabledatabase, PDB001, in READ ONLY mode and then PDB002 in READ WRITEmode. view plainprint?

1. SQL> alter pluggable database pdb001 open read only; 2. 3. Pluggable database altered. 4. 5. SQL> alter pluggable database pdb002 open; 6.

Page 4: Oracle Database 12c and pluggable databases: limitations of the open mode of the CDB imposed on the open mode of PDBs

7. Pluggable database altered. 8. 9. SQL> select name, con_id, open_mode from v$pdbs;

10. 11. NAME CON_ID OPEN_MODE 12. ------------------------------ ---------- ---------- 13. PDB$SEED 2 READ ONLY 14. PDB001 3 READ ONLY 15. PDB002 4 READ WRITE

As you can see I didn't specify to open the pluggable database PDB002 in READWRITE mode: as usual when you don't specify a valid option the READ WRITE isthe default mode.

To open also the PDB001 pluggable database in READ WRITE mode you can usethe following command and the FORCE option. view plainprint?

1. SQL> alter pluggable database PDB001 open read write force; 2. 3. Pluggable database altered. 4. 5. SQL> select name, con_id, open_mode from v$pdbs; 6. 7. NAME CON_ID OPEN_MODE 8. ------------------------------ ---------- ---------- 9. PDB$SEED 2 READ ONLY

10. PDB001 3 READ WRITE 11. PDB002 4 READ WRITE

That's all.