top of page
Writer's pictureHanh Nguyen

Multitenant best Practice and Known issues

Details

1.Consider to always use tnsnames when connecting to either Container or Pluggable instance

The tnsnames.ora should be configured , for eg to add a tns entry for pluggable database PDB_OMF_1

PDB_OMF_1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = MFarag-OEL)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = pdb_omf_1) ) )

Alternatively the easy connect syntax could be used as follow :

SYS@mfarag-oel/PDB_OMF_1>CONN A/A@mfarag-oel/PDB_OMF_1 Connected. A@mfarag-oel/PDB_OMF_1>conn xx/xx@mfarag-oel/XX Connected. XX@mfarag-oel/XX>

Add the following entry to the glogin.sql script under $ORACLE_HOME/sqlplus/admin

set sqlprompt “_USER’@’_CONNECT_IDENTIFIER’>'”

2.Always use OMF pluggable Database when the Container is Pluggable :

SYS@CDB>create pluggable database pdbomf admin user a identified by a ;

SYS@CDB>select CON_ID,DBID,GUID,NAME,OPEN_MODE from V_$CONTAINERS ;

CON_ID       DBID GUID ———- ———- ——————————– NAME                           OPEN_MODE —————————— ———- 1 1949193435 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT                       READ WRITE

2 4075234582 EC25D0EC10347332E043CC8DAB0A7AE1 PDB$SEED                       READ ONLY

3 3255612964 EC25E0FB670B76A8E043CC8DAB0A08D8 PDB                            READ WRITE

CON_ID       DBID GUID ———- ———- ——————————– NAME                           OPEN_MODE —————————— ———- 4 3244820336 EC276A999A790163E043CC8DAB0AD357 PDBOMF                         MOUNTED

. . SYS@CDB>alter session set container=pdbomf ;

Session altered.

SYS@CDB>alter pluggable database open ;

Pluggable database altered.

3.Open the Pluggable Database in Restricted mode before Renaming it

SYS@CDB>conn sys@pdb_omf_1 as sysdba Enter password: Connected.

SYS@pdb_omf_1>alter pluggable database close ;

SYS@pdb_omf_1>alter pluggable database open restricted;

SYS@pdb_omf_1>alter pluggable database pdbomf rename  global_name to pdb_omf_1 ;

 4.unplug and Plug a Database  :

SYS@CDB1>alter pluggable database y close immediate ;

SYS@CDB1>alter pluggable database y unplug into ‘/home/oracle/XDESC.xml’ ;

SYS@CDB1>drop pluggable database y ;

SYS@CDB1>create pluggable database y using ‘/home/oracle/XDESC.xml’ nocopy ;

 5. startup the Pluggable database in single step  :

SYS@CDB>select CON_ID,GUID,NAME,OPEN_MODE from V$containers;

CON_ID GUID                             NAME ———- ——————————– —————————— OPEN_MODE ———- 1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT READ WRITE

2 EC25D0EC10347332E043CC8DAB0A7AE1 PDB$SEED READ ONLY

3 EC2B4C003E221F09E0438636AF0AA57B X MOUNTED

CON_ID GUID                             NAME ———- ——————————– —————————— OPEN_MODE ———- 4 EC276A999A790163E043CC8DAB0AD357 PDB_OMF_1 MOUNTED SYS@CDB>alter pluggable database all open ;

SYS@CDB>select CON_ID,GUID,NAME,OPEN_MODE from V$containers

CON_ID GUID                             NAME ———- ——————————– —————————— OPEN_MODE ———- 1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT READ WRITE

2 EC25D0EC10347332E043CC8DAB0A7AE1 PDB$SEED READ ONLY

3 EC2B4C003E221F09E0438636AF0AA57B X READ WRITE

CON_ID GUID                             NAME ———- ——————————– —————————— OPEN_MODE ———- 4 EC276A999A790163E043CC8DAB0AD357 PDB_OMF_1 READ WRITE

Note : the startup of the Container CDB will place all the pdb in mount status by Defualt

6.Use catcon perl script to run scripts for selective or all pluggable and container database  :

E.g Run the awrinfo script to have information about the awr usage under sysaux for all the databases :

$cd $ORACLE_HOME/rdbms/admin

$ perl catcon.pl -u SYS -U SYS -d $ORACLE_HOME/rdbms/admin -l ‘/home/oracle’  -b catblock_output awrinfo.sql

–Confirm that the script run against all the databases :

$cd /home/oracle $ grep -i “CURRENT CONTAINER” * catblock_output0.log:==== Current Container = CDB$ROOT ==== catblock_output0.log:==== Current Container = PDB$SEED ==== catblock_output1.log:==== Current Container = XX ==== catblock_output2.log:==== Current Container = PDB_OMF_1 ====

Note : use the -c option tpo specify certain databases to have this script run against

7.How to use non-seed template to create CDB + Pluggable database :

$ dbca -silent -createDatabase -templateName Custom_DB_.dbt -gdbName FOFO -sid FOFO -createAsContainerDatabase true -numberOfPDBs 1 -pdbName pdb_silent  -sysPassword <password> -systemPassword <password>   -listeners listener Enter PDBADMIN

Note : the above command used the non-seed Custome_DB_ template to create CDB names FOFO with a PDB database named pdb_silent in silent mode .

0 views0 comments

Recent Posts

See All

Comments


bottom of page