In the previous article, we can see that the architecture of multitenant. In this post, we will configure manually CDB and PDB.
Step 1: create initmycdb.ora
[oracle@localhost ~]$ cd $ORACLE_HOME/dbs [oracle@localhost dbs]$ cat initmycdb.ora db_name=mycdb CONTROL_FILES='/u02/oradata/mycdb/control01.ctl','/u02/oradata/mycdb/control02.ctl' ENABLE_PLUGGABLE_DATABASE=TRUE DB_CREATE_FILE_DEST='/u02/oradata/' DB_CREATE_ONLINE_LOG_DEST_1='/u02/oradata/' DB_BLOCK_SIZE=8192 UNDO_MANAGEMENT=AUTO UNDO_TABLESPACE=undotbs USER_DUMP_DEST='/u01/oracle/admin/mycdb/adump/'
Step 2: Create necessary directories.
[oracle@localhost dbs]$ mkdir -p /u01/oracle/admin/mycdb/adump [oracle@localhost dbs]$ mkdir -p /u02/oradata/mycdb
Step 3: export ORACLE_SID and start the database in the nomount stage
[oracle@localhost ~]$ export ORACLE_SID=mycdb [oracle@localhost dbs]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Tue Jul 24 09:07:35 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 272629760 bytes Fixed Size 2923336 bytes Variable Size 213910712 bytes Database Buffers 50331648 bytes Redo Buffers 5464064 bytes SQL>
Step 4: Create a script to create a manual database using create database command with ENABLE PLUGGABLE DATABASE clause.
create database mycdb user sys identified by oracle user system identified by manager maxlogfiles 3 maxlogmembers 3 logfile group 1 size 50m,group 2 size 50 m default temporary tablespace temp tempfile size 50m undo tablespace undotbs datafile size 200m enable pluggable database;
Step 5: Run this script on sql prompt :
SQL> create database mycdb user sys identified by oracle user system identified by manager maxlogfiles 3 maxlogmembers 3 logfile group 1 size 50m,group 2 size 50 m default temporary tablespace temp tempfile size 50m undo tablespace undotbs datafile size 200m enable pluggable database; Database created.
you will get Database created output after successful completion of this script.
SQL> select name,open_mode,CDB from v$database; NAME OPEN_MODE CDB --------- -------------------- --- MYCDB READ WRITE YES
Now run catcdb.sql
SQL> @?/rdbms/admin/catcdb.sql Session altered. Enter new password for SYS: Enter new password for SYSTEM: Enter temporary tablespace name: temp Session altered. Connected.
Creating pdb as I have used OMF, I don’t need to use file_name_convert parameter
SQL> CREATE PLUGGABLE DATABASE mypdb1 ADMIN USER mypdb1_adm IDENTIFIED BY oracle; Pluggable database created.
Check using show pdbs command
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 MYPDB1 MOUNTED
Open pluggable database
SQL> ALTER PLUGGABLE DATABASE MYPDB1 OPEN; Pluggable database altered. SQL> SHOW PDBS CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 MYPDB1 READ WRITE NO SQL>
Stay tuned for More articles on Oracle Multitenant
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Telegram Channel: https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp