克隆创建PDB--(1)本地克隆创建PDB


1. 创建测试PDB

SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SEED_PDB                       MOUNTED
         4 NONCDB_PDP                     MOUNTED
         5 CLON_PDB                       MOUNTED

SQL> CREATE PLUGGABLE DATABASE test_pdb ADMIN USER pdb_mgr IDENTIFIED BY oracle file_name_convert=('/u01/app/oracle/oradata/zylong/pdbseed','/u01/app/oracle/oradata/zylong/test_pdb');
Pluggable database created.

SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SEED_PDB                       MOUNTED
         4 NONCDB_PDP                     MOUNTED
         5 CLON_PDB                       MOUNTED
         6 TEST_PDB                       MOUNTED

2. 在测试PDB上创建测试用户

SQL> alter session set container=test_pdb;
Session altered.

SQL> Create user testab identified by oracle;
User created.

SQL> grant connect,resource to testab;
Grant succeeded.

SQL> select username from all_users where username='TESTAB';
USERNAME
-------------------------------------------------------------------------------
TESTAB

3. 克隆一个已有的PDB

## 当前的PDB不能被克隆,需要进入CDB中克隆PDB。

SQL> conn / as sysdba
Connected.
SQL> CREATE PLUGGABLE DATABASE pdb4 FROM test_pdb
  2  file_name_convert=('/u01/app/oracle/oradata/zylong/test_pdb','/u01/app/oracle/oradata/zylong/pdb4');
Pluggable database created.

SQL> show pdbs;  
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SEED_PDB                       MOUNTED
         4 NONCDB_PDP                     MOUNTED
         5 CLON_PDB                       MOUNTED
         6 TEST_PDB                       READ WRITE NO
         7 PDB4                           MOUNTED

SQL> Alter pluggable database pdb4 open;
Pluggable database altered.

SQL>  alter session set container=pdb4;
Session altered.

SQL> select username from all_users where username='TESTAB';
USERNAME
-------------------------------------------------------------------------------
TESTAB

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值