天天看点

XTTS 跨平台表空间迁移测试

官方文档XTTS:

Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (文档 ID 1389592.1)

测试环境:11.2.0.3.0 

辅助数据库:11.2.0.4.0 ==《安装在目标数据库。

1,建立配置文件    xtt.properties和相关目录。

tablespaces=SNOW platformid=10 backupformat=/xtts/bak backupondest=/xtts/bak dfcopydir=/xtts/bak stageondest=/xtts/bak storageondest=/u02/test cnvinst_home=/u01/app/oracle/product/11.2.0/dbhome_2 cnvinst_sid=xtt

2,在原数据库执行初始化操作。

[[email protected] ~]$ perl xttdriver.pl -p

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Starting prepare phase

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

Prepare source for Tablespaces:

                  'SNOW'  /xtts/bak

xttpreparesrc.sql for 'SNOW' started at Tue May 16 16:59:46 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:46 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:49 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:49 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:50 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:50 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:51 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:51 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:51 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:51 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:52 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:52 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:52 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:52 2017

Prepare source for Tablespaces:

                  ''  /xtts/bak

xttpreparesrc.sql for '' started at Tue May 16 16:59:53 2017

xttpreparesrc.sql for  ended at Tue May 16 16:59:53 2017

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

Done with prepare phase

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

3,在目标数据库执行转换

[[email protected] ~]$ perl xttdriver.pl -c

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Performing convert

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

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

Converted datafiles listed in: /home/oracle/xtt/xttnewdatafiles.txt

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

4,模拟业务,建立测试业表

SQL> create table test tablespace snow as select * from dba_objects;

Table created.

SQL> select count(*) from test;

  COUNT(*)

----------

     75193

5,执行增量备份==原端

[[email protected] ~]$ perl xttdriver.pl -i

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Backup incremental

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

Prepare newscn for Tablespaces: 'SNOW' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

rman target /  cmdfile /home/oracle/xtt/rmanincr.cmd

Recovery Manager: Release 11.2.0.3.0 - Production on Tue May 16 17:05:04 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD1 (DBID=2082231315)

RMAN> set nocfau;

2> host 'echo ts::SNOW';

3> backup incremental from scn 1194918 

4>   tag tts_incr_update tablespace 'SNOW'  format

5>  '/xtts/bak/%U';

6> 

executing command: SET NOCFAU

using target database control file instead of recovery catalog

ts::SNOW

host command complete

Starting backup at 16-MAY-17

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=144 device type=DISK

backup will be obsolete on date 23-MAY-17

archived logs will not be kept or backed up

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00006 name=/u01/app/oracle/oradata/PROD1/SNOW01.DBF

input datafile file number=00007 name=/u01/app/oracle/oradata/PROD1/snow02.dbf

channel ORA_DISK_1: starting piece 1 at 16-MAY-17

channel ORA_DISK_1: finished piece 1 at 16-MAY-17

piece handle=/xtts/bak/1as4d9m1_1_1 tag=TTS_INCR_UPDATE comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

using channel ORA_DISK_1

backup will be obsolete on date 23-MAY-17

archived logs will not be kept or backed up

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

channel ORA_DISK_1: starting piece 1 at 16-MAY-17

channel ORA_DISK_1: finished piece 1 at 16-MAY-17

piece handle=/xtts/bak/1bs4d9m2_1_1 tag=TTS_INCR_UPDATE comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 16-MAY-17

Recovery Manager complete.

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

Done backing up incrementals

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

6,恢复增量数据

[[email protected] ~]$ perl xttdriver.pl -r

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Start rollforward

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

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

End of rollforward phase

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

7,原端设置成为只读表,并增量备份。

[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue May 16 17:07:54 2017

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter tablespace snow read only;

Tablespace altered.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[[email protected] ~]$ perl xttdriver.pl -i

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Backup incremental

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

Prepare newscn for Tablespaces: 'SNOW' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

Prepare newscn for Tablespaces: '' 

rman target /  cmdfile /home/oracle/xtt/rmanincr.cmd

Recovery Manager: Release 11.2.0.3.0 - Production on Tue May 16 17:08:05 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD1 (DBID=2082231315)

RMAN> set nocfau;

2> host 'echo ts::SNOW';

3> backup incremental from scn 1194918 

4>   tag tts_incr_update tablespace 'SNOW'  format

5>  '/xtts/bak/%U';

6> 

executing command: SET NOCFAU

using target database control file instead of recovery catalog

ts::SNOW

host command complete

Starting backup at 16-MAY-17

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=22 device type=DISK

backup will be obsolete on date 23-MAY-17

archived logs will not be kept or backed up

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00006 name=/u01/app/oracle/oradata/PROD1/SNOW01.DBF

input datafile file number=00007 name=/u01/app/oracle/oradata/PROD1/snow02.dbf

channel ORA_DISK_1: starting piece 1 at 16-MAY-17

channel ORA_DISK_1: finished piece 1 at 16-MAY-17

piece handle=/xtts/bak/1cs4d9rm_1_1 tag=TTS_INCR_UPDATE comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

using channel ORA_DISK_1

backup will be obsolete on date 23-MAY-17

archived logs will not be kept or backed up

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

channel ORA_DISK_1: starting piece 1 at 16-MAY-17

channel ORA_DISK_1: finished piece 1 at 16-MAY-17

piece handle=/xtts/bak/1ds4d9rn_1_1 tag=TTS_INCR_UPDATE comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 16-MAY-17

Recovery Manager complete.

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

Done backing up incrementals

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

8,目标端导入增量数据

[[email protected] ~]$ perl xttdriver.pl -r

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Start rollforward

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

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

End of rollforward phase

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

9,传输表空间---目标库执行

[[email protected] ~]$ perl xttdriver.pl -e

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

Parsing properties

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

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

Done parsing properties

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

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

Checking properties

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

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

Done checking properties

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

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

Generating plugin

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

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

Done generating plugin file /home/oracle/xtt/xttplugin.txt

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

[[email protected] ~]$ cat xtt/xttplugin.txt 

impdp directory=<DATA_PUMP_DIR> logfile=<tts_imp.log> \

network_link=<ttslink> transport_full_check=no \

transport_tablespaces=SNOW \

transport_datafiles='/u02/test/SNOW_6.xtf','/u02/test/SNOW_7.xtf'

[[email protected] ~]$ impdp directory=snow network_link=snow transport_tablespaces=SNOW transport_datafiles=/u02/test/SNOW_6.xtf,/u02/test/SNOW_7.xtf

Import: Release 11.2.0.3.0 - Production on Tue May 16 17:10:37 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_01":  /******** AS SYSDBA directory=snow network_link=snow transport_tablespaces=SNOW transport_datafiles=/u02/test/SNOW_6.xtf,/u02/test/SNOW_7.xtf 

Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

Processing object type TRANSPORTABLE_EXPORT/TABLE

Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

Job "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 17:11:10

10. 验证数据库,表空间设置为读写模式===目标数据库

SQL> select count(*) from test;

  COUNT(*)

----------

     75193

SQL> alter tablespace snow read write;

Tablespace altered.

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

转载于:http://blog.itpub.net/20747382/viewspace-2139162/