Manages PDB databases on Oracle RAC Environment

Manages PDB databases on RAC instances

Container database is started then all PDB’s databases are in mounted state. If we tried to connect with PDB database then we got the following error:
ORA-01033: Oracle initialization or Shutdown in progress.
So we need to open the database in all RAC instances.

Open and Close the PDB database in RAC Environment

Check the status of all PDB

select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 MOUNTED
1 PDB2 MOUNTED
2 PDB2 MOUNTED

Open specific pluggable database on current instance which is connected:

alter pluggable database PDB2 open;
Verify:
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 MOUNTED
1 PDB2 READ WRITE
2 PDB2 MOUNTED

Open specific pluggable database on specific instance:

alter pluggable database pdb2 open instances = ( 'node2');
Verify:
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 MOUNTED
1 PDB2 READ WRITE
2 PDB2 READ WRITE

Open all pluggable database on all instances:

alter pluggable database all open instances=ALL;
Verify:
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 READ WRITE
2 PDB1 READ WRITE
1 PDB2 READ WRITE
2 PDB2 READ WRITE

Close the PDB database on current instance which is connected:

alter pluggable database PDB1 close;
Verify:
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 READ WRITE
1 PDB2 READ WRITE
2 PDB2 READ WRITE

Close the specific pdb on specific instance:

alter pluggable database pdb1 close instances=('node2');
Verify:
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 MOUNTED
1 PDB2 READ WRITE
2 PDB2 READ WRITE

close all the pluggable database on all instances:

alter pluggable database all close instances = ALL;
select inst_id,name,open_mode from gv$pdbs order by name,inst_id;
INST_ID NAME OPEN_MODE
------- -------- ---------
1 PDB$SEED READ ONLY
2 PDB$SEED READ ONLY
1 PDB1 MOUNTED
2 PDB1 MOUNTED
1 PDB2 MOUNTED
2 PDB2 MOUNTED

Relocate the PDB database by close on current instance and open on other:

alter pluggable database PDB2 close close relocate to 'node2';

Manage Service for PDB database in RAC Environment
It is dynamic service we are created, default service is the service which is created when pdb database is created, it name as same pdb name or pdb name plus domain name.

Create a Service for PDB database
Note: you create it with policy automatic then you donot need to start the pdb database everytime when instance started

srvctl add service -db contdb -pdb pdb1 -service pdb1srv -serverpool sp1 -cardinality singleton -policy manual

serctl add service -db contdb -pdb pdb2 -service pdb2srv -serverpool sp1 -cardinality uniform -policy automatic
automatic is default

Start the service of PDB database:

srvctl start service -db contdb -service pdb1srv

Check the Status of the Service

srvctl status service -db contdb
Service pdb1srv is running on nodes: NODE1
Service pdb2srv is running on nodes: NODE1,NODE2

Check Service from sqlplus

select name, con_id from cdb_services;

Remove the service

srvctl remove service -db contdb -service pdb1srv

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s