In this demo I show how to use DBCA or command line to create new pluggable database into an existing container database.
Environment
CDB- TESTDBS
PDB- DEV3DB and DEV4DB
Create Pluggable Database Command Line
1. Connect to container root and check current pluggable databases.
$sqlplus / as sysdba
SQL> show con_id
SQL>select con_id,name,open_mode,open_time from v$pdbs;
2. Create new Pluggable database
SQL>
ROLES = (connect)
DEFAULT TABLESPACE users
DATAFILE '+DG01' SIZE 250M AUTOEXTEND ON
STORAGE (MAXSIZE 5G)
PATH_PREFIX = '+DG01';
3.Check newly created pluggable database.
SQL>show con_id
SQL>select con_id,name,open_mode,open_time from v$pdbs;
4.Open new pluggable database
SQL>alter pluggable database dev4db open read write;
5. Check pluggable database open mode.
SQL>show con_id
SQL>select con_id,name,open_mode,open_time from v$pdbs;
6. Using RMAN do a report schema to see datafile location. You of course can also do this by selecting from the dictionary tables v$datafile and v$tempfile.
$rman target /
RMAN>report schema
Here is a select statement that can be used to see the datafiles if you don't want to use RMAN report schema.
SQL>set linesize 500
SQL>set pagesize 100
SQL>col name format a20
SQL>col db_file_name format a80
SQL>select b.con_id,b.name,a.name as db_file_name from v$datafile a, v$pdbs b
where a.con_id= b.con_id;
Create Pluggable Database DBCA
I will show how you can also create pluggable database using DBCA.
1. Execute DBCA
$ORACLE_HOME/bin/dbca
2. Select Manage Pluggable Databases click Next.
3. Select Create a Pluggable Database click Next.
4. Select your container database and click Next.
5. Select Create a New Pluggable Database click Next.
6. Set pluggable database name, specify storage type, database location, default tablespace and administrator account information. This is the similar information I set during the pluggable database command line step. In my case I will ignore the warning message about the password. Click Next
7. Review the summary and click Finish.
8. The pluggable database create will begin. You can use the activity and alert log button to monitor the details during the creation process.
9. Once the pluggable database has been created click the OK button to close out the DBCA session.
10. Check the newly created pluggable database. You can see that when creating a pluggable database from DBCA the pluggable database is automatically in open read write mode.
$sqlplus / as sysdba
SQL>show con_id
SQL>select con_id,name,open_mode,open_time from v$pdbs;
11. Using RMAN do a report schema to see datafile location. You of course can also do this by selecting from the dictionary tables v$datafile and v$tempfile.
$rman target /
RMAN>report schema
Here is a select statement that can be used to see the datafiles if you don't want to use RMAN report schema.
SQL>set linesize 500
SQL>set pagesize 100
SQL>col name format a20
SQL>col db_file_name format a80
SQL>select b.con_id,b.name,a.name as db_file_name from v$datafile a, v$pdbs b
where a.con_id= b.con_id;
Create Pluggable Database Using Enterprise Manager Cloud Control 12c
If you would like to see how to create more then one pluggable database in one provision operation see my blog post here.
Follow me on Twitter
Posted by Javier Ruiz at 4:57 PM
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest