ITPub博客

首页 > 数据库 > Oracle > XTTS 跨平台表空间迁移测试

XTTS 跨平台表空间迁移测试

Oracle 作者:shilei1 时间:2015-12-25 08:17:21 0 删除 编辑
<strong>简介&nbsp;&nbsp;</strong>&nbsp;&nbsp;&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这两天一直在研究xtts(跨平台表空间迁移的方法),因为一是网上的资源不是很多,二是个人感觉这是个很实用的迁移技巧。下面就和大家来分享一下我个人做的测试过程吧。<img src="http://blog.itpub.net/kindeditor/plugins/emoticons/images/13.gif" alt="" border="0" /><br /> <br /> 1、搭建测试环境<br /> <br /> 跨平台表空间迁移过程&nbsp;&nbsp;&nbsp; (参考文档官方1389592.1)<br /> <br /> --过程主要分为四个部分<br /> &nbsp; 1、初始化阶段<br /> &nbsp; 2、准备阶段<br /> &nbsp; 3、增量备份前滚阶段<br /> &nbsp; 4、运输或叫迁移阶段<br /> <br /> <strong>Phase 1 - 初始化安装</strong><br /> <strong>Step 1.1 - 在目标端安装数据库软件,并且创建target数据库。强烈建议使用11.2.0.4或之后的版本</strong><br /> <strong>Step 1.2 - 如果需要可以配置一个增量转换home和实例<br /> </strong><br /> a、如果软件是11.2.0.4可以忽略这步<br /> b、如果数据库软件时11.2.0.3或是更低,你必须安装一个新的11.2.0.4的数据库软件home,作为增量转换home路径,并且仅启动一个11.2.0.4的实例到nomount状态(数据库可以不用创建)<br /> <br /> <span style="color:#E53333;">--为了简化难度,我的测试环境都用的是64位linux,并且数据库版本也是11.2.0.4.0</span><img src="http://blog.itpub.net/kindeditor/plugins/emoticons/images/20.gif" alt="" border="0" /><span style="color:#E53333;">(</span><span style="color:#E53333;">大家只注意操作步奏就好</span><span style="color:#E53333;">),就只要在目标端建好实例就行了。</span><br /> <br /> <strong>Step 1.3 -选取要传送的表空间,测试源端用的TEST表空间<br /> </strong><strong></strong><br /> --测试里我分别搭建源和目标数据库起名为source、target&nbsp;&nbsp;&nbsp; <br /> &nbsp; source:数据库实例tx9ab,创建表空间test;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 创建用户tx9ab,dba权限默认tablespace为test;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 创建测试用表 xttstest,并插入一条数据。<br /> &nbsp; target:创建数据库实例tx9ab,并且迁移过程中实例保持open;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 创建用户tx9ab,dba权限。<br /> <br /> SQL&gt; create tablespace test datafile '/space/oradata/tx9ab/test01.dbf' size 10m aotuextend on;<br /> <br /> SQL&gt; create user tx9ab identified by tx9ab default tablespace test;<br /> User created.<br /> <br /> SQL&gt; grant connect,resource,select any table to tx9ab;<br /> Grant succeeded.<br /> <br /> SQL&gt; conn tx9ab/tx9ab<br /> Connected.<br /> SQL&gt; create table xttstest(a number);<br /> Table created.<br /> <br /> SQL&gt; select * from xttstest;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100<br /> <br /> SQL&gt; select username,default_tablespace from dba_users where username='TX9AB'; --查看用户默认的表空间;<br /> <br /> USERNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEFAULT_TABLESPACE<br /> ------------------------------ ------------------------------<br /> TX9AB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEST<br /> <br /> --查看各个系统平台信息<br /> SQL&gt; col platform_name for a32<br /> SQL&gt; select * from v$transportable_platform;<br /> <br /> PLATFORM_ID PLATFORM_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIAN_FORMAT<br /> ----------- -------------------------------- --------------<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 Solaris[tm] OE (32-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 Solaris[tm] OE (64-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7 Microsoft Windows IA (32-bit)&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10 Linux IA (32-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 AIX-Based Systems (64-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 HP-UX (64-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 HP Tru64 UNIX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 HP-UX IA (64-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11 Linux IA (64-bit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15 HP Open VMS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8 Microsoft Windows IA (64-bit)&nbsp;&nbsp;&nbsp; Little<br /> <br /> PLATFORM_ID PLATFORM_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIAN_FORMAT<br /> ----------- -------------------------------- --------------<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9 IBM zSeries Based Linux&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#E53333;">13</span> Linux x86 64-bit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16 Apple Mac OS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 Microsoft Windows x86 64-bit&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17 Solaris Operating System (x86)&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18 IBM Power Based Linux&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Big<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19 HP IA Open VMS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20 Solaris Operating System (x86-64 Little<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 21 Apple Mac OS (x86-64)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Little<br /> <br /> 20 rows selected.<br /> <br /> <strong>Step 1.4 -使用RMAN backup(略)</strong><br /> <strong>Step 1.5</strong><strong> -</strong><strong>创建一个转换过程的路径</strong><br /> -在源和目标系统中创建数据转换路径,相关参数定义在xtt.properties文件中:backupformat, backupondest。如果使用RMAN backups则还要设置<br /> dfcopydir, stageondest。<br /> <br /> <strong>Step 1.6 -在源端安装</strong><strong>xttconvert</strong><strong>脚本</strong><br /> -下载并解压rman-xttconvert_2.0.zip<br /> 测试解压/space/sys_software/oracle/scripts/xtts_scripts下<br /> <br /> <strong>Step 1.7 -在源端配置xtt.properties</strong><br /> <br /> [oracle@tx9ab xtts_scripts]$ more xtt.properties<br /> tablespaces=TEST<br /> platformid=<span style="color:#E53333;">13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><br /> dfcopydir=/space/sys_software/oracle/xtts_dir/dfcopydir<br /> backupformat=/space/sys_software/oracle/xtts_dir/backup<br /> stageondest=/space/oradata/tx9ab<br /> storageondest=/space/oradata/tx9ab/test<br /> backupondest=/space/sys_software/oracle/xtts_dir/backup &nbsp; <br /> <br /> <strong>Step 1.8 -将</strong><strong>xttconvert</strong><strong>脚本拷贝到目标端的相同位置下</strong><br /> --这步省了<br /> <strong>Step 1.9 - Set TMPDIR</strong><br /> -告诉系统xttconvert脚本所在的位置<br /> [oracle@single01 ~]$ export TMPDIR=/space/sys_software/oracle/scripts/xtts_scripts<br /> <br /> <strong>Phase 2 - Prepare Phase</strong><br /> <strong>Phase 2A - Prepare Phase for dbms_file_transfer Method&nbsp;</strong>&nbsp; &lt;--本次测试不使用!!!!<br /> <strong>Phase 2B - Prepare Phase for RMAN Backup Method&nbsp;</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;--有两种方法,测试我使用RMAN backup的方法<br /> <strong></strong><br /> <strong>Step 2B.1 - 源端调用</strong><strong>xttdriver.pl</strong><strong>做迁移</strong><strong>准备</strong><br /> <br /> [oracle@single01 xtts_scripts]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -p<br /> <br /> --------------------------------------------------------------------<br /> Parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Starting prepare phase<br /> --------------------------------------------------------------------<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'TEST'&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for 'TEST' started at Thu Sep 17 13:54:21 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:22 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:30 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:31 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:31 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:31 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:32 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:32 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:32 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:32 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:33 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:33 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:33 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:33 2015<br /> Prepare source for Tablespaces:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''&nbsp; /space/oradata/tx9ab<br /> xttpreparesrc.sql for '' started at Thu Sep 17 13:54:34 2015<br /> xttpreparesrc.sql for&nbsp; ended at Thu Sep 17 13:54:34 2015<br /> <br /> --------------------------------------------------------------------<br /> Done with prepare phase<br /> --------------------------------------------------------------------<br /> <br /> 在源端该准备脚本做这样几件事:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、创建要钱仪表空间中的数据文件的拷贝并将它们搬到 xtt.properties<span class="kmfixedwidthfont">文件中定义的dfcopydir路径下。</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、验证表空间是否在线, 是否为读写模式, 并且不包含下线的数据文件。<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3、在TMPDIR下还会生成以下文件:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a、xttplan.txt<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b、rmanconvert.cmd<br /> <br /> <strong>Step 2B.2 -将源端的数据文件,传到目标端</strong><br /> 拷贝source:/space/sys_software/oracle/xtts_dir/dfcopydir/TEST_6.tf&nbsp; ---&gt;&nbsp; target: /space/oradata/tx9ab<br /> <strong>Step 2B.3 -在目标端对来自源端的数据文件拷贝进行转换</strong><br /> 拷贝source:/space/sys_software/oracle/scripts/xtts_scripts/rmanconvert.cmd---&gt; target:/space/sys_software/oracle/scripts/xtts_scripts/rmanconvert.cmd<br /> [oracle@tx9ab xtts_scripts]$ export TMPDIR=/space/sys_software/oracle/scripts/xtts_scripts<br /> [oracle@tx9ab xtts_scripts]$ /space/sys_software/oracle/app/product/11.2.0/db_1/perl/bin/perl xttdriver.pl -c<br /> <br /> --------------------------------------------------------------------<br /> Parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Performing convert<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Converted datafiles listed in: /space/sys_software/oracle/scripts/xtts_scripts/xttnewdatafiles.txt<br /> --------------------------------------------------------------------<br /> <br /> <strong>-转换后的数据文件拷贝会出现在 xtt.properties文件中定义的</strong><span class="kmfixedwidthfont"><strong>参数storageondest下</strong></span><strong>。<br /> </strong>这时在目标的/space/oradata/tx9ab/test/下会生成一个TEST_6.xtf经转换后的数据文件拷贝。<br /> <br /> <strong>Phase 3 - Roll Forward Phase</strong><br /> <br /> &nbsp;&nbsp;&nbsp; 在源端创造增量数据、做增量备份,然后传到目标端的, 在目标端对传过来的增量备份进行格式转换后,将增量数据应用到数据文件备份上。这个过程是可以多次重复的,这样备库上的数据文件拷贝,通过一次次应用增量数据就可以逐渐追上源库的生产数据。<br /> <br /> <strong>创建增量数据</strong><br /> <br /> SQL&gt; update xttstest set a=200;<br /> SQL&gt; commit;<br /> SQL&gt; select * from xttstest;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 200<br /> <br /> <strong>Step 3.1 -源端对表空间进行增量备份</strong><br /> <br /> <strong><span style="color:#E53333;">这里必须注意:在最后一次对源库进行增量备份以前,要把源库要迁移的表空间设为只读,不然以后目标端导入表空间元组时一定会报错的!!!</span></strong><br /> <br /> <span style="color:#E53333;">SQL&gt; show user</span><br /> <span style="color:#E53333;">USER is "SYS"</span><br /> <span style="color:#E53333;">SQL&gt; alter tablespace test read only;</span><br /> <span style="color:#E53333;">Tablespace altered.</span><br /> <br /> [oracle@single01 xtts_scripts]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -i<br /> <br /> --------------------------------------------------------------------<br /> Parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Done checking properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Backup incremental<br /> --------------------------------------------------------------------<br /> Prepare newscn for Tablespaces: 'TEST' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> Prepare newscn for Tablespaces: '' <br /> rman target /&nbsp; cmdfile /space/sys_software/oracle/scripts/xtts_scripts/rmanincr.cmd<br /> <br /> Recovery Manager: Release 11.2.0.4.0 - Production on Thu Sep 17 15:47:40 2015<br /> <br /> Copyright (c) 1982, 2011, Oracle and/or its affiliates.&nbsp; All rights reserved.<br /> <br /> connected to target database: TX9AB (DBID=390378578)<br /> <br /> RMAN&gt; set nocfau;<br /> 2&gt; host 'echo ts::TEST';<br /> 3&gt; backup incremental from scn 1120971 <br /> 4&gt;&nbsp;&nbsp; tag tts_incr_update tablespace 'TEST'&nbsp; format<br /> 5&gt;&nbsp; '/space/sys_software/oracle/xtts_dir/backup/%U';<br /> 6&gt; <br /> executing command: SET NOCFAU<br /> using target database control file instead of recovery catalog<br /> <br /> ts::TEST<br /> host command complete<br /> <br /> Starting backup at 17-SEP-2015 15:47:41<br /> allocated channel: ORA_DISK_1<br /> channel ORA_DISK_1: SID=41 device type=DISK<br /> allocated channel: ORA_DISK_2<br /> channel ORA_DISK_2: SID=38 device type=DISK<br /> allocated channel: ORA_DISK_3<br /> channel ORA_DISK_3: SID=43 device type=DISK<br /> allocated channel: ORA_DISK_4<br /> channel ORA_DISK_4: SID=44 device type=DISK<br /> channel ORA_DISK_1: starting full datafile backup set<br /> channel ORA_DISK_1: specifying datafile(s) in backup set<br /> input datafile file number=00006 name=/space/oradata/tx9ab/test01.dbf<br /> channel ORA_DISK_1: starting piece 1 at 17-SEP-2015 15:47:42<br /> channel ORA_DISK_1: finished piece 1 at 17-SEP-2015 15:47:43<br /> piece handle=/space/sys_software/oracle/xtts_dir/backup/0fqhd10u_1_1 tag=TTS_INCR_UPDATE comment=NONE&nbsp;&nbsp;&nbsp; &lt;--增量的备份集<br /> channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01<br /> Finished backup at 17-SEP-2015 15:47:43<br /> <br /> Recovery Manager complete.<br /> <br /> <br /> --------------------------------------------------------------------<br /> Done backing up incrementals<br /> --------------------------------------------------------------------<br /> <br /> <p> 上面的操作还会在TMPDIR目录下产生以下的文件<span class="kmfixedwidthfont"><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、tsbkupmap.txt</span><span class="kmfixedwidthfont"><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、incrbackups.txt<br /> </span> </p> [oracle@single01 xtts_scripts]$ ls -trl<br /> total 172<br /> -rwxrwxr-x 1 oracle oinstall&nbsp;&nbsp;&nbsp; 52 May 22 08:30 xttstartupnomount.sql<br /> -rwxrwxr-x 1 oracle oinstall 11549 May 22 08:30 xttprep.tmpl<br /> -rwxrwxr-x 1 oracle oinstall 91722 May 22 08:30 xttdriver.pl<br /> -rwxrwxr-x 1 oracle oinstall&nbsp;&nbsp;&nbsp; 71 May 22 08:30 xttdbopen.sql<br /> -rwxrwxr-x 1 oracle oinstall&nbsp; 1390 May 22 08:30 xttcnvrtbkupdest.sql<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp; 354 Sep 17 11:01 xtt.properties<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp;&nbsp; 18 Sep 17 13:54 xttplan.txt<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp; 181 Sep 17 13:54 rmanconvert.cmd<br /> -rw-r--r-- 1 oracle oinstall 11657 Sep 17 13:54 xttpreparesrc.sql<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp;&nbsp; 20 Sep 17 15:47 xttplan.txt.new<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 0 Sep 17 15:47 xttprepare.cmd<br /> -rw-r--r-- 1 oracle oinstall 11592 Sep 17 15:47 xttdetnewfromscnsrc.sql<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp; 169 Sep 17 15:47 rmanincr.cmd<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp;&nbsp; 25 Sep 17 15:47 tsbkupmap.txt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;--new file<br /> -rw-r--r-- 1 oracle oinstall&nbsp;&nbsp;&nbsp; 56 Sep 17 15:47 incrbackups.txt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &lt;--new file<br /> <br /> <strong>Step 3.2 -</strong><strong>将增量备份和新生文件上传至目标端(略)</strong><br /> <strong></strong><strong>Step 3.3 -</strong><strong>在源端对刚传过来的增量备份进行转换和应用</strong><br /> <br /> [oracle@tx9ab xtts_scripts]$ perl xttdriver.pl -r<br /> ################################## 前面报的错 ##################################<br /> ERROR IN CONVERSION ORA-19624: operation failed, retry possible<br /> ORA-19505:<br /> failed to identify file "/space/oradata/tx9ab/0gqhs56u_1_1"<br /> ORA-27037: unable to<br /> obtain file status<br /> Linux-x86_64 Error: 2: No such file or directory<br /> Additional<br /> information: 3<br /> ORA-19600: input file is backup piece<br /> (/space/oradata/tx9ab/0gqhs56u_1_1)<br /> ORA-19601: output file is backup piece<br /> (/space/sys_software/oracle/xtts_dir/backup/xib_0gqhs56u_1_1_6)<br /> CONVERTED BACKUP<br /> PIECE/space/sys_software/oracle/xtts_dir/backup/xib_0gqhs56u_1_1_6<br /> <br /> PL/SQL procedure successfully completed.<br /> <br /> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br /> Error:<br /> ------<br /> /space/sys_software/oracle/scripts/xtts_scripts/xxttconv_0gqhs56u_1_1_6.sql execution failed<br /> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br /> --发现是路径的问题!!!!!!!!!<br /> [oracle@tx9ab xtts_scripts]$ cp /space/sys_software/oracle/xtts_dir/backup/0gqhs56u_1_1 /space/oradata/tx9ab/0gqhs56u_1_1 <br /> --修改备份的路径再次尝试<br /> <br /> [oracle@tx9ab xtts_scripts]$ perl xttdriver.pl -r<br /> --------------------------------------------------------------------<br /> Parsing properties<br /> --------------------------------------------------------------------<br /> Key: backupondest<br /> Values: /space/sys_software/oracle/xtts_dir/backup<br /> Key: platformid<br /> Values: 13<br /> Key: backupformat<br /> Values: /space/sys_software/oracle/xtts_dir/backup<br /> Key: storageondest<br /> Values: /space/oradata/tx9ab/test<br /> Key: dfcopydir<br /> Values: /space/sys_software/oracle/xtts_dir/dfcopydir<br /> Key: cnvinst_home<br /> Values: /space/sys_software/oracle/app/product/11.2.0/db_1<br /> Key: cnvinst_sid<br /> Values: tx9ab<br /> Key: stageondest<br /> Values: /space/oradata/tx9ab<br /> Key: tablespaces<br /> Values: TEST<br /> <br /> --------------------------------------------------------------------<br /> Done parsing properties<br /> --------------------------------------------------------------------<br /> <br /> --------------------------------------------------------------------<br /> Checking properties<br /> --------------------------------------------------------------------<br /> ARGUMENT tablespaces<br /> ARGUMENT platformid<br /> ARGUMENT backupformat<br /> ARGUMENT stageondest<br /> ARGUMENT backupondest<br /> <br /> --------------------------------------------------------------------<br /> Done checking properties<br /> --------------------------------------------------------------------<br /> ORACLE_SID&nbsp; : tx9ab<br /> ORACLE_HOME : /space/sys_software/oracle/app/product/11.2.0/db_1<br /> <br /> --------------------------------------------------------------------<br /> Start rollforward<br /> --------------------------------------------------------------------<br /> convert instance: /space/sys_software/oracle/app/product/11.2.0/db_1 <br /> <br /> convert instance: tx9ab <br /> <br /> ORACLE instance started.<br /> <br /> Total System Global Area&nbsp; 217157632 bytes<br /> Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2251816 bytes<br /> Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 159384536 bytes<br /> Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 50331648 bytes<br /> Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5189632 bytes<br /> rdfno 6<br /> <br /> BEFORE ROLLPLAN<br /> <br /> datafile number : 6 &nbsp;<br /> <br /> datafile name&nbsp;&nbsp; : /space/oradata/tx9ab/test/TEST_6.xtf<br /> <br /> AFTER ROLLPLAN<br /> <br /> CONVERTED BACKUP<br /> PIECE/space/sys_software/oracle/xtts_dir/backup/xib_0gqhs56u_1_1_6<br /> <br /> PL/SQL procedure successfully completed.<br /> Entering RollForward<br /> After applySetDataFile<br /> Done: applyDataFileTo<br /> Done: applyDataFileTo<br /> Done: RestoreSetPiece<br /> Done: RestoreBackupPiece<br /> <br /> PL/SQL procedure successfully completed.<br /> <br /> --------------------------------------------------------------------<br /> End of rollforward phase<br /> --------------------------------------------------------------------<br /> <br /> <strong>Phase 4 - Transport Phase<br /> </strong><br /> -源端导出要迁移的表空间的Metadata<br /> exp \'/ as sysdba\' tablespaces=test transport_tablespace=y file=/space/sys_software/oracle/xtts_dir/backup/test_xtts.dmp<br /> <br /> 由于,我前面有且只做了一次增量数据的备份和前滚应用,这里在目标库直接导入表空间的Metadata就可以完成xtts(虽然我这里的环境是一样的<img src="http://blog.itpub.net/kindeditor/plugins/emoticons/images/20.gif" alt="" border="0" />)<br /> <br /> --在目标导入迁移的表空间的Metadata<br /> [oracle@tx9ab xtts_scripts]$ imp \'/ as sysdba\' tablespaces=test transport_tablespace=y file=/space/sys_software/oracle/scripts/xtts_scripts/test_xtts.dmp datafiles=/space/oradata/tx9ab/test/TEST_6.xtf<br /> <br /> Import: Release 11.2.0.4.0 - Production on Wed Sep 23 23:07:00 2015<br /> <br /> Copyright (c) 1982, 2011, Oracle and/or its affiliates.&nbsp; All rights reserved.<br /> <br /> Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production<br /> With the Partitioning, OLAP, Data Mining and Real Application Testing options<br /> <br /> Export file created by EXPORT:V11.02.00 via conventional path<br /> About to import transportable tablespace(s) metadata...<br /> import done in AL32UTF8 character set and AL16UTF16 NCHAR character set<br /> . importing SYS's objects into SYS<br /> . importing SYS's objects into SYS<br /> . importing TX9AB's objects into TX9AB<br /> . . importing table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "XTTSTEST"<br /> . importing SYS's objects into SYS<br /> Import terminated successfully without warnings.<br /> <br /> --查看源端、目标端的数据一致性<br /> [oracle@tx9ab dbs]$ sqlplus / as sysdba<br /> <br /> SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 23 23:07:38 2015<br /> <br /> Copyright (c) 1982, 2013, Oracle.&nbsp; All rights reserved.<br /> <br /> Connected to:<br /> Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production<br /> With the Partitioning, OLAP, Data Mining and Real Application Testing options<br /> <br /> SQL&gt; select * from tx9ab.XTTSTEST;<br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br /> ----------<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 200<br /> <br /> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; --End<br /> <br /> <br />

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

请登录后发表评论 登录
全部评论

注册时间:2018-10-10

  • 博文量
    546
  • 访问量
    26588