Uploaded by hanhduy.nguyen

12.2 Perform Flashback at PDB Level (Doc ID 2308215.1)

Copyright (c) 2021, Oracle. All rights reserved. Oracle Confidential.
12.2 Perform Flashback at PDB Level (Doc ID 2308215.1)
Modified: Aug 4, 2018
To Bottom
Type: HOWTO
Language:
English
In this Document
Goal
Solution
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.
GOAL
This document discusses how to create restore points for PDB and perform flashback at PDB level which is introduced from 12.2
SOLUTION
NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data
from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material.
Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.
For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:
PDB Name: PDB1
Restore Point: TEST1
Restore Point (Guarantee) TEST2
==================================
1. Creating restore points at PDB level:
Connect to the specific PDB and then run CREATE RESTORE POINT command:
SQL> alter session set container=PDB1;
SQL> create restore point TEST1;
SQL> create restore point TEST2 guarantee flashback database;
or
Connect to the CDB and use FOR PLUGGABLE DATABASE clause of CREATE RESTORE POINT command:
SQL> alter session set container=CDB$ROOT;
SQL> create restore point TEST1 for pluggable database PDB1;
SQL> create restore point TEST2 for pluggable database PDB1 guarantee flashback database;
Note: Starting from 12.2, we have option to create Multitenant Databases with Local Undo. This means that each PDB uses it's own UNDO tablespace. In such a PDB setup, a flashback operation at PDB level can
rollback changes made to the PDB's Undo tablespace similar to system, sysaux or user tablespaces of that PDB i.e. there is no dependency with the CDB or other PDB's.
However, if your 12.2 Multitenant Database is still using Shared Undo, in such a setup, the UNDO tablespace is shared among all PDB's. So, if a flashback operation is performed at PDB level, we need to use
AUXILIARY DESTINATION clause along with FLASHBACK PLUGGABLE DATABASE command. This is used to create a auxiliary instance where CDB's system,sysaux and undo are restored till the point-in-time of
flashback to rollback the active transactions in that particular PDB whose flashback is being performed. To avoid having to create this auxiliary instance during flashback of PDB that uses Shared Undo, you can
optionally create a clean restore point with the PDB closed. When doing PDB flashback to a clean restore point, auxiliary instance need not be created since there would be no active transactions in the PDB as of the
time of restore point:
SQL> alter pluggable database PDB1 close;
SQL> create clean restore point Before_Upgrade for pluggable database PDB1;
2. Viewing restore-point information. Either via SQL*PLUS or RMAN:
SQL> select NAME,TIME,SCN,PDB_RESTORE_POINT,GUARANTEE_FLASHBACK_DATABASE from V$RESTORE_POINT;
NAME TIME SCN PDB GUA
--------------- ------------------------------------- ---------- --- --TEST2 09-AUG-17 12.42.53.000000000 PM 1451338 YES YES
TEST1 09-AUG-17 12.42.21.000000000 PM 1451318 YES NO
RMAN> list restore point all;
SCN RSP Time Type Time Name
---------------- -------------------- ---------- -------------------- ---1451318 09-AUG-2017 12:42:21 TEST1
1451338 GUARANTEED 09-AUG-2017 12:42:53 TEST2
3. Performing flashback:
a. If PDB uses local undo:
SQL> alter pluggable database PDB1 close;
SQL> flashback pluggable database PDB1 to restore point TEST1;
SQL> alter pluggable database PDB1 open resetlogs;
b. If PDB uses shared undo and restore point created when PDB was open:
RMAN> alter pluggable database PDB1 close;
RMAN> flashback pluggable database PDB1 to restore point TEST1 auxiliary destination '/o122/app/oracle/oradata/stage';
RMAN> alter pluggable database PDB1 open resetlogs;
c. If PDB uses shared undo and restore point created when PDB was closed (i.e. clean restore point)
SQL> alter pluggable database PDB1 close;
SQL> flashback pluggable database PDB1 to clean restore point TEST1;
SQL> alter pluggable database PDB1 open resetlogs;
Didn't find what you are looking for?
Ask in Community...
Related
Products
Oracle
Oracle
Oracle
Oracle
Oracle
Oracle
Oracle
Oracle
Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Enterprise Edition > Flashback Recovery > Flashback Database
Cloud > Oracle Platform Cloud > Oracle Database Cloud Service > Oracle Database Cloud Schema Service
Cloud > Oracle Infrastructure Cloud > Oracle Cloud at Customer > Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine)
Cloud > Oracle Platform Cloud > Oracle Cloud Infrastructure - Database Service > Oracle Cloud Infrastructure - Database Service
Cloud > Oracle Platform Cloud > Oracle Database Cloud Service > Oracle Database Cloud Exadata Service
Cloud > Oracle Platform Cloud > Oracle Database Backup Service > Oracle Database Backup Service
Cloud > Oracle Platform Cloud > Oracle Database Cloud Service > Oracle Database Exadata Express Cloud Service
Cloud > Oracle Platform Cloud > Oracle Database Cloud Service > Oracle Database Cloud Service
Keywords
AUXILIARY; DATABASE; FLASHBACK; GUARANTEE; MULTITENANT; PDB; PLUGGABLE DATABASE; RESETLOGS; RESTORE; SCN; SQL*PLUS; UNDO
Errors
ORA-38780
Translations
English Source
Back to Top
Chinese 简体中⽂
Japanese ⽇本語