Quantcast
Channel: Sameer Shaik. B.E,M.S,M.B.A,P.M.P,C.S.M
Viewing all articles
Browse latest Browse all 191

Oracle Cloud 12c database - Recover the database from the cloud backup using orec

$
0
0

In my previous post I showed you how to backup the Oracle cloud database using bkp_api and console.
Post related to Backups:
http://www.shaiksameer.com/2017/12/oracle-cloud-12c-how-to-manually-backup.html

In this series I will show how to restore/recover the Cloud database using orec (Oracle Recovery utility ) of dbaascli tool.


Recovery:


Oracle Cloud 12c database - Recover the database from the cloud backup using orec

First we will list the most recent backups use the below command and then use orec utility to restore/recover the database using the latest backup.


[root@erpdev1 ~]# dbaascli orec --args -list
DBAAS CLI version 1.0.0
Executing command orec --args -list
--args : -list


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-04_20:31:47.log
Config file is /var/opt/oracle/orec/orec.cfg


DB name: erpdev2
OREC:: RUNNING IN NON DATAGUARD ENVIRONMENT
OREC:: Catalog mode:  Disabled
Getting list backups...
 Backup Tag             Completion Date         Config Files Location
 ---------------------- ----------------------- ------------------------
 TAG20171201T193037     12/01/2017 19:30:37
 TAG20171204T200050     12/04/2017 20:00:50
 TAG20171204T200105     12/04/2017 20:01:05
 TAG20171204T203034     12/04/2017 20:30:34
 TAG20171204T203050     12/04/2017 20:30:50


Now let's recover the database from the latest cloud backup using orec

[root@erpdev1 ~]#  dbaascli orec --args -latest
DBAAS CLI version 1.0.0
Executing command orec --args -latest
--args : -latest


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-04_20:25:26.log
Config file is /var/opt/oracle/orec/orec.cfg


DB name: erpdev2
OREC:: RUNNING IN NON DATAGUARD ENVIRONMENT
OREC:: Checking prerequirements before recovery process.
OREC:: DB Status : OPEN
OREC:: Changing instance to MOUNT stage.
OREC:: Shutting down the database... Completed.
OREC:: (RMAN) Startup MOUNT... Completed.
OREC:: Checking for PDBs directories.
OREC:: Checking for REDO logs.
OREC:: Restablishing DB instance to the original stage.
OREC:: Shutting down the database... Completed.
OREC:: Starting up database... Completed.
OREC:: Catalog mode:  Disabled
OREC:: Testing RMAN connection.
OREC:: Verifying backups dates ..
   :: OK
OREC:: Latest backup : TAG20171204T200105


WARN: No corresponding cfg files exist for latest tag.
OREC:: Continuing with the DB recovery.
OREC:: Shutting down the database... Completed.
OREC:: Startup MOUNT... Completed.
OREC:: Performing recovery from latest backup.RMAN Completed.


RMAN Completed.

INFO : DB instance is up and running after recovery procedure.
OREC:: Recovery to latest backup completed.


[root@erpdev1 ~]#


List long term cloud backups using orec:
[root@erpdev1 ~]# dbaascli orec --args -keep -list
DBAAS CLI version 1.0.0
Executing command orec --args -keep -list
--args : -keep -list


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-05_14:23:19.log
Config file is /var/opt/oracle/orec/orec.cfg


DB name: erpdev2
OREC:: RUNNING IN NON DATAGUARD ENVIRONMENT
OREC:: Catalog mode:  Disabled
Tag parameter not required
OREC::############ LONG-TERM RETENTION BACKUPS #############


 Backup Tag             Completion Date
------------------------ -------------------------
 JAAS20171201T170605        12/01/2017 17:06:05
OREC:: Looking for known issues
Not issues found


Restoring from a Specific Backup using dbaascli - orec Utility


[root@erpdev1 ~]# dbaascli orec --args  -pitr TAG20171204T203050
DBAAS CLI version 1.0.0
Executing command orec --args -pitr TAG20171204T203050
--args : -pitr TAG20171204T203050


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-05_14:28:50.log
Config file is /var/opt/oracle/orec/orec.cfg


DB name: erpdev2
OREC:: RUNNING IN NON DATAGUARD ENVIRONMENT
OREC:: Catalog mode:  Disabled
OREC:: Checking prerequirements before recovery process.
OREC:: DB Status : OPEN
OREC:: Changing instance to MOUNT stage.
OREC:: Shutting down the database... Completed.
OREC:: (RMAN) Startup MOUNT... Completed.
OREC:: Checking for PDBs directories.
OREC:: Checking for REDO logs.
OREC:: Restablishing DB instance to the original stage.
OREC:: Shutting down the database... Completed.
OREC:: Starting up database... Completed.
OREC:: Testing RMAN connection.
OREC:: Verifying backups dates ..
   :: OK
WARN: No Config files backup exist for the specified tag.
OREC:: Shutting down the database... Completed.
OREC:: Startup MOUNT... Completed.
OREC:: Performing Point-In-Time-Recovery to: 12/04/2017 20:30:50 ...
OREC:: Checking if PITR is across incarnations ...
OREC:: Determining current incarnation ...
OREC:: Determining target incarnation for time: 12/04/2017 20:30:50 ...


OREC:: PITR is within current incarnation 3


INFO : DB instance is up and running after recovery procedure.
OREC:: PITR Completed.


You have new mail in /var/spool/mail/root

Recover Oracle Cloud database up to a Specific SCN by Using the dbaascli Utility


Use :dbaascli orec --args  -SCN <scn number>


Find the SCN of the system for the particular date/time as below:

SQL> select timestamp_to_scn(to_date('12/03/2017 12:01:00','mm/dd/yyyy hh24:mi:ss')) from dual;


TIMESTAMP_TO_SCN(TO_DATE('12/03/201712:01:00','MM/DD/YYYYHH24:MI:SS'))
----------------------------------------------------------------------
                                                              3005455

Now use the above SCN to do a Point-in-time Recovery.

[root@erpdev1 ~]# dbaascli orec --args -scn 3005455
DBAAS CLI version 1.0.0
Executing command orec --args -scn 3005455
--args : -scn 3005455


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-05_15:12:28.log
Config file is /var/opt/oracle/orec/orec.cfg


DB name: erpdev2
OREC:: RUNNING IN NON DATAGUARD ENVIRONMENT
OREC:: Verifying scn validity...
PITR using SCN: 3005455
OREC:: Catalog mode:  Disabled
OREC:: Checking prerequirements before recovery process.
OREC:: DB Status : OPEN
OREC:: Changing instance to MOUNT stage.
OREC:: Shutting down the database... Completed.
OREC:: (RMAN) Startup MOUNT... Completed.
OREC:: Checking for PDBs directories.
OREC:: Checking for REDO logs.
OREC:: Restablishing DB instance to the original stage.
OREC:: Shutting down the database... Completed.
OREC:: Starting up database... Completed.
OREC:: Testing RMAN connection.
OREC:: Verifying backups dates ..
   :: OK
OREC:: Performing PITR using SCN number 3005455 ...OREC:: Checking if PITR is ac      ross incarnations ...
OREC:: Determining current incarnation ...
OREC:: Determining target incarnation for SCN: 3005455 ...


OREC:: PITR is from current incarnation 4 to target incarnation 3


OREC:: Converting SCN to timestamp as PITR to a different incarnation using SCN       is not possible unless using a recovery catalog.
OREC:: Converting SCN to timestamp ...
OREC:: Shutting down the database... Completed.
OREC:: Starting up database... Completed.
OREC:: Performing Point-In-Time-Recovery to: 12/01/2017 19:57:15 ...
OREC:: Checking if PITR is across incarnations ...
OREC:: Determining current incarnation ...
OREC:: Determining target incarnation for time: 12/01/2017 19:57:15 ...


OREC:: PITR is from current incarnation 4 to target incarnation 3
OREC:: Reseting database to incarnation # : 3
OREC:: Shutting down the database... Completed.


OREC: Startup NOMOUNT... Completed.
OREC:: Restoring controlfile from autobackup... Completed.


INFO : DB instance is up and running after recovery procedure.
OREC:: PITR Completed.


OREC:: Recovery to SCN completed.


You have new mail in /var/spool/mail/root
[root@erpdev1 ~]#



For help and explore the commands that are available with orec

[root@erpdev1 ~]# dbaascli orec --args -help
DBAAS CLI version 1.0.0
Executing command orec --args -help
--args : -help


OREC version: 16.0.0.0


Starting OREC
Logfile is /var/opt/oracle/log/erpdev2/orec/orec_2017-12-04_20:34:15.log


Usage:
  orec -dbname=<db_instance> -list


Where:
  -help      = Print this help.
  -list      = List all the available RMAN backups.
  ------------------------ Long-term backup retention options -----------------------
  -keep      = General Mode for Long-term backup retention
  -keep -list = Shows the list of the current Long-term backups


Examples:
  orec -help
  orec -dbname=PROD -list

Usage:
  orec -list
  orec -pitr <backup_tag>
  orec -pitr <backup_tag> -data
  orec -pitr <backup_tag> -cfgfiles
  orec -timestamp="<date_and_time>"
  orec -scn <SCN number>
  orec -latest
  orec -latest -data
  orec -latest -cfgfiles
  orec -duplicate
  orec -duplicate -dbrole <db_role>


Where:
  -help      = Print this help.
  -list      = List all the available RMAN backups and the location of their respective config files.
  -pitr      = Point-in-time recovery for the entire Database, an RMAN tag must be specified.
  -timestamp = Point-in-time recovery for the entire Database using a timestamp.
               Time format "DD-MON-YYYY hh24:mi:ss"
  -scn       = Point-in-time recovery for the entire Database using SCN (System Change Number) number.
  -latest    = Performs a database recovery using the latest backup.
  -data      = Recovery only for DATA, exludes config files.
  -cfgfiles  = Recovery only for config files, excludes DATA.
  -duplicate = Executes RMAN duplicate when issued in a Standby instance. (DataGuard)
  -dbrole    = Specify the DB instance role when OREC is unable to detect it (DataGuard).
  ------------------------ Long-term backup retention options -----------------------
  -keep      = General Mode for Long-term backup retention
  -keep -list = Shows the list of the current Long-term backups
  -keep -tag <backup_tag> = Performs a recovery using the backup tag


Examples:
  orec -help
  orec -list
  orec -pitr TAG20140117T061554
  orec -pitr TAG20140117T061554 -cfgfiles
  orec -pitr TAG20140117T061554 -data
  orec -timestamp="31-JAN-2014 14:50:07"
  orec -scn 1815307
  orec -latest -cfgfiles
  orec -latest -data
  orec -latest
  orec -duplicate
  orec -duplicate -dbrole standby


Note : It is highly recommended to perform a backup prior using this recovery tool.


Recover Oracle Cloud database 12c using console

Login into your cloud console →
Go to DBCS →
Open Service Console →
Pick your database service →
Click on Administration →
Click on Backup.


Now you can either click on the menu on a available backup to recover from it or go recover tab and pick a date/SCN/latest backup to recover.




-OR-





If you chose a particular backup to restore then confirm your selection as shown below and click OK.



Now wait for the recovery to complete.







Viewing all articles
Browse latest Browse all 191

Trending Articles