Search This Blog

Total Pageviews

Tuesday 13 September 2022

Recover Pluggable Database


  Recover Pluggable Database  ..


Recover Pluggable Database

Performing Point-In-Time Recovery for a Pluggable Database
Restoring and recovering pluggable database using point-in-time recovery


on 

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0




full_backup.sh

export DATE=$(date +%y-%m-%d_%H%M%S)

rman target / log=/u01/app/Rman/proddb_${DATE}.log << EOF
run
{
allocate channel ch1 device type disk format '/u01/app/Rman/proddb_full_bkp_%u';
allocate channel ch2 device type disk format '/u01/app/Rman/proddb_full_bkp_%u';
crosscheck backup;
delete noprompt obsolete;
backup database;
backup archivelog all delete input;
release channel ch1;
release channel ch2;
}
EOF


=====



[oracle@DESKTOP-BAS028D ~]$ export NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS'
[oracle@DESKTOP-BAS028D ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Sep 13 14:36:09 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCLCDB (DBID=2780785463)

RMAN> LIST BACKUP OF PLUGGABLE DATABASE orcl;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    1008.70M   DISK        00:00:23     13/09/2022 13:27:54
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20220913T132730
        Piece Name: /u01/app/Rman/proddb_full_bkp_0117k7q3
  List of Datafiles in backup set 2
  Container ID: 3, PDB Name: ORCL
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  10      Full 2826715    13/09/2022 13:27:31              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/sysaux01.dbf
  13      Full 2826715    13/09/2022 13:27:31              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/APEX_1291597703607401.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
3       Full    470.40M    DISK        00:00:12     13/09/2022 13:28:09
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20220913T132730
        Piece Name: /u01/app/Rman/proddb_full_bkp_0317k7qt
  List of Datafiles in backup set 3
  Container ID: 3, PDB Name: ORCL
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  9       Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/system01.dbf
  12      Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/users01.dbf
  15      Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/undotbs2.dbf


====
before start check below 
If the FRA is not configured, then AUXILIARY DESTINATION must be specified ....
show parameter DB_RECOVERY

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_
                                                 area
db_recovery_file_dest_size           big integer 12918M

https://docs.oracle.com/en/database/oracle/oracle-database/19/ntdbi/about-fast-recovery-area-and-fast-recovery-area-disk-group.html


RUN {
  ALTER PLUGGABLE DATABASE orcl CLOSE;
  SET UNTIL TIME "TO_DATE('13-SEP-2022 13:27:57','DD-MON-YYYY HH24:MI:SS')";
RESTORE PLUGGABLE DATABASE orcl; RECOVER PLUGGABLE DATABASE orcl; ALTER PLUGGABLE DATABASE orcl OPEN RESETLOGS; }
=====================
RMAN>  RESTORE pluggable DATABASE orcl UNTIL TIME "TO_DATE('13.09.2022 13:27:57','DD.MM.YYYY HH24:MI:SS')" PREVIEW;

Starting restore at 13/09/2022 13:53:00
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=7 device type=DISK


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
3       Full    470.40M    DISK        00:00:12     13/09/2022 13:28:09
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20220913T132730
        Piece Name: /u01/app/Rman/proddb_full_bkp_0317k7qt
  List of Datafiles in backup set 3
  Container ID: 3, PDB Name: ORCL
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  9       Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/system01.dbf
  12      Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/users01.dbf
  15      Full 2826726    13/09/2022 13:27:57              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/undotbs2.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    1008.70M   DISK        00:00:23     13/09/2022 13:27:54
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20220913T132730
        Piece Name: /u01/app/Rman/proddb_full_bkp_0117k7q3
  List of Datafiles in backup set 2
  Container ID: 3, PDB Name: ORCL
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  10      Full 2826715    13/09/2022 13:27:31              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/sysaux01.dbf
  13      Full 2826715    13/09/2022 13:27:31              NO    /u01/app/oracle/oradata/ORCLCDB/orcl/APEX_1291597703607401.dbf
using channel ORA_DISK_1


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
7       451.00K    DISK        00:00:00     13/09/2022 13:28:26
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20220913T132825
        Piece Name: /u01/app/Rman/proddb_full_bkp_0817k7rq

  List of Archived Logs in backup set 7
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    24      2825244    13/09/2022 13:06:57 2826756    13/09/2022 13:28:24
recovery will be done up to SCN 2826726
Media recovery start SCN is 2826715
Recovery must be done beyond SCN 2826726 to clear datafile fuzziness    <<<<<<<<<<<<<+1 i.e.  2826727 scn no
Finished restore at 13/09/2022 13:53:04

RMAN>






RUN {
  SET UNTIL scn 2826727;
  RESTORE PLUGGABLE DATABASE orcl;
  RECOVER PLUGGABLE DATABASE orcl;
  ALTER PLUGGABLE DATABASE orcl OPEN RESETLOGS;
}
RMAN> 2> 3> 4> 5> 6>

executing command: SET until clause

Starting restore at 13/09/2022 14:48:35
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=13 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/ORCLCDB/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/ORCLCDB/orcl/APEX_1291597703607401.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/Rman/proddb_full_bkp_0117k7q3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/13/2022 14:48:39
ORA-19870: error while restoring backup piece /u01/app/Rman/proddb_full_bkp_0117k7q3
ORA-19573: cannot obtain exclusive enqueue for datafile 10                   <<<<<<<<<<<<<<<<<<<<<<<

RMAN>

RMAN>


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO

SQL> alter session set container=orcl;

Session altered.


SQL> shutdown immediate ;
Pluggable Database closed.


**********************************************

started again after shutdown  the pluggable database  !!!!!!!

RMAN>
RUN {
  SET UNTIL scn 2826727;
  RESTORE PLUGGABLE DATABASE orcl;
  RECOVER PLUGGABLE DATABASE orcl;
  ALTER PLUGGABLE DATABASE orcl OPEN RESETLOGS;
}
RMAN> 



executing command: SET until clause

Starting restore at 13/09/2022 14:55:37
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/ORCLCDB/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/ORCLCDB/orcl/APEX_1291597703607401.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/Rman/proddb_full_bkp_0117k7q3
channel ORA_DISK_1: piece handle=/u01/app/Rman/proddb_full_bkp_0117k7q3 tag=TAG20220913T132730
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/ORCLCDB/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/ORCLCDB/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00015 to /u01/app/oracle/oradata/ORCLCDB/orcl/undotbs2.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/Rman/proddb_full_bkp_0317k7qt
channel ORA_DISK_1: piece handle=/u01/app/Rman/proddb_full_bkp_0317k7qt tag=TAG20220913T132730
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 13/09/2022 14:56:00

Starting recover at 13/09/2022 14:56:01
using channel ORA_DISK_1


starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 13/09/2022 14:56:03

Statement processed


===================================================================================

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO


      
      

Oracle DBA

anuj blog Archive