0% found this document useful (0 votes)
6 views4 pages

Pdb_plug and Unplug

The document outlines the process of backing up and restoring a pluggable database (PDB1) using RMAN commands. It details the steps taken to close the database, perform a backup, transfer backup files to a secondary server, and restore the database from those files. Finally, it describes the creation and opening of the pluggable database in the new environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Pdb_plug and Unplug

The document outlines the process of backing up and restoring a pluggable database (PDB1) using RMAN commands. It details the steps taken to close the database, perform a backup, transfer backup files to a secondary server, and restore the database from those files. Finally, it describes the creation and opening of the pluggable database in the new environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

ALTER PLUGGABLE DATABASE PDB1 CLOSE IMMEDIATE;

RMAN> LIST BACKUP;


specification does not match any backup in the repository

RMAN> BACKUP PLUGGABLE DATABASE PDB1;


Starting backup at 10-JUN-21
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00083
name=+DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/
system.257.1074872859
input datafile file number=00084
name=+DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/
sysaux.258.1074872857
input datafile file number=00085
name=+DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/
undotbs1.259.1074872857
input datafile file number=00089
name=+DATA_PDB2_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/
users.261.1074873435
channel ORA_DISK_1: starting piece 1 at 10-JUN-21
channel ORA_DISK_1: finished piece 1 at 10-JUN-21
piece handle=+FRA_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/BACKUPSET/2021_06_10/
nnndf0_tag20210610t165853_0.270.1074877135 tag=TAG20210610T165853 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 10-JUN-21
Starting Control File and SPFILE Autobackup at 10-JUN-21
piece handle=+FRA_DG/ORA1/AUTOBACKUP/2021_06_10/s_1074877159.257.1074877165
comment=NONE
Finished Control File and SPFILE Autobackup at 10-JUN-21
Now, Restore process:

Since we can’t restore into the original CDB on the original server,
we’ll restore it in a secondary environment. The first step is to
move the RMAN backup set pieces to that secondary server.
There are lots of ways to move the RMAN backup set pieces
(including possibly hardware disk clones). In this demo
environment, I first copied them out of ASM:

asmcmd cp +FRA_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/BACKUPSET/2021_06_10/
nnndf0_tag20210610t165853_0.270.1074877135 /tmp
copying +FRA_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/BACKUPSET/2021_06_10/
nnndf0_tag20210610t165853_0.270.1074877135 ->
/tmp/nnndf0_tag20210610t165853_0.270.1074877135
$ asmcmd cp +FRA_DG/ORA1/AUTOBACKUP/2021_06_10/s_1074877159.257.1074877165 /tmp
copying +FRA_DG/ORA1/AUTOBACKUP/2021_06_10/s_1074877159.257.1074877165 ->
/tmp/s_1074877159.257.1074877165

To have RMAN restore the data files into the desired ASM disk
group, I also need to set the db_create_file_dest parameter:

RMAN> STARTUP NOMOUNT;


Oracle instance started
Total System Global Area 2634018936 bytes
Fixed Size 9138296 bytes
Variable Size 1174405120 bytes
Database Buffers 1442840576 bytes
Redo Buffers 7634944 bytes
RMAN> ALTER SYSTEM SET db_create_file_dest='+DATA_PDB1_DG' SCOPE=memory;
using target database control file instead of recovery catalog
Statement processed
RMAN> RESTORE control file FROM '/tmp/s_1074877159.257.1074877165';
Starting restore at 10-JUN-21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DATA_DG/ORA1/control file/current.269.1071227145
output file name=+FRA_DG/ORA1/control file/current.256.1071227145
Finished restore at 10-JUN-21
RMAN> ALTER DATABASE MOUNT;
released channel: ORA_DISK_1
Statement processed

RMAN> CATALOG BACKUPPIECE '/tmp/nnndf0_tag20210610t165853_0.270.1074877135';

RMAN> RESTORE PLUGGABLE DATABASE PDB1;

DBMS_PDB.RECOVER to build the XML manifest file that was


needed to plug in the restore database.
SQL> BEGIN
2 DBMS_PDB.RECOVER (
3 pdb_descr_file => '/home/oracle/pdb1_recover.xml',
4 pdb_name => 'PDB1',
5 filenames => '
6 +DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/SYSTEM.259.1074880009,
7 +DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/SYSAUX.258.1074880029,
8 +DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/UNDOTBS1.257.1074880039,
9 +DATA_PDB1_DG/ORA1/C471569CB28C0E4BE0536D3810AC346D/DATAFILE/USERS.256.1074880047'
10 );
11 END;
12 /
PL/SQL procedure successfully completed.

SQL> CREATE PLUGGABLE DATABASE PDB1 USING '/home/oracle/pdb1_recover.xml' NOCOPY;

Pluggable database created.

SQL> show pdbs


CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ WRITE YES
3 PDB1 MIGRATE YES
SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ WRITE YES
3 PDB1 READ WRITE NO

You might also like