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.
规划
source | target | |
---|---|---|
os | centos 7.4 | centos 7.4 |
ip | 192.168.56.220 | 192.168.56.201 |
db | 11.2.0.4 | 11.2.0.4 |
sid | orcl | orcl |
# 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
这个就没啥好啰嗦了
# su - oracle
$ mkdir xtts
$ cd xtts
$ rz
$ unzip rman_xttconvert_VER4.3.zip
源端创建数据文件的目录
# su - oracle
$ mkdir xtts_rman_sour
# su - oracle
$ mkdir xtts;mkdir xtts_rman_dest;
源端创建数据文件的目录
# 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;
# su - oracle
$ cd xtts
$ scp ./* 192.168.56.201:/home/oracle/xtts
$ export TMPDIR=/home/oracle/xtts
# 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
# 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 步骤以减少后面的停机时间。
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
There are two options, running manually or running across sqlnet:
本次选择手动运行 expdp/impdp
# 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
$ 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/
# 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
# su - oracle
$ rman target /
RMAN> validate tablespace XTTS_TBS check logical;
# su - oracle
$ sqlplus / as sysdba
SQL> alter tablespace XTTS_TBS read write;
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
联系客服