打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
oracle xtts 解决跨平台迁移之一 Recovery Manager (RMAN)

os: centos 7.4.1708
db: oracle 11.2.0.4

xtts 是 tts 的加强版,主要用在表空间迁移上,限制是源端和目标端的数据库版本必须一致.

V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245.1)
已经明确指出 DBMS_FILE_TRANSFER 已经不再支持。

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.

规划

sourcetarget
oscentos 7.4centos 7.4
ip192.168.56.220192.168.56.201
db11.2.0.411.2.0.4
sidorclorcl

版本

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
# 
# su - oracle
$ sqlplus / as sysdba;

SQL> set lines 200;
set pages 200;
SQL> 
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE11.2.0.4.0Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

Phase 1 - Initial setup

目标端安装 RDBMS 软件,创建数据库

这个就没啥好啰嗦了


源端设置 rman_xttconvert_VER4.zip

# su - oracle
$ mkdir xtts
$ cd xtts
$ rz
$ unzip rman_xttconvert_VER4.3.zip

源端配置 src_scratch_location 目录

源端创建数据文件的目录

# su - oracle
$ mkdir xtts_rman_sour

目标端配置 dest_scratch_location、dest_datafile_location 目录

# su - oracle
$ mkdir xtts;mkdir xtts_rman_dest;

源端配置 xtt.properties

源端创建数据文件的目录

# su - oracle
$ cd xtts_rman_sour
$ vi xtt.properties

tablespaces=XTTS_TBS
platformid=13
src_scratch_location=/home/oracle/xtts_rman_sour
dest_datafile_location=/u01/app/oracle/oradata/orcl
dest_scratch_location=/home/oracle/xtts_rman_dest
parallel=2
rollparallel=2
getfileparallel=4

查询平台代码

SQL> select * from v$transportable_platform order by platform_id;

源端复制 xttconvert scripts and xtt.properties 到目标端

# su - oracle
$ cd xtts
$ scp ./* 192.168.56.201:/home/oracle/xtts

源端设置 TMPDIR

$ export TMPDIR=/home/oracle/xtts

Phase 2 - Prepare phase

源端基础备份

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backup

源端传输基础备份到目标端

# su - oracle
$ cd xtts
$ scp /home/oracle/xtts_rman_sour/* 192.168.56.201:/home/oracle/xtts_rman_dest/
$ scp res.txt 192.168.56.201:/home/oracle/xtts

目标端还原文件

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restore

Phase 3 - Roll Forward Phase

源端增量备份

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backup

源端传输增量备份到目标端

# su - oracle
$ cd xtts
$ scp `cat incrbackups.txt` 192.168.56.201:/home/oracle/xtts_rman_dest/
$ scp res.txt 192.168.56.201:/home/oracle/xtts

目标端还原文件

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restore

可以重复 Phase 3 - Roll Forward Phase 步骤以减少后面的停机时间。

Phase 4 - Final Incremental Backup

源端设置表空间为只读

SQL> alter tablespace XTTS_TBS read only;

源端最后增量备份

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --backup

表空间设置为 read only 后,如下的错误可以忽略

Prepare newscn for Tablespaces: 'XTTS_TBS'
DECLARE*
ERROR at line 1:
ORA-20001: TABLESPACE(S) IS READONLY OR,
OFFLINE JUST CONVERT, COPY
ORA-06512: at line 284

源端传输最后增量备份到目标端

# su - oracle
$ cd xtts
$ scp `cat incrbackups.txt` 192.168.56.201:/home/oracle/xtts_rman_dest/
$ scp res.txt 192.168.56.201:/home/oracle/xtts

目标端还原文件

# su - oracle
$ cd xtts
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl --restore

Phase 5 - Transport Phase: Import Object Metadata into Destination Database

There are two options, running manually or running across sqlnet:
本次选择手动运行 expdp/impdp

源端执行 expdp

# su - oracle
$ mkdir expdp
$ vi exp.par

dumpfile=xttdump.dmp
directory=DATA_PUMP_DIR
statistics=NONE
transport_tablespaces=XTTS_TBS
transport_full_check=y
logfile=tts_export.log
cluster=n

$ expdp system/oracle parfile=exp.par

源端传输 datapump 文件到目标端

$ scp /u01/app/oracle/product/11.2.0/db_1/rdbms/log/xttdump.dmp 192.168.56.201:/u01/app/oracle/product/11.2.0/db_1/rdbms/log/

目标端执行 impdp

# su - oracle
$ mkdir impdp
$ vi manual_imp.par
dumpfile= xttdump.dmp
directory=DATA_PUMP_DIR
transport_datafiles='/u01/app/oracle/oradata/orcl/XTTS_TBS_7.dbf'

$ impdp system/oracle parfile=manual_imp.par 

Phase 6 - Validate the Transported Data

目标端检查表空间是否存在错误

# su - oracle
$ rman target /

RMAN> validate tablespace XTTS_TBS check logical;

目标端表空间置位 read write

# su - oracle
$ sqlplus / as sysdba

SQL> alter tablespace XTTS_TBS read write;

Phase 7 - Cleanup

src_scratch location on the source system
dest_scratch location on the destination system
$TMPDIR location in both source and destination systems

参考:
V4 Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 2471245.1)

11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup (Doc ID 1389592.1)
Known Issues for Cross Platform Transportable Tablespaces XTTS (Doc ID 2311677.1)

https://www.oracle.com/technetwork/database/features/availability/maa-wp-11g-platformmigrationtts-129269.pdf

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
XTTS,又一个值得你重视的Oracle数据库迁移升级利器
Oracle数据库迁移:异构传输表空间TTS HP-UX迁移至Redhat Linux 7.7
如何搭建一个数据库服务器平台
RAC 之 RMAN 备份
aidu : 使用RMAN在线创建DataGuard备用库(数据文件不同路径结构)
ORA-19809: 超出了恢复文件数的限制故障处理实例
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服