专栏首页数据库架构之美史上最全-oracle12c pdb迁移实践

史上最全-oracle12c pdb迁移实践

Oracle在12c版本引入了多租户的概念,在一个cdb的根容器下可以创建多个pdb供不同用户使用,cdb中主要保存数据库元数据,而pdb中保存用户数据,各个pdb直接不相互影响。Oracle提供了多种方式进行pdb数据库的创建/迁移/克隆,甚至实现了不停机的在线克隆。

PDB的创建

Creating a PDB by Relocating It

12.2的online pdb relocate 实现了PDB 在线几乎零停机时间在不同CDB之间的迁移,且在relocate过程中源库一直是open read-write状态,使用了增量日志的方式追加减少了最源库和网络资源的影响。

Creating a PDB by relocating it

实施步骤验证

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

sourcdb

pdb1

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

pdb1

源库:创建复制用户,授权(cdb级别)

SQL>create user C##CLONE_ADMIN identified by oracle container=all;

User created.

SQL> grant connect, sysoper, create pluggable database to C##CLONE_ADMIN container=all;

Grant succeeded.

目标库:修改tnsnames.ora

cdb_remote =

(DESCRIPTION =

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

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = sourcdb)

)

)

目标库:创建dblink(一定要是cdb级别的)

SQL> create database link link_cdb connect to C##CLONE_ADMIN identified by oracle using 'cdb_remote';

Database link created.

目标库:测试dblink

SQL> select sysdate from dual@link_cdb;

SYSDATE

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

30-JUL-18

目标库:创建pdb1

SQL> create pluggable database pdb1 from pdb1@link_cdb relocate ;

Pluggable database created.

目标库:查询pdb1

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

3 PDB3 READ WRITE NO

4 PDB2 READ WRITE NO

5 PDB1 MOUNTED

目标库:启动pdb1

SQL> alter pluggable database pdb1 open;

Pluggable database altered.

源库:查看pdb1,发现pdb1已经不存在了。

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

Creating a PDB by relocating it with parallel and concurrency sql

Relocating和copying方式支持并行方式克隆数据库,需加上参数 parallel integer

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

sourcdb

pdb1

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

pdb1

源库:创建复制用户,授权(cdb级别)

SQL>create user C##CLONE_ADMIN identified by oracle container=all;

User created.

SQL> grant connect, sysoper, create pluggable database to C##CLONE_ADMIN container=all;

Grant succeeded.

目标库:修改tnsnames.ora

cdb_remote =

(DESCRIPTION =

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

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = sourcdb)

)

)

目标库:创建dblink(一定要是cdb级别的)

SYSDATE

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

30-JUL-18

源库:执行循环插入程序(开两个session不间断执行插入,中途选某些时刻commit)

SQL> alter session set container=pdb1;

SQL> Create table test(id number);

Begin

For i in 1 .. 1000000

Loop

Insert into test values(i);

End loop;

End;

/

目标库:创建pdb1(该语句直接成功,不会等待源端并发sql,执行完后目标端mount状态,源端open状态)

Pluggable database created.

源库:查询pdb1状态

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

3 PDB2 READ WRITE NO

4 PDB3 READ WRITE NO

5 PDB1 READ WRITE NO

目标库:查询pdb1状态

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

3 PDB1 MOUNTED

目标库:打开数据库(执行这条命令的途中源端sql报错了,并且源端数据库变为了mount状态,再过一段时间目标端数据库open成功)

SQL> alter pluggable database pdb1 open instances=all;

Pluggable database altered.

源端:查看session1和session2中数据插入情况

Session1:(session1在失败之前有5次成功的commit)

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> commit

2 ;

Commit complete.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

Begin

*

ERROR at line 1:

ORA-03113: end-of-file on communication channel

Process ID: 810

Session ID: 2087 Serial number: 44031

Session2:(session2在失败之前有3次成功的commit)

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

PL/SQL procedure successfully completed.

SQL> Begin

2 For i in 1 .. 1000000

3 Loop

4 Insert into test values(i);

5 End loop;

6 End;

7 /

Begin

*

ERROR at line 1:

ORA-03113: end-of-file on communication channel

Process ID: 22947

Session ID: 1710 Serial number: 30218

目标库:查询test表条数(发现有8000000条数据,也就是在源库变为mount之前已提交的sql同步过来了,未提交的sql没有同步过来)

SQL> select count(*) from test;

COUNT(*)

----------

8000000

源库:在目标库创建语句完成后查看源库状态

源库:查看pdb1,发现pdb1依然存在,可见加了availability max参数时目标端open后源端库也不会自动remove。

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

3 PDB2 READ WRITE NO

4 PDB3 READ WRITE NO

5 PDB1 MOUNTED

目标库:

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

3 PDB1 READ WRITE NO

Copying

Cloning from the Seed

SQL>col name for a15;

Set linesize 200;

select con_id, dbid, guid, name , open_mode from v$pdbs;

CON_ID DBID GUID NAME OPEN_MODE

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

2 3862635051 6FBFB6C2522C0FBBE0537A2003BC80B0 PDB$SEED READ ONLY

SQL> create pluggable database pdb1 admin user pdb1admin identified by pdb1admin roles=(connect,select_catalog_role);

Pluggable database created.

SQL>col pdb_name for a15;

select pdb_id,pdb_name,status,creation_time from cdb_pdbs where pdb_name='PDB1';

PDB_ID PDB_NAME STATUS CREATION_

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

5 PDB1 NEW 29-JUN-18

SQL> select con_id,name,open_mode from v$pdbs where name='PDB1';

CON_ID NAME OPEN_MODE

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

5 PDB1 MOUNTED

SQL> alter pluggable database PDB1 OPEN;

Pluggable database altered.

SQL> conn PDB1ADMIN/pdb1admin@192.168.1.36:1521/pdb1

Connected.

SQL> show user;

USER is "PDB1ADMIN"

SQL> col username for a10

SQL> col granted_role for a10

SQL> select * from user_role_privs

USERNAME GRANTED_RO ADM DEL DEF OS_ COM INH

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

PDB2ADMIN PDB_DBA YES NO YES NO NO NO

SQL> select * from session_privs;

PRIVILEGE

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

SET CONTAINER

CREATE PLUGGABLE DATABASE

CREATE SESSION

SQL> ho lsnrctl status |grep pdb1 -B1

Instance "rac12c1", status READY, has 1 handler(s) for this service...

Service "pdb1" has 1 instance(s).

Cloning a pdb locally

If the CDB is not in ARCHIVELOG mode, then the source PDB must be in open read only

mode. This requirement does not apply if the CDB is in ARCHIVELOG mode.

col PROPERTY_NAME for a20

col PROPERTY_VALUE for a20

SELECT PROPERTY_NAME, PROPERTY_VALUE

FROM DATABASE_PROPERTIES

WHERE PROPERTY_NAME = 'LOCAL_UNDO_ENABLED';

PROPERTY_NAME PROPERTY_VALUE

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

LOCAL_UNDO_ENABLED TRUE

select

con_id,username,default_tablespace,temporary_tablespace

from cdb_users

where lower(username)='c##global_user1' order by con_id;

CON_ID USERNAME DEFAULT_TABLESPACE TEMPORARY_TABLESPACE

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

1 C##GLOBAL_USER1 USERS TEMP

3 C##GLOBAL_USER1 USERS TEMP

SQL> CREATE PLUGGABLE DATABASE pdb2 FROM pdb1

PATH_PREFIX ='+DATADG';

Pluggable database created.

SQL> select con_id, dbid, guid, name , open_mode from v$pdbs;

CON_ID DBID GUID NAME OPEN_MODE

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

2 3862635051 6FBFB6C2522C0FBBE0537A2003BC80B0 PDB$SEED READ ONLY

3 1192027733 70CFFC1034AE1258E0537A2003BCF86A PDB1 READ WRITE

4 3478260040 70D030CE84E51838E0537A2003BC0B37 PDB2 MOUNTED

SQL> alter pluggable database PDB2 OPEN;

Pluggable database altered.

SQL> alter session set container=PDB2;

Session altered.

SQL> select file_name from dba_data_files;

FILE_NAME

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

+DATADG/RAC12C/70D030CE84E51838E0537A2003BC0B37/DATAFILE/users.413.981330561

+DATADG/RAC12C/70D030CE84E51838E0537A2003BC0B37/DATAFILE/undotbs1.393.981330561

+DATADG/RAC12C/70D030CE84E51838E0537A2003BC0B37/DATAFILE/sysaux.392.981330561

+DATADG/RAC12C/70D030CE84E51838E0537A2003BC0B37/DATAFILE/system.391.981330561

SQL> conn PDB1ADMIN/pdb1admin@192.168.1.36:1521/pdb2

Connected.

SQL> show user;

USER is "PDB1ADMIN"

SQL> col username for a10

SQL> col granted_role for a10

SQL> select * from user_role_privs;

USERNAME GRANTED_RO ADM DEL DEF OS_ COM INH

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

PDB1ADMIN PDB_DBA YES NO YES NO NO NO

SQL> select * from session_privs;

PRIVILEGE

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

SET CONTAINER

CREATE PLUGGABLE DATABASE

CREATE SESSION

Cloning a Remote PDB

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

sourcdb

pdbtest

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

Pdbtest_new

源库:查看状态:
Col name for a20;
Set linesize 200;
select con_id, dbid, guid, name , open_mode from v$pdbs;
CON_ID DBID GUID NAME OPEN_MODE
---------- ---------- -------------------------------- -----------
2 2014944745 70B4B2EE9A133E58E053100300C51687 PDB$SEED READ ONLY
3 2848006685 71199200CB156359E053100300C5E0A3 PDB1 READ WRITE
4 230313777 7118BDDD91712315E053100300C5B974 PDB2 READ WRITE
6 3617836477 71BAA9EBF6BB18E2E053100300C561BE PDBTEST READ WRITE
目标库:配置监听(rac的话两台机器都要配置,不然克隆数据库会报错ora-65169):
pdbtest_remote =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.36)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.37)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdbtest)
)
)
目标库:测试连接:
sqlplus pdbtestadmin/pdbtestadmin@pdbtest_remote
SQL> select cdb from v$database@pdbtest_link;
CDB
---------
YES
目标库:远程克隆pdb:
SQL> create pluggable database pdbtest_new from pdbtest@pdbtest_link;
Pluggable database created.
目标库:打开数据库:
SQL> alter pluggable database pdbtest_new open;
Warning: PDB altered with errors.
发现有warning,查看如下视图:
SQL> col name for a15;
Col time for a30;
Col type for a10;
Col type for a10;
col cause for a15;
Col status for a10;
Col message for a70;
Set linesize 200;
Select time,name,cause,type,message,status from pdb_plug_in_violations order by time;

发现是因为源库和目标库的pga_aggregate_target参数和processes参数设置不一致导致的。第三条是因为源pdb没有users表空间造成的,目标库启动后处于限制模式。

有两种方式解决这个问题:

1.在目标端pdb添加users表空间:

SQL> create tablespace users datafile '+DATADG' size 512M;

Tablespace created.

SQL> select file_name,bytes/1024/1024 from dba_data_files;

FILE_NAME BYTES/1024/1024

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

+DATADG/DESTCDB/71CA8CBF1BBE3D46E053E18003C58534/DATAFILE/system.296.982405347 1228.80469

+DATADG/DESTCDB/71CA8CBF1BBE3D46E053E18003C58534/DATAFILE/sysaux.297.982405347 1228.80469

+DATADG/DESTCDB/71CA8CBF1BBE3D46E053E18003C58534/DATAFILE/undotbs1.298.982405347 6144

+DATADG/DESTCDB/71CA8CBF1BBE3D46E053E18003C58534/DATAFILE/undo_2.300.982408217 6144

+DATADG/DESTCDB/71CA8CBF1BBE3D46E053E18003C58534/DATAFILE/users.301.982419533 512

然后重启一下pdbtest_new,发现此时pdbtest_new可以正常启动:

SQL> alter pluggable database pdbtest_new close immediate;

Pluggable database altered.

SQL> alter pluggable database pdbtest_new open;

Pluggable database altered.

再查看pdb_plug_in_violations视图发现错误已解决

1.在源数据库pdbtest创建users表空间,然后再进行克隆:

SQL> create tablespace users datafile '+DATADG' size 512M;

Tablespace created.

SQL> select name,con_id from v$tablespace;

NAME CON_ID

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

SYSTEM 6

SYSAUX 6

UNDOTBS1 6

TEMP 6

USERS 6

UNDO_2 6

此时源端已经有了users表空间

然后执行克隆命令:

SQL> create pluggable database pdbtest_new from pdbtest@pdbtest_link;

Pluggable database created.

SQL> alter pluggable database pdbtest_new open;

Pluggable database altered.

发现此时正常open,没有报错。

Cloning a Remote PDB (with parallel)

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

sourcdb

pdbtest

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

Pdbtest_new

源库:并行克隆pdb3创建pdbtest
SQL> create pluggable database pdbtest from pdb3 parallel 2;
Pluggable database created.
SQL> alter pluggable database pdbtest open;
Pluggable database altered.
源库:查询pdb
Col name for a20;
Set linesize 200;
select con_id, dbid, guid, name , open_mode from v$pdbs;
CON_ID DBID GUID NAME OPEN_MODE
---------- ---------- -------------------------------- ----------
2 2014944745 70B4B2EE9A133E58E053100300C51687 PDB$SEED READ ONLY
3 2278955566 72346EAC0C5420B1E053100300C5C447 PDB2 READ WRITE
4 1456576834 72346EAC0C5F20B1E053100300C5C447 PDB3 READ WRITE
6 3636583599 72433986472915BDE053100300C56C89 PDBTEST READ WRITE
目标库:配置监听(rac的话两台机器都要配置,不然克隆数据库会报错ora-65169):
pdbtest_remote =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.36)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.37)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdbtest)
)
)
目标库:测试连接:
sqlplus pdb2admin/pdb2admin@pdbtest_remote
SQL> select cdb from v$database@pdbtest_link;
CDB
---------
YES
目标库:远程并行克隆pdb:
Pluggable database created.
目标库:打开数据库:
SQL> alter pluggable database pdbtest_new open instances=all;
Pluggable database altered.
目标端:查看pdb状态
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ---------------------- ----------
2 PDB$SEED READ ONLY NO
3 PDBTEST_NEW READ WRITE NO
Cloning a Remote Non-CDB

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

noncdb(非cdb)

不适用

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

pdbtest

源端:由于没有noncdb,使用dbca创建一个non-cdb类型的数据库noncdb

export ORACLE_SID=noncdb1

SQL> select name,cdb,con_id from v$database;

NAME CDB CON_ID

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

NONCDB NO 0

目标端:配置监听

noncdb_remote =

(DESCRIPTION =

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

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = noncdb)

)

)

目标端:测试连接

sqlplus sys/oracle@noncdb_remote as sysdba

目标端:创建dblink

SQL> create public database link noncdb_link connect to linkuser identified by linkuser using 'noncdb_remote';

Database link created.

源端:创建linkuser

SQL> create user linkuser identified by linkuser;

User created.

SQL> grant dba to linkuser;

Grant succeeded.

目标端:测试dblink

SQL> select cdb from v$database@noncdb_link;

CDB

---------

NO

目标端:远程克隆pdb

SQL> create pluggable database noncdb_new from noncdb@noncdb_link;

Pluggable database created.

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

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

2 PDB$SEED READ ONLY NO

3 NONCDB_NEW MOUNTED

4 PDB1 READ WRITE NO

5 PDB2 MOUNTED

目标端:执行noncdb_to_pdb.sql(在打开数据库之前一定要切换到该pdb下并执行这个sql,否者启动会报错)

SQL> alter session set container=noncdb_new;

SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

目标端:切换到cdb,然后再启动数据库

SQL> alter session set container=cdb$root;

Session altered.

SQL> alter pluggable database noncdb_new open;

Pluggable database altered.

Plugging in

使用xml文件创建pdb

主机

cdb

pdb

192.168.1.36/192.168.1.37(RAC)

sourcdb

pdb1

目标

192.168.1.225/192.168.1.226(RAC)

destcdb

pdbtest

源库:关闭并拔出数据库

SQL> alter session set container=pdb1;

Session altered.

SQL> alter pluggable database pdb1 close immediate;

Pluggable Database closed.

SQL> conn / as sysdba

Connected.

SQL> alter pluggable database PDB1 unplug into '/tmp/pdb1.xml';

Pluggable database altered.

源库:删除pdb1保留数据文件:

SQL> drop pluggable database PDB1;

Pluggable database dropped.

--拷贝文件(将源库asm磁盘中该guid文件夹下的文件挨个拷贝到本地,再拷贝到远程,再拷贝入远程的asm中)

示例是拷贝到/tmp目录下做中转

Scp到目标库文件系统,然后拷贝到目标库的asm磁盘(不能加上OMF的文件后缀,否则报错)

ASMCMD> pwd

+datadg/sourcdb/722EE1EE9A370DBDE053100300C558EF/datafile

ASMCMD> cp /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/SYSAUX.289.982836275 +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/SYSAUX

copying /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/SYSAUX.289.982836275 -> +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/SYSAUX

ASMCMD> cp /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/SYSTEM.290.982836275 +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/SYSTEM

copying /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/SYSTEM.290.982836275 -> +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/SYSTEM

ASMCMD> cp /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/UNDOTBS1.284.982836275 +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/UNDOTBS1

copying /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/UNDOTBS1.284.982836275 -> +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/UNDOTBS1

ASMCMD> cp /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/USERS.292.982836373 +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/USERS

copying /tmp/722EE1EE9A370DBDE053100300C558EF/datafile/USERS.292.982836373 -> +datadg/destcdb/722EE1EE9A370DBDE053100300C558EF/datafile/USERS

目标库:查询pdb

SQL> select con_id,name,open_mode from v$pdbs where name='PDB1';

no rows selected

目标库:创建pdb1

SQL> CREATE PLUGGABLE DATABASE pdb1 USING '/tmp/pdb1.xml'

COPY tempfile reuse

--PATH_PREFIX = '+DATADG'

--FILE_NAME_CONVERT = ('+DATADG/SOURCDB', '+DATADG/DESTCDB');

Pluggable database created.

目标库:查询并开启pdb1

SQL> select con_id,name,open_mode from v$pdbs where name='PDB1';

CON_ID NAME OPEN_MODE

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

5 PDB1 MOUNTED

SQL> alter session set container=PDB1;

Session altered.

SQL> alter pluggable database pdb1 open;

Pluggable database altered.

目标库:查看相关数据文件

SQL> select file_name from dba_data_files;

FILE_NAME

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

+DATADG/DESTCDB/722EE1EE9A370DBDE053100300C558EF/DATAFILE/system.286.982861811

+DATADG/DESTCDB/722EE1EE9A370DBDE053100300C558EF/DATAFILE/sysaux.302.982861811

+DATADG/DESTCDB/722EE1EE9A370DBDE053100300C558EF/DATAFILE/undotbs1.306.982861811

+DATADG/DESTCDB/722EE1EE9A370DBDE053100300C558EF/DATAFILE/users.284.982861811

SQL> select file_name from dba_temp_files;

FILE_NAME

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

+DATADG/DESTCDB/722EE1EE9A370DBDE053100300C558EF/TEMPFILE/temp.282.982861839

SQL> conn PDB1ADMIN/pdb1admin@192.168.1.225:1521/pdb1

Connected.

本文分享自微信公众号 - 数据库架构之美(databasekernel)

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2018-09-30

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • STM32远程乒乓升级,基于WIFI模块AT指令TCP透传方式,定时访问升级(含数据校验)

      定时使用http访问云端的程序版本,如果版本不一致,然后通过http下载最新的升级文件,实现升级.

    杨奉武
  • ESP8266 LUA脚本语言开发: 测试下诱人的程序

      实现的功能,APP通过SmartConfig给Wi-Fi模块配网并绑定设备,然后通过MQTT远程控制开发板的继电器,

    杨奉武
  • 以太网驱动的流程浅析(五)-mii_bus初始化以及phy id的获取【原创】

    Author:张昺华 Email:920052390@qq.com Time:2019年3月23日星期六

    用户3033338
  • 时序约束是如何影响Vivado编译时间的

    常有工程师会抱怨,自己的Vivado工程从综合到生成bit文件太耗时,尤其是在调试阶段,一天跑不出一个版本,压力骤增。抛开FPGA芯片本身容量大、设计复杂等因素...

    Lauren的FPGA
  • 【STM32笔记】串口空闲中断接收不定长数据(DMA方式)

    在使用STM32的串口接收数据的时候,我们常常会使用接收中断的方式来接收数据,常用的是RXNE。这里分享另一种接收数据的方式——IDLE中断(PS:本文的例子运...

    正念君
  • ESA2GJK1DH1K升级篇: 关于升级篇数据校验

      问一下就像是上面  假设现在 sum = 255;  然后接着数据是 0x03

    杨奉武
  • 【STM32笔记】两块STM32之间的SPI主从通信实例(附代码工程)

    之前分享过的SPI通讯实例:STM32硬件SPI主从通信,是基于一块STM32的两个SPI通讯。如果要进行两块STM32之间的SPI通讯,需要注意一些什么呢?

    正念君
  • SpringCache完整案例介绍

      Spring从3.1开始定义了org.springframework.cache.Cache和org.springframework.cache.Cache...

    用户4919348
  • 云机器人 ~ Android + Arduino + ROS = Cloud Robotics

    关于机器人技术的一个重要公告是在Google IO 2011上发布的,该公告是对Android Open Accessory Kit的公告的补充。如以下有关Cl...

    zhangrelay
  • STM32远程乒乓升级,基于GPRS模块AT指令TCP透传方式,定时访问升级(含有数据校验)

    一.当前只下载了BootLoader程序,在BootLoader程序里面实现更新,需要按照下面操作

    杨奉武

扫码关注云+社区

领取腾讯云代金券