Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 12C xtts and dbms_file_transfer

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Initialization setup phase

1.1 install the target database software and create the target database

Install the target Oracle database software on the target system, the version should be Oracle12c, the operating system is Linux, I have 12.2.0.1 here. A tablespace jy is created in the source database to be transferred to the target database, the user schema jy, the source database version is 12.2.0.1, and the operating system is Linux.

1.2 identify the tablespace to be transferred

The tablespace to be transferred in the source database is jy, and the user schema jy.

1.3 install xttconvert scripts on the source system

[oracle@jytest3 xtts_script] $unzip rman_xttconvert_v3.zipArchive: rman_xttconvert_v3.zip inflating: xtt.properties inflating: xttcnvrtbkupdest.sql inflating: xttdbopen.sql inflating: xttdriver.pl inflating: xttstartupnomount.sql [oracle@jytest1 backup] $vi $ORACLE_HOME/dbs/initxtt.oradb_name=xttcompatible= 12.2.0.0.0 [oracle @ jytest1 backup] $export ORACLE_SID= xtt[ orac le@jytest1 backup] $sqlplus / as sysdbaSQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 22 18:25:46 2017Copyright (c) 1982 2016, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit ProductionSQL > startup nomountORACLE instance started.Total System Global Area 444596224 bytesFixed Size 8621520 bytesVariable Size 377487920 bytesDatabase Buffers 50331648 bytesRedo Buffers 8155136 bytes

1.4 create directories that need to be used

If you use the dbms_file_transfer method, configure the directory object and dblink, note that the dbms_file_transfer method requires the target database to be version 11.2.0.4, and if you use dbms_file_transfer access, you must create the following three database objects:

. Create a database directory object in the source database that points to the directory where the data file to be copied is stored

. Create a database directory object in the target database that points to the directory where the data files will be stored

. Create a dblink connection to the source database in the target database

The source database directory object refers to the directory where the data files are currently stored in the source database. For example, the following creates a directory object to point to, and the data file storage directory + DATA/ORCL/DATAFILE/, connects to the source data warehouse to execute the following command:

[oracle@jytest3] $export ORACLE_SID= oracle @ jytest3] $sqlplus / as sysdbaSQL*Plus: Release 12.2.0.1.0 Production on Mon Aug 21 19:57:36 2017Copyright (c) 1982, 2016, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit ProductionSQL > 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.952394755SQL > create directory sourcedir as'+ DATA/ORCL/DATAFILE' Directory created.

The target database directory object references the directory in the target database where the data files will be stored. This directory is the directory where the final target database will store the data files. + DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/, connects to the target database to execute the following command. Note that the directory object and dblink are created in CDB.

[oracle@jytest1] $sqlplus / nologSQL*Plus: Release 12.2.0.1.0 Production on Mon Aug 21 16:24:46 2017Copyright (c) 1982, 2016, Oracle. All rights reserved.SQL > conn sys/abcd@jy as sysdbaConnected.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.dbfNAME -+ DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/orders_test_01.dbf12 rows selected.SQL > create directory destdir as'+ DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile' Directory created.

Create a dblink connection to the source database in the target database. For example, create a dblink named ttslink and execute the following command:

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

Create a directory / ora_xtts/backupformat on the source system to store backup and incremental backup files for the source database generated on the source system, which is set by the backupformat parameter in the xtt.properties file.

[oracle@jytest3 ora_xtts] $mkdir backupformat

Create a directory / tts/backup on the target system to store backup and incremental backup files transferred manually from the source system, which is set by the stageondest parameter in the xtt.properties file.

[oracle@jytest1 tts] $mkdir backup

The storageondest parameter in the xtt.properties file sets the directory where the target database will eventually store the data files, here is the

+ DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/ directory.

1.5 configure xtt.properties files on the source system

SQL > select platform_id from vault database and Platf database ID-13 [oracle@jytest3 xtts_script] $vi xtt.propertiestablespaces=JYplatformid=13srcdir=SOURCEDIRdstdir=DESTDIRsrclink=ttslinkstorageondest=+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/backupformat=/ora_xtts/backupformatstageondest=/tts/xttsbackupondest=/tts/backupasm_home=/u01/app/product/12.2.0/crsasm_sid=+ASM1parallel=4cnvinst_home=/u01/app/oracle/product/12.2.0/dbcnvinst_sid=xtt

Copy xttconvert scripts and xtt.properties files from the source system to the target system

Replicate as an Oracle software user on the source system

[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)? YesWarning: 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:00xttcnvrtbkupdest.sql 1390 1.4KB/s 00:00xttdbopen.sql 71 0.1KB/s 00:00xttdriver.pl 100% 136KB 136.1KB/s 00:00xttprep.tmpl 100% 11KB 11.4KB/s 00:00xttstartupnomount.sql 100% 52 0.1KB/s 00:00xtt.properties.jy 100% 7969 7.8KB/s 00:00xtt.properties 100% 217 0.2KB/s 00:00 [oracle@jytest1 tts] $cd xtts_ script [oracle @ jytest1 xtts_script] $ls-lrttotal 212 Mustang RW Mustang r Mustang-1 oracle oinstall 33949 Aug 18 23:35 rman_xttconvert_v3.zip-rw- Rmuri 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 set the environment variable TMPDIR

Set the environment variable TMPDIR on the source and target systems. Files generated by executing the Perl script xttdriver.pl using shell are stored in the $TMPDIR directory, and if the TMPDIR environment variable is not set, the generated files are stored in the / tmp directory.

Source system

[oracle@jytest3 ora_xtts] $export TMPDIR=/ora_xtts/xtts_script

Target system

[oracle@jytest1 tts] $export TMPDIR=/tts/xtts_script

two。 Preparation stage

In the preparation phase, the tablespace to be transferred generates a backup on the source system, then transfers the backup to the target system, and restores the backup by executing the xttdriver.pl script. Note that for a large number of data files to be transferred, using dbms_file_transfer (refer to the preparation phase in document 1389592.1) is much faster than manually transferring backup files to the target system. This method is also applicable to Oracle 12 c-Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 1389592.1).

2.1 generate a backup of the tablespace to be transferred in the source system

On the source system, log in as an oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the source database, and execute the following command to generate a backup

[oracle@jytest3 xtts_script] $export ORACLE_HOME=/u01/app/oracle/product/12.2.0/ DB [oracle @ jytest3 xtts_script] $export ORACLE_SID= oracle [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/xttsxttpreparesrc.sql for' JY' started at Mon Aug 21 20:33:36 2017xttpreparesrc.sql for Ended at Mon Aug 21 20:33:36 2017Prepare source for Tablespaces:''/ tts/xttsxttpreparesrc.sql for 'started at Mon Aug 21 20:33:36 2017xttpreparesrc.sql for ended at Mon Aug 21 20:33:36 2017 Murray- -Done with prepare phase---- [oracle@jytest3 xtts_script] $cat xttnewdatafiles.txt::JY5 DESTDIR:/jy.371.952394755 [oracle@jytest3 xtts_script] $cat getfile.sql0,SOURCEDIR,jy.371.952394755,DESTDIR,jy_371_952394755

The set of tablespaces to be transferred must be in online,read write state and contain no offline data files. An error is triggered if one or more data files of the tablespace being transferred in the source database are offline or read only. If the tablespace remains read only throughout the tablespace transfer, use the traditional cross-platform transport tablespace instead of using cross-platform incremental backup to transport the tablespace.

2.2 transfer data files to the target system

On the target system, use the Oracle software user to log in and set the relevant environment variables (ORACLE_HOME and ORACLE_SID) to point to the target database, and copy the xttnewdatafiles.txt and getfile.sql files generated in the previous step to the target system and perform actions to get the data file

[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-lrttotal 220Meli RWMULY RLV-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- -oracle oinstall-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 _ homeValues: / u01/app/oracle/product/12.2.0/dbKey: backupondestValues: / tts/backupKey: backupformatValues: / ora_xtts/backupformatKey: cnvinst_sidValues: jy1Key: asm_sidValues: + ASM1Key: stageondestValues: / tts/xttsKey: srclinkValues: ttslinkKey: parallelValues: 4Key: tablespacesValues: JYKey: platformidValues: 13Key: asm_homeValues: / u01/app/product/12.2.0/crsKey: dstdirValues: DESTDIRKey: srcdirValues: SOURCEDIRKey: storageondestValues: + DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/- -Done parsing properties -Checking properties-- -- ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondestARGUMENT srcdirARGUMENT dstdirARGUMENT srclink----Done checking properties- -ORACLE_SID: jy1ORACLE_HOME: / u01ActionUniplicationApplicationoracleUniplicationproductUniverse 12.2.0ActionUniplicationdbMayer- -- Getting datafiles from source----fetchCheckDirObjectsDST: Check dir pathfetchDirEntry: 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. Roll forward phase

Let's create incremental data in the source database

SQL > select * from jy.jy_test; USER_ID- 1 2 3SQL > 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

At this stage, an incremental backup of the source database is created in the source system, the incremental backup files are transferred to the destination system and converted to the byte order used by the target system, and then the converted incremental backup is applied to the data file. Operations at this stage can be performed multiple times. Each successful incremental backup takes less time than the previous one, which uses the contents of the data files in the target database to be closer to the contents of the source database. The data transferred during this phase of the operation is fully accessible.

3.1 create an incremental backup of the transferred tablespace LDJC,CDZJ in the source system

"on the source system, point to the source database as an Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID), and execute the following command to create an incremental backup:"

[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: srclinkValues: ttslinkKey: cnvinst_homeValues: / u01/app/oracle/product/12.2.0/dbKey: platformidValues: 13Key: storageondestValues: + DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3 / datafile/Key: asm_sidValues: + ASM1Key: dstdirValues: DESTDIRKey: backupondestValues: / tts/backupKey: srcdirValues: SOURCEDIRKey: cnvinst_sidValues: jy1Key: tablespacesValues: JYKey: asm_homeValues: / u01/app/product/12.2.0/crsKey: backupformatValues: / ora_xtts/backupformatKey: parallelValues: 4Key: stageondestValues: / tts/xtts-- -- Done parsing properties- -Checking properties----ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondest -Done checking properties -ORACLE_SID: orclORACLE_HOME: / u01/app/oracle/product/12.2.0/db----Backup incremental- -fetchCheckDirObjectsSRC: Check dir pathfetchDirEntry: remotelink not presentTABLESPACE STRING: 'JY'Prepare source for Tablespaces:' JY' / tts/xttsxttpreparesrc.sql for 'JY' started at Tue Aug 22 21:19:39 2017xttpreparesrc.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:5verifySrcdirDatafiles: EnteredTABLESPACE STRING:''Prepare source for Tablespaces:' / tts/xttsxttpreparesrc.sql for''started at Tue Aug 22 21:19:39 2017xttpreparesrc.sql for ended at Tue Aug 22 21:19:40 2017verifySrcdirDatafiles: EnteredJY: + DATA/ORCL/DATAFILE/jy.371.952394755===No new datafiles added===TABLESPACE STRING:' JY'Prepare newscn for Tablespaces: 'JY'JY::::62924193 5TABLESPACE STRING:' Prepare Newscn for Tablespaces:'- Starting incremental backup-- -/ ora_xtts/xtts_script/incremental_Aug22_Tue_21_19_39_709//rmanincr.cmdRecovery Manager: Release 12.2.0.1.0-Production on Tue Aug22 21:19:40 2017Copyright (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 629241934 > tag tts_incr_update tablespace' JY' format5 >'/ ora_xtts/backupformat/%U' 6 > RMAN-03023: executing command: SET NOCFAURMAN-06009: using target database control file instead of recovery catalogts::JYRMAN-06134: host command completeRMAN-03090: Starting backup at 22-AUG-17RMAN-08030: allocated channel: ORA_DISK_1RMAN-08500: channel ORA_DISK_1: SID=43 device type=DISKRMAN-08008: channel ORA_DISK_1: starting full datafile backup setRMAN-08010: channel ORA_DISK_1: specifying datafile (s) in backup setRMAN-08522: input datafile file number=00005 name=+DATA/ORCL/DATAFILE/jy.371.952394755RMAN-08038: channel ORA_DISK_1: starting piece 1 at 22-AUG-17RMAN-08044: channel ORA_DISK_1: finished piece 1 at 22-AUG-17RMAN-08530: piece handle=/ora_xtts/backupformat/2dscipng_1_1 tag=TTS_INCR_UPDATE comment=NONERMAN-08540: channel ORA_DISK_1: backup set complete Elapsed time: 00:00:01RMAN-03091: Finished backup at 22-AUG-17Recovery Manager complete.----Done backing up incrementals-- -

The above operation executes the RMAN command to generate an incremental backup file for all tablespaces specified in the xtt.properties file. The following files will also be created for later operations:

.tsbkupmap.txt

.incrbackups.txt

The tsbkupmap.txt is as follows:

[oracle@jytest3 xtts_script] $cat tsbkupmap.txtJY::5:::1=2dscipng_1_1

The contents of the file record the relationship between tablespaces and incremental backups

The incrbackups.txt is as follows:

[oracle@jytest3 xtts_script] $cat incrbackups.txt/ora_xtts/backupformat/2dscipng_1_1

The contents of the file show the information of the generated incremental backup file

[oracle@jytest3 backupformat] $ls-lrttotal 56 RW Murray. 1 oracle asmadmin 57344 Aug 22 21:19 2dscipng_1_1

3.2 transfer incremental backups to the target system

Transfer the incremental backup generated in the previous step to the stageondest directory (/ oracle11/xtts) in the xtt.properties file on the target system.

[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 convert incremental backups in the target system and apply to a copy of the data file

On the target system, log in to the Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the target database, and transfer the xttplan.txt and tsbkupmap.txt files generated in the previous step from the source system.

[oracle@jytest3 xtts_script] $scp / ora_xtts/xtts_script/xttplan.txt oracle@10.138.130.171:/tts/xtts_scriptoracle@10.138.130.171's password:xttplan.txt 17 0.0KB/s 00:00 [oracle@jytest3 xtts_script] $scp / ora_xtts/xtts_script/tsbkupmap.txt oracle@10.138.130.171:/tts/xtts_scriptoracle@10.138.130.171's password:tsbkupmap.txt 23 0.0KB/s 00:00 [oracle@jytest3 xtts_script] $scp / ora_xtts/xtts_script/incrbackups.txt oracle@10.138.130.171:/tts/ Xtts_scriptoracle@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: backupformatValues: / ora_xtts/backupformatKey: srclinkValues: ttslinkKey: tablespacesValues: JYKey: parallelValues: 4Key: asm_homeValues: / u01/app/product / 12.2.0/crsKey: cnvinst_sidValues: xttKey: platformidValues: 13Key: stageondestValues: / tts/xttsKey: cnvinst_homeValues: / u01/app/oracle/product/12.2.0/dbKey: asm_sidValues: + ASM1Key: dstdirValues: DESTDIRKey: backupondestValues: / tts/backupKey: srcdirValues: SOURCEDIR -Done parsing properties- -- Checking properties----ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondestARGUMENT backupondest- -Done checking properties -ORACLE_SID: jy1ORACLE_HOME: / u01/app/oracle/product/12.2.0/db----Start rollforward- -convert instance: / u01/app/oracle/product/12.2.0/dbconvert instance: xttORACLE instance started.Total System Global Area 6442450944 bytesFixed Size 8807168 bytesVariable Size 3909094656 bytesDatabase Buffers 1442840576 bytesRedo Buffers 7966720 bytesIn-Memory Area 1073741824 bytesrdfno 5BEFORE ROLLPLANdatafile number: 5datafile name: + DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755AFTER ROLLPLANCONVERTED BACKUP PIECE/tts/backup/xib_2dscipng_1_1_5PL/SQL procedure successfully completed.Entering RollForwardAfter applySetDataFileDone: applyDataFileToDone: applyDataFileToDone: RestoreSetPieceDone: RestoreBackupPiecePL/SQL procedure successfully completed.asmcmd rm / tts/backup/xib_2dscipng_1_1_5 / u01/app/product/12.2.0/crs.. + ASM1Connected to an idle instance.ASMCMD-8102: no connection to Oracle ASM Command requires Oracle ASM to runASMCMD:----End of rollforward phase-- -

This step of rolling forward the data file will connect the sys user to the incremental conversion instance, convert the incremental backup, then connect to the target database and apply the incremental backup to each tablespace Note: for each incremental backup, you need to copy the xttplan.txt and tsbkupmap.txt files once, and do not modify, copy, or make any other changes to the xttplan.txt.new files generated by the script. When performing this step, the target instance will restart.

3.4 determine the from_scn for the next incremental backup

Generate incremental data again

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

On the source system, use the Oracle software user to log in and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the source database, and execute the following command to determine 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: backupformatValues: / ora_xtts/backupformatKey: cnvinst_homeValues: / u01/app/oracle/product/12.2.0/dbKey: tablespacesValues: JYKey: platformidValues : 13Key: stageondestValues: / tts/xttsKey: backupondestValues: / tts/backupKey: parallelValues: 4Key: asm_homeValues: / u01/app/product/12.2.0/crsKey: srcdirValues: SOURCEDIRKey: dstdirValues: DESTDIRKey: asm_sidValues: + ASM1Key: cnvinst_sidValues: xttKey: srclinkValues: ttslink -Done parsing properties- -- Checking properties----ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondest- -Done checking properties -ORACLE_SID: orclORACLE_HOME: / u01/app/oracle/product/12.2.0/dbTABLESPACE STRING: 'JY'Prepare newscn for Tablespaces:' JY'TABLESPACE STRING:''Prepare newscn for Tablespaces:' 'New / ora_xtts/xtts_script/xttplan.txt with FROM SCN's generatedNew / ora_xtts/xtts_script/xttplan.txt with FROM SCN's generated [oracle@jytest3 xtts_script] $cat xttplan.txt JY::::62924193 5

4. Transmission stage

When performing the transfer phase operation, the transmitted tablespace in the source database is set to the read only state, and the data files in the target database are consistent with the data file contents in the source database by creating and applying the last incremental backup. After the content of the target database data file is consistent with that of the source database data file, perform normal transport tablespace operations in the source system to export the metadata, and then import the metadata into the target database. Until the transfer phase operation is completed, the transmitted data can only be accessed in read only mode.

4.1 set the transmitted tablespace in the source database to read only state

On the source system, log in as the Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the source database and execute the following command to set the tablespace to read only:

SQL > alter tablespace jy read only;Tablespace altered.

4.2 create an incremental backup for the last time, transfer it to the target system and perform the conversion and apply it to the target data file

"on the source system, point to the source database as an Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID), and execute the following command to create an incremental backup:"

[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: parallelValues: 4Key: backupformatValues: / ora_xtts/backupformatKey: asm_homeValues: / u01/app/product/12.2.0/crsKey: platformidValues: 13Key : tablespacesValues: JYKey: cnvinst_homeValues: / u01/app/oracle/product/12.2.0/dbKey: stageondestValues: / tts/xttsKey: srclinkValues: ttslinkKey: srcdirValues: SOURCEDIRKey: backupondestValues: / tts/backupKey: dstdirValues: DESTDIRKey: asm_sidValues: + ASM1Key: cnvinst_sidValues: xtt -Done parsing properties- -- Checking properties----ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondest- -Done checking properties -ORACLE_SID: orclORACLE_HOME: / u01/app/oracle/product/12.2.0/db----Backup incremental- -fetchCheckDirObjectsSRC: Check dir pathfetchDirEntry: remotelink not presentTABLESPACE STRING: 'JY'Prepare source for Tablespaces:' JY' / tts/xttsxttpreparesrc.sql for 'JY' started at Tue Aug 22 21:57:21 2017xttpreparesrc.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:5verifySrcdirDatafiles: EnteredTABLESPACE STRING:''Prepare source for Tablespaces:' / tts/xttsxttpreparesrc.sql for''started at Tue Aug 22 21:57:21 2017xttpreparesrc.sql for ended at Tue Aug 22 21:57:21 2017verifySrcdirDatafiles: EnteredJY: + DATA/ORCL/DATAFILE/jy.371.952394755===No new datafiles added===TABLESPACE STRING:' JY'Prepare newscn for Tablespaces: 'JY'JY::::62928997 5TABLESPACE STRING:' Prepare Newscn for Tablespaces:'- Starting incremental backup-- -/ ora_xtts/xtts_script/incremental_Aug22_Tue_21_57_21_478//rmanincr.cmdRecovery Manager: Release 12.2.0.1.0-Production on Tue Aug22 21:57:21 2017Copyright (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 629241934 > tag tts_incr_update tablespace' JY' format5 >'/ ora_xtts/backupformat/%U' 6 > RMAN-03023: executing command: SET NOCFAURMAN-06009: using target database control file instead of recovery catalogts::JYRMAN-06134: host command completeRMAN-03090: Starting backup at 22-AUG-17RMAN-08030: allocated channel: ORA_DISK_1RMAN-08500: channel ORA_DISK_1: SID=43 device type=DISKRMAN-08008: channel ORA_DISK_1: starting full datafile backup setRMAN-08010: channel ORA_DISK_1: specifying datafile (s) in backup setRMAN-08522: input datafile file number=00005 name=+DATA/ORCL/DATAFILE/jy.371.952394755RMAN-08038: channel ORA_DISK_1: starting piece 1 at 22-AUG-17RMAN-08044: channel ORA_DISK_1: finished piece 1 at 22-AUG-17RMAN-08530: piece handle=/ora_xtts/backupformat/2esciru5_1_1 tag=TTS_INCR_UPDATE comment=NONERMAN-08540: channel ORA_DISK_1: backup set complete Elapsed time: 00:00:01RMAN-03091: Finished backup at 22-AUG-17Recovery Manager complete.----Done backing up incrementals-- -

The above operation executes the RMAN command to generate an incremental backup file for all tablespaces specified in the xtt.properties file. The following files will also be created for later operations:

.tsbkupmap.txt

.incrbackups.txt

The tsbkupmap.txt is as follows:

[oracle@jytest3 xtts_script] $cat tsbkupmap.txtJY::5:::1=2esciru5_1_1

The contents of the file record the relationship between tablespaces and incremental backups

The incrbackups.txt is as follows:

[oracle@jytest3 xtts_script] $cat incrbackups.txt/ora_xtts/backupformat/2esciru5_1_1

The contents of the file show the information of the generated incremental backup file

[oracle@jytest3 backupformat] $ls-lrttotal 112 Murray RW Murray. 1 oracle asmadmin 57344 Aug 22 21:19 2dscipngrub 1mi RW Murray. 1 oracle asmadmin 57344 Aug 22 21:57 2esciru5_1_1

Transfer incremental backups to the target system

Transfer the incremental backup generated in the previous step to the stageondest directory (/ oracle11/xtts) in the xtt.properties file on the target system.

[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

Convert an incremental backup in the target system and apply it to a copy of the data file

On the target system, log in to the Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the target database, and transfer the xttplan.txt and tsbkupmap.txt files generated in the previous step from the source system.

[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_scriptoracle@10.138.130.171's password:xttplan.txt 19 0.0KB/s 00:00 [oracle@jytest3 xtts_script] $scp / ora_xtts/xtts_script/tsbkupmap.txt oracle@10.138.130.171:/tts/xtts_scriptoracle@10.138. 130.171s 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_scriptoracle@10.138.130.171's password:incrbackups.txt 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_homeValues: / u01/app/oracle/product/12.2.0/dbKey: dstdirValues: DESTDIRKey: stageondestValues: / tts/xttsKey: platformidValues: 13Key: parallelValues: 4Key: backupformatValues: / ora_xtts/backupformatKey: asm_homeValues: / u01/app/product/12.2.0/crsKey: cnvinst_sidValues: xttKey: srclinkValues: ttslinkKey: srcdirValues: SOURCEDIRKey: asm_sidValues: + ASM1Key: tablespacesValues: JYKey: backupondestValues: / tts/backup- -Done parsing properties- -Checking properties -ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondestARGUMENT backupondest----Done checking properties-- -ORACLE_SID: jy1ORACLE_HOME: / u01ActionPlacleUniverse productUniverse 12.2.0Universe dbMurray- -Start rollforward----convert instance: / u01/app/oracle/product/12.2.0/dbconvert instance: xttORACLE instance started.Total System Global Area 6442450944 bytesFixed Size 8807168 bytesVariable Size 3892317440 bytesDatabase Buffers 1459617792 bytesRedo Buffers 7966720 bytesIn-Memory Area 1073741824 bytesrdfno 5BEFORE ROLLPLANdatafile number: 5datafile name: + DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755AFTER ROLLPLANCONVERTED BACKUP PIECE/tts/backup/xib_2esciru5_1_1_5PL/SQL procedure successfully completed.Entering RollForwardAfter applySetDataFileDone: applyDataFileToDone: applyDataFileToDone: RestoreSetPieceDone: RestoreBackupPiecePL/SQL procedure successfully completed.asmcmd rm / tts/backup/xib_2esciru5_ 1_1_5 / u01/app/product/12.2.0/crs.. + ASM1Connected to an idle instance.ASMCMD-8102: no connection to Oracle ASM Command requires Oracle ASM to runASMCMD:----End of rollforward phase-- -

4.3 Import metadata in the target database

On the target system, log in as the Oracle software user and set the environment variables (ORACLE_HOME and ORACLE_SID) to point to the target database, and execute the following command to generate the Data Pump TTS command:

[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_homeValues: / u01/app/oracle/product/12.2.0/dbKey: cnvinst_sidValues: xttKey: asm_sidValues: + ASM1Key: dstdirValues: DESTDIRKey: platformidValues : 13Key: backupondestValues: / tts/backupKey: parallelValues: 4Key: stageondestValues: / tts/xttsKey: tablespacesValues: JYKey: srclinkValues: ttslinkKey: srcdirValues: SOURCEDIRKey: backupformatValues: / ora_xtts/backupformatKey: asm_homeValues: / u01Applicable productCompact 12.2.0CRS talk- -Done parsing properties- -- Checking properties----ARGUMENT tablespacesARGUMENT platformidARGUMENT backupformatARGUMENT stageondest- -Done checking properties -ORACLE_SID: jy1ORACLE_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.txtimpdp directory= logfile=\ network_link= transport_full_check=no\ transport_tablespaces=JY\ transport_datafiles='+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_371_952394755'

The above command generates a file called xttplugin.txt, which creates a command that uses the network_link parameter to execute the transport tablespace import metadata. The transport_tablespaces and transport_datafiles parameters in the command have been set correctly. Note that the network_link mode indicates that the import is done by using dblink, so there is no need to perform an export or use an dump file. If you choose to execute this command to complete the transfer of the tablespace, you need to modify the directory,logfile and network_link parameters

SQL > create directory dump_dir as'/ tts/xtts_script';Directory created.SQL > grant read,write on directory dump_dir to public;Grant succeeded.

Create a user schema jy in the target database

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 2017Copyright (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 ProductionStarting "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_952394755Source time zone is + 08:00 and target time zone is + 00:00.Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLKProcessing object type TRANSPORTABLE_EXPORT/TABLEProcessing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICSProcessing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKERProcessing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLKJob "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=ttslinkImport: Release 12.2.0.1.0-Production on Tue Aug 22 18:47:22 2017Copyright (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 ProductionStarting "SYSTEM". SYS_IMPORT_SCHEMA_01: system/*@jypdb directory=dump_dir logfile=ysj.log content=metadata_only exclude=table Index network_link=ttslinkProcessing object type SCHEMA_EXPORT/SYSTEM_GRANTProcessing object type SCHEMA_EXPORT/ROLE_GRANTProcessing object type SCHEMA_EXPORT/DEFAULT_ROLEProcessing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMAProcessing object type SCHEMA_EXPORT/STATISTICS/MARKERJob "SYSTEM". "SYS_IMPORT_SCHEMA_01" successfully completed at Tue Aug 22 18:47:49 2017 elapsed 0 00:00:21

5. Verify the transmission of data

5.1 check the tablespace for damage

[oracle@jytest1 xtts_script] $rman target sys/abcd@jypdbRecovery Manager: Release 12.2.0.1.0-Production on Sat Aug 19 01:17:35 2017Copyright (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-17using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=1144 instance=jy1 device type=DISKchannel ORA_DISK_1: starting validation of datafilechannel ORA_DISK_1: specifying datafile (s) for validationinput datafile file number=00083 name=+DATA/jy/4B2C6373AE2547CCE053AB828A0A7CA3/datafile/jy_5.dbfchannel ORA_DISK_1: validation complete Elapsed time: 00:00:07List of Datafiles=File Status Marked Corrupt Empty Blocks Blocks Examined High SCN-----83 OK 01 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 63994Finished validate at 19-AUG-17

5.2 modify the tablespace JY in the target database to the read write state

SQL > alter tablespace jy read write;Tablespace altered.

6. Clear operation

If you use a separate conversion home and instance, you can close the conversion instance and delete the transformation home. You can also delete the backupformat directory created on the source system, the bacup directory created on the target system, and the environment variable $TMPDIR set on the source and target systems.

Xttdriver.pl scripting options

-- backup: create a level level 0 backup of the tablespaces to be transferred in the source database. These backups are written to the directory specified by the backupoformat parameter in the xtt.properties file. These backups need to be manually copied to the directory specified by the stageondest parameter on the target system. It also generates tsbkupmap.txt and xttnewdatafiles.txt files and also needs to copy to the appropriate directory on the target system (the directory pointed to by the TMPDIR variable)

-- restore: restore and convert a backup copy of the data file in the stageondest directory on the target system. The restored files will be stored in the directory specified by the storageondest parameter

-- bkpincr: creates an incremental backup of the tablespace on the source system and stores it in the directory specified by the backupformat parameter. This also creates an incrbackups.txt file that lists the backups created. This file and tsbkupmap.txt must be copied to the directory specified by the stageondest parameter on the target system

-recover: apply incremental backups to restored data files

-s: determine that the new from_scn for the source database can be executed one or more times. This operation will calculate the next from_scn, record it in the xttplan.txt file, and then use it to create an incremental backup.

-bkpexport: the last incremental backup will be performed and an dump file of metadata will be created to import the data file. Incremental backups will be stored in the directory specified by the backupformat parameter and incrbckups.txt and tsbkupmaps.txt files will be created, which will be copied to the target system

-- resincrdmp: the last incremental backup will be restored and applied to the data file. At the same time, the dump file is restored to the directory specified by the TMPDIR variable, and the dump file can be used to import

-e: generate metadata scripts for transport tablespaces to import in the target system

-d debug: to execute xttdriver.pl and RMAN scripts in debug mode. You can also set the environment variable XTTDEBUG=1,debug level to 1mem2p3e. For example, xttdriver.pl-3

Xtt.properties file parameter description

Tablespaces: use commas to separate the list of tablespaces from the source database to the target database, such as tablespaces=TS1,TS2

Platformid: the platformid of the source database obtained from v$database.platform_id, such as platformid=13

Backupformat: the directory on the source system where backup files are stored. This directory must have enough space to store all backup and incremental backup files created. This directory can be a directory mounted to the source system through the NFS-mounted file system on the target system, in which case the stageondest parameter on the target system also refers to the same NFS directory. For example, backupformat=/stage_source

Stageondest: copies of data files manually transferred from the source system are stored on the target system. This directory should have enough space to store copies of the data files. This directory is also used to store incremental backup files transferred from the source system. Data file copies and incremental backup files are read from this directory when you perform xttdriver.pl-c conversion data files and xttdriver.pl-r roll forward data files on the target system. This target can also be an DBFS-mounted file system. A directory can be a directory on the source system mounted to the target system through the NFS-mounted file system, in which case the backupformat parameter and the dfcopydir parameter on the source system refer to the same NFS directory. You can refer to See Note 359515.1 for mount option guidelines. For example, stageondest=/stage_dest

Storageondest: the directory in the target system where copies of the data files generated after the xttdriver.pl-c conversion operation are stored, that is, the directory where the target database finally stores the data files. This directory should have enough space to store the data files permanently. This parameter is used when using RMAN backup to make a copy of the initialization data file, for example

Storageondest=+DATA or storageondest=/oradata/test

Asm_home: the ORACLE_HOME of the ASM instance in the target system. Note that if backupondest is set to the file system directory, delete the asm_home and asm_sid parameters, such as asm_home=/u01/app/11.2.0.4/grid

Asm_sid: the ORACLE_SID of the ASM instance in the target system. For example, asm_sid=+ASM1

Parallel: defines the degree of parallelism of rmanconvert commands in the rmanconvert.cmd command file. If this parameter is not set, xttdriver.pl will use the default parallelism of parallel=8. For example, parallel=3

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report