Create a Pluggable Database (PDB):-
To create a pluggable database, you need to be connected to the CDB with the container
set to the root (which is the default).
You must also have the Create Pluggable Database privilege.
SQL> select CON_ID, NAME from v$datafile where CON_ID=1;
CON_ID NAME
---------- -----------------------------------------------------------
1 /data2/CDBDB/system01.dbf
1 /data2/CDBDB/sysaux01.dbf
1 /data2/CDBDB/users01.dbf
1 /data2/CDBDB/undotbs01.dbf
SQL> select CON_ID, NAME from v$datafile where CON_ID=2;
CON_ID NAME
---------- -----------------------------------------------------------
2 /data2/CDBDB/pdbseed/system01.dbf
2 /data2/CDBDB/pdbseed/sysaux01.dbf
2 /data2/CDBDB/pdbseed/users01.dbf
Before creating PDB1, check the DB_CREATE_FILE_DEST:-
Check if DB_CREATE_FILE_DEST is already set: SQL> show parameter db_create_file_dest NAME TYPE VALUE ------------------------------------ ----------- -------------------- db_create_file_dest string If it’s not set, define it with an appropriate path: SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST='/data2/CDBDB/PDB1/'; System altered. SQL> SHOW PARAMETER db_create_file_dest; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_create_file_dest string /data2/CDBDB/PDB1/
To create a PDB:
SQL> CREATE PLUGGABLE DATABASE PDB1 ADMIN USER pdbadmin1 IDENTIFIED BY pdbadmin1; Pluggable database created. This will create a new pluggable database called PDB1.
SQL> SELECT NAME FROM V$DATAFILE WHERE CON_ID = 3; NAME ---------------------------------------------------------------------------------------------------- /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_system_mpkx6hwd_.dbf /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_sysaux_mpkx6hwm_.dbf /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_users_mpkx6hwm_.dbf
Check the status of Newly Created PDB1 database :-
SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name; NAME OPEN_MODE --------------------- ---------- PDB$SEED READ ONLY PDB1 MOUNTED
Let's open PDB1 database :-
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN; Pluggable database altered. SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name; NAME OPEN_MODE --------------- ---------- PDB$SEED READ ONLY PDB1 READ WRITE
SQL> select CON_ID, NAME from v$datafile where CON_ID=1; CON_ID NAME ---------- ---------------------------------------------------------------------------------------------------- 1 /data2/CDBDB/system01.dbf 1 /data2/CDBDB/sysaux01.dbf 1 /data2/CDBDB/users01.dbf 1 /data2/CDBDB/undotbs01.dbf SQL> SQL> select CON_ID, NAME from v$datafile where CON_ID=2; CON_ID NAME ---------- ---------------------------------------------------------------------------------------------------- 2 /data2/CDBDB/pdbseed/system01.dbf 2 /data2/CDBDB/pdbseed/sysaux01.dbf 2 /data2/CDBDB/pdbseed/users01.dbf SQL> SQL> select CON_ID, NAME from v$datafile where CON_ID=3; CON_ID NAME ---------- ---------------------------------------------------------------------------------------------------- 3 /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_system_mpkx6hwd_.dbf 3 /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_sysaux_mpkx6hwm_.dbf 3 /data2/CDBDB/PDB1/CDBDB/29EA4183169B10B1E063C900A8C06423/datafile/o1_mf_users_mpkx6hwm_.dbf
No comments:
Post a Comment