使用可移动表空间(TTS)的最佳做法 (Doc ID 1457876.1)

Best Practices for Using Transportable Tablespaces (TTS) (Doc ID 1457876.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 12.1.0.1 [Release 9.2 to 12.1]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

PURPOSE

 The purpose of this document is to discuss best practices when using transportable tablespaces (TTS), especially when migrating databases to a different RDBMS version and/or OS.

本文的目的是讨论使用传输表空间(TTS)时的最佳实践,尤其是在将数据库迁移到其他RDBMS版本和/或OS时。

SCOPE

The suggestions in this note generally apply to all databases.  E-Business Suite (EBS) databases, however, have specific instructions for using TTS.   For information regarding TTS and EBS databases, please see one of these two notes:

本注释中的建议通常适用于所有数据库。 但是,电子商务套件(EBS)数据库具有使用TTS的特定说明。 有关TTS和EBS数据库的信息,请参阅以下两个注释之一:

Using Transportable Database to migrate Oracle E-Business Suite 11i Using Oracle Database 10.2.0 or 11.1.0 Document 729309.1

Using Transportable Database to migrate E-Business Suite R12 Using Oracle Database 10gR2 or 11gR1 Document 734763.1.

Note: With 12c, you can now use full transportable export/import to move complete databases for sources that are 11.2.0.3 and up to 12c targets.  If this is your scenario, you may want to consider whether or not TTS is still the best way to move your entire database.  See Document 1457743.1 Upgrading a Database Using Transportable Tablespaces (TTS) regarding the Full Transportable option.

注意:现在,使用12c,您可以使用Full传输的导出/导入来移动11.2.0.3和最多12c目标的源的完整数据库。 如果是这种情况,则可能要考虑TTS是否仍然是移动整个数据库的最佳方法。 有关 Full Transportable 选项,请参阅Document 1457743.1 Upgrading a Database Using Transportable Tablespaces (TTS) 。

DETAILS

1.  Check restrictions/limitations  检查限制

It is important to know up front if your source and target databases are going to be compatible, and if there will be any limitations on the transport of your objects.  The best place to check for a consolidated list is in Document 1454872.1  Transportable Tablespace (TTS) Restrictions and Limitations: Details, Reference, and Version Where Applicable. 

重要的是要事先知道您的源数据库和目标数据库是否兼容,以及对象的传输是否存在任何限制。检查合并列表的最佳位置是Document 1454872.1  Transportable Tablespace (TTS) Restrictions and Limitations: Details, Reference, and Version Where Applicable. 

2.  Check for corruption bugs and common issues 检查腐败错误和常见问题

Depending on your version of target and source database, there could be several bugs that could affect the smooth transport of objects from one database to another.   Normally, Oracle does not recommend you apply one-off patches for issues you are not experiencing.   However, if you know you have objects in the target database that could hit the scenario reported in a corruption bug, we do recommend you apply the one-off patch to avoid the issue.  In general, if the bug involves the export, patch the source database; if the bug involves the import, patch the target database.  Keep in mind that target databases can later become source databases themselves.  See Document 1166564.1 "Master Note for Transportable Tablespaces (TTS) -- Common Questions and Issues" for corruption bugs and major known issues/errors.
根据目标数据库和源数据库的版本,可能存在多个错误,这些错误可能会影响对象从一个数据库到另一个数据库的平稳传输。通常,Oracle不建议您针对未遇到的问题应用一次性修补程序。但是,如果您知道目标数据库中的对象可能会遇到损坏错误中报告的情况,那么我们建议您应用一次性修补程序来避免此问题。通常,如果该错误涉及导出,请修补源数据库;否则,请执行以下操作。如果错误涉及导入,请修补目标数据库。请记住,目标数据库以后可以成为源数据库本身。有关损坏的错误和主要的已知问题/错误,请参见Document 1166564.1 "Master Note for Transportable Tablespaces (TTS) -- Common Questions and Issues
If you find there are a number of patches you need to apply, we recommend using the MOS Patch Planner. 

如果发现有许多补丁需要应用,我们建议使用MOS补丁计划器。

3.  Resolve invalid objects in the source database  解决源数据库中的无效对象

Before taking the export from the source database, make sure there are no invalid objects.  Although SYS-owned objects are not transported, invalid SYS-owned objects can prevent the success of the export, depending on the invalid object.  The best practice is to make sure all issues are resolved in the source database before transporting objects to another one.   Here is a query you can use to find the invalid objects in your database:

从源数据库进行导出之前,请确保没有无效的对象。尽管不传输SYS拥有的对象,但是无效的SYS拥有的对象可能会阻止导出成功,具体取决于无效的对象。最佳实践是,在将对象传输到另一个数据库之前,请确保源数据库中的所有问题均已解决。您可以使用以下查询在数据库中查找无效对象:

col owner for a15
col object_name for a35
col object_type for a20
select owner, object_name, object_type from dba_objects
where status !='VALID' order by owner, object_type, object_name;

4.  Check the TTS tablespaces you want to export are self-contained. 检查要导出的TTS表空间是独立的

You need to make sure that the set of objects you want to transport are self-contained within the set of tablespaces you are specifying; that is, that there are no objects they depend on in other tablespaces.  Use DBMS_TTS.TRANSPORT_SET_CHECK to check for self-containment of objects in the transportable set, Document 1459800.1 "How to Fix Transport Set Check Violations (DBMS_TTS.TRANSPORT_SET_CHECK)(ORA-39908, ORA-39910, ORA-39932, ORA-39921, etc.)," tells you how to do this.

您需要确保要传输的对象集在指定的表空间内是独立的。也就是说,在其他表空间中没有它们依赖的对象。使用 DBMS_TTS.TRANSPORT_SET_CHECK 检查可传输集中的对象的自包​​含性,Document 1459800.1 "How to Fix Transport Set Check Violations (DBMS_TTS.TRANSPORT_SET_CHECK)(ORA-39908, ORA-39910, ORA-39932, ORA-39921, etc.),告诉您如何执行此操作。

5.  Take a full "structural export" (no rows)  进行完整的“结构导出”(no rows)

A full structural export is a full export (expdp or exp) with no data -- that is, it contains all the create statements necessary to recreate objects that won't be transported with TTS.   You need this export because some objects reside in the SYSTEM tablespace, such as views, triggers, roles, grants, etc. and cannot be exported with TTS.   Additionally, if you use the traditional export/import (exp/imp) and not datapump export/import (expdp/impdp), there are additional objects that are not transported.  If you are using traditional exp/imp, see Document 883153.1 What Objects Are Exported With Transportable Tablespaces (TTS) and the ORIGINAL Export Utility?  Note that tradition exp/imp is not supported for 11gR2 TTS and above.

完整的结构导出是不包含数据的完整导出(expdp或exp)-也就是说,它包含重新创建将不会与TTS一起传输的对象所需的所有create语句。您需要进行此导出,因为某些对象驻留在SYSTEM表空间中,例如视图,触发器,角色,授权等,并且无法与TTS一起导出。此外,如果您使用传统的导出/导入(exp / imp)而不是datapump导出/导入(expdp / impdp),则还有其他未传输的对象。如果您使用的是传统的exp / imp,请参见 Document 883153.1 What Objects Are Exported With Transportable Tablespaces (TTS) and the ORIGINAL Export Utility? 请注意,11gR2 TTS及更高版本不支持传统的exp / imp。

6.  Make sure usernames exist in the target database before importing  导入之前,请确保目标数据库中存在用户名

Before importing, make sure the usernames (schema owners) for the objects being exported already exist in the target database.   If not, you will need to manually create the usernames before starting the transportable tablespace import.

导入之前,请确保目标数据库中已经存在要导出的对象的用户名(模式所有者)。如果没有,则在开始可移植表空间导入之前,您将需要手动创建用户名。

If you pre-create a user and it uses a default tablespace that is not yet plugged in, you need to temporarily assign a default tablespace that exists in the target database.  After the import is complete, you can alter the user and set the default tablespace to the desired one.

如果您预先创建了一个用户,并且该用户使用了尚未插入的默认表空间,则需要临时分配目标数据库中存在的默认表空间。导入完成后,您可以更改用户并将默认表空间设置为所需的表空间。

7. Import the full "structural export" (no rows) after you've plugged in the tablespaces 插入表空间后,导入完整的“结构导出”(no rows)

After the tablespaces are plugged in, the tablespaces are in read-only mode, and you have reset default tablespaces for your users, run the full structural import.   This should error on any objects that already exist (ignore) and create any that are missing, including roles, grants, triggers, etc.

插入表空间之后,表空间处于只读模式,并且您已为用户重置了默认表空间,请运行完整的结构导入。这应该在所有已经存在(忽略)的对象上出错并创建任何缺少的对象,包括角色,授予,触发器等。

8.  Do a dry run, especially for production databases  进行空运行,尤其是对于生产数据库

We recommend doing a dry run especially (1) if this is the first time you have been migrating a specific RDBMS version to another specific RDBMS version, and (2) if this is a production database.  Dry runs let you work out unexpected issues and determine timings before you actually take the downtime on the database being moved, migrated, and/or upgraded.  A dry run will also give you an accurate estimate for your company's change control procedures.

我们建议您特别尝试一下(1)如果这是您第一次将特定的RDBMS版本迁移到另一个特定的RDBMS版本,请尝试(2)如果这是生产数据库。试运行可让您解决意外问题并确定时间,然后再对正在移动,迁移和/或升级的数据库进行实际停机。试运行还将为您提供有关公司变更控制程序的准确估计。

9.  Keep the source database viable for a while, if possible  如果可能,使源数据库保持一段时间

It is a good idea to keep the source database viable (in read-only mode) until you have determined all objects are in the target database, and there are no issues; that is, the target database has been thoroughly checked out and exercised. 

在确定所有对象都在目标数据库中并且没有问题之前,保持源数据库(在只读模式下)可行是一个好主意。也就是说,目标数据库已被彻底检出并执行。

10. Pay attention to "clean up" on the source server  注意源服务器上的“清理”

If you moved a database to a different server via TTS (or any other method), remember clean up on the source server for things such as OS scripts that may be starting/stopping the listener (scripts in /etc/init.d, /etc/init, for example), cron jobs, and so forth.  Aliases and IP numbers are often reused during database moves to different servers; more than once, stopping the scripts on the source database server has been known to take down resources on the target server if cleanup has not first been done on the source server.  If you have materialized views in other databases that use a master table in the new target, be aware of where the dblinks in the remote databases are pointing; you may or may not need to recreate the dblinks, accordingly.

如果您通过TTS(或任何其他方法)将数据库移动到其他服务器,请记住在源服务器上清理诸如OS脚本之类可能会启动/停止侦听器(scripts in /etc/init.d, /etc/init, for example),cron作业等。别名和IP编号通常在数据库移至不同服务器的过程中被重用。如果不首先在源服务器上未进行清理,则已知不止一次地在源数据库服务器上停止脚本会占用目标服务器上的资源。如果您在使用新目标中的主表的其他数据库中拥有实例化视图,请注意远程数据库中的dblink指向何处;因此,您可能需要也可能不需要重新创建dblink。

Additional Resources

1. If you have materialized views, you may be interested in Document 1406586.1 How to Handle Materialized Views When You Upgrade or Clone a Database.

2. Oracle Database Administrator's Guide 11g Resease 2 (11.2)

3. Oracle Database Administrator's Guide 12c Release 1 (12.1) - Transporting Tablespaces Between Databases

4. Document 438035.1 How To Use Transportable Tablespaces To Copy OLAP Analytic Workspaces 

REFERENCES

NOTE:1166564.1 - Master Note for Transportable Tablespaces (TTS) -- Common Questions and Issues
NOTE:1406586.1 - How to Handle Materialized Views When You Upgrade or Clone a Database
NOTE:1454872.1 - Transportable Tablespace (TTS) Restrictions and Limitations: Details, Reference, and Version Where Applicable

posted @ 2019-12-10 10:55  ZYLONG-SYS  阅读(458)  评论(0编辑  收藏  举报