Oracle NON-CDB转换为PDB几种方式
Posted lucifer三思后行
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle NON-CDB转换为PDB几种方式相关的知识,希望对你有一定的参考价值。
参考MOS文档:How to Convert Non-CDB to PDB - Step by Step Example (Doc ID 2288024.1)
将非CDB转换为PDB的方法:
If Source/Non-CDB is 11.2.0.3/11.2.0.4:
1) FULL-TTS
2) Datapump Export/Import
If Source/Non-CDB is already a 12c version:
1) FULL-TTS
2) DBMS_PDB.DESCRIBE
3) Datapump Export/Import
最简单通用的方法就是通过数据泵将源库NON-CDB导入到目标库CDB的PDB中。
Using FULL-TTS:
以下是使用FULL-TTS方法将非CDB转换为PDB的完整步骤:
Source: Non-CDB 12c database or 11g database
Target: 12c PDB database in the Container (CDB) database
1. Verify whether the Platforms are supported for transport?
2. Verify whether the Platforms differ by endian format? (for conversion)
3. Verify the National and Database Character Set.
4. Create an empty PDB in the Target CDB
5. Pre-create the 'Source Database Users' in the Target PDB or use REMAP_SCHEMA.
6. Make the user-defined and application tablespaces to READ-ONLY in Source.
7. Perform the FULL-TTS Export in Source.
8. Transport the FULL-TTS Dumpfile to the PDB Target location.
9. Transport the Datafiles to the PDB Target location. If endianness are different, Conversion of datafiles to Target Platform Endian is necessary.
10. Perform the FULL-TTS Import in Target.
11. When the FULL-TTS Import is complete, the tablespaces are automatically put into READ WRITE mode in Target.
12. Open the Source Tablespaces to READ WRITE upon successful completion of import. (this step can be after Step 9 as well)
For detailed steps on FULL-TTS, please follow the below documents.
a) Oracle Database Administrator Guide - Moving a Non-CDB to PDB in the target CDB
b) FULL-TTS WHITEPAPER FROM OTN
Using DBMS_PDB.DESCRIBE:
以下是使用“ DBMS_PDB.DESCRIBE”方法将12c非CDB转换为PDB的完整步骤:
1) Shutdown the 12c non-cdb database gracefully (shutdown immediate)
2) Now Open the 12c non-cdb database in Read-Only Mode
3) In the 12c non-CDB database, execute the "DBMS_PDB.DESCRIBE" package, which will create an XML file containing the description about the non-cdb database datafiles.
4) Shutdown the 12c non-cdb database
5) Connect to the target root CDB and check the compatibility of the 12c non-cdb database using "DBMS_PDB.CHECK_PLUG_COMPATIBILITY" package
6) If this package returns FALSE/NO, then check for violations in "PDB_PLUG_IN_VIOLATIONS" view and correct the errors and warnings.
7) If the above package returns TRUE/YES, then plug the 12c non-cdb as a PDB to the target cdb using the "CREATE PLUGGABLE DATABASE USING <xml>" command
8) Now switch or connect to the pdb using "ALTER SESSION SET CONTAINER=pdbname" and execute "$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql" script
9) Now open the PDB in read write mode using "ALTER PLUGGABLE DATABASE pdbname OPEN" command.
10) Now, the non-CDB has been converted to a PDB.
--如果要插入的数据库曾经是11g或已升级到12c,则需要应用必备补丁程序#20298413并重置使用以下查询返回的所有用户的密码
set linesize 120
col name for a15
col password for a20
col spare4 for a40
select u.name, u.password, u.spare4, a.syspriv, decode(bitand(u.spare1, 128), 128, 1, 0) from adminauth$ a, user$ u where a.user# > 0 and u.user# = a.user# and a.syspriv != 0;
以上是关于Oracle NON-CDB转换为PDB几种方式的主要内容,如果未能解决你的问题,请参考以下文章
多租户:在Oracle12.2中 从Non-CDB迁移到PDB,从PDB迁移另一个CDB中
如何使用 TRANSPORTABLE = ALWAYS 将PDB移回Non-CDB (Doc ID 2027352.1)
ORACLE 单机 11GR2升级到19C NON-CDB(DBUA方式)