Search This Blog

Thursday, 13 October 2016

12C FEATURES


12C FEATURES

Queries to check the info of pluggable databases:

Ø  select con_id,name, open_mode from  v$pdbs;

Ø  select pdb_name, status from cdb_pdbs;

Ø  select name,con_id from v$active_services order by 1;

Ø  alter session set container=pdb1

Checking the info of pluggable databases:

è For data files and tablespaces:

Ø  select name from v$datafile;

Ø  select file_name, con_id from cdb_data_files;

Ø  select tablespace_name, con_id from cdb_tablespaces where con_id=1;

=>        For temp files:

Ø  select file_name,con_id from cdb_temp_files

Opening & Closing

è For one pluggable database:

Ø  alter pluggable database pdb open;

Ø  alter pluggable database pdb close;

SQL> Select name,open_mode from v$pdbs;

è For all pluggable databases:

Ø  alter pluggable database all open;

Ø  alter pluggable database all close;

SQL> Select name,open_mode from v$pdbs;

For creating tablespace:

Left Arrow Callout: Under the container db.SQL> Select Tablespace_name,file_name from cdb_data_files;

Ø  create tablespace tb1 datafile ‘/u01/home/prod/tb01.dbf’ size 10m;

SQL>Left Arrow Callout: Under pluggable db alter session set container=pdb1; ( To Switch from One DB to Another DB)

Ø  create tablespace pdbt1 datafile ‘/u01/home/prod/pdbt01.dbf’ size 10m;

Ø  select tablespace_name, con_id from cdb_tablespaces order by con_id;

 

CREATION OF PLUGGABLE DATABASES:

From seed (template):

Ø  create pluggable database pdb1 admin user dba1 identified by dba1;

SQL> select name,dbid,open_mode from v$pdbs;

SQL> alter pluggable database pdb1 open;

Unplugging a database:

Ø  alter pluggable database pdb1 close;

Ø  alter pluggable database pdb1 unplug into ‘/u01/home/pdb1.xml’;

(We cannot unplug a db unless it is closed. Even after unplugging the db, the db name will be listed in the v$pdb view as mounted. So to completely remove it we have to drop the database)

Creating a Pluggable database by using Xml file.

Ø  create pluggable database salespdb using ‘/u01/home/pdb1.xml’;

 

Cloning a pluggable database:

                        Steps:   I) make the source database read only

                                    II) Clone the source database

                                    III) make the source database back to read write.

Ø  alter pluggable database pdb1 close;                                              

Ø  alter pluggable database pdb1 open read only;                    Source pdb

 

Ø  create pluggable database newpdb from pd1;

Ø  alter pluggable database newpdb open read write;   Clone pdb

 

Ø  alter pluggable database pd1 close;

Ø  alter pluggable database pd1 open read write                      Source Pdb

 

Dropping a pluggable database:

Ø  drop pluggable database pdb1;  (only after unplugging)

Ø  drop pluggable database pdb2 keep datafiles; (data files will not be deleted)

 

No comments:

Post a Comment