Oracle 12c Create, switch, delete ____oracle

Source: Internet
Author: User

PDB tests: Creating, switching, deleting

-----------------------

The concept of CDB and PDB presented in ORACLE12C
They can be understood separately as containers and Plug-ins (PDB inserts in CDB)
There is little difference between CDB management and traditional databases


--Confirm Current CDB
Sql> select name,cdb from V$database;

NAME CDB
--------- ---
ZARADB YES

--Querying the current PDB basic information
Col Pdb_name for A30
Select Pdb_id,pdb_name,dbid,status,creation_scn from Dba_pdbs;
Select Con_id,dbid,name,open_mode from V$pdbs;


    pdb_id pdb_name                              DBID status        CREATION_SCN
---------------------------------------------- -----------------------------
         3 pdb1                             3337485269 normal              1909544
         2 pdb$seed                        4072348290 normal             1720741

sql> 
    con_id       DBID name                             open_mode
------------------------------------------------------------
         2 4072348290 pdb$seed                        READ only
          3 3337485269 pdb1                            READ WRITE


--Creating a PDB
--1 Direct Creation
CREATE Pluggable DATABASE PDB2
ADMIN USER PDB2DBA identified by Anbaisheng
STORAGE (MAXSIZE 2G max_shared_temp_size 100M)
DEFAULT tablespace tbs_pdb2 datafile '/opt/oracle/oradata/zaradb/datafile/pdb2_001.dbf ' SIZE 25M autoextend on;

--2 with existing PDB for template creation
--The existing PDB must be created in read only mode, otherwise the error
--Create PDB2 with PDB1 as template


Drop pluggable database pdb2 including datafiles;
Alter pluggable database PDB1 close;
Alter pluggable database PDB1 open Read only;

Create pluggable Database Pdb2
From PDB1
File_name_convert = ('/opt/oracle/oradata/zaradb/e98beb85b1a80c56e0439a02a8c05841/datafile/', '/opt/oracle/ Oradata/zaradb/datafile/pdb2 ');


--Turn off PDB
Alter pluggable database PDB2 close;
Alter pluggable database all close;
Alter pluggable database PDB2 close immediate;

Alter pluggable database PDB2 open;
Alter pluggable database all open;


--Removing the PDB
--Similar to deleting a table space, you can cascade data files
Drop pluggable database pdb2;
Drop pluggable database pdb2 including datafiles;


--unplug
--unplug after the PDB can only mount cannot open
Alter pluggable database PDB2 unplug into '/tmp/pdb2.xml ';

Remove the PDB after--unplug, then add back to the PDB using the XML file
Drop pluggable database pdb2;
Create pluggable database pdb2 using '/tmp/pdb2.xml ' nocopy;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.