I'll create a Pluggable database 'PDBTEST' with the help of Seed container template.
Create datafile directory for new Pluggable database.
[oracle@test pdbseed]$ mkdir -p /u01/app/oracle/oradata/cdb12c/pdbtest/
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> create pluggable database pdbtest
2 admin user testadmin identified by oracle
3 roles=(dba)
4 file_name_convert=('/u01/app/oracle/oradata/cdb12c/pdbseed/','/u01/app/oracle/oradata/cdb12c/pdbtest/');
Pluggable database created.
Lets configure the Tnsnames.ora and Listener.ora file for newly created Pluggable database.
[oracle@test admin]$ vim listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PDBORCL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
)
(SID_DESC =
(SID_NAME = PDBTEST)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
)
)
[oracle@test admin]$ vim tnsnames.ora
PDBTEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdbtest.oracle.com)
)
)
PDBORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdborcl.oracle.com)
)
)
CDB12C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cdb12c.oracle.com)
)
)
Now check the container status.
SQL> select CON_ID,NAME from v$pdbs;
CON_ID NAME
---------- ------------------------------
2 PDB$SEED
3 PDBORCL
4 PDBTEST
SQL> select pdb_name, status from cdb_pdbs;
PDB_NAME STATUS
-------------------- -------------
PDBORCL NORMAL
PDB$SEED NORMAL
PDBTEST NEW
SQL> select NAME,CON_NAME,CON_ID from v$active_services;
NAME CON_NAME CON_ID
-------------------- ------------------------------ ----------
pdbtest.oracle.com PDBTEST 4
pdborcl.oracle.com PDBORCL 3
cdb12cXDB CDB$ROOT 1
cdb12c.oracle.com CDB$ROOT 1
SYS$BACKGROUND CDB$ROOT 1
SYS$USERS CDB$ROOT 1
6 rows selected.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
PDBTEST MOUNTED
SQL> alter pluggable database pdbtest open;
Pluggable database altered.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
-------------------- ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
PDBTEST READ WRITE
SQL> conn sys/oracle@pdbtest as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
PDBTEST
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
HTH. :)
Create datafile directory for new Pluggable database.
[oracle@test pdbseed]$ mkdir -p /u01/app/oracle/oradata/cdb12c/pdbtest/
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> create pluggable database pdbtest
2 admin user testadmin identified by oracle
3 roles=(dba)
4 file_name_convert=('/u01/app/oracle/oradata/cdb12c/pdbseed/','/u01/app/oracle/oradata/cdb12c/pdbtest/');
Pluggable database created.
Lets configure the Tnsnames.ora and Listener.ora file for newly created Pluggable database.
[oracle@test admin]$ vim listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PDBORCL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
)
(SID_DESC =
(SID_NAME = PDBTEST)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
)
)
[oracle@test admin]$ vim tnsnames.ora
PDBTEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdbtest.oracle.com)
)
)
PDBORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdborcl.oracle.com)
)
)
CDB12C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cdb12c.oracle.com)
)
)
Now check the container status.
SQL> select CON_ID,NAME from v$pdbs;
CON_ID NAME
---------- ------------------------------
2 PDB$SEED
3 PDBORCL
4 PDBTEST
SQL> select pdb_name, status from cdb_pdbs;
PDB_NAME STATUS
-------------------- -------------
PDBORCL NORMAL
PDB$SEED NORMAL
PDBTEST NEW
SQL> select NAME,CON_NAME,CON_ID from v$active_services;
NAME CON_NAME CON_ID
-------------------- ------------------------------ ----------
pdbtest.oracle.com PDBTEST 4
pdborcl.oracle.com PDBORCL 3
cdb12cXDB CDB$ROOT 1
cdb12c.oracle.com CDB$ROOT 1
SYS$BACKGROUND CDB$ROOT 1
SYS$USERS CDB$ROOT 1
6 rows selected.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
PDBTEST MOUNTED
SQL> alter pluggable database pdbtest open;
Pluggable database altered.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
-------------------- ----------
PDB$SEED READ ONLY
PDBORCL READ WRITE
PDBTEST READ WRITE
SQL> conn sys/oracle@pdbtest as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
PDBTEST
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
HTH. :)
No comments:
Post a Comment