XTTS(Cross Platform Incremental Backup)的测试例子
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
对于数据库的跨平台迁移,大家所熟悉的方法有很多,例如传统的传输表空间技术(TTS),如果是10gR2+版本,字节序相同的话,那么还能进行rman convert database。甚至使用其他的第三方数据同步软件,例如GoldenGate,DSG,DDS,shareplex等等。
对于上述的技术,各有相互的优势,对于数据的逻辑迁移,后面的数据校对工作是比较麻烦的。
因此,对于数据迁移,我个人还是更倾向去使用物理迁移。convert database功能限制太多,必须要去源端和目标端字节序一致,如果是字节序不同,例如从AIX迁移至Linux(x86),那么只能通过TTS来操作。
对于传统的TTS,如果数据量较大的情况下,很难满足要求,为此Oracle提供了增强版的XTTS功能,可以进行增量操作,这可以最大程度的降低停机时间。这一功能之前Oracle仅仅针对exadata开发,后面对于非exadata环境也可以进行使用了。
对于XTTS的增量操作,Oracle提供了2种方式来进行,分别如下:
1)dbms_file_transfer
2)RMAN 备份
对于第一种方法,要求目标端数据库版本必须是11.2.0.4以及更新的版本。如果数据库版本低于11.2.0.4,
那么只能使用第2种方式。即使使用第2种方法,如果数据库版本低于11.2.0.4,那么目标端环境,仍然需要
安装11.2.0.4以及更新版本的临时环境。因为XTTS增量的核心脚本功能必须是基于11.2.0.4(+)版本。
如下是我的一个简单测试,是基于RMAN备份的方式,供参考!
1. 目标端安装11.2.0.4软件环境(如果不用ASM,那么不需要安装grid)
该步骤略.
2. 目标端准备convert Instance(以及修改相关的环境变量)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@cszwbdb1 11204]# su - ora1124 [ora1124@cszwbdb1 ~]$ export ORACLE_HOME=/oracle/app/ora1124/product/11.2.0/dbhome_1 [ora1124@cszwbdb1 ~]$ export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch [ora1124@cszwbdb1 ~]$ export ORACLE_SID=xtt [ora1124@cszwbdb1 ~]$ cat << EOF > $ORACLE_HOME/dbs/init$ORACLE_SID.ora > db_name=xtt > compatible=11.2.0.4.0 > EOF [ora1124@cszwbdb1 ~]$ [ora1124@cszwbdb1 ~]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 9 11:12:41 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 1177632768 bytes Fixed Size 2260848 bytes Variable Size 935329936 bytes Database Buffers 218103808 bytes Redo Buffers 21938176 bytes |
注意,只需要将辅助实例启动到nomount状态即可.
3. 源端解压rman convert脚本
1 2 3 4 5 6 7 8 9 10 |
$ unzip * Archive: rman_xttconvert_1.4.2.1.zip inflating: xttcnvrtbkupdest.sql inflating: xttdbopen.sql inflating: xttdriver.pl inflating: xttprep.tmpl inflating: xtt.properties inflating: xttstartupnomount.sql $ pwd /telephone_cdr/oracle11203/xtts |
4. 源端修改xtt.properties内容
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ cat xtt.properties tablespaces=TEST_TAB platformid=2 backupformat=/telephone_cdr/oracle11203/backup backupondest=/telephone_cdr/oracle11203/backup #srcdir=SOURCEDIR #dstdir=DESTDIR #srclink=ttslink dfcopydir=/telephone_cdr/oracle11203/dfcopydir stageondest=/ogg/11204/xtts storageondest=/ogg/11204/xtts/test cnvinst_home=/oracle/app/ora1124/product/11.2.0/dbhome_1 cnvinst_sid=xtts |
说明:
tablespaces:表示你需要传输的表空间名称
platformid: 表示源端平台编号,该值可以从v$transportable_platform获取
5. 源端运行perl脚本,准备Prepare操作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -p -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Starting prepare phase -------------------------------------------------------------------- Prepare source for Tablespaces: 'TEST_TAB' /ogg/11204/xtts xttpreparesrc.sql for 'TEST_TAB' started at Tue Feb 10 09:32:16 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:32:18 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:34:55 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:05 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:14 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:14 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:20 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:21 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:27 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:27 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:33 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:33 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:39 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:40 2015 Prepare source for Tablespaces: '' /ogg/11204/xtts xttpreparesrc.sql for '' started at Tue Feb 10 09:35:45 2015 xttpreparesrc.sql for ended at Tue Feb 10 09:35:46 2015 -------------------------------------------------------------------- Done with prepare phase -------------------------------------------------------------------- $ |
该操作执行完毕之后,会在xtts目录下产生几个文件,其中xttplan.txt文件中的内容如下:
1 2 3 |
$ cat xttplan.txt TEST_TAB::::1264229 5 |
该文件中的数值,数据库的SCN。如果后面再次运行脚本进行增量操作时,该值会发现改变。
1 2 3 4 5 6 7 8 |
$ cat rmanconvert.cmd host 'echo ts::TEST_TAB'; convert from platform 'AIX-Based Systems (64-bit)' datafile '/ogg/11204/xtts/TEST_TAB_5.tf' format '/ogg/11204/xtts/test/%N_%f.xtf' parallelism 8; $ |
上述脚本是perl脚本产生的rman convert脚本,需要将该脚本传递到目标端主机。注意,上述脚本文件格式需要注意,同时并行度是默认的,可以进行调整。
6. 将数据文件传输到目标端
这里你可以直接使用如下的方式进行scp:
scp oracle11@133.37.253.3:/telephone_cdr/oracle11203/dfcopydir/TEST_TAB_5.tf /ogg/11204/xtts
我这里直接进行ftp 传递,因为scp有问题,操作如下:
1 2 3 4 5 6 7 8 9 10 |
ftp> get TEST_TAB_5.tf local: TEST_TAB_5.tf remote: test_tab.dbf 227 Entering Passive Mode (133,37,253,3,131,207) 150 Opening data connection for test_tab.dbf (1073750016 bytes). 226 Transfer complete. 1073750016 bytes received in 155 secs (6948.62 Kbytes/sec) ftp> bye 421 Timeout (900 seconds): closing connection. [root@cszwbdb1 xtts]# pwd /ogg/11204/xtts |
7. 将源端的rman convert脚本传到目标端
这里在传递文件的时候,将源端的xtts目录下的所有文件都传递到目标端。如果直接在目标端解压
rmancovert程序,那么还需要修改相关的配置文件,以及将源端的xttplan.txt等传过来。
我这里省略了传递其他文件的步骤:
1 2 3 4 5 6 7 8 9 10 |
ftp> cd /telephone_cdr/oracle11203/xtts 250 CWD command successful. ftp> get rmanconvert.cmd local: rmanconvert.cmd remote: rmanconvert.cmd 227 Entering Passive Mode (133,37,253,3,137,129) 150 Opening data connection for rmanconvert.cmd (189 bytes). 226 Transfer complete. 189 bytes received in 0.00881 secs (21.46 Kbytes/sec) ftp> bye 221 Goodbye. |
8. 目标端进行数据文件的转换
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[ora1124@cszwbdb1 xtts]$ perl xttdriver.pl -c -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Performing convert -------------------------------------------------------------------- -------------------------------------------------------------------- Converted datafiles listed in: /ogg/11204/xtts/xttnewdatafiles.txt -------------------------------------------------------------------- |
转换之后,如下:
[ora1124@cszwbdb1 xtts]$ cd test/
[ora1124@cszwbdb1 test]$ ls -ltr
total 1048588
-rw-r—– 1 ora1124 dba 1073750016 Feb 10 10:19 TEST_TAB_5.xtf
[ora1124@cszwbdb1 test]$
9. 创建增量数据(源端数据库)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
SQL> conn /as sysdba Connected. SQL> create user roger identified by roger default tablespace test_tab; User created. SQL> grant connect,resource to roger; Grant succeeded. SQL> conn roger/roger Connected. SQL> create table killdb(a number); Table created. SQL> insert into killdb values(100); 1 row created. SQL> commit; Commit complete. SQL> select * from killdb; A ---------- 100 |
10. 源端数据库创建增量备份
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
$ pwd /telephone_cdr/oracle11203/xtts $ $ORACLE_HOME/perl/bin/perl xttdriver.pl -i -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Backup incremental -------------------------------------------------------------------- Prepare newscn for Tablespaces: 'TEST_TAB' 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 /telephone_cdr/oracle11203/xtts/rmanincr.cmd Recovery Manager: Release 11.2.0.3.0 - Production on Tue Feb 10 10:28:00 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TEST (DBID=2169100805) RMAN> set nocfau; 2> host 'echo ts::TEST_TAB'; 3> backup incremental from scn 1264229 4> tag tts_incr_update tablespace 'TEST_TAB' format 5> '/telephone_cdr/oracle11203/backup/%U'; 6> executing command: SET NOCFAU using target database control file instead of recovery catalog ts::TEST_TAB host command complete Starting backup at 10-FEB-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=4 device type=DISK backup will be obsolete on date 17-FEB-15 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=00005 name=/telephone_cdr/oracle11203/oracle/oradata/test/test_tab.dbf channel ORA_DISK_1: starting piece 1 at 10-FEB-15 channel ORA_DISK_1: finished piece 1 at 10-FEB-15 piece handle=/telephone_cdr/oracle11203/backup/0hputq9s_1_1 tag=TTS_INCR_UPDATE comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 using channel ORA_DISK_1 backup will be obsolete on date 17-FEB-15 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 10-FEB-15 channel ORA_DISK_1: finished piece 1 at 10-FEB-15 piece handle=/telephone_cdr/oracle11203/backup/0iputqac_1_1 tag=TTS_INCR_UPDATE comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 10-FEB-15 Recovery Manager complete. -------------------------------------------------------------------- Done backing up incrementals -------------------------------------------------------------------- |
上述步骤的增量备份信息,会写入到如下txt文件中。
1 2 |
$ cat incrbackups.txt /telephone_cdr/oracle11203/backup/0hputq9s_1_1 |
11. 将增量备份信息传到目标端
将$/telephone_cdr/oracle11203/backup/0hputq9s_1_1 传到目标端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
ftp> cd /telephone_cdr/oracle11203/backup 250 CWD command successful. ftp> get 0hputq9s_1_1 local: 0hputq9s_1_1 remote: 0hputq9s_1_1 227 Entering Passive Mode (133,37,253,3,145,111) 150 Opening data connection for 0hputq9s_1_1 (122880 bytes). 226 Transfer complete. 122880 bytes received in 0.0147 secs (8334.24 Kbytes/sec) ftp> cd /telephone_cdr/oracle11203/xtts 250 CWD command successful. ftp> get tsbkupmap.txt local: tsbkupmap.txt remote: tsbkupmap.txt 227 Entering Passive Mode (133,37,253,3,145,183) 150 Opening data connection for tsbkupmap.txt (29 bytes). 226 Transfer complete. 29 bytes received in 2.9e-05 secs (1000.00 Kbytes/sec) ftp> get xttplan.txt local: xttplan.txt remote: xttplan.txt 227 Entering Passive Mode (133,37,253,3,145,200) 150 Opening data connection for xttplan.txt (22 bytes). 226 Transfer complete. 22 bytes received in 0.000117 secs (188.03 Kbytes/sec) |
注意:这里传递增量数据信息的时候,还需要将源端xtts目录下的xttplan.txt,以及tsbkupmap.txt
文件都传输到目标端。每当你进行一次增量的备份操作,这2个文件的内容都会发现变化。每一次增量操作之后,都需要将这2个文件传到目标端数据库的xtts目录中。
对于一个比较大量的系统来讲,上述的增量操作,我们可以进行多次。假设我们进行了多次操作之后,在停机时间的时候,再将源端数据库中需要传输的表空间设置为只读模式,如下:
12. 源端数据库最后一次增量操作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 10 12:05:17 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter tablespace test_tab read only; Tablespace altered. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options $ pwd /telephone_cdr/oracle11203/xtts $ $ORACLE_HOME/perl/bin/perl xttdriver.pl -i -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- -------------------------------------------------------------------- Backup incremental -------------------------------------------------------------------- Prepare newscn for Tablespaces: 'TEST_TAB' 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 /telephone_cdr/oracle11203/xtts/rmanincr.cmd Recovery Manager: Release 11.2.0.3.0 - Production on Tue Feb 10 12:05:48 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TEST (DBID=2169100805) RMAN> set nocfau; 2> host 'echo ts::TEST_TAB'; 3> backup incremental from scn 1264229 4> tag tts_incr_update tablespace 'TEST_TAB' format 5> '/telephone_cdr/oracle11203/backup/%U'; 6> executing command: SET NOCFAU using target database control file instead of recovery catalog ts::TEST_TAB host command complete Starting backup at 10-FEB-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=50 device type=DISK backup will be obsolete on date 17-FEB-15 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=00005 name=/telephone_cdr/oracle11203/oracle/oradata/test/test_tab.dbf channel ORA_DISK_1: starting piece 1 at 10-FEB-15 channel ORA_DISK_1: finished piece 1 at 10-FEB-15 piece handle=/telephone_cdr/oracle11203/backup/0jpuu017_1_1 tag=TTS_INCR_UPDATE comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 using channel ORA_DISK_1 backup will be obsolete on date 17-FEB-15 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 10-FEB-15 channel ORA_DISK_1: finished piece 1 at 10-FEB-15 piece handle=/telephone_cdr/oracle11203/backup/0kpuu01e_1_1 tag=TTS_INCR_UPDATE comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 10-FEB-15 Recovery Manager complete. -------------------------------------------------------------------- Done backing up incrementals -------------------------------------------------------------------- |
13. 目标端进行增量转换和数据写入同步
在测试的过程中,发现了不少的问题,需要进行排除,最后发现该脚本本身提供了debug功能,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
[ora1124@cszwbdb1 xtts]$ export XTTDEBUG=1 (打开debug功能) [ora1124@cszwbdb1 xtts]$ perl xttdriver.pl -r -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: backupondest Values: /ogg/11204/xtts Key: platformid Values: 2 Key: backupformat Values: /ogg/11204/xtts Key: storageondest Values: /ogg/11204/xtts Key: dfcopydir Values: /telephone_cdr/oracle11203/dfcopydir Key: cnvinst_home Values: /oracle/app/ora1124/product/11.2.0/dbhome_1 Key: cnvinst_sid Values: xtt Key: stageondest Values: /ogg/11204/xtts Key: tablespaces Values: TEST_TAB -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest ARGUMENT backupondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : xtt ORACLE_HOME : /oracle/app/ora1124/product/11.2.0/dbhome_1 -------------------------------------------------------------------- Start rollforward -------------------------------------------------------------------- convert instance: /oracle/app/ora1124/product/11.2.0/dbhome_1 convert instance: xtt ORACLE instance started. Total System Global Area 1177632768 bytes Fixed Size 2260848 bytes Variable Size 935329936 bytes Database Buffers 218103808 bytes Redo Buffers 21938176 bytes rdfno 5 BEFORE ROLLPLAN datafile number : 5 datafile name : /ogg/11204/xtts/test/TEST_TAB_5.xtf AFTER ROLLPLAN CONVERTED BACKUP PIECE/ogg/11204/xtts/xib_0jpuu017_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. alter database mount * ERROR at line 1: ORA-00205: error in identifying control file, check alert log for more info alter database open * ERROR at line 1: ORA-01507: database not mounted !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Error: ------ Error in executing xttdbopen.sql !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
说明:我们可以看到关键性的操作已经关闭,之所以后面会报ORA-00205错误,是因为我们的用于
转换的临时辅助实例XTT是nomount状态,是没有控制文件的,因此这个错误直接忽略之.
14. 最后将表空间相关的元数据插入到目标端数据库
该perl脚本本身提供了产生脚本的功能,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
[ora1124@cszwbdb1 xtts]$ perl xttdriver.pl -e -------------------------------------------------------------------- Parsing properties -------------------------------------------------------------------- Key: backupondest Values: /ogg/11204/xtts Key: platformid Values: 2 Key: backupformat Values: /ogg/11204/xtts Key: storageondest Values: /ogg/11204/xtts Key: dfcopydir Values: /telephone_cdr/oracle11203/dfcopydir Key: cnvinst_home Values: /oracle/app/ora1124/product/11.2.0/dbhome_1 Key: cnvinst_sid Values: xtt Key: stageondest Values: /ogg/11204/xtts Key: tablespaces Values: TEST_TAB -------------------------------------------------------------------- Done parsing properties -------------------------------------------------------------------- -------------------------------------------------------------------- Checking properties -------------------------------------------------------------------- ARGUMENT tablespaces ARGUMENT platformid ARGUMENT backupformat ARGUMENT stageondest ARGUMENT backupondest -------------------------------------------------------------------- Done checking properties -------------------------------------------------------------------- ORACLE_SID : xtt ORACLE_HOME : /oracle/app/ora1124/product/11.2.0/dbhome_1 -------------------------------------------------------------------- Generating plugin -------------------------------------------------------------------- -------------------------------------------------------------------- Done generating plugin file /ogg/11204/xtts/xttplugin.txt -------------------------------------------------------------------- [ora1124@cszwbdb1 xtts]$ cat /ogg/11204/xtts/xttplugin.txt impdp directory=<DATA_PUMP_DIR> logfile=<tts_imp.log> \ network_link=<ttslink> transport_full_check=no \ transport_tablespaces=TEST_TAB \ transport_datafiles='/ogg/11204/xtts/test/TEST_TAB_5.xtf' |
产生的脚本内容在/ogg/11204/xtts/xttplugin.txt文件中,我们创建相关的directory和network_link即可。
不过我这里创建link后,impdp有问题,因此我直接通过exp/imp 元数据的方式来进行了,如下:
15. 源端数据库,导致元数据
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$ exp \'/ as sysdba\' tablespaces=test_tab transport_tablespace=y file=/telephone_cdr/oracle11203/dfcopydir/test_xtts.dmp Export: Release 11.2.0.3.0 - Production on Tue Feb 10 17:26:52 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Export done in US7ASCII character set and AL16UTF16 NCHAR character set server uses ZHS16GBK character set (possible charset conversion) Note: table data (rows) will not be exported About to export transportable tablespace metadata... For tablespace TEST_TAB ... . exporting cluster definitions . exporting table definitions . . exporting table T1 EXP-00091: Exporting questionable statistics. EXP-00091: Exporting questionable statistics. . . exporting table KILLDB . exporting referential integrity constraints . exporting triggers . end transportable tablespace metadata export Export terminated successfully with warnings. $ |
16. 目标端数据库导入元数据
1)首先创建相关的用户信息(其中roger用户是我的增量操作中创建的测试用户)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[oracle@cszwbdb1 ~]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 10 17:36:48 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> create user test identified by test ; User created. SQL> grant connect,resource to test; Grant succeeded. SQL> create user roger identified by roger; User created. SQL> grant connect,resource to roger; Grant succeeded. SQL> ! |
2) 导入元数据
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[oracle@cszwbdb1 ~]$ imp \'/ as sysdba\' tablespaces=test_tab transport_tablespace=y file=/ogg/11204/xtts/test_xtts.dmp datafiles=/ogg/11204/xtts/test/TEST_TAB_5.xtf Import: Release 11.2.0.3.0 - Production on Tue Feb 10 17:37:35 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options Export file created by EXPORT:V11.02.00 via conventional path About to import transportable tablespace(s) metadata... import done in ZHS16GBK character set and AL16UTF16 NCHAR character set export client uses US7ASCII character set (possible charset conversion) . importing SYS's objects into SYS . importing SYS's objects into SYS . importing TEST's objects into TEST . . importing table "T1" . importing ROGER's objects into ROGER . . importing table "KILLDB" . importing SYS's objects into SYS Import terminated successfully without warnings. [oracle@cszwbdb1 ~]$ exit exit |
17. 验证数据是否OK
1 2 3 4 5 6 7 8 9 10 11 12 |
SQL> select * from roger.killdb; A ---------- 100 SQL> SQL> select name,status,bytes from v$datafile where name like '/ogg%'; NAME STATUS BYTES ---------------------------------------------------------------------- ------- ---------- /ogg/11204/xtts/test/TEST_TAB_5.xtf ONLINE 1073741824 |
我们可以看到,最后我们的增量操作的数据,已经可以查询到了.
备注:在最近的一个运营商项目中,客户的2套10TB的RAC,我计划使用该方法来进行迁移(AIX–>Linux)。
4 Responses to “XTTS(Cross Platform Incremental Backup)的测试例子”
rman_xttconvert_1.4.2.1.zip 从哪里来?
详见MOS [1389592.1] Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup
I have followed your steps. but I got error at step 16 during imp, the error is ” ORA-19722: datafile /u0/exports/test/oradata/TTB5_18.xtf is an incorrect version’. I have already put the source tablespace in the read only. Can you help?
I need more detail,you can send message to my email,oracledba@live.cn.
Leave a Reply
You must be logged in to post a comment.