Pluggable Database 12c PDB configuration:
When you install 12c Database with
container database (CDB), by default 12c EM Express PORT configure’ s for only
CDB database.
Creating New
Port for PDB:
Connect to Database:
sqlplus / as
sysdba
-- default it connects to CDB
View all Ports for PDB's :
---
to list all PDB instances
select
c.name,c.open_mode,e.port
from v$pdbs c, xdb.xdb$cdbports
e
where c.con_id = e.pdb (+);
Change Session to PDB:
alter session set container = PDB_DB12CR2;
--session changed PDB, PDB_DB12CR2 --
PDB instance name
Verify EM Port on PDB:
select dbms_xdb_config.gethttpsport()
from dual;
Set New Port to PDB:
--If above query returns NULL or required
to change the PORT, verify PORT availability
exec dbms_xdb_config.sethttpsport(5501);
---
5501 PORT will assign to current PDB
Verify Ports from CDB:
select
c.name,c.open_mode,e.port
from v$pdbs c, xdb.xdb$cdbports
e
where c.con_id = e.pdb (+);
Verify listners on new PORT:
snrctl
status | grep -i 5501
PDB - Direct
Connection TNS Entries:
Add
bellow tns entry into existing tnsnames.ora file, change PDB service name, CDB
hostname and PORT number.
$
vi $ORACLE_HOME/network/admin/tnsnames.ora
#PDB
Instance details
PDB_DB12CR2
=
(DESCRIPTION
= (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT
= )))
(CONNECT_DATA
= (SERVICE_NAME = ) ))
Esc
: wq
#
save your tns file
Now
client SQL Developer/TOAD/SQL Plus can connect directly to PDB database.
PDB - Start
Stop Services:
Startup:
--from Container Database
ALTER
PLUGGABLE DATABASE PDB_DB12CR2 OPEN;
OR
ALTER SESSION SET CONTAINER =
PDB_DB12CR2;
STARTUP
Stop:
--from Container Database
ALTER
PLUGGABLE DATABASE PDB_DB12CR2 CLOSE IMMEDIATE;
OR
ALTER SESSION SET CONTAINER =
PDB_DB12CR2;
SHUTDOWN IMMEDIATE;
Status:
--from Container Database
SELECT name, open_mode FROM v$pdbs;
All PDB’s Start & Stop:
ALTER PLUGGABLE DATABASE ALL OPEN;
ALTER
PLUGGABLE DATABASE ALL CLOSE IMMEDIATE;
Startup & Stop Except:
ALTER PLUGGABLE DATABASE ALL EXCEPT
pdb_1 OPEN;
ALTER
PLUGGABLE DATABASE ALL EXCEPT pdb_1 CLOSE IMMEDIATE;
Automatic PDB Startup:
--Create
trigger on CDB startup
CREATE OR REPLACE TRIGGER
OPEN_ALL_PDBS
AFTER
STARTUP ON DATABASE
BEGIN
EXECUTE
IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END
OPEN_ALL_PDBS;