Creating a pluggable database :
> CONN / AS SYSDBA
> CREATE PLUGGABLE DATABASE pdborcl ADMIN USER pdb_adm IDENTIFIED BY Admin123 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/orcl/pdbseed/','/u01/app/oracle/oradata/orcl/pdborcl/');
Modify the listener.ora file as below:
> CONN / AS SYSDBA
> CREATE PLUGGABLE DATABASE pdborcl ADMIN USER pdb_adm IDENTIFIED BY Admin123 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/orcl/pdbseed/','/u01/app/oracle/oradata/orcl/pdborcl/');
Modify the listener.ora file as below:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(SID_NAME=orcl))
(SID_DESC=
(GLOBAL_DBNAME=pdborcl)
(SID_NAME=pdborcl))
)
Add the pluggable database entry in tnsnames.ora file:
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
Command for opening the pluggable databases:
For opening all pluggable databases at a time
> CONN / AS SYSDBA
>ALTER PLUGGABLE DATABASE
ALL OPEN;
To open individual pluggable database
>ALTER PLUGGABLE DATABASE pdborcl OPEN;
Command for closing the pluggable databases:
For closing all pluggable databases at a time
> CONN / AS SYSDBA
>ALTER PLUGGABLE DATABASE
ALL CLOSE IMMEDIATE;
To close individual pluggable database
>ALTER PLUGGABLE DATABASE pdborcl CLOSE IMMEDIATE;
Command for checking the open pluggable databases:
> CONN / AS SYSDBA
>SELECT name, open_mode
FROM v$pdbs;
Trigger for starting all the pluggable database at the CDB startup time:
> CONN / AS SYSDBA
>CREATE OR REPLACE
TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE
ALL OPEN';
END open_pdbs;
/
Command to display the current container:
> CONN / AS SYSDBA
>SHOW CON_NAME;
Command to switch between the containers:
> CONN / AS SYSDBA
>ALTER SESSION SET
container = pdborcl;
Connecting to a
Pluggable Database (PDB):
>
CONN system/password@//localhost:1521/pdborcl
No comments:
Post a Comment