LESSON 07
Create a new pluggable database
You use the seed read
only pluggable database to create a pluggable database. In this lesson,
you will create a new PDB pluggable database named
mypdb2 in mycdb
You can use either the
dbca tool or SQL Developer or SQL command to create a pluggable
database.
In this lesson, we use
the SQL tool to create a PDB.
You need to create a
system file to store the mypdb2 data (PDB) in there.
# cd /oradata/mycdb
# mkdir mypdb2
# cd mypdb2
# pwd
/oradata/mycdb/mypdb2
Run the mycdb profile
and then connect to your "mycdb" root container.
# cd ~
# . ./.profile
# sqlplus /nolog
SQL>
connect / as sysdba
SQL> CREATE
PLUGGABLE DATABASE mypdb2 ADMIN USER mypdb2_admin
2
IDENTIFIED BY mypass ROLES=(CONNECT)
3
FILE_NAME_CONVERT=("/oradata/mycdb/pdbseed","/oradata/mycdb/mypdb2");
Pluggable database
created.
Notice that you are
duplicating the seed template from /oradata/mycdb/pdbseed
to /oradata/mycdb/mypdb2.
Now, check to see that
the mode of mypdb2 is open. Query the V$PDBS view.
SQL> SELECT
con_id, name, open_mode, dbid FROM v$pdbs;
CON_ID |
NAME |
OPEN_MODE |
DBID |
2 |
PDB$SEED |
READ ONLY |
3654327692 |
3 |
MYPDB1 |
READ WRITE |
6783241652 |
4 |
MYPDB2 |
MOUNTED |
7549320153 |
Notice that the
open_mode value for the mypdb2 pluggable database is "MOUNTED."
Change the mypdb2
pluggable database open mode to READ WRITE.
SQL> ALTER
PLUGGABLE DATABASE mypdb2 OPEN;
Use the
netca tool to create a net service name
for the mypdb2 pluggable database and name it
mypdb2
Login to the mypdb2 PDB
as sysdba
# sqlplus /nolog
SQL> connect
sys/mypass@mypdb2 as sysdba
You can
use EasyConnect to the mypdb2 pluggable database as sysdba.
SQL>
connect sys/mypass@localhost:1521/mypdb2 as sysdba
Connect as mypdb2_admin.
SQL> connect
mypdb2_admin/mypass@mypdb2
Get the container name
SQL> show
con_name
Getting the container
ID:
|