12c 新特性





查询所有pdb

[oracle@gj4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 24 09:18:34 2017

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         READ WRITE NO

 

 

切换cdbpdb

SQL> alter session set container=drbpdb;

Session altered.

SQL> show con_name

CON_NAME

——————————

DRBPDB

 

 

SQL> alter session set container=cdb$root;

Session altered.

SQL> show con_name

CON_NAME

——————————

CDB$ROOT

 

 

cdb中关闭和打开pdb

SQL> show pdbs

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         READ WRITE NO

SQL> alter pluggable database drbpdb close immediate;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         MOUNTED

 

 

cdb中打开关闭所有pdb

SQL> alter pluggable database all close immediate;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         MOUNTED

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         READ WRITE NO

 

 

cdb中新建sysdba用户

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

User created.

SQL> grant sysdba,connect ,resource to c##test container = all;

Grant succeeded.

SQL> conn c##test/test as sysdba

Connected.

SQL> show con_name

CON_NAME

——————————

CDB$ROOT

 

创建新pdb

SQL> create pluggable database testpdb admin user dxq identified by oracle roles=(connect,resource) 

  2  file_name_convert= 

  3  ('/oradata/drb/pdbseed','/oradata/drb/testpdb');

 

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

———- —————————— ———- ———-

         2 PDB$SEED                       READ ONLY  NO

         3 DRBPDB                         READ WRITE NO

         4 TESTPDB                        MOUNTED

 

配置pdbtns连接

Tnsnames.ora

test =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.190.147)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = testpdb)

    )

  )

listener.ora

SID_LIST_LISTENER=

(SID_LIST=

  (SID_DESC =

  (GLOBAL_DBNAME = drb)   #CDB信息

  (SID_NAME = drb)

  )

  (SID_DESC =

  (GLOBAL_DBNAME = testpdb) #testPDB信息

  (SID_NAME = drb)

  )

)

—————————————–

重启监听

—————————————–

[oracle@gj4 admin]$ sqlplus dxq/oracle@test

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 24 13:25:11 2017

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

Last Successful login time: Fri Mar 24 2017 11:31:34 +08:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

SQL> show con_name

CON_NAME

——————————

TESTPDB

 

 




Related posts

coded by nessus
分享:  DeliciousGReader鲜果豆瓣CSDN网摘
Trackback

no comment untill now

Add your comment now

无觅相关文章插件