Friday 15 January 2016

PDB Create & Drop in GUI / CLI MODE

12c

This method copies the files for the seed to a new location and associates the copied files with the new PDB, which will be called PDB1. Although you have many options for creating PDBs, this example is one of the simplest ways to get up and running. Using this method leaves you with a PDB with no customizations.

1.    Log in to your CDB using SQL*Plus as SYSDBA. To make sure you’re in the correct location, type
show con_name
You should see something like this:
CON_NAME
------------------------------
CDB$ROOT
The out-of-the box file location for PDBs is in a subdirectory under the oradata directory for the CDB.
2.    Create a subdirectory for the new PDB under the CDB file location from the OS oracle software owner by typing
mkdir /u01/app/oracle/oradata/CDB1/pdb1
If this command succeeds, you get no output. You can list the new directory by typing
ls –l /u01/app/oracle/oradata/CDB1 |grep pdb1
You should see something like this:
drwxr-xr-x. 2 oracle oinstall   4096 Aug 17 01:56 pdb1

3.    Back in SQL*Plus as SYSDBA, create pluggable database command by typing
select CON_ID, OPEN_MODE, NAME from v$containers;
select FILE_NAME from cdb_data_files;
alter session set container=PDB$SEED;
select FILE_NAME from dba_data_files;
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER vinay identified by oracle  ROLE=(CONNECT)
DEFAULT TABLESPACE USERS
DATAFILE '/u01/app/oracle/oradata/CDB1/pdb1/users01.dbf'
SIZE 250M AUTOEXTEND ON
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_c62dlts4_.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/system01.dbf',
'/u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_c62dltrv_.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/sysaux01.dbf',
'/u01/app/oracle/oradata/CDB1/datafile/pdbseed_temp012015-12-04_11-59-21-AM.dbf', '/u01/app/oracle/oradata/CDB1/pdb1/temp01.dbf');
You should see this:
Pluggable database created.
The new PDB is left in a mount state.
4.    Show the new PDB and open it by typing
show pdbs
alter pluggable database pdb1 open;
You should see this:
CON_ID CON_NAME            OPEN MODE RESTRICTED
------- ------------------------------ ---------- ----------
   2 PDB$SEED            READ ONLY NO
   3 PDB1            READ WRITE NO
Pluggable database altered.

5.    Verify the status by typing
show pdbs
You should see this:
CON_ID CON_NAME            OPEN MODE RESTRICTED
------ ------------------------------ ---------- ----------
   2 PDB$SEED            READ ONLY NO
   3 PDB1            READ WRITE NO

   



No comments: