Monday, August 31, 2015

Oracle 12c Create PDB From Seed



https://www.youtube.com/watch?v=Z57FrM1hn8c

sqlplus / as sysdba
SQL>select intance_name,version, status from v$instance;
SQL>select name,cdb from v$database;
cdb should be yes

SELECT b.con_id, a.pdb_name, a.status,b.open_mode
from dba_pdbs a, v$pdbs b
where a.pdb_name=b.name


can create plugable database using 3 methods
1)create PDB from PDB$seed
2)create PDB from cloning an existing pdb
3)create PDB by plugging and unplugged pdb

http://docs.oracle.com/database/121/SQLRF/statements_6010.htm#CCHBFIDF
1)create PDB from PDB$seed

Syntax

create_pluggable_database::=

Description of create_pluggable_database.gif follows
Description of the illustration create_pluggable_database.gif


SQL>create pluggable database pdb_hr
admin user pdb_hr_admin  identified by india123;

run query to check list of PDB's

SELECT b.con_id, a.pdb_name, a.status,b.open_mode
from dba_pdbs a, v$pdbs b
where a.pdb_name=b.name

it will show mounted

Example 2

creating PDB with more details storage option is ASM

SQL>create pluggable database pdb_sales
admin user pdb_sales_admin  identified by india123
default tablespace  pdb_sales_users_tbs
storage (maxsize 100g max_shared_temp_size 100g)
;

run query to check list of PDB's

SELECT b.con_id, a.pdb_name, a.status,b.open_mode
from dba_pdbs a, v$pdbs b
where a.pdb_name=b.name

it will show 2nd one mounted too mounted



exit
I will create 2 folders temp and data file systtem for another pdb database
mkdir -p /u02/app/oracle/oradata/syed/pbd_mktg/DATAFILE
mkdir -p /u02/app/oracle/oradata/syed/pbd_mktg/TEMPFILE

SQLPLUS / AS SYSDBA
run query to check list of PDB's

SELECT b.con_id, a.pdb_name, a.status,b.open_mode
from dba_pdbs a, v$pdbs b
where a.pdb_name=b.name

CHECK DATAFILE LOCATION FOR PDB$SEED
SQL>select name from v$datafile where con_id=2;  ( where 2 is is seed conid)
it will give you path

copy the path
now create  5TH ONE
CREATE



SQL>create pluggable database pdb_mktg
admin user pdb_mktg_admin  identified by india123
default tablespace  pdb_mktg_users_tbs
DATAFILE '/u02/app/oracle/oradata/syed/pbd_mktg/DATAFILE/pdb_mktg_users_tbs_001.dat'
size 1g
FILE_NAME_CONVERT=('+DATA/select name from v$datafile where con_id=2','/u02/app/oracle/oradata/syed/pbd_mktg/')
STORAGE (MAXSIZE 10G MAX_SHARED_TEMP_SIZE 10G)
PATH_PREFIX='/u02/app/oracle/oradata/syed/pbd_mktg/'


SQL>SELECT NAME FROM V$DATAFILE WHERE CON_ID=3;
SQL>SELECT NAME FROM V$TEMPFILE WHERE CON_ID=3;
SQL>SELECT NAME FROM V$DATAFILE WHERE CON_ID=5;


;

SELECT b.con_id, a.pdb_name, a.status,b.open_mode
from dba_pdbs a, v$pdbs b
where a.pdb_name=b.name








No comments:

Post a Comment