0% found this document useful (0 votes)
83 views3 pages

Unplug Plug A PDB

This document describes how to unplug and plug a pluggable database (PDB) between an on-premise database and Oracle Cloud Infrastructure database. It details the steps to: 1. Create a PDB, schema, and populate with data on-premise. 2. Unplug the PDB, copy the files to cloud infrastructure, and plug the PDB using the files. 3. Open the PDB and resolve any plug-in violations by applying data patches. 4. Restart the PDB to check that the data was migrated successfully.

Uploaded by

Lotus Light
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views3 pages

Unplug Plug A PDB

This document describes how to unplug and plug a pluggable database (PDB) between an on-premise database and Oracle Cloud Infrastructure database. It details the steps to: 1. Create a PDB, schema, and populate with data on-premise. 2. Unplug the PDB, copy the files to cloud infrastructure, and plug the PDB using the files. 3. Open the PDB and resolve any plug-in violations by applying data patches. 4. Restart the PDB to check that the data was migrated successfully.

Uploaded by

Lotus Light
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unplug / Plug a PDB

On-Premise

# Create a new PDB

create pluggable database XEPDB2 admin user adminpdb identified by admin


roles=(connect) file_name_convert=('/opt/oracle/oradata/XE/pdbseed/',
'/opt/oracle/oradata/XE/XEPDB2/');

Alter pluggable database xepdb2 open;

# Create a Schema in New PDB

create tablespace dbaltab datafile '/opt/oracle/oradata/XE/XEPDB2/dbaltab_01.dbf' size


100M;

Tablespace created.

Create user dbalchemist identified by oracle12 default tablespace dbaltab temporary


tablespace TEMP ;

GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE, create view TO dbalchemist ;

Connect as user dbalchemist :

connect dbalchemist/oracle12@oracleprem:1539/xepdb2

@hr_cre.sql
@hr_popul.sql

#Close the PDB

SQL> alter pluggable database xepdb2 close;

# Unplug the PDB

mkdir -p /opt/oracle/product/18c/export/

alter pluggable database xepdb2 unplug into '/opt/oracle/product/18c/export/xepdb2.xml';


# SCP XML File and Datafiles

scp -i /home/oracle/.ssh/id_rsa '/opt/oracle/product/18c/export/xepdb2.xml'


[email protected]:/u01/app/oracle/admin/export/.

scp -i /home/oracle/.ssh/id_rsa '/opt/oracle/oradata/XE/XEPDB2/system01.dbf'


[email protected]:/u01/app/oracle/admin/export/.

scp -i /home/oracle/.ssh/id_rsa '/opt/oracle/oradata/XE/XEPDB2/sysaux01.dbf'


[email protected]:/u01/app/oracle/admin/export/.

scp -i /home/oracle/.ssh/id_rsa '/opt/oracle/oradata/XE/XEPDB2/undotbs01.dbf'


[email protected]:/u01/app/oracle/admin/export/.

scp -i /home/oracle/.ssh/id_rsa '/opt/oracle/oradata/XE/XEPDB2/dbaltab_01.dbf'


[email protected]:/u01/app/oracle/admin/export/.

OCI DB System

# Create a new PDB using XML file

CREATE PLUGGABLE DATABASE PDB2 USING '/u01/app/oracle/admin/export/xepdb2.xml'


copy
SOURCE_FILE_NAME_CONVERT = ('/opt/oracle/oradata/XE/XEPDB2/',
'/u01/app/oracle/admin/export/')
;

# Open the Pluggable database

Alter pluggable database pdb2 open;

# Check and resolve all the PLUG_IN_VIOLATIONS

ODA: After Database Upgrade - PDB Opened In Restricted Mode Due To PDB Plug-in
Violations Related To Datapatch (Doc ID 2481660.1)

col name format a30


col message format a40

SELECT name,message FROM pdb_plug_in_violations where type != 'WARNING';


select patch_id,action,status,substr(action_time,1,20),substr(description,1,50) from
registry$sqlpatch;

# Apply data patch

./datapatch -pdbs PDB2

exec DBMS_PDB.CLEAR_PLUGIN_VIOLATIONS( pdb_name => 'PDB2');

col name format a30


col message format a40

SELECT name,message FROM pdb_plug_in_violations where type != 'WARNING';

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc

@?/rdbms/admin/utlrp

# Restart the PDB Database

SQL> alter pluggable database PDB2 close;

SQL>alter pluggable database PDB2 open;

# Check the data

sqlplus
dbalchemist/[email protected]:1521/pdb2.sub12192155370.vcndbal.oraclevcn.com

You might also like