- export ORACLE_SID=cdbtest
- To be authenticated with a password file create a password file
- Create the initialization parameter file
- Connect to the instance
- Create a server parameter file
- Start the instance with nomount option
- Issue the create database
The create database command has following additional clause to indicate that it is CDB
enable pluggable database
seed file_name_convert=('/u01/app/oracle/oradata/testcdb', '/u01/app/oracle/oradata/pdbseed')
Enable pluggable database clause creates a CDB with a root and a seed
The seed file_name_convert generates file names for the seed's file in /u01/app/oracle/oradata/pbdseed directoru using filenames in the /u01/app/oracle/oradata/testcdb directory.
After you create a CDB it consist of the root and the seed.
- Create additional tablespaces if required
- Run scripts to build data dictionary views
The following three scripts needs to be run:
catalog.sql
catproc.sql
pubbld.sql
- Create PDBs to store user data,.
You can create a PDB from the seed using the create pluggable database statement.
create pluggable database testpdb admin user testpdb identified by test123 file_name_convert=('/test1/bench/pdbseed','/test1/bench/testpdb' );
- PDB is now in mount state, modify its mode to OPEN
alter pluggable database testpdb open ;
grant dba to test;
- Set the current session to point to PDB
- Create a local user which will own the schema
grant dba to test;
- Clone a pbd from existing pdb.
A PDB namely testpdb exist. We need to clone this pbd and call the cloned PDB as clonePDB
Open source pdb in read-only mode
create pluggable database clonepdb from testpdb file_name_convert=('/testpbd,'clonepdb') ;
; change the mode to open
con_id desc
0 the data pertains to entire PDB
1 the data pertains to the root (oracle metadata)
2 the data pertains to the seed
3 the data pertains to the PDB
SQL> select name,con_id from v$tablespace;
NAME CON_ID
------------------------------ ----------
SYSTEM 1
SYSAUX 1
UNDOTBS1 1
USERS 1
TEMP 1
SYSTEM 2
SYSAUX 2
TEMP 2
SYSTEM 3
SYSAUX 3
TEMP 3
NAME CON_ID
------------------------------ ----------
USERS 3
The root ,seed and PDB has system, sysaux and temp tablespace each.
Additionally , the root container has UNDO tablespace . Root and PDB conainters also has user tablespace.
SQL> show user;
USER is "SYS"
SQL> show con_id;
CON_ID
------------------------------
1
SQL> show con_name
CON_NAME
------------------------------
cdb_pdbs or dba_pdbs
How many containers does it have:
- Is it a CDB or a non-CDB database
- What does the various con_id stand for:
con_id desc
0 the data pertains to entire PDB
1 the data pertains to the root (oracle metadata)
2 the data pertains to the seed
3 the data pertains to the PDB
- How many tablespace do I have after I create a CDB containing 1 PDB:
SQL> select name,con_id from v$tablespace;
NAME CON_ID
------------------------------ ----------
SYSTEM 1
SYSAUX 1
UNDOTBS1 1
USERS 1
TEMP 1
SYSTEM 2
SYSAUX 2
TEMP 2
SYSTEM 3
SYSAUX 3
TEMP 3
NAME CON_ID
------------------------------ ----------
USERS 3
The root ,seed and PDB has system, sysaux and temp tablespace each.
Additionally , the root container has UNDO tablespace . Root and PDB conainters also has user tablespace.
- What is my user and con_id and con_name
SQL> show user;
USER is "SYS"
SQL> show con_id;
CON_ID
------------------------------
1
SQL> show con_name
CON_NAME
------------------------------
- How many PDBs are exist in a given CDB
cdb_pdbs or dba_pdbs
How many containers does it have:
No comments:
Post a Comment