V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245.1)
APPLIES TO:
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Linux x86-64
Updated 09-Nov-2018 -- Version 4
PURPOSE
This article covers the steps needed to use V4 Cross Platform Transportable Tablespaces (XTTS) with RMAN incremental backups to migrate data between systems that have different endian formats, with the least amount of application down time. 本文介绍了将V4跨平台可移植表空间(XTTS)与RMAN增量备份配合使用,以在具有不同字节序格式的系统之间迁移数据,而应用程序停机时间最短的步骤
The first step will be to copy a full backup from the source to the destination. Then, by using a series of incremental backups, each smaller than the last, the data at the destination system can be brought nearly current with the source system, before any downtime is required. This procedure requires down time only during the final incremental backup, and the meta-data export/import. 第一步是将完整备份从源复制到目标。然后,通过使用一系列增量备份(每个备份增量都小于最后一个备份),可以在不需要任何停机时间之前,将源系统中的数据几乎与源系统中的数据同步。此过程仅在最终增量备份和元数据导出/导入期间需要停机时间。
This document describes the V4 procedures for Cross Platform Incremental Backup which can be used with 11.2.0.4 and higher. This new procedure is simplified version of previous XTTs versions. This version has the following differences: 本文档介绍了适用于11.2.0.4及更高版本的跨平台增量备份的V4过程。此新过程是以前XTT版本的简化版本。此版本具有以下差异:
- this procured uses simplified commands. One command (--backup) for the source and one command (--restore) for the destination. 此过程使用简化的命令。一个命令(--backup)用于源,一个命令(--restore)用于目的地
- this procedure requires only one file to be copied between the source's and destination's $TMPDIR (res.txt). 此过程仅需要在源文件和目标文件的$ TMPDIR(res.txt)之间复制一个文件。
- this procedure will automatically resolve added datafiles with no additional intervention. 此过程将自动解析添加的数据文件,而无需其他干预
- this procedure allows for multiple incremental backups taken off the source without running the recovery. After which, recovery will be of all the incremental backups in the destination at once. 此过程允许从源中删除多个增量备份,而无需运行恢复。之后,将立即恢复目标中所有增量备份
The earlier versions of this procedure are still available in: 早期版本的这个程序是仍然可用
11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Note 1389592.1)
12C - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Note 2005729.1)
The following may help: 以下内容可能会有所帮助
MAA paper Platform Migration Using Transportable Tablespaces: Oracle Database.
The high-level steps for Cross Platform Incremental Backup are: 跨平台增量备份的高级步骤是
1. Initial setup 初始设置
2. Prepare phase (source data remains online) 准备阶段(源数据保持在线)
- Backup (level=0) of tablespaces to be transported 备份(级别= 0)要传输的表空间
- Transfer backup and other necessary setup files to destination system 将备份和其他必要的设置文件传输到目标系统
- Restore datafiles on destination system endian format 恢复目标系统字节序格式的数据文件
3. Roll Forward phase (source data remains online - Repeat this phase as many times as necessary to catch destination datafile copies up to source database) 前滚阶段(源数据保持联机状态-重复此阶段多次以捕获目标数据文件副本直至源数据库)
- Create incremental backup on source system 在源系统上创建增量备份
- Transfer incremental backup and other necessary setup files to destination system 将增量备份和其他必要的设置文件传输到目标系统
- Convert incremental backup to destination system endian format and apply the backup to the destination datafile copies 将增量备份转换为目标系统字节序格式,并将备份应用于目标数据文件副本
- Repeat steps until ready to transport the tablespace. 重复步骤,直到准备传输表空间为止
4. Transport phase (source data is READ ONLY) 传输阶段(源数据为只读)
-
- Alter the tablespaces in the source database to READ ONLY 将源数据库中的表空间更改为只读
- Repeat the Roll Forward phase one final time 最后一次重复前滚阶段
- This step makes destination datafile copies consistent with source database and generates necessary export. 此步骤使目标数据文件副本与源数据库一致,并生成必要的导出。
- Time for this step is significantly shorter than traditional XTTS method when dealing with large data because the incremental backup size is smaller. 处理增量数据时,此步骤所需的时间明显少于传统XTTS方法,因为增量备份大小较小。
- Import metadata of objects in the tablespaces into destination database using Data Pump 使用数据泵将表空间中对象的元数据导入到目标数据库中
- Alter the tablespaces in the destination database to READ WRITE 将目标数据库中的表空间更改为READ WRITE
SCOPE
The source system may be any platform provided the prerequisites referenced and listed below for both platform and database are met. 源系统可以是任何平台,只要满足以下针对平台和数据库所引用和列出的先决条件即可。
If you are migrating from a little endian platform to Oracle Linux, then the migration method that should receive first consideration is Data Guard. See Note 413484.1 for details about heterogeneous platform support for Data Guard between your current little endian platform and Oracle Linux. 如果从小端平台迁移到Oracle Linux,则应首先考虑的迁移方法是Data Guard。有关当前的小端平台与Oracle Linux之间对Data Guard的异构平台支持的详细信息,请参见 Note 413484.1
DETAILS
Overview 总览
This document provides a procedural example of transporting two tablespaces called TS1 and TS2 from an Oracle Solaris SPARC system to Oracle Linux, incorporating Oracle's Cross Platform Incremental Backup capability to reduce downtime. 本文档提供了一个程序示例,该示例将两个称为TS1和TS2的表空间从Oracle Solaris SPARC系统传输到Oracle Linux,并结合了Oracle跨平台增量备份功能以减少停机时间。
After performing the initial setup, moving the data is performed as follows: 执行初始设置后,按以下步骤移动数据
Prepare 准备
During the prepare phase, a level =0 backup of the tablespaces' datafiles is taken on the source. The backups are transferred to the destination, datafiles are restored and converted to the destination endian format. 在准备阶段,在源上获取表空间的数据文件的= 0级备份。备份将传输到目标,数据文件将还原并转换为目标字节序格式Roll Forward 前滚
During the roll forward phase, the datafiles restored during the prepare phase are rolled forward using incremental backups taken from the source database. By performing this phase multiple times, each successive incremental backup becomes smaller and faster to apply, allowing the data at the destination system to be brought almost current with the source system. The application being migrated is fully accessible during the Roll Forward phase. 在前滚阶段,使用从源数据库获取的增量备份来前滚在准备阶段还原的数据文件。通过多次执行此阶段,每个连续的增量备份将变得更小,更快地应用,从而使目标系统上的数据几乎与源系统保持最新。在前滚阶段,可以完全访问要迁移的应用程序。Transport 传输
During the transport phase, the tablespaces being transported are put into READ ONLY mode, a final incremental backup is taken from the source database, backups are transferred to destination and applied to the destination datafiles. At this point, the destination datafile copies consistent with source database and the application being migrated cannot receive any further updates. The tablespaces then are TTS-exported from the source database and TTS-imported into the destination database. Finally, the tablespaces are made READ WRITE for full access on the destination database. 在传输阶段,将要传输的表空间置于“只读”模式,从源数据库中获取最终的增量备份,将备份转移到目标并应用于目标数据文件。此时,目标数据文件副本与源数据库一致,并且正在迁移的应用程序无法接收任何进一步的更新。然后,将表空间从源数据库导出到TTS,并将TTS导入到目标数据库。最后,将表空间设置为READ WRITE以便对目标数据库进行完全访问。
Cross Platform Incremental Backup Supporting Scripts 跨平台增量备份支持脚本
The Cross Platform Incremental Backup core functionality was delivered in Oracle Database 11.2.0.4 and later. Some of the features in the prior versions (such as using DBMS_FILE_TRANSFER) are not available in this Version 4. If you need such functionality, use the standard procedure for 11g outlined in Note 1389592.1. The procedures outlined in this note applies to both Oracle 11.2.0.4 , 12c and later. See the Requirements and Recommendations section for details. In addition, a set of supporting scripts in the file rman_xttconvert_VER4.zip is attached to this document that are used to manage the procedure required to perform XTTS with Cross Platform Incremental Backup using Version 4. Oracle数据库11.2.0.4及更高版本提供了跨平台增量备份核心功能。此版本4中不提供先前版本中的某些功能(例如,使用DBMS_FILE_TRANSFER)。如果需要此类功能,请使用Note 1389592.1概述的11g标准过程。本说明中概述的过程适用于Oracle 11.2.0.4,12c和更高版本。有关详细信息,请参见“需求和建议”部分。此外,此文档还附带了文件rman_xttconvert_VER4.zip中的一组支持脚本,这些脚本用于管理使用版本4使用跨平台增量备份执行XTTS所需的过程。
The two primary supporting scripts files are the following: 以下是两个主要的支持脚本文件
- Perl script xttdriver.pl script that is run to perform the main steps of the XTTS with Cross Platform Incremental Backup procedure. 运行Perl脚本xttdriver.pl脚本,以执行带有跨平台增量备份的XTTS的主要步骤
- Parameter file xtt.properties: the file which stores site-specific configuration. 参数文件xtt.properties:用于存储特定于站点的配置的文件
Prerequisites 先决条件
The following prerequisites must be met before starting this procedure: 开始此过程之前,必须满足以下先决条件
- The limitations and considerations for transportable tablespaces must still be followed. They are defined in the following manuals: 必须遵循可移植表空间的限制和注意事项。它们在以下手册中定义
- Oracle Database Administrator's Guide
- Oracle Database Utilities
- In addition to the limitations and considerations for transportable tablespaces, the following conditions must be met: 除了可移动表空间的限制和注意事项之外,还必须满足以下条件
- The current version does NOT support Windows as either source or destination. 当前版本不支持Windows作为源或目标
- The source database's COMPATIBLE parameter must not be greater than the destination database's COMPATIBLE parameter. 源数据库的COMPATIBLE参数不得大于目标数据库的COMPATIBLE参数
- The source database must be in ARCHIVELOG mode. 源数据库必须处于ARCHIVELOG模式
- RMAN on the source system must not have DEVICE TYPE DISK configured with COMPRESSED. 源系统上的RMAN 不得将COMICEED配置为DEVICE TYPE DISK
- RMAN on the source system must not have BACKUP TYPE TO COPY. The source must have BACKUP TYPE TO BACKUPSET. 源系统上的RMAN 不得具有BACKUP TYPE TO COPY。源必须具有BACKUP TYPE TO BACKUPSET
- RMAN on the source system must not have default channel configured to type SBT. 源系统上的RMAN 不得将默认通道配置为键入SBT。
- The set of tablespaces being moved must all be online, and contain no offline data files. Tablespaces must be READ WRITE. 要移动的表空间集必须全部在线,并且不包含任何离线数据文件。表空间必须是READ WRITE
- Tablespaces that are READ ONLY may be moved with the normal XTTS method. There is no need to incorporate Cross Platform Incremental Backups to move tablespaces that are always READ ONLY. 只读的表空间可以使用普通的XTTS方法移动。无需合并跨平台增量备份来移动始终只读的表空间
- Although preferred destination system is Linux (either 64-bit Oracle Linux or a certified version of RedHat Linux), this procedure can be used with other Unix based operating systems. However, any non-Linux operating system must be running 12.1.0.1 or higher in both destination and source. 尽管首选的目标系统是Linux(64位Oracle Linux或RedHat Linux的认证版本),但是此过程可以与其他基于Unix的操作系统一起使用。但是,任何非Linux操作系统都必须在目标和源中都运行12.1.0.1或更高版本
- The Oracle version of source must be lower or equal to destination. Therefore, this procedure can be used as an upgrade method. Transportable tablespace restrictions WILL apply. 源的Oracle版本必须低于或等于目标。因此,此过程可以用作升级方法。 可移动表空间限制将适用。
- Minimum version for source and destination is 11.2.0.4. 源和目标的最低版本为11.2.0.4
- ASM can only be used for final location of datafiles in destination, backups cannot be placed on ASM with this version. ASM仅可用于数据文件在目标中的最终位置,不能将备份放在此版本的ASM上
- All steps in this procedure are run as the oracle user that is a member of the OSDBA group. OS authentication is used to connect to both the source and destination databases. 此过程中的所有步骤均以作为OSDBA组成员的oracle用户身份运行。操作系统身份验证用于连接到源数据库和目标数据库
- It is not supported to execute this procedure against a standby or snapshot standby databases. 不支持对备用数据库或快照备用数据库执行此过程
Whole Database Migration 整个数据库迁移
If Cross Platform Incremental Backups will be used to reduce downtime for a whole database migration, then the steps in this document can be combined with the XTTS guidance provided in the MAA paper Platform Migration Using Transportable Tablespaces: Oracle Database. 如果将使用跨平台增量备份来减少整个数据库迁移的停机时间,那么可以将本文档中的步骤与MAA论文《使用可迁移表空间的平台迁移:Oracle数据库》中提供的XTTS指导相结合
Troubleshooting 故障排除
Debug mode enables additional screen output and causes all RMAN executions to be performed with the debug command line option. To enable debug mode, set the environment variable XTTDEBUG=1 before running xttdriver.pl OR
run xttdriver.pl with the --debug flag. This flag allows for 3 levels, -d [1/2/3] with 3 generating the most information. 调试模式可启用其他屏幕输出,并使用调试命令行选项执行所有RMAN执行。要启用调试模式,请在运行xttdriver.pl之前设置环境变量XTTDEBUG = 1或
使用--debug标志运行xttdriver.pl。该标志允许3个级别,-d [1/2/3],其中3个级别生成最多的信息。
Known Issues 已知的问题
- If the roll forward phase (xttdriver.pl -r) fails with the following errors, then verify RMAN DEVICE TYPE DISK is not configured COMPRESSED. 如果前滚阶段(xttdriver.pl -r)失败并出现以下错误,则请验证RMAN DEVICE TYPE DISK 没有配置为COMPRESSED。
Entering RollForward
After applySetDataFile
Done: applyDataFileTo
Done: RestoreSetPiece
DECLARE
*
ERROR at line 1:
ORA-19624: operation failed, retry possible
ORA-19870: error while restoring backup piece
/<path>/xtts_incr_backup
ORA-19608: /<path>/xtts_incr_backup is not a backup
piece
ORA-19837: invalid blocksize 0 in backup piece header
ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 2338
ORA-06512: at line 40 - If using ASM in both source and destination, see XTTS Creates Alias on Destination when Source and Destination use ASM (Note 2351123.1) 如果在源和目标中都使用ASM,请参阅XTTS在源和目标使用ASM时在目标上创建别名(注释2351123.1)
- If using ASM for datafiles, an error deleting file system file using ASMCMD can be ignored. (Bug 29268792, currently open) 如果对数据文件使用ASM,则可以忽略使用ASMCMD删除文件系统文件时出错。(错误29268792,当前打开)
- The existence of a GLOGIN.sql, in either source or destination, can cause syntax errors. 源或目标中存在GLOGIN.sql可能会导致语法错误。
- For other known issues, see other issues within Known Issues for Cross Platform Transportable Tablespaces XTTS Document 2311677.1. 有关其他已知问题,请参阅跨平台可移动表空间XTTS 文档2311677.1的已知问题中的其他问题。
- You cannot use this procedure for a TDE tablespace. 您不能对TDE表空间使用此过程。
V4 Transport Tablespaces with Reduced Downtime using Cross Platform Incremental Backup 使用跨平台增量备份减少停机时间的V4传输表空间
The XTTS with Cross Platform Incremental Backups procedure is divided into the following phases: 具有跨平台增量备份的XTTS过程分为以下几个阶段:
- Phase 1 - Initial Setup phase 初始设置阶段
- Phase 2 - Prepare phase 准备阶段
- Phase 3 - Roll Forward phase 前滚阶段
- Phase 4 - Transport Phase: Import Metadata 传输阶段:导入元数据
- Phase 5 - Validate the Transported Data 验证传输的数据
- Phase 6 - Cleanup 清理
Conventions Used in This Document 本文档中使用的约定
- All command examples use bash shell syntax. 所有命令示例都使用bash shell语法
- Commands prefaced by the shell prompt string [oracle@source]$ indicate commands run as the oracle user on the source system. shell提示符字符串[oracle @ source] $开头的命令表示命令在源系统上以oracle用户身份运行
- Commands prefaced by the shell prompt string [oracle@dest]$ indicate commands run as the oracle user on the destination system. Shell提示符字符串[oracle @ dest] $开头的命令表示命令在目标系统上以oracle用户身份运行
Phase 1 - Initial Setup 初始设置
Perform the following steps to configure the environment to use Cross Platform Incremental Backups: 执行以下步骤以配置环境以使用跨平台增量式备份
Step 1.1 - Install the destination database software and create the destination database 步骤1.1-安装目标数据库软件并创建目标数据库
Install the desired Oracle Database software on the destination system that will run the destination database. 在将运行目标数据库的目标系统上安装所需的Oracle数据库软件。
Identify (or create) a database on the destination system to transport the tablespace(s) into and create the schema users required for the tablespace transport. I.e., users who own the objects within the tablespaces being transported. 在目标系统上标识(或创建)数据库以将表空间传输到表空间中,并创建表空间传输所需的模式用户。即,拥有要传输的表空间内的对象的用户。
Step 1.2 - Identify tablespaces to be transported 步骤1.2-确定要传输的表空间
Identify the tablespace(s) in the source database that will be transported. Tablespaces TS1 and TS2 will be used in the examples in this document. As indicated above, the limitations and considerations for transportable tablespaces must still be followed. 在源数据库中标识将要传输的表空间。表空间TS1和TS2将在本文档的示例中使用。如上所述,对于可移动表空间的限制和注意事项仍然必须遵循
Step 1.3 - Install xttconvert scripts on the source system 步骤1.3-在源系统上安装xttconvert脚本
On the source system, as the oracle software owner, download and extract the supporting scripts attached as rman_xttconvert_VER4.zip to this document. 在源系统上,以oracle软件所有者的身份下载并提取作为rman_xttconvert_VER4.zip附加到此文档的支持脚本
[oracle@source]$ pwd
/home/oracle/xtt [oracle@source]$ unzip rman_xttconvert_VER4.zip
Archive: rman_xttconvert_v3.zip
inflating: xtt.properties
inflating: xttcnvrtbkupdest.sql
inflating: xttdbopen.sql
inflating: xttdriver.pl
inflating: xttprep.tmpl
extracting: xttstartupnomount.sql
Step 1.4 - Create necessary directories 步骤1.4-建立必要的目录
- On source:
- Location of backups as defined by src_scratch_location parameter in the xtt.properties file. 备份的位置,由xtt.properties文件中的src_scratch_location参数定义
- On destination:
- Location of backups as defined by the dest_scratch_location parameter in the xtt.properties file. 备份的位置,由xtt.properties文件中的dest_scratch_location参数定义。
- Location for datafiles on destination, as defined by dest_datafile_location parameter in the xtt.properties file. 数据文件在目标上的位置,由xtt.properties文件中的dest_datafile_location参数定义
Step 1.5 - Configure xtt.properties on the source system 步骤1.5-在源系统上配置xtt.properties
Edit the xtt.properties file on the source system with your site-specific configuration. For more information about the parameters in the xtt.properties file, refer to the Description of Parameters in Configuration File xtt.properties section in the Appendix below. For this procedure, only the following parameters are mandatory. Others are optional and/or available for use. 使用特定于站点的配置在源系统上编辑xtt.properties文件。有关xtt.properties文件中的参数的更多信息,请参考下面附录中的配置文件xtt.properties中的参数说明。对于此过程,仅以下参数是必需的。其他是可选的和/或可供使用
- tablespaces
- platformid
- src_scratch_location
- dest_scratch_location
- dest_datafile_location
- (if using 12c) -- usermantransport=1
Step 1.6 - Copy xttconvert scripts and xtt.properties to the destination system< 步骤1.6-将xttconvert脚本和xtt.properties复制到目标系统<
As the oracle software owner copy all xttconvert scripts and the modified xtt.properties file to the destination system. 作为oracle软件所有者,将所有xttconvert脚本和修改后的xtt.properties文件复制到目标系统。
[oracle@source]$ scp -r /home/oracle/xtt oracle@dest:/home/oracle/xtt
Step 1.7 - Set TMPDIR environment variable 步骤1.7-设置TMPDIR环境变量
In the shell environment on both source and destination systems, set environment variable TMPDIR to the location where the supporting scripts exist. Use this shell to run the Perl script xttdriver.pl as shown in the steps below. If TMPDIR is not set, output files are created in and input files are expected to be in /tmp. 在源系统和目标系统上的Shell环境中,将环境变量TMPDIR设置为支持脚本所在的位置。使用此外壳程序运行Perl脚本xttdriver.pl,如下步骤所示。如果未设置TMPDIR,则会在/ tmp中创建输出文件,并且输入文件应位于/ tmp中
[oracle@source]$ export TMPDIR=/home/oracle/xtt [oracle@dest]$ export TMPDIR=/home/oracle/xtt
Phase 2 - Prepare Phase 准备阶段
During the Prepare phase, datafiles of the tablespaces to be transported are backed up on source, backups transferred to the destination system and restored by the xttdriver.pl script. 在“准备”阶段,要传输的表空间的数据文件在源上备份,备份转移到目标系统,并由xttdriver.pl脚本还原。
Step 2.1 - Run the backup on the source system 步骤2.1-在源系统上运行备份
On the source system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the source database, run the backup as follows: 在源系统上,以oracle用户身份登录并使用指向源数据库的环境(ORACLE_HOME和ORACLE_SID环境变量),运行备份,如下所示:
[oracle@source]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backup
Step 2.2 - Transfer the following files to the destination system: 步骤2.2-将以下文件传输到目标系统
- Backups created from source src_scratch_location to destination dest_scratch_location 从源src_scratch_location创建到目标dest_scratch_location的备份
- The res.txt file from source $TMPDIR to destination $TMPDIR: 从源$ TMPDIR到目标$ TMPDIR的res.txt文件
In the example below, scp is used to transfer the level=0 backup created by the previous step from the source system to the destination system. 在下面的示例中, scp 用于将上一步创建的level = 0备份从源系统传输到目标系统
[oracle@source]$ scp /src_scratch/* oracle@dest:/dest_scratch
[oracle@source]$ scp res.txt oracle@dest:/home/oracle/xtt
Step 2.3 - Restore the datafiles on the destination system 步骤2.3-在目标系统上还原数据文件
On the destination system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the destination database, run the restore as follows: 在目标系统上,以oracle用户身份登录并使用指向目标数据库的环境(ORACLE_HOME和ORACLE_SID环境变量)来运行还原,如下所示:
[oracle@dest]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restoreDatafiles will be placed on the destination system in the defined dest_datafile_location. 数据文件将在定义的dest_datafile_location中放置在目标系统上 。
Phase 3 - Roll Forward Phase 前滚阶段
During this phase an incremental backup is created from the source database, transferred to the destination system, converted to the destination system endian format, then applied to the converted destination datafile copies to roll them forward. This phase may be run multiple times. Each successive incremental backup should take less time than the prior incremental backup, and will bring the destination datafile copies more current with the source database. The data being transported (source) is fully accessible during this phase. 在此阶段,将从源数据库创建增量备份,将其备份到目标系统,转换为目标系统字节序格式,然后将其应用于转换后的目标数据文件副本以将其前滚。此阶段可以运行多次。每次连续的增量备份应该比以前的增量备份花费更少的时间,并且将使目标数据文件副本与源数据库的副本更新。在此阶段,可以完全访问要传输的数据(源)
Step 3.1 - Create an incremental backup of the tablespaces being transported on the source system 步骤3.1-创建源系统上正在传输的表空间的增量备份
On the source system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the source database, run the create incremental step as follows: 在源系统上,以oracle用户身份登录并使用指向源数据库的环境(ORACLE_HOME和ORACLE_SID环境变量),运行创建增量步骤,如下所示
[oracle@source]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backupThis step will create an incremental backup for all tablespaces listed in xtt.properties. 此步骤将为xtt.properties中列出的所有表空间创建增量备份
Step 3.2 - Transfer incremental backups and res.txt to the destination system 步骤3.2-将增量备份和res.txt传输到目标系统
Transfer the incremental backup(s) (between src_scratch_location and dest_scratch_location) and the res.txt (between the $TMPDIRs) from the source to the destination. The list of incremental backup files from current backup can be
found in the incrbackups.txt file on the source system. 将增量备份(在src_scratch_location和dest_scratch_location之间)和res.txt(在$ TMPDIR之间)从源传输到目标。当前备份中增量备份文件的列表可以在源系统上的incrbackups.txt文件中
找到。[oracle@source]$ scp `cat incrbackups.txt` oracle@dest:/dest_scratch_location
[oracle@source]$ scp res.txt oracle@dest:/home/oracle/xttIf the src_scratch_location on the source system and the dest_scratch_location on the destination system refer to the same NFS storage location, then the backups do not need to be copied as they are available in the expected location on the destination system. 如果src_scratch_location 源系统和目标系统上的dest_scratch_location上指的是同一NFS存储位置,则不需要备份,因为它们是在目标系统上的预期位置可被复制However, the res.txt file MUST be copied after the LAST incremental backup before it can be applied on destination (step 3.3). 但是,必须在最后一次增量备份之后复制res.txt文件,然后才能将其应用于目标(步骤3.3)
Step 3.3 - Apply the incremental backup to the datafile copies on the destination system 步骤3.3-将增量备份应用于目标系统上的数据文件副本
On the destination system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the destination database, run the roll forward datafiles step as follows: 在目标系统上,以oracle用户身份使用指向目标数据库的环境(ORACLE_HOME和ORACLE_SID环境变量)登录,运行前滚数据文件步骤,如下所示:
[oracle@dest]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restoreThe roll forward step connects to destination database and applies the incremental backups on the tablespaces' datafiles for each tablespace being transported. 前滚步骤连接到目标数据库,并对要传输的每个表空间在表空间的数据文件上应用增量备份。
NOTE: Although multiple backups can be executed against the source without being applied on the destination, the res.txt must be copied after the last backup and before the '--restore' is executed at the destination. 注意:尽管可以对源执行多个备份而不将其应用于目标,但是必须在上次备份之后以及在目标执行'--restore'之前复制res.txt。
Step 3.4 - Repeat the roll forward phase 3 (3.1 - 3.3) or proceed to phase 4, final incremental backup 步骤3.4-重复前滚阶段3(3.1-3.3)或进行到阶段4,最后进行增量备份
At this point there are two choices: 此时有两种选择
- If you need to bring the files at the destination database closer in sync with the production system, then repeat the Roll Forward phase, starting with step 3.1. 如果需要使目标数据库中的文件与生产系统更接近,请从步骤3.1开始重复前滚阶段
- If the files at the destination database are as close as desired to the source database, then proceed to the Transport phase. 如果目标数据库上的文件与源数据库尽可能接近,则进入传输阶段
Phase 4 - Final Incremental Backup -- If you are running 12c, this step can be replaced by Phase 4 in Note 2005729.1: 阶段4-最终增量备份-如果您运行的是12c,则可以用注释2005729.1中的阶段4代替此步骤:
During this phase the source data is made READ ONLY and the destination datafiles are made consistent with the source database by creating and applying a final incremental backup. After the destination datafiles are made consistent, the normal transportable tablespace steps are performed to export object metadata from the source database and import it into the destination database. The data being transported is accessible only in READ ONLY mode until the end of this phase. 在此阶段,通过创建并应用最终增量备份,使源数据成为只读状态,并使目标数据文件与源数据库一致。在使目标数据文件一致之后,执行常规的可移动表空间步骤以从源数据库导出对象元数据并将其导入到目标数据库中。在此阶段结束之前,只能在“只读”模式下访问正在传输的数据。
Step 4.1 - Alter source tablespace(s) to READ ONLY in the source database 步骤4.1-将源表空间更改为在源数据库中只读
On the source system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the source database, alter the tablespaces being transported to READ ONLY. 在源系统上,以oracle用户身份登录并使用指向源数据库的环境(ORACLE_HOME和ORACLE_SID环境变量),将要传输的表空间更改为“只读”。
system@source/prod SQL> alter tablespace TS1 read only; Tablespace altered. system@source/prod SQL> alter tablespace TS2 read only; Tablespace altered.
Step 4.2 - Create the final incremental backup of the tablespaces being transported on the source system: 步骤4.2-创建源系统上正在传输的表空间的最终增量备份
On the source system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the source database, run the backup as follows: 在源系统上,以oracle用户身份登录并使用指向源数据库的环境(ORACLE_HOME和ORACLE_SID环境变量),运行备份,如下所示
[oracle@source]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backup
####################################################################
Warning:
------
Warnings found in executing /home/oracle/radranly/convert_source/backup_Nov9_Fri_09_08_26_213//xttpreparenextiter.sql
####################################################################
Prepare newscn for Tablespaces: 'SECOND'
DECLARE*
ERROR at line 1:
ORA-20001: TABLESPACE(S) IS READONLY OR,
OFFLINE JUST CONVERT, COPY
ORA-06512: at line 284
Step 4.3- Transfer incremental backups and res.txt to the destination system 步骤4.3-将增量备份和res.txt传输到目标系统
[oracle@source]$ scp 'cat incrbackups.txt' oracle@dest:/dest_scratch_location
[oracle@source]$ scp res.txt oracle@dest:/home/oracle/xtt
Step 4.4 - Apply last incremental backup to destination datafiles 步骤4.4-将最后一次增量备份应用于目标数据文件
The final incremental backup must be applied to the destination datafiles: 最终增量备份必须应用于目标数据文件:
[oracle@dest]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restore
This step will apply the last incremental backup to the datafiles on the destination. 此步骤将最后一次增量备份应用于目标上的数据文件
Phase 5 - Transport Phase: Import Object Metadata into Destination Database 阶段5-传输阶段:将对象元数据导入目标数据库
During this phase, you need an export of the metadata of the tablespaces from the source and plug in the tablespace(s) into the destination. 在此阶段,您需要从源导出表空间的元数据,并将表空间插入目标。
There are two options, running manually or running across sqlnet: 有两个选项,手动运行或跨sqlnet运行:
OPTION #1. Manually running export and import command. 选项1。手动运行导出和导入命令
Option1.A: Run datapump export on source database: Option1.A:在源数据库上运行datapump导出:
Perform the tablespace transport by running transportable mode Data Pump export on the source database to export the object metadata being transported into a dump file. The below example assumes a directory (DATA_PUMP_DIR) already exists in the source. For example: 通过在源数据库上运行可传输模式的数据泵导出来执行表空间传输,以将要传输的对象元数据导出到转储文件中。以下示例假定源中已存在目录(DATA_PUMP_DIR)。例如:
[oracle@source]$ cat exp.par dumpfile=xttdump.dmp
directory=DATA_PUMP_DIR
statistics=NONE
transport_tablespaces=TS1,TS2
transport_full_check=y
logfile=tts_export.log [oracle@source]$ expdp system/manager parfile=exp.par
Refer to the following manuals for details: 有关详细信息,请参阅以下手册
Oracle Database Administrator's Guide
Oracle Database Utilities
Option1.B: Transfer the export file to destination directory used by datapump 将导出文件传输到datapump使用的目标目录
Option1.C: Run datapump import on destination to plug in the tablespaces. For example: 在目标上运行datapump import以插入表空间。例如:
[oracle@dest]$ cat manual_imp.par
dumpfile= xttdump.dmp
directory=DATAPUMP
transport_datafiles='/dest_datafile_location/TS1.dbf','/dest_datafile_location/TS2.dbf' [oracle@dest]$ impdp system/oracle parfile=manual_imp.par
OPTION #2. Import across sqlnet. 跨sqlnet导入。
Option2.A: Create datapump directory and grant privilege: 创建数据泵目录并授予特权
Datapump will look for the export file in the specified directory. Either copy the '.dmp' file in your existing data pump directory or create a new directory pointing to the or copy the '.dmp' in an existing datapump directory Datapump将在指定目录中查找导出文件。在现有数据泵目录中复制“ .dmp”文件,或者创建指向该目录的新目录,或者在现有数据泵目录中复制“ .dmp”
SYS@DESTDB> create directory dpump_tts as '/home/oracle/destination/convert';
The directory must be granted to use who will do the import: 必须授予目录使用谁来执行导入
SYS@DESTDB> GRANT READ, WRITE ON DIRECTORY dpump_tts TO system;
Option2.B: Generate new xttplugin.txt for netowrk import 生成新的xttplugin.txt以进行netowrk导入
On the destination system, logged in as the oracle user with the environment (ORACLE_HOME and ORACLE_SID environment variables) pointing to the destination database, run the generate Data Pump TTS command step as follows: 在目标系统上,以oracle用户身份使用指向目标数据库的环境(ORACLE_HOME和ORACLE_SID环境变量)登录,运行generate Data Pump TTS命令步骤,如下所示:
[oracle@dest]$ $ORACLE_HOME/perl/bin/perl xttdriver.pl -e
This will generate a sample Data Pump network_link transportable import command in the file xttplugin.txt with the transportable tablespaces parameters TRANSPORT_TABLESPACES and TRANSPORT_DATAFILES correctly set. In addition, a datapump export file will also be created. 这将在文件xttplugin.txt中生成一个示例数据泵network_link transportable import命令,其中 正确设置了可传输表空间参数TRANSPORT_TABLESPACES和TRANSPORT_DATAFILES。此外,还将创建一个数据泵导出文件。
Option2.C: Create a database link on destination database: 在目标数据库上创建数据库链接
Connecting to the destination database, create a database link connecting to the source database. For example: 连接到目标数据库,创建一个连接到源数据库的数据库链接。例如:
SQL@dest> create public database link ttslink connect to system identified by <password> using '<tns_to_source>';
Verify the database link can properly access the source system: 验证数据库链接可以正确访问源系统
SQL@dest> select name from v$database@ttslink;
Option2.D: Modify and execute Impdp command: 修改并执行Impdp命令
A separate export or dump file is not required. To perform the tablespace transport with this command, then you must edit the import command file xttplugin.txt (generated in step 5B.1) and replace import parameters DIRECTORY, LOGFILE, and NETWORK_LINK with site-specific values. 不需要单独的导出或转储文件。要使用此命令执行表空间传输,则必须编辑导入命令文件xttplugin.txt(在步骤5B.1中生成),并将导入参数DIRECTORY,LOGFILE和NETWORK_LINK替换为特定于站点的值。
The following is an example network mode transportable import command: 以下是示例网络模式可传输导入命令
[oracle@dest]$ impdp directory=DATA_PUMP_DIR logfile=tts_imp.log network_link=ttslink \
transport_full_check=no \
transport_tablespaces=TS1,TS2 \
transport_datafiles='+DATA/prod/datafile/ts1.285.771686721', \
'+DATA/prod/datafile/ts2.286.771686723', \
'+DATA/prod/datafile/ts2.287.771686743'
Resources:
Phase 6 - Validate the Transported Data 阶段6-验证传输的数据
Step 6.1 Check tablespaces for corruption 步骤6.1检查表空间是否损坏
At this step, the transported data is READ ONLY in the destination database. Perform application specific validation to verify the transported data. 在此步骤中,已传输的数据在目标数据库中为只读。执行特定于应用程序的验证以验证传输的数据。
Also, run RMAN to check for physical and logical block corruption by running VALIDATE TABLESPACE as follows: 另外,通过运行VALIDATE TABLESPACE,运行RMAN来检查物理和逻辑块损坏,如下所示:
RMAN> validate tablespace TS1, TS2 check logical;
Step 6.2 - Alter the tablespace(s) READ WRITE in the destination database 更改目标数据库中的表空间的READ WRITE
The final step is to make the destination tablespace(s) READ WRITE in the destination database. 最后一步是使目标表空间在目标数据库中为READ WRITE
system@dest/prod SQL> alter tablespace TS1 read write; Tablespace altered. system@dest/prod SQL> alter tablespace TS2 read write; Tablespace altered.
Phase 7 - Cleanup 清理
If a separate incremental convert home and instance were created for the migration, then the instance may be shutdown and the software removed. 如果为迁移创建了单独的增量转换主目录和实例,则可以关闭该实例并删除软件
Files created by this process are no longer required and may now be removed. They include the following: 通过此过程创建的文件不再需要,现在可以删除。其中包括
- src_scratch location on the source system src_scratch 在源系统上的位置
- dest_scratch location on the destination system 目标系统上的dest_scratch 位置
- $TMPDIR location in both source and destination systems $ TMPDIR在源系统和目标系统中的位置
Appendix 附录
Description of Perl Script xttdriver.pl Options Perl脚本xttdriver.pl选项的描述
The following table describes the options available for the main supporting script xttdriver.pl. 下表描述了主要支持脚本xttdriver.pl可用的选项。
Option | Description |
---|---|
--backup |
Creates a level 0 backups of the datafiles belonging to the selected tablespaces. These backups will be written into the location pointed to by the xtt.properties variable “backupformat”. These backups need to be copied over to the destination to the location pointed to by the variable “stageondest”. Two more files, tsbkupmap.txt and xttnewdatafiles.txt, will be generated which also need to be copied over to the temporary directory in the destination, defined by TMPDIR. 创建属于所选表空间的数据文件的0级备份。这些备份将被写入xtt.properties变量“ backupformat”指向的位置。 这些备份需要复制到目标变量“ stageondest”所指向的位置。还将生成另外两个文件tsbkupmap.txt和xttnewdatafiles.txt,这些文件也需要复制到目标的临时目录中,该目录由TMPDIR定义。 |
--restore |
Restores and converts the datafiles from the backups copied to the location “stageondest” in destination. The restored files will be placed in the path defined by the variable “storageondest”. 从复制到目标中“ stageondest”位置的备份还原并转换数据文件。恢复的文件将放置在变量“ storageondest”定义的路径中。 |
-e |
Generates Data Pump TTS command step is run once on the destination system with the environment (ORACLE_HOME and ORACLE_SID) set to the destination database. 在将环境(ORACLE_HOME和ORACLE_SID)设置为目标数据库的目标系统上,一次运行Generates Data Pump TTS命令步骤。 This step creates the template of a Data Pump Import command that uses a network_link to import metadata of objects that are in the tablespaces being transported. 此步骤创建数据泵导入命令的模板,该命令使用network_link导入要传输的表空间中的对象的元数据。 |
-d debug |
Enables debug mode for xttdriver.pl and RMAN commands it executes. Debug mode can also be enabled by setting environment variable XTTDEBUG=1. Debug allows for 1,2,3 levels of debug. I.e., xttdriver.pl -d 3 为xttdriver.pl及其执行的RMAN命令启用调试模式。也可以通过设置环境变量XTTDEBUG = 1来启用调试模式。调试允许进行1,2,3级调试。即xttdriver.pl -d 3 |
Description of Parameters in Configuration File xtt.properties 配置文件xtt.properties中的参数说明
The following table describes the parameters used by xttdriver.pl which must be defined in the xtt.properties file that are needed for this 12c procedure. Other parameters may exist which are needed for backward compatibility. 下表描述了xttdriver.pl使用的参数,此参数必须在xtt.properties文件中定义,此参数是12c过程所必需的。可能存在向后兼容所需的其他参数。
Parameter | Description | Example Setting |
---|---|---|
tablespaces |
Comma-separated list of tablespaces to transport from source database to destination database. Must be a single line, any subsequent lines will not be read. 从源数据库传输到目标数据库的表空间的逗号分隔列表。必须为一行,任何后续行都不会被读取。 |
tablespaces=TS1,TS2 |
platformid |
Source database platform id, obtained from V$DATABASE.PLATFORM_ID. 从V $ DATABASE.PLATFORM_ID获得的源数据库平台ID。 |
platformid=13 |
dest_datafile_location |
Directory object in the destination database that defines where the destination datafiles will be created. 目标数据库中的目录对象,用于定义将在何处创建目标数据文件。 |
dest_datafile_location=/u01/oradata/V122 i.e.: dest_datafile_location=+DATA |
src_scratch_location |
Location on the source system where backups are created. 在源系统上创建备份的位置。 This location must have sufficient free space to hold the level=0 backup of the tablespace datafiles and all subsequent incremental backups created for one iteration through the process documented above. 该位置必须有足够的可用空间来保存表空间数据文件的level = 0备份以及通过上述文档过程为一次迭代创建的所有后续增量备份。 This location may be an NFS-mounted filesystem that is shared with the destination system, in which case it should reference the same NFS location as the dest_scratch_location parameter for the destination system. 该位置可能是与目标系统共享的NFS挂载文件系统,在这种情况下,它应该引用与目标系统的dest_scratch_location参数相同的NFS位置 |
scr_scratch_location=/stage_source |
dest_scratch_location |
Location on the destination system where backups are placed by the user when they are transferred manually from the source system. 从源系统手动传输备份时,用户放置备份的目标系统上的位置。 This location must have sufficient free space to hold level=0 backup and all subsequent incremental backups transferred from the source. 此位置必须有足够的可用空间来容纳级别= 0的备份以及从源传输的所有后续增量备份。 This location may be a DBFS-mounted filesystem. 该位置可能是安装DBFS的文件系统。 This location may be an NFS-mounted filesystem that is shared with the source system, in which case it should reference the same NFS location as the backupformat parameters for the source system. See Note 359515.1 for mount option guidelines. 该位置可能是与源系统共享的NFS挂载文件系统,在这种情况下,它应引用与源系统的backupformat参数相同的NFS位置。 有关安装选项的准则,请参见注释359515.1。 |
dest_scratch_location=/stage_dest |
asm_home |
ORACLE_HOME for the ASM instance that runs on the destination system.、 |
asm_home=/u01/app/12.2.0.1/grid |
asm_sid |
ORACLE_SID for the ASM instance that runs on the destination system. 在目标系统上运行的ASM实例的ORACLE_SID。 |
asm_sid=+ASM1 |
parallel |
Defines the degree of parallelism used in the backup on the source (--backup). 定义源备份(--backup)中使用的并行度。 |
parallel=3 |
srcconnstr |
In CDB environment, specifies connect string of the source pluggable database. 在CDB环境中,指定源可插入数据库的连接字符串。 |
srcconnstr=sys/passwd@sourc_cdb_PDB1 |
destconnstr |
In CDB environment, specifies connect string of the destination pluggable database. 在CDB环境中,指定目标可插入数据库的连接字符串。 |
destconnstr=sys/passwd@dest_cdb_PDB1 |
usermantransport |
Set this parameter to 1 if using 12c to use the 12c functionality. 如果使用12c来使用12c功能,则将此参数设置为1。 |
usermantransport=1 |
Change History
Change | Date |
---|---|
rman_xttconvert_VER4.zip released |
29-Nov-2018 |
REFERENCES
NOTE:2005729.1 - 12C - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup
BUG:18596700 - CHANGE TRACKING IS NOT USED DURING INCREMENTAL BACKUP FOR READ ONLY TBS
BUG:29036164 - ADD "SECTION SIZE" AS AN OPTION TO XTTS SCRIPTS
NOTE:2013271.1 - 12c How Perform Cross-Platform Database Transport to different Endian Platform with RMAN Backup Sets
NOTE:1389592.1 - 11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup
BUG:29268792 - V4 XTTS WILL ATTEMPT TO DELETE FILE SYSTEM FILE WITH ASMCMD
BUG:28309542 - LFI-00005 LFI-01007 XTTDRIVER.PL --RESTORE
NOTE:2311677.1 - Known Issues for Cross Platform Transportable Tablespaces XTTS