oracle数据库支持手动的跨平台移动数据库。主要存在的问题是不同平台的字节顺序可能不同。RMAN使用convert datafile和 convert tablespace命令将数据文件转换为正确的尾数格式。只有oracle 10g以上版本才支持跨平台移动数据库。
注意:该功能不是支持当前的所有平台。可查看平台相关文档以确定是否符合条件。
oracle采用两种字节顺序,big和little。如果平台字节顺序一致,那么可以使用以前常用的方法传送表空间,不会产生任何问题,如果字节顺序不同,需要使用rman的covert命令将表空间转换为目标平台的格式。可以通过v$database和v$transportable_platform来确定格式尾数:
SQL> select endian_format from v$transportable_platform tp,v$database d where tp.platform_name=d.platform_name;
ENDIAN_FORMAT
--------------
Little
如果两个平台返回相同结果,则不需要转换,否则需要使用rman convert转换。
查询各个平台的字节顺序:
SQL> SELECT * FROM v$transportable_platform ORDER BY endian_format;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ----------------------------------------------------------------------------------------------------- --------------
3 HP-UX (64-bit) Big
6 AIX-Based Systems (64-bit) Big
18 IBM Power Based Linux Big
2 Solaris[tm] OE (64-bit) Big
4 HP-UX IA (64-bit) Big
16 Apple Mac OS Big
1 Solaris[tm] OE (32-bit) Big
9 IBM zSeries Based Linux Big
17 Solaris Operating System (x86) Little
19 HP IA Open VMS Little
20 Solaris Operating System (x86-64) Little
12 Microsoft Windows x86 64-bit Little
13 Linux x86 64-bit Little
8 Microsoft Windows IA (64-bit) Little
21 Apple Mac OS (x86-64) Little
11 Linux IA (64-bit) Little
5 HP Tru64 UNIX Little
10 Linux IA (32-bit) Little
7 Microsoft Windows IA (32-bit) Little
15 HP Open VMS Little
首先需要将转换的表空间设置为只读模式,然后使用下面语句conver tablepsace并将数据文件放到其他位置:
RMAN> convert tablespace "TEST" to platform='AIX-Based Systems (64-bit)' db_file_name_convert='/opt/oracle/oradata/squan','/home/oracle';
Starting conversion at source at 24-MAY-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00005 name=/opt/oracle/oradata/squan/test02.dbf
converted datafile=/home/oracle/test02.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00006 name=/opt/oracle/oradata/squan/test01.dbf
converted datafile=/home/oracle/test01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished conversion at source at 24-MAY-14
也可以转换目标站点上的数据文件:
RMAN> convert datafile '/opt/oracle/oradata/squan/test01.dbf' from platform 'Linux x86 64-bit' db_file_name_convert='/opt/oracle/oradata/squan','/home/oracle/backup';
Starting conversion at target at 24-MAY-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input file name=/opt/oracle/oradata/squan/test01.dbf
converted datafile=/home/oracle/backup/test01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished conversion at target at 24-MAY-14
完成转换之后就可以手工进行移动数据文件和表空间。