Oracle12c create and delete PDB

  In 12C R1 version only supports Global Shared Undo mode, all share a container UNDO tablespace; introduced PDB Local Undo mode 12C R2, each container has its own UNDO tablespace, for each RAC is

Instances of each container has its own UNDO table space. Local Undo option when there DBCA, and the default check.

  In clone 12c R1 version of the PDB database need to open the source read only read-only mode, 12c R2 has been introduced to local undo mode, PDB source library clone may be in the read write read-write mode.

Cloning PDB requirements:

  1. Archive Log Enabled  
  2. Local Undo Enabled 
  3. destination CDB must have a public database link to the source CDB,have sufficient privileges to use the database link

By graphical tools DBCA, command line, create and delete PDB em express, etc., where the only way to describe the command-line operation.

First, create a PDB

1. Cloning seed container

SQL> select * from v $ dbfile; # View Path

 

SQL> show parameter db_create_file_dest;

 

SQL> create pluggable database PDB3 admin user song identified by song file_name_convert=('/home/oracle/u01/app/oracle/oradata/orcl/pdbseed','/home/oracle/u01/app/oracle/oradata/orcl/PDB3');

 

2. Cloning local PDB

 1) Check the archive is open

SQL> archive log list;

 

 2) local undo whether to open

SQL> col PROPERTY_NAME for a25;

SQL> col PROPERTY_VALUE for a25;

SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties where property_name='LOCAL_UNDO_ENABLED';

 

 3) start cloning

SQL> show pdbs;

 

a) Use the feature to create OMF

SQL> show parameter DB_CREATE_FILE_DEST; #OMF functional path

SQL> show parameter pdb_file_name_convert; # Set initialization parameters

SQL> alter system set db_create_file_dest='/home/oracle/u01/app/oracle/oradata/orcl';

SQL> alter session set pdb_file_name_convert='ORCLPDB','PDB5';       

SQL> create pluggable database PDB5 from ORCLPDB; 

Error: ORA-65005: file name pattern file is missing or invalid file name mode, parameter setting is not DB_CREATE_FILE_DEST

 

b) create using file_name_convert

SQL> create pluggable database PDB4 from ORCLPDB file_name_convert=(
   '/home/oracle/u01/app/oracle/oradata/orcl/orclpdb','/home/oracle/u01/app/oracle/oradata/orcl/pdb4');

 

SQL> alter pluggable database pdb4 open;

 

3. Cloning remote PDB

 Source

SQL> create user c##sonny identified by sonny container=all;

SQL> grant dba to c##sonny container=all;

 

 End goal

create database link clonepdb connect to c##sonny identified by sonny using '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.208)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ORCLPDB)))';

 

 SQL> create pluggable database sonnypdb from ORCLPDB@clonepdb;

$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql脚本

 

Second, delete PDB

 PDB needs to be in a state before they can delete MOUNTED

SQL> alter pluggable database pdb5 close immediate;

SQL> drop pluggable database pdb5 including datafiles;

SQL> show pdbs;

  

So far the PDB creation and deletion is complete, the following for the opening and closing operation of the PDB:

SQL> alter pluggable database orclpdb open; # start a single PDB
the SQL> ALTER Pluggable Database All Open; # start all PDB
the SQL> ALTER Pluggable Database orclpdb Close immediate; # close individual PDB
the SQL> ALTER Pluggable Database All Close immediate; # close all PDB

Auto Start All PDB
database the status of all activated when the PDB is MOUNTED, the following settings automatically starts (CDB level OS):
Create or Replace Trigger sys.pdb_startup
After Startup Database ON
the begin
Execute immediate 'ALTER All Open Pluggable Database';
End pdb_startup ;
/

 

Cloning pdb article

https://www.cnblogs.com/andy6/p/6867240.html

Switching shared undo / local undo the article

https://blog.csdn.net/zhang123456456/article/details/71374528

Guess you like

Origin www.cnblogs.com/sonnyBag/p/11557952.html