如何通过RMAN使用传输表空间迁移到不同的Endian平台 (Doc ID 371556.1)
How to Migrate to different Endian Platform Using Transportable Tablespaces With RMAN (Doc ID 371556.1)
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.1.0.2 to 12.2.0.1 [Release 12.1 to 12.2]
Oracle Database - Enterprise Edition - Version 9.2.0.3 to 9.2.0.3 [Release 9.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Information in this document applies to any platform.
******************* WARNING *************
Document 1334152.1 Corrupt IOT when using Transportable Tablespace to HP from different OS
Document 13001379.8 Bug 13001379 - Datapump transport_tablespaces produces wrong dictionary metadata for some tables
GOAL
Starting with Oracle Database 10g, you can transport tablespaces across platforms. In this note there is a step by step guide about how to do it with ASM datafiles and with OS filesystem datafiles.
从 Oracle Database 10g 开始,您可以跨平台传输表空间。在本说明中,提供了有关如何使用ASM数据文件和OS文件系统数据文件进行操作的逐步指南。
If your goal is to migrate a database to different endian platform, the following high-level steps describe how to migrate a database to a new platform using transportable tablespace:
如果您的目标是将数据库迁移到其他字节序平台,则以下高级步骤描述了如何使用可传输表空间将数据库迁移到新平台:
1.- Create a new, empty database on the destination platform. 在目标平台上创建一个新的空数据库
2.- Import objects required for transport operations from the source database into the destination database. 将传输操作所需的对象从源数据库导入到目标数据库
3.- Export transportable metadata for all user tablespaces from the source database. 从源数据库导出所有用户表空间的可传输元数据
4.- Transfer data files for user tablespaces to the destination system. 将用户表空间的数据文件传输到目标系统
5.- Use RMAN to convert the data files to the endian format of the destination system. 使用RMAN将数据文件转换为目标系统的字节序格式
6.- Import transportable metadata for all user tablespaces into the destination database. 将所有用户表空间的可传输元数据导入目标数据库
You could also convert the datafiles at source platform and once converted transfer them to destination platform.
您也可以在源平台上转换数据文件,转换后将其传输到目标平台
The MAA white paper "Platform Migration Using Transportable Tablespace" is available at
MAA白皮书“使用传输表空间进行平台迁移”可从以下网站获得
From 11.2.0.4, 12C and further, if converting to Linux x86-64 consider to follow this doc:
从11.2.0.4、12C起,如果转换为Linux x86-64,请考虑遵循以下文档
Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup [1389592.1]
For 12c you can also refer 对于12c,您还可以参考
12c How Perform Cross-Platform Database Transport to different Endian Platform with RMAN Backup Sets Document 2013271.1
SOLUTION
Supported platforms 支持平台
You can query the V$TRANSPORTABLE_PLATFORM view to see the platforms that are supported and to determine each platform's endian format (byte ordering).
您可以查询 V$TRANSPORTABLE_PLATFORM 视图以查看受支持的平台,并确定每个平台的字节序格式(字节顺序)
SQL> COLUMN PLATFORM_NAME FORMAT A32 SQL> SELECT * FROM V$TRANSPORTABLE_PLATFORM; PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT ----------- -------------------------------- -------------- 1 Solaris[tm] OE (32-bit) Big 2 Solaris[tm] OE (64-bit) Big 7 Microsoft Windows IA (32-bit) Little 10 Linux IA (32-bit) Little 6 AIX-Based Systems (64-bit) Big 3 HP-UX (64-bit) Big 5 HP Tru64 UNIX Little 4 HP-UX IA (64-bit) Big 11 Linux IA (64-bit) Little 15 HP Open VMS Little 8 Microsoft Windows IA (64-bit) Little 9 IBM zSeries Based Linux Big 13 Linux 64-bit for AMD Little 16 Apple Mac OS Big 12 Microsoft Windows 64-bit for AMD Little 17 Solaris Operating System (x86) Little
If the source platform and the target platform are of different endianness, then an additional step must be done on either the source or target platform to convert the tablespace being transported to the target format. If they are of the same endianness, then no conversion is necessary and tablespaces can be transported as if they were on the same platform.
如果源平台和目标平台的字节序不同,则必须在源平台或目标平台上执行其他步骤,以将要传输的表空间转换为目标格式。如果它们具有相同的字节序,则无需进行转换,就可以像在同一平台上一样传输表空间
Transporting the tablespace 传输表空间
- Prepare for export of the tablespace. 准备导出表空间
- Check that the tablespace will be self contained: 检查表空间是否是自包含的
SQL> execute sys.dbms_tts.transport_set_check('TBS1,TBS2', true); SQL> select * from sys.transport_set_violations;
Note: these violations must be resolved before the tablespaces can be transported. 注意:必须先解决这些冲突,然后才能传输表空间 - The tablespaces need to be in READ ONLY mode in order to successfully run a transport tablespace export: 表空间需要处于只读模式才能成功运行传输表空间导出
SQL> ALTER TABLESPACE TBS1 READ ONLY; SQL> ALTER TABLESPACE TBS2 READ ONLY;
- Check that the tablespace will be self contained: 检查表空间是否是自包含的
- Export the metadata. 导出元数据
- Using the original export utility: 使用原始的导出实用程序
exp userid=\'sys/sys as sysdba\' file=tbs_exp.dmp log=tba_exp.log transport_tablespace=y tablespaces=TBS1,TBS2
- Using Datapump export: 使用Datapump导出
First create the directory object to be used for Datapump, like in: 首先创建要用于Datapump的目录对象
CREATE OR REPLACE DIRECTORY dpump_dir AS '/tmp/subdir' ; GRANT READ,WRITE ON DIRECTORY dpump_dir TO system;
Then initiate Datapump Export: 然后启动Datapump Export
expdp system/password DUMPFILE=expdat.dmp DIRECTORY=dpump_dir TRANSPORT_TABLESPACES = TBS1,TBS2
If you want to perform a transport tablespace operation with a strict containment check, use the TRANSPORT_FULL_CHECK parameter: 如果要执行严格限制检查的传输表空间操作,请使用TRANSPORT_FULL_CHECK参数
expdp system/password DUMPFILE=expdat.dmp DIRECTORY = dpump_dir TRANSPORT_TABLESPACES= TBS1,TBS2 TRANSPORT_FULL_CHECK=Y
If the tablespace set being transported is not self-contained then the export will fail. 如果要传输的表空间集不是自包含的,则导出将失败
- Using the original export utility: 使用原始的导出实用程序
- Use V$TRANSPORTABLE_PLATFORM to determine the endianness of each platform. You can execute the following query on each platform instance: 使用 V$TRANSPORTABLE_PLATFORM 来确定每个平台的字节序。您可以在每个平台实例上执行以下查询
SELECT tp.platform_id,substr(d.PLATFORM_NAME,1,30), ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
If you see that the endian formats are different and then a conversion is necessary for transporting the tablespace set: 如果您发现字节序格式不同,则必须进行转换才能传输表空间集
RMAN> convert tablespace TBS1 to platform="Linux IA (32-bit)" FORMAT '/tmp/%U'; RMAN> convert tablespace TBS2 to platform="Linux IA (32-bit)" FORMAT '/tmp/%U';
Then copy the datafiles as well as the export dump file to the target environment. 然后将数据文件以及导出转储文件复制到目标环境 - Import the transportable tablespace. 导入可传输表空间
- Using the original import utility: 使用原始的导入实用程序
imp userid=\'sys/sys as sysdba\' file=tbs_exp.dmp log=tba_imp.log transport_tablespace=y datafiles='/tmp/....','/tmp/...'
- Using Datapump: 使用数据泵
CREATE OR REPLACE DIRECTORY dpump_dir AS '/tmp/subdir'; GRANT READ,WRITE ON DIRECTORY dpump_dir TO system;
Followed by: 其次是
impdp system/password DUMPFILE=expdat.dmp DIRECTORY=dpump_dir TRANSPORT_DATAFILES='/tmp/....','/tmp/...' REMAP_SCHEMA=(source:target) REMAP_SCHEMA=(source_sch2:target_schema_sch2)
You can use REMAP_SCHEMA if you want to change the ownership of the transported database objects. 如果要更改传输的数据库对象的所有权,可以使用REMAP_SCHEMA
- Using the original import utility: 使用原始的导入实用程序
- Put the tablespaces in read/write mode: 将表空间置于读/写模式
SQL> ALTER TABLESPACE TBS1 READ WRITE; SQL> ALTER TABLESPACE TBS2 READ WRITE;
Using DBMS_FILE_TRANSFER
You can also use DBMS_FILE_TRANSFER to copy datafiles to another host.
您还可以使用 DBMS_FILE_TRANSFER 将数据文件复制到另一个主机
In releases lower than 11.2.0.4 you need to follow the same steps specified above for ASM files. But if the endian formats are different then you must use the RMAN convert AFTER transfering the files. The files cannot be copied directly between two ASM instances at different platforms.
在低于11.2.0.4的发行版中,您需要遵循上述为ASM文件指定的相同步骤。但是,如果字节序格式不同,则在传输文件后必须使用RMAN转换。无法在不同平台上的两个ASM实例之间直接复制文件。
This is an example of usage: 这是用法示例
RMAN> CONVERT DATAFILE '/path/tbs_31.f', '/path/tbs_32.f', '/path/tbs_41.f' TO PLATFORM="Solaris[tm] OE (32-bit)" FROM PLATFORM="HP TRu64 UNIX" DB_FILE_NAME_CONVERT= "/path_source/", "/path_dest/" PARALLELISM=5;
The same example, but here showing the destination being an +ASM diskgroup: 相同的示例,但此处显示的目标是+ASM磁盘组
RMAN> CONVERT DATAFILE '/path/tbs_31.f', '/path/tbs_32.f', '/path/tbs_41.f' TO PLATFORM="Solaris[tm] OE (32-bit)" FROM PLATFORM="HP TRu64 UNIX" DB_FILE_NAME_CONVERT="/path_source/", "+diskgroup" PARALLELISM=5;
- Index Organized Tables (IOT) can become corrupt when using Transportable Tablespace (TTS) from Solaris, Linux or AIX to HP/UX. 使用从Solaris,Linux或AIX到HP/UX的可传输表空间(TTS)时,索引组织表(IOT)可能会损坏
This is a restriction caused by BUG:9816640. 这是由BUG:9816640引起的限制
Currently there is no patch for this issue, the Index Organized Tables (IOT) need to be recreated after the TTS. 当前没有针对此问题的补丁程序,需要在TTS之后重新创建索引组织表(IOT)。
See Document 1334152.1 Corrupt IOT when using Transportable Tablespace to HP from different OS. - When using dropped columns, Bug:13001379 - Datapump transport_tablespaces produces wrong dictionary metadata for some tables can occur.See Document 1440203.1 for details on this alert.
=> Unpublished Bug 13636964 - ORA-19563 from RMAN convert on datafile copy transferred with DBMS_FILE_TRANSFER (Doc ID 13636964.8)
Versions confirmed as being affected
11.2.0.3
This issue is fixed in
12.1.0.1 (Base Release)
11.2.0.4 (Future Patch Set)
Description
A file transferred using DBMS_FILE_TRANSFER fails during an RMAN convert
operation.
eg:
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of conversion at target command at 01/24/2012 16:22:23
ORA-19563: cross-platform datafile header validation failed for file +RECO/tbs_9.tf
Rediscovery Notes:
If RMAN convert fails on a file transferred using DBMS_FILE_TRANSFER
then it may be due to this bug
Workaround
Transfer the file using OS facilities.
Additional Resources 其他资源
Community: Database Utilities
Still have questions? Use the above community to search for similar discussions or start a new discussion on this subject.
Limitations on Transportable Tablespace Use 可移动表空间使用的限制
- The source and target database must use the same character set and national character set. 源数据库和目标数据库必须使用相同的字符集和国家字符集
- You cannot transport a tablespace to a target database in which a tablespace with the same name already exists. However, you can rename either the tablespace to be transported or the destination tablespace before the transport operation. 您无法将表空间传输到目标数据库中已经存在相同名称的表空间。但是,您可以在传输操作之前重命名要传输的表空间或目标表空间
- Objects with underlying objects (such as materialized views) or contained objects (such as partitioned tables) are not transportable unless all of the underlying or contained objects are in the tablespace set. 具有基础对象(例如,物化视图)或包含对象(例如,分区表)的对象是不可传输的,除非所有基础对象或包含的对象都在表空间集中
- Review Table "Objects Exported and Imported in Each Mode" from the Oracle Database Utilities documentation, there are several object types that are not exported in tablespace mode. 查看Oracle数据库实用程序文档中的表“在每种模式下导出和导入的对象”,有几种对象类型未在表空间模式下导出
- If the owner/s of tablespace objects does not exist on target database, the usernames need to be created manually before starting the transportable tablespace import. 如果目标数据库上不存在表空间对象的所有者,则需要在开始传输表空间导入之前手动创建用户名
- If you use spatial indexes, then: 如果使用空间索引,则
- be aware that TTS across different endian platforms are not supported for spatial indexes in 10gR1 and 10gR2; such a limitation has been released in 11g 请注意,10gR1和10gR2中的空间索引不支持跨不同字节序平台的TTS;这样的限制已在11g中发布
- specific Spatial packages must be run before exporting and after transportation, please see Oracle Spatial documentation. 特定的Spatial软件包必须在导出之前和运输之后运行,请参阅Oracle Spatial文档
- If you use spatial indexes, then: 如果使用空间索引,则
- Beginning with Oracle Database 11g Release 1, you must use only Data Pump to export and import the tablespace metadata for tablespaces that contain XMLTypes. 从Oracle Database 11g第1版开始,必须仅使用数据泵来导出和导入包含XMLTypes的表空间的表空间元数据
The following query returns a list of tablespaces that contain XMLTypes: 以下查询返回包含XMLTypes的表空间的列表
select distinct p.tablespace_name from dba_tablespaces p, dba_xml_tables x, dba_users u, all_all_tables t where t.table_name=x.table_name and t.tablespace_name=p.tablespace_name and x.owner=u.username;
Transporting tablespaces with XMLTypes has the following limitations: 使用XMLTypes传输表空间有以下限制- The target database must have XML DB installed. 目标数据库必须安装了XML DB
- Schemas referenced by XMLType tables cannot be the XML DB standard schemas. XMLType表引用的架构不能是XML DB标准架构
- Schemas referenced by XMLType tables cannot have cyclic dependencies. XMLType表引用的模式不能具有循环依赖性
- Any row level security on XMLType tables is lost upon import. 导入后,XMLType表上的任何行级安全性都会丢失
- If the schema for a transported XMLType table is not present in the target database, it is imported and registered. If the schema already exists in the target databasean error is returned unless the ignore=y option is set. 如果目标数据库中不存在用于传输的XMLType表的模式,则将其导入并注册。如果该模式已存在于目标数据库中,则除非设置了ignore = y选项,否则将返回错误
- Advanced Queues Transportable tablespaces do not support 8.0-compatible advanced queues with multiple recipients. 高级队列可移动表空间不支持具有多个收件人的8.0兼容高级队列
- You cannot transport the SYSTEM tablespace or objects owned by the user SYS. 您不能传输SYSTEM表空间或用户SYS拥有的对象
- Opaque Types Types(such as RAW, BFILE, and the AnyTypes) can be transported, but they are not converted as part of the cross-platform transport operation. Their actual structure is known only to the application, so the application must address any endianness issues after these types are moved to the new platform. 可以传输不透明的类型(例如RAW,BFILE和AnyTypes),但不能将其转换为跨平台传输操作的一部分。它们的实际结构只有应用程序知道,因此在将这些类型移至新平台后,应用程序必须解决所有字节序问题
- Floating-Point Numbers BINARY_FLOAT and BINARY_DOUBLE types are transportable using Data Pump but not the original export utility, EXP. 浮点数BINARY_FLOAT和BINARY_DOUBLE类型可以使用数据泵进行传输,但不能使用原始导出实用程序EXP进行传输。
- Please also check Document 1454872.1 - Transportable Tablespace (TTS) Restrictions and Limitations: Details, Reference, and Version Where Applicable 另请检查文档 1454872.1
Transportable tablespace EXP/IMP of ASM files ASM文件的可传输表空间EXP/IMP
- Using RMAN CONVERT
There is no direct way to exp/imp ASM files as transportable tablespace. However, the funcationality can be done via RMAN.
没有直接方法将ASM文件作为可移动表空间进行Exp / imp。但是,功能性可以通过RMAN完成
You must follow this steps: 您必须按照以下步骤操作:- Prepare for exporting the tablespace. 准备导出表空间
- Check that the tablespace will be self contained: 检查表空间是否是自包含的
SQL>execute sys.dbms_tts.transport_set_check('TBS1,TBS2', true); SQL> select * from sys.transport_set_violations;
Note: these violations must be resolved before the tablespaces can be transported. 注意:必须先解决这些冲突,然后才能传输表空间 - The tablespaces need to be in READ ONLY mode in order to successfully run a transport tablespace export: 表空间需要处于只读模式才能成功运行传输表空间导出
SQL> ALTER TABLESPACE TBS1 READ ONLY; SQL> ALTER TABLESPACE TBS2 READ ONLY;
- Check that the tablespace will be self contained: 检查表空间是否是自包含的
- Export the metadata. 导出元数据
- Using the original export utility: 使用原始的导出实用程序
exp userid=\'sys/sys as sysdba\' file=tbs_exp.dmp log=tba_exp.log transport_tablespace=y tablespaces=TBS1,TBS2
- Using Datapump Export: 使用数据泵导出
CREATE OR REPLACE DIRECTORY dpump_dir AS '/tmp/subdir'; GRANT READ,WRITE ON DIRECTORY dpump_dir TO system;
followed by: 其次是
expdp system/password DUMPFILE=expdat.dmp DIRECTORY=dpump_dir TRANSPORT_TABLESPACES = TBS1,TBS2
If you want to perform a transport tablespace operation with a strict containment check, use the TRANSPORT_FULL_CHECK parameter: 如果要执行严格限制检查的传输表空间操作,请使用TRANSPORT_FULL_CHECK参数
expdp system/password DUMPFILE=expdat.dmp DIRECTORY = dpump_dir TRANSPORT_TABLESPACES= TBS1,TBS2 TRANSPORT_FULL_CHECK=Y
If the tablespace set being transported is not self-contained, then the export will fail. 如果要传输的表空间集不是自包含的,则导出将失败 - Using the original export utility: 使用原始的导出实用程序
- Use V$TRANSPORTABLE_PLATFORM to find the exact platform name of target database. You can execute the following query on target platform instance: 使用 V$TRANSPORTABLE_PLATFORM查找目标数据库的确切平台名称。您可以在目标平台实例上执行以下查询
SELECT tp.platform_id,substr(d.PLATFORM_NAME,2,30), ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
- Generate an OS file from the ASM file, in target platform format: 从ASM文件生成目标平台格式的OS文件
RMAN> CONVERT TABLESPACE TBS1 TO PLATFORM 'HP-UX (64-bit)' FORMAT '/tmp/%U'; RMAN> CONVERT TABLESPACE TBS2 TO PLATFORM 'HP-UX (64-bit)' FORMAT '/tmp/%U';
- Copy the generated file to target server if different from source. 如果与源文件不同,则将生成的文件复制到目标服务器
- Import the transportable tablespace 导入可移动表空间
- Using the original import utility: 使用原始的导入实用程序
imp userid=\'sys/sys as sysdba\' file=tbs_exp.dmp log=tba_imp.log transport_tablespace=y datafiles='/tmp/....','/tmp/...'
- Using Datapump Import: 使用数据泵导入
CREATE OR REPLACE DIRECTORY dpump_dir AS '/tmp/subdir'; GRANT READ,WRITE ON DIRECTORY dpump_dir TO system;
followed by: 其次是
impdp system/password DUMPFILE=expdat.dmp DIRECTORY=dpump_dir TRANSPORT_DATAFILES='/tmp/....','/tmp/...' REMAP_SCHEMA=(source:target) REMAP_SCHEMA=(source_sch2:target_schema_sch2)
You can use REMAP_SCHEMA if you want to change the ownership of the transported database objects. 如果要更改传输的数据库对象的所有权,可以使用REMAP_SCHEMA
- Using the original import utility: 使用原始的导入实用程序
- Put the tablespaces in read/write mode: 将表空间置于读/写模式
SQL> ALTER TABLESPACE TBS1 READ WRITE; SQL> ALTER TABLESPACE TBS2 READ WRITE;
If you want to transport the datafiles from ASM area to filesystem, you have finished after the above steps. But if you want to transport tablespaces between two ASM areas you must continue. 如果要将数据文件从ASM区域传输到文件系统,请完成上述步骤。但是,如果要在两个ASM区域之间传输表空间,则必须继续。 - Copy the datafile '/tmp/....dbf' into the ASM area using rman: 使用 rman将数据文件 '/tmp/....dbf' 复制到ASM区域
rman nocatalog target / RMAN> backup as copy datafile '/tmp/....dbf' format '+DGROUPA';
where +DGROUPA is the name of the ASM diskgroup. 其中+ DGROUPA是ASM磁盘组的名称 - Switch the datafile to the copy. 将数据文件切换到副本
If the 10g database is open you need to offline the datafile first: 如果10g数据库已打开,则需要首先使数据文件脱机
SQL> alter database datafile '/tmp/....dbf' offline;
Switch to the copy: 切换到副本
rman nocatalog target / RMAN> switch datafile '/tmp/....dbf' to copy;
Note down the name of the copy created in the +DGROUPA diskgroup, ex. '+DGROUPA/s101/datafile/tts.270.5'. 记下在+ DGROUPA磁盘组中创建的副本的名称,例如 '+DGROUPA/s101/datafile/tts.270.5'。 - Put the datafile online again, we need to recover it first: 将数据文件再次联机,我们需要首先对其进行恢复
SQL> recover datafile '+DGROUPA/SID/datafile/tts.270.5'; SQL> alter database datafile '+DGROUPA/SID/datafile/tts.270.5' online;
- Check if datafile is indeed part of the ASM area and online: 检查数据文件是否确实是ASM区域的一部分并且在线
SQL> select name, status from v$datafile;
The output should be: 输出应为
+DGROUPA/SID/datafile/tts.270.5 ONLINE
- Prepare for exporting the tablespace. 准备导出表空间
- Using DBMS_FILE_TRANSFER
You can also use DBMS_FILE_TRANSFER to copy datafiles from one ASM disk group to another, even on another host. Starting with 10g release 2 you can also use DBMS_FILE_TRANSFER also to copy datafiles from ASM to filesystem and to filesystem to ASM.
您还可以使用DBMS_FILE_TRANSFER将数据文件从一个ASM磁盘组复制到另一个,甚至在另一台主机上。从10g第2版开始,您还可以使用DBMS_FILE_TRANSFER将数据文件从ASM复制到文件系统以及从文件系统复制到ASM。
The PUT_FILE procedure reads a local file or ASM and contacts a remote database to create a copy of the file in the remote file system. The file that is copied is the source file, and the new file that results from the copy is the destination file. The destination file is not closed until the procedure completes successfully.
PUT_FILE过程读取本地文件或ASM并联系远程数据库以在远程文件系统中创建文件的副本。复制的文件是源文件,复制后的新文件是目标文件。在过程成功完成之前,不会关闭目标文件。
Syntax: 语法
DBMS_FILE_TRANSFER.PUT_FILE( source_directory_object IN VARCHAR2, source_file_name IN VARCHAR2, destination_directory_object IN VARCHAR2, destination_file_name IN VARCHAR2, destination_database IN VARCHAR2);
Where:
- source_directory_object: The directory object from which the file is copied at the local source site. This directory object must exist at the source site. 在本地源站点上从中复制文件的目录对象。此目录对象必须在源站点上存在
- source_file_name: The name of the file that is copied from the local file system. This file must exist in the local file system in the directory associated with the source directory object. 从本地文件系统复制的文件的名称。此文件必须存在于与源目录对象关联的目录中的本地文件系统中
- destination_directory_object: The directory object into which the file is placed at the destination site. This directory object must exist in the remote file system. 将文件放置在目标站点上的目录对象。该目录对象必须存在于远程文件系统中
- destination_file_name: The name of the file placed in the remote file system. A file with the same name must not exist in the destination directory in the remote file system. 放置在远程文件系统中的文件的名称。远程文件系统的目标目录中不得存在相同名称的文件
- destination_database: The name of a database link to the remote database to which the file is copied. 指向文件复制到的远程数据库的数据库链接的名称。
If we want to use DBMS_FILE_TRANSFER.PUT_FILE to transfer the file from source to destination host, the steps 3,4,5 should be changed by the following: 如果我们要使用DBMS_FILE_TRANSFER.PUT_FILE将文件从源主机传输到目标主机,则应更改以下步骤3、4、5:- Create a directory at target database host, and give permissions to local user. This is the directory object into which the file is placed at the destination site, it must exist in the remote file system: 在目标数据库主机上创建目录,并将权限授予本地用户。这是文件放置在目标站点上的目录对象,它必须存在于远程文件系统中
CREATE OR REPLACE DIRECTORY target_dir AS '+DGROUPA'; GRANT WRITE ON DIRECTORY target_dir TO "USER";
- Create a directory at source database host. The directory object from which the file is copied at the local source site. This directory object must exist at the source site: 在源数据库主机上创建目录。在本地源站点上复制文件的目录对象。此目录对象必须存在于源站点上
CREATE OR REPLACE DIRECTORY source_dir AS '+DGROUPS/subdir'; GRANT READ,WRITE ON DIRECTORY source_dir TO "USER"; CREATE OR REPLACE DIRECTORY source_dir_1 AS '+DGROUPS/subdir/subdir_2';
- Create a dblink to connect to target database host: 创建一个dblink以连接到目标数据库主机
CREATE DATABASE LINK DBS2 CONNECT TO 'user' IDENTIFIED BY 'password' USING 'target_connect';
where target_connect is the connect string for target database and USER is the user that we are going to use to transfer the datafiles. 其中target_connect是目标数据库的连接字符串,而USER是我们将用于传输数据文件的用户 - Connect to source instance. The following items are used: 连接到源实例。使用了以下项目
- dbs1: Connect string to source database 将字符串连接到源数据库
- dbs2: dblink to target database 到目标数据库的dblink
- a1.dat: Filename at source database 源数据库中的文件名
- a4.dat: Filename at target database 目标数据库上的文件名
CONNECT user/password@dbs1 -- - put a1.dat to a4.dat (using dbs2 dblink) -- - level 2 sub dir to parent dir -- - user has read privs on source_dir_1 at dbs1 and write on target_dir -- - in dbs2 BEGIN DBMS_FILE_TRANSFER.PUT_FILE('source_dir_1', 'a1.dat', 'target_dir', 'a4.dat', 'dbs2' ); END;
REFERENCES
BUG:9816640 - ORA-600 [6200] ORA-600 [KDDUMMY_BLKCHK] IOT CORRUPTION CODE 6401 AFTER TTS
NOTE:1493809.1 - How to Move a Database Using Transportable Tablespaces
http://www.oracle.com/technetwork/database/features/availability/maa-wp-11g-platformmigrationtts-129269.pdf
BUG:13001379 - DATAPUMP TRANSPORT_TABLESPACES PRODUCES WRONG METADATA FOR SOME TABLES
http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/d_ftran.htm#CHDEFEGG
NOTE:1389592.1 - 11G - Reduce Transportable Tablespace Downtime using Cross Platform Incremental Backup
NOTE:1989198.1 - TTS changed XMLTYPE from CLOB to Binary, XML Tag Syntax are Changed