1. PDB preparation for migration from PDB or NON-CDB to another CDB
Migrating from the PDB or NON-CDB to the PDB in the CDB container database, the PDB and non-cdb migrations are very similar and work together because the PDB and NON-CDB are almost identical in the steps to the CDB.
Get ready:
CDB1: Container database for the target PDB database
DB12C: non-cdb that needs to be migrated
CDB3: The container database that needs to migrate PBD
2. Cloning remote PDB or NON-CDB in Oracle db12c
-Note: Local represents the destination or target CDB, and remote represents the source of the PBD or non-cdb.
Steps to **--2.1 cloning * *
/*
1, in the target side and the container, must have the Create pluggable database permissions.
2. The source-side database (PDB or NON-CDB) must turn on Read-only mode.
3, the target database must have a database link link source, if it is pbd,database link using a normal user point to the source CDB or PDB with the target end or ordinary users
4, the source database link user must have create pluggable database permissions.
5, the target database and the source database must have the same installation options and character set;
6. TDE must be configured before cloning;
7, the destination CDB must have the source side of the default table space. If it does not exist, the new PDB can only be opened in restricted mode.
8. When cloning non-cdb, the database of the source and target must use the version above 12.1.0.2.
*/
2.2 Clone Remote PDB
--1. Setting up the environment
Export Oraenv_ask=noexport oracle_sid=cdb3. Oraenvexport Oraenv_ask=yessqlplus/as SYSDBA
--2. Creating a user on remote terminal for Db_link
Alter session set Container=pdb5;create user Remote_clone_user identified by Remote_clone_user;grant create session, Create pluggable database to Remote_clone_user;
--3. Open Read Only mode in the PDB of the remote terminal
Conn/as sysdbaalter Pluggable Database pdb5 close;alter pluggable database PDB5 open read only;exit;
--4. Add a local link name to Db_link for use in "Tnsnames.ora" on the local side
PDB5 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.2.81) (PORT = 1521)) (CON Nect_data = (service_name = PDB5)))
--5. Connecting the local end to start cloning
Export Oraenv_ask=noexport oracle_sid=cdb1. Oraenvexport Oraenv_ask=yessqlplus/as SYSDBA
--6. Creating a database connection on the local side
Drop DATABASE link clone_link;create database link clone_link connect to remote_clone_user identified by Remote_clone_user Using ' PDB5 ';
--Test connection
desc [email Protected]_link;
--7. Creating a new PDB in the local database
Create pluggable database pdb5new from [email protected]_link;
--8, viewing the new PDB and its status
Select Name,open_mode from V$pdbs where name= ' pdb5new ';
--9, open pdb in Read-write mode
Alter pluggable database pdb5new Open;select name,open_mode from V$pdbs where name = ' pdb5new ';
**--2.3 Cloning non-cdb**
--1. Setting up the environment
Export Oraenv_ask=noexport oracle_sid=db12c. Oraenvexport Oraenv_ask=yessqlplus/as SYSDBA
--2. Creating a user on remote terminal for Db_link
Create user Remote_clone_user identified by remote_clone_user;grant create Session,create pluggable database to REMOTE_CL One_user;
--3. Open Read Only mode in the PDB of the remote terminal
Shutdown immediate;startup mount;alter database read only;exit;
--4. Add a local link name to Db_link for use in "Tnsnames.ora" on the local side
db12c = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.93) (PORT = 1521))) (CO Nnect_data = (service_name = PDF)))
--5. Connecting the local end to start cloning
Export Oraenv_ask=noexport oracle_sid=cdb1. Oraenvexport Oraenv_ask=yessqlplus/as SYSDBA
--6. Creating a database connection on the local side
Drop DATABASE link clone_link;create database link clone_link connect to remote_clone_user identified by Remote_clone_user Using ' db12c ';
--Test connection
desc [email Protected]_link;
--7. Creating a new PDB in the local database
Create pluggable database db12cpdb from [email protected]_link;
--8. Viewing the new PDB and its status
Select Name,open_mode from V$pdbs where name= ' db12cpdb ';
--9. Run the following script to clear the NON-CDB to PDB information
Alter session set container=db12cpdb;@ $ORACLE _home/rdbms/admin/noncdb_to_pdb.sql
--10. Opening the PDB in Read-write mode
ALTER pluggable DATABASE db12cpdb open;select name,open_mode from V$pdbs where name = ' db12cpdb ';
**--2.4 migrating the NON-CDB database into place pdb**
--1. Turn off non-cdb and open in read-only mode
Export Oracle_sid=db12csqlplus/as sysdbashutdown Immediate;startup Open Read only;
--2. Creating an XML file using the Dbms_pbd.describe procedure
Begin Dbms_pdb.describe (pdb_descr_file = '/tmp/db12c.xml '); end;
--3. Closing the NON-CDB database
Exprot Oracle_sid=db12csqlplus/as SYSDBA
Shutdown immediate;
--4. Creating a PDB in CDB using the NON-CDB profile
Export Oracle_sid=cdb1sqlplus/as SYSDBA
Craete pluggable database pdb6 using '/tmp/db12c.xml ' Copyfile_name_convert = ('/u01/app/oracle/oradata/db12c/', '/u01/ app/oracle/oradata/cdb1/pdb6/');
--5. Switch to PDB6, run the following script
Alter session Set container = pdb6;@ $ORACLE _home/rdbms/admin/noncdb_to_pdb.sql
--6. Start the PDB and check the Open_mode
Alter session SET container =pdb6;alter pluggable database open;
Select Name,open_mode from V$pdbs;
**--2.5 Data Migration * *
--Scenario One: Using Data dump (EXPDP/IMPDP)
--Use data dump (EXPDP/IMPDP) to migrate from NON-CDB to the newly created PDB database. If NON-CDB is 11.2.0.3 or more versions below, EXPDP uses the "full=y transportable=always version=12" parameter. If you are converting on a different platform, you need to use the Convert command of Rman, or the Dbms_file_transfer package.
--Scenario two: using Goldengate
--Transfer data from NON-CDB to the PDB using Goldengate's replicate.
**--2.6 Patch Considerations * *
--If the patches on the source and target sides are fundamentally different, they need to be viewed from the pdb_plug_in_violations attempt of the PDB, and the Datapatch tool is used to scan the target side and implement the relevant patches.
Multi-tenancy: Migrating from NON-CDB to PDB in Oracle12.2, migrating from PDB to another CDB