大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1.初始化设置阶段
1.1安装目标数据库软件并创建目标数据库
在目标系统上安装目标Oracle数据库软件,版本应该为Oracle12c,操作系统是Linux,我这里都是12.2.0.1。在源数据库中创建了一个要被传输到目标数据库的表空间jy,用户方案jy,源数据库版本也是12.2.0.1,操作系统是Linux。
为沙市等地区用户提供了全套网页设计制作服务,及沙市网站建设行业解决方案。主营业务为网站制作、成都做网站、沙市网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
1.2识别要被传输的表空间
源数据库中要被传输的表空间为jy,用户方案jy。
1.3在源系统上安装xttconvert脚本
[oracle@jytest3 xtts_script]$ unzip rman_xttconvert_v3.zip Archive: rman_xttconvert_v3.zip inflating: xtt.properties inflating: xttcnvrtbkupdest.sql inflating: xttdbopen.sql inflating: xttdriver.pl inflating: xttprep.tmpl extracting: xttstartupnomount.sql [oracle@jytest1 backup]$ vi $ORACLE_HOME/dbs/initxtt.ora db_name=xtt compatible=12.2.0.0.0 [oracle@jytest1 backup]$ export ORACLE_SID=xtt [oracle@jytest1 backup]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 22 18:25:46 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> startup nomount ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 8621520 bytes Variable Size 377487920 bytes Database Buffers 50331648 bytes Redo Buffers 8155136 bytes
1.4 创建需要使用的目录
如果使用dbms_file_transfer方法,那么配置目录对象与dblink,注意dbms_file_transfer方法要求目标数据库的版本为11.2.0.4,如果使用dbms_file_transfer访求,那么必须创建以下三个数据库对象:
.在源数据库中创建一个数据库目录对象,它指向要被复制的数据文件所存放的目录
.在目标数据库中创建一个数据库目录对象,它指向将要存放数据文件的目录
.在目标数据库中创建一个dblink连接到源数据库
源数据库目录对象引用源数据库中当前存放数据文件的目录。例如,下面创建目录对象指向,数据文件存放目录+DATA/ORCL/DATAFILE/,连接到源数据库房执行以下命令:
[oracle@jytest3 ~]$ export ORACLE_SID=orcl [oracle@jytest3 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Mon Aug 21 19:57:36 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> select name from v$datafile; NAME -------------------------------------------------------------------------------- +DATA/ORCL/DATAFILE/system.280.941831569 +DATA/ORCL/DATAFILE/sysaux.281.941831647 +DATA/ORCL/DATAFILE/undotbs1.282.941831677 +DATA/ORCL/DATAFILE/users.284.941831687 +DATA/ORCL/DATAFILE/jy.371.952394755 SQL> create directory sourcedir as '+DATA/ORCL/DATAFILE'; Directory created.
目标数据库目录对象引用目标数据库中将要存储数据文件的目录。这个目录是最终目标数据库将要存放数据文件的目录+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/,连接到目标数据库执行以下命令要注意的是目录对象与dblink要在CDB中创建
[oracle@jytest1 ~]$ sqlplus /nolog SQL*Plus: Release 12.2.0.1.0 Production on Mon Aug 21 16:24:46 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> conn sys/abcd@jy as sysdba Connected. SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/system.274.939167015 +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/sysaux.275.939167015 +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/undotbs1.273.939167015 +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/undo_2.277.939167063 +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/testtb01.dbf +DATA/JY/4B2C6373AE2547CCE053AB828A0A7CA3/DATAFILE/undotbs2.278.945029905 +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/example01.dbf +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/test01.dbf +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/users01.dbf +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/sales_test_01.dbf +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/emp_test_01.dbf NAME -------------------------------------------------------------------------------- +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/orders_test_01.dbf 12 rows selected. SQL> create directory destdir as '+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile'; Directory created.
在目标数据库中创建一个dblink连接到源数据库。例如创建一个名叫ttslink的dblink,执行以下命令:
SQL> create public database link ttslink 2 connect to system identified by "xxzx#7817600" 3 using '(DESCRIPTION = 4 (ADDRESS_LIST = 5 (ADDRESS = (PROTOCOL = TCP)(HOST =10.138.130.173)(PORT = 1521)) 6 ) 7 (CONNECT_DATA = 8 (SERVER = DEDICATED) 9 (SERVICE_NAME =orcl) 10 ) 11 )'; Database link created. SQL> select * from dual@ttslink; D - X
在源系统中创建目录/ora_xtts/backupformat用来存储源系统中对源数据库生成的备份及增量备份文件,xtt.properties文件中的backupformat参数设置该目录。
[oracle@jytest3 ora_xtts]$ mkdir backupformat
在目标系统中创建目录/tts/backup用来存储手动从源系统中传输过来的备份及增量备份文件,xtt.properties文件中的stageondest参数设置该目录。
[oracle@jytest1 tts]$ mkdir backup
xtt.properties文件中的storageondest参数设置目标数据库最终存储数据文件的目录,这里是
+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/目录。
1.5在源系统中配置xtt.properties文件
SQL> select platform_id from v$database; PLATFORM_ID ----------- 13 [oracle@jytest3 xtts_script]$ vi xtt.properties tablespaces=JY platformid=13 srcdir=SOURCEDIR dstdir=DESTDIR srclink=ttslink storageondest=+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/ backupformat=/ora_xtts/backupformat stageondest=/tts/xtts backupondest=/tts/backup asm_home=/u01/app/product/12.2.0/crs asm_sid=+ASM1 parallel=4 cnvinst_home=/u01/app/oracle/product/12.2.0/db cnvinst_sid=xtt
1.6将源系统中的xttconvert脚本与xtt.properties文件复制到目标系统中
在源系统中以Oracle软件用户来进行复制
[oracle@jytest1 tts]$ scp -r oracle@10.138.130.173:/ora_xtts/xtts_script/ /tts/ The authenticity of host '10.138.130.173 (10.138.130.173)' can't be established. ECDSA key fingerprint is 67:29:52:b1:c0:74:ff:33:fc:67:63:53:31:14:69:ec. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.138.130.173' (ECDSA) to the list of known hosts. oracle@10.138.130.173's password: rman_xttconvert_v3.zip 100% 33KB 33.2KB/s 00:00 xttcnvrtbkupdest.sql 100% 1390 1.4KB/s 00:00 xttdbopen.sql 100% 71 0.1KB/s 00:00 xttdriver.pl 100% 136KB 136.1KB/s 00:00 xttprep.tmpl 100% 11KB 11.4KB/s 00:00 xttstartupnomount.sql 100% 52 0.1KB/s 00:00 xtt.properties.jy 100% 7969 7.8KB/s 00:00 xtt.properties 100% 217 0.2KB/s 00:00 [oracle@jytest1 tts]$ cd xtts_script [oracle@jytest1 xtts_script]$ ls -lrt total 212 -rw-r--r-- 1 oracle oinstall 33949 Aug 18 23:35 rman_xttconvert_v3.zip -rw-r--r-- 1 oracle oinstall 1390 Aug 18 23:35 xttcnvrtbkupdest.sql -rw-r--r-- 1 oracle oinstall 71 Aug 18 23:35 xttdbopen.sql -rw-r--r-- 1 oracle oinstall 139331 Aug 18 23:35 xttdriver.pl -rw-r--r-- 1 oracle oinstall 11710 Aug 18 23:35 xttprep.tmpl -rw-r--r-- 1 oracle oinstall 52 Aug 18 23:35 xttstartupnomount.sql -rw-r--r-- 1 oracle oinstall 7969 Aug 18 23:35 xtt.properties.jy -rw-r--r-- 1 oracle oinstall 217 Aug 18 23:35 xtt.properties
1.7设置环境变量TMPDIR
在源系统与目标系统中设置环境变量TMPDIR。使用shell来执行Perl脚本xttdriver.pl所生成的文件会存储在$TMPDIR目录中,如果没有设置TMPDIR环境变量,那么生成的文件会存储在/tmp目录中。
源系统
[oracle@jytest3 ora_xtts]$ export TMPDIR=/ora_xtts/xtts_script
目标系统
[oracle@jytest1 tts]$ export TMPDIR=/tts/xtts_script
2.准备阶段
在准备阶段,要被传输的表空间会在源系统中生成备份,然后将备份传输到目标系统中,并通过执行xttdriver.pl脚本将备份还原。注意,对于要传输大量数据文件,可以使用dbms_file_transfer进行传输(可以参考文档 1389592.1中的准备阶段)会要比手动传输备份文件到目标系统中快很多。这种方法也适用于Oracle 12c,11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 1389592.1).
2.1在源系统中对要传输的表空间生成备份
在源系统中,以oracle软件用户登录,并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向源数据库,执行以下命令来生成备份
[oracle@jytest3 xtts_script]$ export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db [oracle@jytest3 xtts_script]$ export ORACLE_SID=orcl [oracle@jytest3 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -S ============================================================ trace file is /ora_xtts/xtts_script/setupgetfile_Aug21_Mon_20_33_36_837//Aug21_Mon_20_33_36_837_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Starting prepare phase -------------------------------------------------------------------- Prepare source for Tablespaces: 'JY' /tts/xtts xttpreparesrc.sql for 'JY' started at Mon Aug 21 20:33:36 2017 xttpreparesrc.sql for ended at Mon Aug 21 20:33:36 2017 Prepare source for Tablespaces: '''' /tts/xtts xttpreparesrc.sql for '''' started at Mon Aug 21 20:33:36 2017 xttpreparesrc.sql for ended at Mon Aug 21 20:33:36 2017 -------------------------------------------------------------------- Done with prepare phase -------------------------------------------------------------------- [oracle@jytest3 xtts_script]$ cat xttnewdatafiles.txt ::JY 5,DESTDIR:/jy.371.952394755 [oracle@jytest3 xtts_script]$ cat getfile.sql 0,SOURCEDIR,jy.371.952394755,DESTDIR,jy_371_952394755
要被传输的一组表空间必须是online,read write状态且不包含脱机数据文件。如果在源数据库中被传输表空间的一个或多个数据文件是脱机状态或read only就会触发错误。如果表空间在整个表空间传输过程中都保持read only状态,那么就使用传统的跨平台传输表空间,不要使用跨平台增量备份传输表空间。
2.2 传输数据文件到目标系统中
在目标系统中,使用Oracle软件用户登录并设置相关环境变量(ORACLE_HOME与ORACLE_SID)来指向目标数据库,并复制上一步生成的xttnewdatafiles.txt与getfile.sql文件到目标系统并执行操作来获取数据文件
[oracle@jytest1 xtts_script]$ scp oracle@10.138.130.173:/ora_xtts/xtts_script/xttnewdatafiles.txt /tts/xtts_script/ oracle@10.138.130.173's password: xttnewdatafiles.txt 100% 33 0.0KB/s 00:00 [oracle@jytest1 xtts_script]$ scp oracle@10.138.130.173:/ora_xtts/xtts_script/getfile.sql /tts/xtts_script/ oracle@10.138.130.173's password: getfile.sql 100% 54 0.1KB/s 00:00 [oracle@jytest1 xtts_script]$ ls -lrt total 220 -rw-r--r-- 1 oracle oinstall 1390 May 24 16:57 xttcnvrtbkupdest.sql -rw-r--r-- 1 oracle oinstall 52 May 24 16:57 xttstartupnomount.sql -rw-r--r-- 1 oracle oinstall 11710 May 24 16:57 xttprep.tmpl -rw-r--r-- 1 oracle oinstall 139331 May 24 16:57 xttdriver.pl -rw-r--r-- 1 oracle oinstall 71 May 24 16:57 xttdbopen.sql -rw-r--r-- 1 oracle oinstall 7969 Jun 5 08:47 xtt.properties.jy -rw-r--r-- 1 oracle oinstall 33949 Aug 18 23:35 rman_xttconvert_v3.zip -rw-r--r-- 1 oracle oinstall 351 Aug 21 17:02 xtt.properties -rw-r--r-- 1 oracle oinstall 33 Aug 21 17:17 xttnewdatafiles.txt -rw-r--r-- 1 oracle oinstall 54 Aug 21 17:17 getfile.sql [oracle@jytest1 xtts_script]$ export TMPDIR=/tts/xtts_script [oracle@jytest1 xtts_script]$ export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db [oracle@jytest1 xtts_script]$ export ORACLE_SID=jy1 [oracle@jytest1 xtts_script]$ export XTTDEBUG=1 [oracle@jytest1 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -G ============================================================ trace file is /tts/xtts_script/getfile_Aug22_Tue_17_28_19_991//Aug22_Tue_17_28_19_991_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: backupondest Values: /tts/backup Key: backupformat Values: /ora_xtts/backupformat Key: cnvinst_sid Values: jy1 Key: asm_sid Values: +ASM1 Key: stageondest Values: /tts/xtts Key: srclink Values: ttslink Key: parallel Values: 4 Key: tablespaces Values: JY Key: platformid Values: 13 Key: asm_home Values: /u01/app/product/12.2.0/crs Key: dstdir Values: DESTDIR Key: srcdir Values: SOURCEDIR Key: storageondest Values: +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/ -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest ARGUMENT srcdir ARGUMENT dstdir ARGUMENT srclink -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : jy1 ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Getting datafiles from source -------------------------------------------------------------------- fetchCheckDirObjectsDST: Check dir path fetchDirEntry: remotelink not present -------------------------------------------------------------------- Executing getfile for /tts/xtts_script/getfile_Aug22_Tue_17_28_19_991//getfile_sourcedir_jy.371.952394755_0.sql -------------------------------------------------------------------- PL/SQL procedure successfully completed. -------------------------------------------------------------------- Completed getting datafiles from source --------------------------------------------------------------------
3.前滚阶段
下面在源数据库中创建增量数据
SQL> select * from jy.jy_test; USER_ID ---------- 1 2 3 SQL> insert into jy.jy_test values(4); 1 row created. SQL> commit; Commit complete. SQL> select * from jy.jy_test; USER_ID ---------- 1 2 3 4
在这个阶段会在源系统中对源数据库创建增量备份,将增量备份文件传输到目标系统并转换为目标系统所使用的字节序,然后将转换后的增量备份应用到数据文件。这个阶段的操作可以执行多次。每一次成功的增量备份所花的时间要比上一次的少,这将使用目标数据库中的数据文件的内容更接近源数据库的内容。在执行这个阶段操作时被传输的数据完全可以被访问。
3.1 在源系统中对被传输的表空间LDJC,CDZJ创建增量备份
在源系统中,以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向源数据库,并执行以下命令来创建增量备份:
[oracle@jytest3 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -i ============================================================ trace file is /ora_xtts/xtts_script/incremental_Aug22_Tue_21_19_39_709//Aug22_Tue_21_19_39_709_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: srclink Values: ttslink Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: platformid Values: 13 Key: storageondest Values: +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/ Key: asm_sid Values: +ASM1 Key: dstdir Values: DESTDIR Key: backupondest Values: /tts/backup Key: srcdir Values: SOURCEDIR Key: cnvinst_sid Values: jy1 Key: tablespaces Values: JY Key: asm_home Values: /u01/app/product/12.2.0/crs Key: backupformat Values: /ora_xtts/backupformat Key: parallel Values: 4 Key: stageondest Values: /tts/xtts -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : orcl ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Backup incremental -------------------------------------------------------------------- fetchCheckDirObjectsSRC: Check dir path fetchDirEntry: remotelink not present TABLESPACE STRING :'JY' Prepare source for Tablespaces: 'JY' /tts/xtts xttpreparesrc.sql for 'JY' started at Tue Aug 22 21:19:39 2017 xttpreparesrc.sql for ended at Tue Aug 22 21:19:39 2017 #DNAME:+DATA/ORCL/DATAFILE #FNAME:jy.371.952394755 #PLAN:JY::::62924193 #TRANSFER:source_file_name=JY,+DATA/ORCL/DATAFILE,jy.371.952394755 #NEWDESTDF:5,DESTDIR:+DATA/ORCL/DATAFILE,/jy.371.952394755 #PLAN:5 verifySrcdirDatafiles: Entered TABLESPACE STRING :'''' Prepare source for Tablespaces: '''' /tts/xtts xttpreparesrc.sql for '''' started at Tue Aug 22 21:19:39 2017 xttpreparesrc.sql for ended at Tue Aug 22 21:19:40 2017 verifySrcdirDatafiles: Entered JY: +DATA/ORCL/DATAFILE/jy.371.952394755 ============================================================ No new datafiles added ============================================================= TABLESPACE STRING :'JY' Prepare newscn for Tablespaces: 'JY' JY::::62924193 5 TABLESPACE STRING :'''''' Prepare newscn for Tablespaces: '''''' -------------------------------------------------------------------- Starting incremental backup -------------------------------------------------------------------- /ora_xtts/xtts_script/incremental_Aug22_Tue_21_19_39_709//rmanincr.cmd Recovery Manager: Release 12.2.0.1.0 - Production on Tue Aug 22 21:19:40 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. RMAN-06005: connected to target database: ORCL (DBID=1469612247) RMAN> set nocfau; 2> host 'echo ts::JY'; 3> backup incremental from scn 62924193 4> tag tts_incr_update tablespace 'JY' format 5> '/ora_xtts/backupformat/%U'; 6> RMAN-03023: executing command: SET NOCFAU RMAN-06009: using target database control file instead of recovery catalog ts::JY RMAN-06134: host command complete RMAN-03090: Starting backup at 22-AUG-17 RMAN-08030: allocated channel: ORA_DISK_1 RMAN-08500: channel ORA_DISK_1: SID=43 device type=DISK RMAN-08008: channel ORA_DISK_1: starting full datafile backup set RMAN-08010: channel ORA_DISK_1: specifying datafile(s) in backup set RMAN-08522: input datafile file number=00005 name=+DATA/ORCL/DATAFILE/jy.371.952394755 RMAN-08038: channel ORA_DISK_1: starting piece 1 at 22-AUG-17 RMAN-08044: channel ORA_DISK_1: finished piece 1 at 22-AUG-17 RMAN-08530: piece handle=/ora_xtts/backupformat/2dscipng_1_1 tag=TTS_INCR_UPDATE comment=NONE RMAN-08540: channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 RMAN-03091: Finished backup at 22-AUG-17 Recovery Manager complete. -------------------------------------------------------------------- Done backing up incrementals --------------------------------------------------------------------
上面的操作会执行RMAN命令对xtt.properties文件中所指定的所有表空间生成增量备份文件。并且还将创建以下文件供后面的操作使用:
.tsbkupmap.txt
.incrbackups.txt
tsbkupmap.txt的内容如下:
[oracle@jytest3 xtts_script]$ cat tsbkupmap.txt JY::5:::1=2dscipng_1_1
文件中的内容记录了表空间与增量备份的关联关系
incrbackups.txt的内容如下:
[oracle@jytest3 xtts_script]$ cat incrbackups.txt /ora_xtts/backupformat/2dscipng_1_1
文件中的内容显示了生成的增量备份文件信息
[oracle@jytest3 backupformat]$ ls -lrt total 56 -rw-r-----. 1 oracle asmadmin 57344 Aug 22 21:19 2dscipng_1_1
3.2 将增量备份传输到目标系统中
将上一步生成的增量备份传输到目标系统中由xtt.properties文件中的stageondest目录(/oracle11/xtts)中。
[oracle@jytest3 xtts_script]$ scp `cat incrbackups.txt` oracle@10.138.130.171:/tts/xtts/ oracle@10.138.130.171's password: 2dscipng_1_1 100% 56KB 56.0KB/s 00:00
3.3 在目标系统中转换增量备份并应用到数据文件副本
在目标系统中以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向目标数据库,并从源系统中将上一步生成的xttplan.txt与tsbkupmap.txt文件。
[oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/xttplan.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: xttplan.txt 100% 17 0.0KB/s 00:00 [oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/tsbkupmap.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: tsbkupmap.txt 100% 23 0.0KB/s 00:00 [oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/incrbackups.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: incrbackups.txt 100% 36 0.0KB/s 00:00 [oracle@jytest1 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -r ============================================================ trace file is /tts/xtts_script/rollforward_Aug22_Tue_18_27_05_399//Aug22_Tue_18_27_05_399_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: backupformat Values: /ora_xtts/backupformat Key: srclink Values: ttslink Key: tablespaces Values: JY Key: parallel Values: 4 Key: asm_home Values: /u01/app/product/12.2.0/crs Key: cnvinst_sid Values: xtt Key: platformid Values: 13 Key: stageondest Values: /tts/xtts Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: asm_sid Values: +ASM1 Key: dstdir Values: DESTDIR Key: backupondest Values: /tts/backup Key: srcdir Values: SOURCEDIR -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest ARGUMENT backupondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : jy1 ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Start rollforward -------------------------------------------------------------------- convert instance: /u01/app/oracle/product/12.2.0/db convert instance: xtt ORACLE instance started. Total System Global Area 6442450944 bytes Fixed Size 8807168 bytes Variable Size 3909094656 bytes Database Buffers 1442840576 bytes Redo Buffers 7966720 bytes In-Memory Area 1073741824 bytes rdfno 5 BEFORE ROLLPLAN datafile number : 5 datafile name : +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755 AFTER ROLLPLAN CONVERTED BACKUP PIECE/tts/backup/xib_2dscipng_1_1_5 PL/SQL procedure successfully completed. Entering RollForward After applySetDataFile Done: applyDataFileTo Done: applyDataFileTo Done: RestoreSetPiece Done: RestoreBackupPiece PL/SQL procedure successfully completed. asmcmd rm /tts/backup/xib_2dscipng_1_1_5 /u01/app/product/12.2.0/crs .. +ASM1 Connected to an idle instance. ASMCMD-8102: no connection to Oracle ASM; command requires Oracle ASM to run ASMCMD: -------------------------------------------------------------------- End of rollforward phase --------------------------------------------------------------------
这步前滚数据文件的操作,会以sys用户连接到增量转换实例,转换完增量备份后,然后连接到目标数据库并将增量备份应用到每个表空间注意:对于每一次增量备份都需要将xttplan.txt与tsbkupmap.txt文件复制一次,不要对脚本所生成的xttplan.txt.new文件进行修改,复制或者其它任何改变。执行这步操作时目标实例会进行重启操作。
3.4 为下一次增量备份判断from_scn
再次生成增量数据
SQL> insert into jy.jy_test values(5); 1 row created. SQL> commit; Commit complete. SQL> select * from jy.jy_test; USER_ID ---------- 1 2 3 4 5
在源系统中,以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向源数据库,执行以下命令来判断from_scn:
[oracle@jytest3 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -s ============================================================ trace file is /ora_xtts/xtts_script/determinescn_Aug22_Tue_21_54_18_326//Aug22_Tue_21_54_18_326_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: backupformat Values: /ora_xtts/backupformat Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: tablespaces Values: JY Key: platformid Values: 13 Key: stageondest Values: /tts/xtts Key: backupondest Values: /tts/backup Key: parallel Values: 4 Key: asm_home Values: /u01/app/product/12.2.0/crs Key: srcdir Values: SOURCEDIR Key: dstdir Values: DESTDIR Key: asm_sid Values: +ASM1 Key: cnvinst_sid Values: xtt Key: srclink Values: ttslink -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : orcl ORACLE_HOME : /u01/app/oracle/product/12.2.0/db TABLESPACE STRING :'JY' Prepare newscn for Tablespaces: 'JY' TABLESPACE STRING :'''' Prepare newscn for Tablespaces: '''' New /ora_xtts/xtts_script/xttplan.txt with FROM SCN's generated New /ora_xtts/xtts_script/xttplan.txt with FROM SCN's generated [oracle@jytest3 xtts_script]$ cat xttplan.txt JY::::62924193 5
4.传输阶段
在执行传输阶段操作时,源数据库中被传输表空间要设置为read only状态,并且通过创建与应用最后一次的增量备份使用目标数据库中的数据文件与源数据库中的数据文件内容保持一致。在目标数据库数据文件与源数据库数据文件内容达成一致后,在源系统中执行正常的传输表空间操作来导出元数据,然后将元数据导入到目标数据库中。直到传输阶段操作完成之前,被传输的数据只能以read only模式被访问。
4.1 将源数据库中被传输表空间设置为read only状态
在源系统中,以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向源数据库,并执行以下命令将表空间设置为read only:
SQL> alter tablespace jy read only; Tablespace altered.
4.2 最后一次创建增量备份,并传输到目标系统且执行转换并应用到目标数据文件
在源系统中,以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向源数据库,并执行以下命令来创建增量备份:
[oracle@jytest3 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -i ============================================================ trace file is /ora_xtts/xtts_script/incremental_Aug22_Tue_21_57_21_478//Aug22_Tue_21_57_21_478_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: parallel Values: 4 Key: backupformat Values: /ora_xtts/backupformat Key: asm_home Values: /u01/app/product/12.2.0/crs Key: platformid Values: 13 Key: tablespaces Values: JY Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: stageondest Values: /tts/xtts Key: srclink Values: ttslink Key: srcdir Values: SOURCEDIR Key: backupondest Values: /tts/backup Key: dstdir Values: DESTDIR Key: asm_sid Values: +ASM1 Key: cnvinst_sid Values: xtt -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : orcl ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Backup incremental -------------------------------------------------------------------- fetchCheckDirObjectsSRC: Check dir path fetchDirEntry: remotelink not present TABLESPACE STRING :'JY' Prepare source for Tablespaces: 'JY' /tts/xtts xttpreparesrc.sql for 'JY' started at Tue Aug 22 21:57:21 2017 xttpreparesrc.sql for ended at Tue Aug 22 21:57:21 2017 #DNAME:+DATA/ORCL/DATAFILE #FNAME:jy.371.952394755 #PLAN:JY::::62928997 #TRANSFER:source_file_name=JY,+DATA/ORCL/DATAFILE,jy.371.952394755 #NEWDESTDF:5,DESTDIR:+DATA/ORCL/DATAFILE,/jy.371.952394755 #PLAN:5 verifySrcdirDatafiles: Entered TABLESPACE STRING :'''' Prepare source for Tablespaces: '''' /tts/xtts xttpreparesrc.sql for '''' started at Tue Aug 22 21:57:21 2017 xttpreparesrc.sql for ended at Tue Aug 22 21:57:21 2017 verifySrcdirDatafiles: Entered JY: +DATA/ORCL/DATAFILE/jy.371.952394755 ============================================================ No new datafiles added ============================================================= TABLESPACE STRING :'JY' Prepare newscn for Tablespaces: 'JY' JY::::62928997 5 TABLESPACE STRING :'''''' Prepare newscn for Tablespaces: '''''' -------------------------------------------------------------------- Starting incremental backup -------------------------------------------------------------------- /ora_xtts/xtts_script/incremental_Aug22_Tue_21_57_21_478//rmanincr.cmd Recovery Manager: Release 12.2.0.1.0 - Production on Tue Aug 22 21:57:21 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. RMAN-06005: connected to target database: ORCL (DBID=1469612247) RMAN> set nocfau; 2> host 'echo ts::JY'; 3> backup incremental from scn 62924193 4> tag tts_incr_update tablespace 'JY' format 5> '/ora_xtts/backupformat/%U'; 6> RMAN-03023: executing command: SET NOCFAU RMAN-06009: using target database control file instead of recovery catalog ts::JY RMAN-06134: host command complete RMAN-03090: Starting backup at 22-AUG-17 RMAN-08030: allocated channel: ORA_DISK_1 RMAN-08500: channel ORA_DISK_1: SID=43 device type=DISK RMAN-08008: channel ORA_DISK_1: starting full datafile backup set RMAN-08010: channel ORA_DISK_1: specifying datafile(s) in backup set RMAN-08522: input datafile file number=00005 name=+DATA/ORCL/DATAFILE/jy.371.952394755 RMAN-08038: channel ORA_DISK_1: starting piece 1 at 22-AUG-17 RMAN-08044: channel ORA_DISK_1: finished piece 1 at 22-AUG-17 RMAN-08530: piece handle=/ora_xtts/backupformat/2esciru5_1_1 tag=TTS_INCR_UPDATE comment=NONE RMAN-08540: channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 RMAN-03091: Finished backup at 22-AUG-17 Recovery Manager complete. -------------------------------------------------------------------- Done backing up incrementals --------------------------------------------------------------------
上面的操作会执行RMAN命令对xtt.properties文件中所指定的所有表空间生成增量备份文件。并且还将创建以下文件供后面的操作使用:
.tsbkupmap.txt
.incrbackups.txt
tsbkupmap.txt的内容如下:
[oracle@jytest3 xtts_script]$ cat tsbkupmap.txt JY::5:::1=2esciru5_1_1
文件中的内容记录了表空间与增量备份的关联关系
incrbackups.txt的内容如下:
[oracle@jytest3 xtts_script]$ cat incrbackups.txt /ora_xtts/backupformat/2esciru5_1_1
文件中的内容显示了生成的增量备份文件信息
[oracle@jytest3 backupformat]$ ls -lrt total 112 -rw-r-----. 1 oracle asmadmin 57344 Aug 22 21:19 2dscipng_1_1 -rw-r-----. 1 oracle asmadmin 57344 Aug 22 21:57 2esciru5_1_1
将增量备份传输到目标系统中
将上一步生成的增量备份传输到目标系统中由xtt.properties文件中的stageondest目录(/oracle11/xtts)中。
[oracle@jytest3 xtts_script]$ scp `cat incrbackups.txt` oracle@10.138.130.171:/tts/xtts/ oracle@10.138.130.171's password: 2dscipng_1_1 100% 56KB 56.0KB/s 00:00
在目标系统中转换增量备份并应用到数据文件副本
在目标系统中以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向目标数据库,并从源系统中将上一步生成的xttplan.txt与tsbkupmap.txt文件。
[oracle@jytest3 xtts_script]$ scp `cat incrbackups.txt` oracle@10.138.130.171:/tts/xtts/ oracle@10.138.130.171's password: 2esciru5_1_1 100% 56KB 56.0KB/s 00:00 [oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/xttplan.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: xttplan.txt 100% 19 0.0KB/s 00:00 [oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/tsbkupmap.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: tsbkupmap.txt 100% 23 0.0KB/s 00:00 [oracle@jytest3 xtts_script]$ scp /ora_xtts/xtts_script/incrbackups.txt oracle@10.138.130.171:/tts/xtts_script oracle@10.138.130.171's password: incrbackups.txt 100% 36 0.0KB/s 00:00 [oracle@jytest1 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -r ============================================================ trace file is /tts/xtts_script/rollforward_Aug22_Tue_18_38_06_743//Aug22_Tue_18_38_06_743_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: dstdir Values: DESTDIR Key: stageondest Values: /tts/xtts Key: platformid Values: 13 Key: parallel Values: 4 Key: backupformat Values: /ora_xtts/backupformat Key: asm_home Values: /u01/app/product/12.2.0/crs Key: cnvinst_sid Values: xtt Key: srclink Values: ttslink Key: srcdir Values: SOURCEDIR Key: asm_sid Values: +ASM1 Key: tablespaces Values: JY Key: backupondest Values: /tts/backup -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest ARGUMENT backupondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : jy1 ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Start rollforward -------------------------------------------------------------------- convert instance: /u01/app/oracle/product/12.2.0/db convert instance: xtt ORACLE instance started. Total System Global Area 6442450944 bytes Fixed Size 8807168 bytes Variable Size 3892317440 bytes Database Buffers 1459617792 bytes Redo Buffers 7966720 bytes In-Memory Area 1073741824 bytes rdfno 5 BEFORE ROLLPLAN datafile number : 5 datafile name : +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755 AFTER ROLLPLAN CONVERTED BACKUP PIECE/tts/backup/xib_2esciru5_1_1_5 PL/SQL procedure successfully completed. Entering RollForward After applySetDataFile Done: applyDataFileTo Done: applyDataFileTo Done: RestoreSetPiece Done: RestoreBackupPiece PL/SQL procedure successfully completed. asmcmd rm /tts/backup/xib_2esciru5_1_1_5 /u01/app/product/12.2.0/crs .. +ASM1 Connected to an idle instance. ASMCMD-8102: no connection to Oracle ASM; command requires Oracle ASM to run ASMCMD: -------------------------------------------------------------------- End of rollforward phase --------------------------------------------------------------------
4.3 在目标数据库中导入元数据
在目标系统中以Oracle软件用户登录并设置环境变量(ORACLE_HOME与ORACLE_SID)来指向目标数据库,执行以下命令来生成Data Pump TTS命令:
[oracle@jytest1 xtts_script]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -e ============================================================ trace file is /tts/xtts_script/generate_Aug22_Tue_18_39_22_670//Aug22_Tue_18_39_22_670_.log ============================================================= -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: cnvinst_home Values: /u01/app/oracle/product/12.2.0/db Key: cnvinst_sid Values: xtt Key: asm_sid Values: +ASM1 Key: dstdir Values: DESTDIR Key: platformid Values: 13 Key: backupondest Values: /tts/backup Key: parallel Values: 4 Key: stageondest Values: /tts/xtts Key: tablespaces Values: JY Key: srclink Values: ttslink Key: srcdir Values: SOURCEDIR Key: backupformat Values: /ora_xtts/backupformat Key: asm_home Values: /u01/app/product/12.2.0/crs -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : jy1 ORACLE_HOME : /u01/app/oracle/product/12.2.0/db -------------------------------------------------------------------- Generating plugin -------------------------------------------------------------------- -------------------------------------------------------------------- Done generating plugin file /tts/xtts_script/xttplugin.txt -------------------------------------------------------------------- [oracle@jytest1 xtts_script]$ cat xttplugin.txt impdp directory= logfile= \ network_link= transport_full_check=no \ transport_tablespaces=JY \ transport_datafiles='+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755'
上面的命令会生成一个名叫xttplugin.txt的文件,文件创建了一个使用network_link参数执行传输表空间导入元数据的命令。命令中的transport_tablespaces与transport_datafiles参数已经设置正确。注意network_link模式指示导入通过使用dblink来完成,就不需要执行导出或使用dump文件。如果选择执行这个命令来完成表空间的传输就需要修改directory,logfile与network_link参数
SQL> create directory dump_dir as '/tts/xtts_script'; Directory created. SQL> grant read,write on directory dump_dir to public; Grant succeeded.
在目标数据库中创建用户方案jy
SQL> create user jy identified by "jy"; User created. SQL> grant dba,connect,resource to jy; Grant succeeded. [oracle@jytest1 xtts_script]$ impdp system/abcd@jypdb directory=dump_dir logfile=tts_imp.log network_link=ttslink transport_full_check=no transport_tablespaces=JY transport_datafiles='+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755' Import: Release 12.2.0.1.0 - Production on Tue Aug 22 18:45:00 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_03": system/********@jypdb directory=dump_dir logfile=tts_imp.log network_link=ttslink transport_full_check=no transport_tablespaces=JY transport_datafiles=+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755 Source time zone is +08:00 and target time zone is +00:00. Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_03" successfully completed at Tue Aug 22 18:46:20 2017 elapsed 0 00:01:11 [oracle@jytest1 xtts_script]$ impdp system/abcd@jypdb directory=dump_dir logfile=ysj.log content=metadata_only exclude=table,index network_link=ttslink Import: Release 12.2.0.1.0 - Production on Tue Aug 22 18:47:22 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/********@jypdb directory=dump_dir logfile=ysj.log content=metadata_only exclude=table,index network_link=ttslink Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/ROLE_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/STATISTICS/MARKER Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully completed at Tue Aug 22 18:47:49 2017 elapsed 0 00:00:21
5.验证传输数据
5.1检查表空间是否有损坏
[oracle@jytest1 xtts_script]$ rman target sys/abcd@jypdb Recovery Manager: Release 12.2.0.1.0 - Production on Sat Aug 19 01:17:35 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: JY:JYPDB (DBID=2825277312) RMAN> validate tablespace jy check logical; Starting validate at 19-AUG-17 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1144 instance=jy1 device type=DISK channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00083 name=+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_5.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:07 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 83 OK 0 1 64001 1590987 File Name: +DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_5.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 5 Index 0 0 Other 0 63994 Finished validate at 19-AUG-17
5.2将目标数据库中的表空间JY修改为read write状态
SQL> alter tablespace jy read write; Tablespace altered.
6.清除操作
如果使用单独的转换home与实例,那么可以关闭转换实例并删除转换home。还可以删除源系统中创建的backupformat目录,目标系统中创建的bacup目录,源系统与目标系统中设置的环境变量$TMPDIR。
xttdriver.pl脚本选项
--backup:对源数据库中要被传输的表空间创建level 0级备份。这些备份将被写到xtt.properties文件中backupoformat参数所指定的目录中。这些备份需要手动复制到目标系统中stageondest参数所指定的目录中。而且还会生成tsbkupmap.txt与xttnewdatafiles.txt文件并且也需要复制到目标系统中相应目录(TMPDIR变量所指向的目录)
--restore:在目标系统中还原并转换stageondest目录中的数据文件备份的副本。还原的文件将会存储到storageondest参数所指定的目录中
--bkpincr:在源系统中对表空间创建增量备份并存储在backupformat参数所指定的目录中。这步操作还会创建incrbackups.txt文件它列出了所创建的备份。这个文件与tsbkupmap.txt必须复制到目标系统中的stageondest参数所指定的目录中
-recover:将增量备份应用到已经还原的数据文件上
-s:对源数据库判断新的from_scn可以执行一次或多次。这个操作将会计算下一个from_scn,并记录在xttplan.txt文件中,然后使用创建增量备份时会使用。
-bkpexport:将执行最后一次增量备份并且会创建元数据的dump文件用来导入数据文件。增量备份将会存储在backupformat参数所指定的目录中并且会创建incrbckups.txt与tsbkupmaps.txt文件,这些都要复制到目标系统中
--resincrdmp:将恢复最后一次增量备份并应用到数据文件。同时dump文件会被还原到TMPDIR变量所指定的目录中,dump文件可以用来导入
-e:在目标系统中生成传输表空间要导入的元数据脚本
-d debug:为了以debug模式来执行xttdriver.pl 与RMAN脚本。也可以设置环境变量XTTDEBUG=1,debug级别可以为1,2,3,例如xttdriver.pl -3
xtt.properties文件参数说明
tablespaces:用逗号来分隔从源数据库要被传输到目标数据库的表空间列表,例如tablespaces=TS1,TS2
platformid:从v$database.platform_id获得的源数据库的platform id,例如platformid=13
backupformat:源系统中存储备份文件的目录。这个目录必须要有足够的空间来存储所有创建的备份与增量备份文件。这个目录可以是目标系统上通过NFS-mounted文件系统所挂载到源系统中的一个目录,在这种情况下,目标系统中的stageondest参数也引用这个相同的NFS目录。例如,backupformat=/stage_source
stageondest:目标系统中存储从源系统中手动传输过来的数据文件副本。这个目录要有足够的空间来存储数据文件副本。这个目录同时也是用来存储从源系统传输过来的增量备份文件的目录。在目标系统上执行xttdriver.pl -c转换数据文件与执行xttdriver.pl -r前滚数据文件时会从这个目录中读取数据文件副本与增量备份文件。这个目标也可以是一个DBFS-mounted文件系统。个目录可以是源系统上通过NFS-mounted文件系统所挂载到目标系统中的一个目录,在这种情况下,源系统中的backupformat参数与dfcopydir参数就会引用这个相同的NFS目录。可以参考See Note 359515.1 for mount option guidelines。例如stageondest=/stage_dest
storageondest:目标系统中用来存储xttdriver.pl -c转换操作后所生成的数据文件副本的目录,也就是目标数据库最终存储数据文件的目录。这个目录要有足够的空间来永久存储数据文件。这个参数当使用RMAN备份来生成初始化数据文件副本时才使用,例如
storageondest=+DATA或者storageondest=/oradata/test
asm_home:目标系统中ASM实例的ORACLE_HOME。注意如果backupondest设置为文件系统目录,那么就要删除asm_home与asm_sid参数,例如asm_home=/u01/app/11.2.0.4/grid
asm_sid:目标系统中ASM实例的ORACLE_SID。例如asm_sid=+ASM1
parallel:定义rmanconvert.cmd命令文件中rman convert命令的并行度。如果不设置这个参数,那么xttdriver.pl将使用parallel=8的缺省并行度。例如,parallel=3