ITPub博客

首页 > 数据库 > Oracle > oracle12c的CDB和PDB初探

oracle12c的CDB和PDB初探

原创 Oracle 作者:hunterjoy 时间:2016-06-22 16:39:38 0 删除 编辑

[oracle@oracle12cs ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 22 15:49:41 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show con_name;

CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container=pdbndc;     --进入PDB

Session altered.

SQL> show con_name;

CON_NAME
------------------------------
PDBNDC

[oracle@oracle12cs ~]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 22 15:53:44 2016


Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
with the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>  select name,cdb from v$database;

NAME      CDB
--------- ---
NDC       YES

SQL> select pdb_id,pdb_name,dbid,status,create_scn from dba_pdbs;
    PDB_ID PDB_NAME                   DBID STATUS    CREATION_SCN
---------- -------------------- ---------- --------- ------------
         3 PDBNDC               4056045727 NORMAL         1740000
         2 PDB$SEED             3164418748 NORMAL         1594403
         4 PDB2                 2424970819 NEW            1746754

    PDB_ID PDB_NAME                   DBID STATUS    CREATION_SCN
---------- -------------------- ---------- --------- ------------
         3 PDBNDC               4056045727 NORMAL         1740000
         2 PDB$SEED             3164418748 NORMAL         1594403

--1直接创建
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER pdb2_admin IDENTIFIED BY oracle
STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M)
DEFAULT TABLESPACE tbs_pdb2 DATAFILE '/u01/app/oracle/oradata/NDC/datafile/pdb2_001.dbf' SIZE 25M AUTOEXTEND ON;

--2  按照模板创建PDB
SQL> alter pluggable database pdbndc close;
alter pluggable database pdbndc close
*
ERROR at line 1:
ORA-65020: pluggable database PDBNDC already closed

SQL> alter pluggable database pdbndc open read only;

Pluggable database altered.
SQL> create pluggable database pdb2    
  2  from pdbndc
  3  file_name_convert=('/u01/app/oracle/oradata/NDC/35D8EADBC36F2F56E0539B00A8C098CD/datafile/','/u01/app/oracle/oradata/NDC/datafile/pdb2');

SQL> alter pluggable database pdb2 open;

Pluggable database altered.


SQL> alter pluggable database pdb2 close;


Pluggable database altered.

SQL> alter pluggable database pdb2 open;

Pluggable database altered.

SQL> alter pluggable database all close;

Pluggable database altered.

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> alter pluggable database pdb2 close immediate;

Pluggable database altered.

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;


NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDBNDC                         READ WRITE
PDB2                           READ WRITE


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/543979/viewspace-2120722/,如需转载,请注明出处,否则将追究法律责任。

下一篇: R语言画图
请登录后发表评论 登录
全部评论

注册时间:2007-12-31

  • 博文量
    156
  • 访问量
    351990