当前位置:  数据库>oracle

RMAN跨小版本跨平台与字节序传输表空间

    来源: 互联网  发布时间:2017-06-15

    本文导语: 将Linux平台上的源数据库中的tspitr与test表空间传输到AIX平台上。并在源主机上使用目录/u02/transport来存储被转换的数据文件。操作步骤如下: 1.将要被传输的表空间tspitr与test设置为只读 SQL> alter tablespace tspitr read only; Tablespace altered...

将Linux平台上的源数据库中的tspitr与test表空间传输到AIX平台上。并在源主机上使用目录/u02/transport来存储被转换的数据文件。操作步骤如下:

1.将要被传输的表空间tspitr与test设置为只读
SQL> alter tablespace tspitr read only;

Tablespace altered.

SQL> alter tablespace test read only;

Tablespace altered.


2.检查源平台与目标平台信息支不支持传输操作
 数据库所支持的平台信息:
SQL> select platform_name,endian_format from v$transportable_platform;

PLATFORM_NAME                                                                    ENDIAN_FORMAT
-------------------------------------------------------------------------------- --------------
Solaris[tm] OE (32-bit)                                                          Big
Solaris[tm] OE (64-bit)                                                          Big
Microsoft Windows IA (32-bit)                                                    Little
Linux IA (32-bit)                                                                Little
AIX-Based Systems (64-bit)                                                      Big
HP-UX (64-bit)                                                                  Big
HP Tru64 UNIX                                                                    Little
HP-UX IA (64-bit)                                                                Big
Linux IA (64-bit)                                                                Little
HP Open VMS                                                                      Little
Microsoft Windows IA (64-bit)                                                    Little
IBM zSeries Based Linux                                                          Big
Linux x86 64-bit                                                                Little
Apple Mac OS                                                                    Big
Microsoft Windows x86 64-bit                                                    Little
Solaris Operating System (x86)                                                  Little
IBM Power Based Linux                                                            Big
Solaris Operating System (x86-64)                                                Little
HP IA Open VMS                                                                  Little


源平台:
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d where tp.platform_name=d.platform_name ;

PLATFORM_NAME                                                                                        ENDIAN_FORMAT
----------------------------------------------------------------------------------------------------- --------------
Linux 64-bit for AMD                                                                                  Little

 

目标平台
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d where tp.platform_name=d.platform_name ;

PLATFORM_NAME                                                                    ENDIAN_FORMAT
-------------------------------------------------------------------------------- --------------
AIX-Based Systems (64-bit)                                                      Big

 

3.确认要被传输的表空间是否是自包含表空间(TSPITR,TEST):
SQL> exec sys.dbms_tts.transport_set_check('TSPITR',true);

PL/SQL procedure successfully completed.


SQL> exec sys.dbms_tts.transport_set_check('TEST',true);

PL/SQL procedure successfully completed.

SQL> select * from sys.transport_set_violations;

no rows selected


如果没有行选择,表示该表空间只包含表数据,可以传输。

4.记录表空间传输前表tspitr与test中的记录:
SQL> select count(*) from tspitr.tspitr;

  COUNT(*)
----------
    50315

SQL> select count(*) from test.test;

  COUNT(*)
----------
    50316


5.使用RMAN将源数据库中的表空间tspitr,test转换为目标平台字节序格式,使用format参数来控制被转换后数据文件的文件名和存储目录.
[Oracle@oracle11g ~]export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
[oracle@oracle11g ~]rman target/

Recovery Manager: Release 10.2.0.5.0 - Production on Mon Mar 30 10:35:41 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: TEST (DBID=2168949517)


RMAN> convert tablespace "TSPITR","TEST"
2> to platform 'AIX-Based Systems (64-bit)'
3> format ='/u02/transport/%U';

Starting backup at 2015-03-30 10:37:27
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00006 name=/u01/app/oracle/oradata/test/tspitr01.dbf
converted datafile=/u02/transport/data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00007 name=/u01/app/oracle/oradata/test/test01.dbf
converted datafile=/u02/transport/data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished backup at 2015-03-30 10:37:45


[oracle@oracle11g transport]$ ls -lrt
total 112776
-rw-r----- 1 oracle oinstall 104865792 Mar 30 10:37 data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8
-rw-r----- 1 oracle oinstall  10493952 Mar 30 10:37 data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo


6.使用导出工具创建传输表空间元数据dump文件
SQL> create or replace directory test_dump as '/u02/transport';

Directory created.

SQL> grant read,write on directory test_dump to public;

Grant succeeded.


[oracle@oracle11g dump_test]$ expdp 'sys/zzh_2046@test as sysdba' directory=test_dump dumpfile=tspitr_test.dmp logfile=tspitr_test.log transport_tablespaces=TSPITR,TEST

Export: Release 10.2.0.5.0 - Production on Monday, 30 March, 2015 10:57:37

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01":  "sys/********@test AS SYSDBA" directory=test_dump dumpfile=tspitr_test.dmp logfile=tspitr_test.log transport_tablespaces=TSPITR,TEST
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
  /u02/dump_test/tspitr_test.dmp
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 10:57:55

[oracle@oracle11g dump_test]ls -lrt

-rw-r----- 1 oracle oinstall      960 Mar 30 15:23 tspitr_test.log
-rw-r----- 1 oracle oinstall    90112 Mar 30 15:23 tspitr_test.dmp


7.将转换后存储在/u02/transport目录中的数据文件与导出的元数据文件tspitr_test.dmp传输到目标主机的目录/yb_oradata/transport中
ftp> put data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8
200 PORT command successful.
150 Opening data connection for data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v
8.
226 Transfer complete.
ftp: 发送 104865792 字节,用时 8.86秒 11839.88千字节/秒。
ftp> put data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo
200 PORT command successful.
150 Opening data connection for data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo.

226 Transfer complete.
ftp: 发送 10493952 字节,用时 0.90秒 11659.95千字节/秒。
ftp> put tspitr_test.dmp
200 PORT command successful.
150 Opening data connection for tspitr_test.dmp.
226 Transfer complete.

[IBMP740-1:oracle:/yb_oradata]$ls -lrt
-rwxrwxrwx    1 oracle  dba      104865792 Mar 30 12:42 data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8
-rwxrwxrwx    1 oracle  dba        10493952 Mar 30 12:42 data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo
-rwxrwxrwx    1 oracle  dba          98304 Mar 30 12:42 tspitr_test.dmp


8.将要被传输的表空间附加到目标数据库中
[IBMP740-1:oracle:/yb_oradata]$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Mar 30 11:31:47 2015

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create user tspitr identified by "tspitr";

User created.

SQL> grant dba,connect,resource to tspitr;

Grant succeeded.

SQL> create user test identified by "test";

User created.

SQL> grant dba,connect,resource to test;

Grant succeeded.

 

SQL> create or replace directory test_dump as '/yb_oradata/transport';

Directory created.

SQL> grant read,write on directory test_dump to public;

Grant succeeded.


[IBMP740-1:oracle]$impdp system/system directory=test_dump dumpfile=tspitr_test.dmp transport_datafiles=/yb_oradata/data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo,/yb_oradata/data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8

Import: Release 10.2.0.4.0 - 64bit Production on Monday, 30 March, 2015 11:45:48

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/******** directory=test_dump dumpfile=tspitr_test.dmp transport_datafiles=/yb_oradata/transport/data_D-TEST_I-2168949517_TS-TEST_FNO-7_3bq349vo,/yb_oradata/transport/data_D-TEST_I-2168949517_TS-TSPITR_FNO-6_3aq349v8
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-00721: changes by release 10.2.0.5.0 cannot be used by release 10.2.0.3.0

Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" stopped due to fatal error at 11:45:53


出错原因是因为源数据库的compatible=10.2.0.5.0,目标数据库的compatible=10.2.0.3.0这里在导出使用version=10.2.0.3.0导出元数据后再执行导出也是同样会报这个错误,因为这里不是逻辑导出,而是传输表空间,所以version参数不起作用。所以想修改源数据库的compatible参数为10.2.0.3.0,但在10g以后,compatible参数只能增大不能减少。
SQL> show parameter compatible

NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 compatible string 10.2.0.5.0

SQL> alter system set compatible='10.2.0.3.0' scope=spfile;

System altered.

SQL> shutdown immediate
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup
 ORACLE instance started.

Total System Global Area 167772160 bytes
 Fixed Size 1272600 bytes
 Variable Size 109053160 bytes
 Database Buffers 54525952 bytes
 Redo Buffers 2920448 bytes
 ORA-00201: control file version 10.2.0.5.0 incompatible with ORACLE version
 10.2.0.3.0
 ORA-00202: control file: '/u01/app/oracle/oradata/test/control01.ctl'

在将源数据库的compatible参数修改为10.2.0.3.0后无法启动数据库。

更多详情见请继续阅读下一页的精彩内容:

--------------------------------------推荐阅读 --------------------------------------

RMAN 配置归档日志删除策略

Oracle基础教程之通过RMAN复制数据库

RMAN备份策略制定参考内容

RMAN备份学习笔记

Oracle数据库备份加密 RMAN加密

--------------------------------------分割线 --------------------------------------


    
 
 

您可能感兴趣的文章:

 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • rman备份脚本和rman增量备份脚本分享
  • Oracle数据库备份和恢复工具 RMan
  • catalog方式的rman备份与恢复示例
  • rman配置及rman常用命令操作
  • win平台oracle rman备份和删除dg备库归档日志脚本
  • linux自动运行rman增量备份脚本
  • 9i下RMAN的备份及恢复步骤
  • Oracle相关:Rman Crosscheck删除失效归档
  • ORACLE 数据库RMAN备份恢复
  • rman恢复方案和oracle异机恢复
  • Oracle RMAN快速入门指南


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3