Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
oracle_multitenant_pdb_management [2021/11/13 17:35] – [Operations] andonovj | oracle_multitenant_pdb_management [2021/11/14 08:31] (current) – [Unplug a PDB] andonovj | ||
---|---|---|---|
Line 37: | Line 37: | ||
==== Unplug a PDB ==== | ==== Unplug a PDB ==== | ||
In 12.1 we could unplug a PDB into .xml file and the migration of the PDB, would be the migration of that XML file AND the relevant database files. | In 12.1 we could unplug a PDB into .xml file and the migration of the PDB, would be the migration of that XML file AND the relevant database files. | ||
+ | |||
From 12.2 we can also unplug the PDB into a .pdb archive file, which contains information about the PDB AND the relevant database files. That will ease our migration. | From 12.2 we can also unplug the PDB into a .pdb archive file, which contains information about the PDB AND the relevant database files. That will ease our migration. | ||
Line 225: | Line 226: | ||
Non-CDB in this case, refers to normal database, pre 12c | Non-CDB in this case, refers to normal database, pre 12c | ||
So let's see how it will be done. As before we need to create a user and bring the whole database in read only mode: | So let's see how it will be done. As before we need to create a user and bring the whole database in read only mode: | ||
+ | In fact there are multiple ways to be done: | ||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | But let's do it cloning: | ||
==On remote== | ==On remote== | ||
- | <code: | + | <Code: |
export ORAENV_ASK=NO | export ORAENV_ASK=NO | ||
export ORACLE_SID=db12c | export ORACLE_SID=db12c | ||
Line 305: | Line 312: | ||
REMEMBER, as the cloned DB wasn't a PDB, we need to run the noncdb_to_pdb.sql. | REMEMBER, as the cloned DB wasn't a PDB, we need to run the noncdb_to_pdb.sql. | ||
+ | |||
+ | |||
+ | ==== Cross-Platform PDB Transport ==== | ||
+ | We can perform also cross platform migration of PDB, however there are certain requirements: | ||
+ | |||
+ | * COMPATIBLE: Greater or Equal to 12.2 | ||
+ | * OPEN_MODE: MOUNTED | ||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | This action is done either on the source server, when the backup is done, OR on the destination host, when the restore is done. | ||
+ | |||
+ | === Backup ==== | ||
+ | We can transform the data either on the source or the destination server. Different situations call for different solutions. | ||
+ | |||
+ | ==On Source host== | ||
+ | |||
+ | < | ||
+ | RMAN> BACKUP TO PLATFORM 'Linux x86_64-bit' | ||
+ | UNPLUG INTO / | ||
+ | FORMAT '/ | ||
+ | </ | ||
+ | |||
+ | Bare in mind, as we backup to XML, that WILL NOT SAVE THE DATA, ONLY THE METADATA, you want the data, dump to .pdb file. | ||
+ | |||
+ | ==On destination host== | ||
+ | < | ||
+ | RMAN> BACKUP FOR TRANSPORT UNPLUG INTO / | ||
+ | PLUGGABLE DATABASE pdb1 FORMAT '/ | ||
+ | </ | ||
+ | |||
+ | === Restore === | ||
+ | After we have moved the backup sets and the XML to the destination server. We can start an RMAN session and connect to the target CDB. | ||
+ | Also here, depending on where the conversation happened, we have two chocies. | ||
+ | |||
+ | == If conversation was on source host == | ||
+ | < | ||
+ | RMAN> RESTORE USING '/ | ||
+ | FROM BACKUPSET ' | ||
+ | </ | ||
+ | |||
+ | == If conversation was on the destination host == | ||
+ | < | ||
+ | RMAN> ALTER SYSTEM SET DB_CREATE_FILE_DEST='/ | ||
+ | RMAN> RESTORE FROM PLATFORM 'LINUX x86 64-bit' | ||
+ | FOREIGN PLUGGABLE DATABASE pdb1 TO NEW | ||
+ | FROM BACKUPSET '/ | ||
+ | </ | ||
+ | |||
===== Hot clone ===== | ===== Hot clone ===== | ||
Line 513: | Line 570: | ||
SQL> | SQL> | ||
- | </ | ||
- | |||
- | ===== Using DBCA ===== | ||
- | We can use DBCA to create and delete CDB and PDBs as follows: | ||
- | |||
- | < | ||
- | # Local container (cdb1). | ||
- | dbca -silent -createDatabase \ | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | # Remote container (cdb3) with PDB (pdb5). | ||
- | dbca -silent -createDatabase \ | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | # Non-CDB instance (db12c). | ||
- | dbca -silent -createDatabase \ | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | # Delete the instances. | ||
- | #dbca -silent -deleteDatabase -sourceDB cdb1 -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
- | dbca -silent -deleteDatabase -sourceDB cdb3 -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
- | dbca -silent -deleteDatabase -sourceDB db12c -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
- | |||
- | #Configure OMF | ||
- | export ORAENV_ASK=NO | ||
- | export ORACLE_SID=cdb3 | ||
- | . oraenv | ||
- | export ORAENV_ASK=YES | ||
- | |||
- | sqlplus / as sysdba <<EOF | ||
- | |||
- | ALTER SYSTEM SET db_create_file_dest = '/ | ||
- | |||
- | SHUTDOWN IMMEDIATE; | ||
- | STARTUP MOUNT; | ||
- | ALTER DATABASE ARCHIVELOG; | ||
- | ALTER DATABASE OPEN; | ||
- | |||
- | ALTER PLUGGABLE DATABASE pdb5 OPEN; | ||
- | ALTER PLUGGABLE DATABASE pdb5 SAVE STATE; | ||
- | |||
- | EXIT; | ||
- | EOF | ||
- | |||
</ | </ | ||