Some of the good Database Backup-Recovery & RMAN related questions are listed below.
Q 1
What is SCN?
A 1
The SCN is an Oracle server–assigned number that indicates a committed version of the database. It’s quite possible that different datafiles in the database might have a different SCN at any given point in time.
At checkpoint, the server will makes all database file SCNs and control file SCN consistent with respect to an identical SCN.The datafiles will not contain any database changes beyond that common SCN. This synchronization of the SCNs will make sure we have a consistent backup of database.
When you are doing hot backup, you may end up with backups of the various datafiles at various time points and different SCNs and you can not open a database without synchronizing the SCN on all data files, so you will have to apply archive logs to make the data current and synchronize the SCNs across the datafiles.
Q 2
What is the significance of fast_start_mttr_target parameter?
A 2
You use the Oracle initialization parameter fast_start_mttr_target to specify the number of seconds you want the crash recovery to take. Oracle will try to recover the
instance as close as possible to the time that you specify for the fast_start_mttr_target parameter. The maximum value of this parameter is 3600 seconds (1 hour).
During instance recovery, in the first roll forward operation, the database server must apply all transactions between the last checkpoint and the end of the redo log to the datafiles. Thus, in order to tune instance recovery, you control the gap between the checkpoint position and the end of the redo log. This is called Mean Time to Recover (MTTR).
Q 3
There was a media failure. How can you find which files you must recover?
A 3
By querying the V$RECOVER_FILE view, which lists all files that need media recovery.
Q 4
What are the benefits of RMAN over user-managed backup-recovery process?
A 4
– powerful Data Recovery Advisor feature
– simpler backup and recovery commands
– automatically manages the backup files without DBA intervention.
– automatically deletes unnecessary backup datafiles and archived redo log files both from disk and tape.
– provides you with detailed reporting of backup actions
– Easy to duplicate a database or create standby database.
– Without actually restoring data, you can test whether you will be able to do it or not
– Incremental backup! only RMAN can do that.
– Active Duplication! (11g new feature), you can perform database duplication without backups by using the network enabled database duplication feature
– automatically detects corrupt data blocks during backups
– Data block level recovery possible in case only few DB blocks are corrupt
– Encrypted backups possible
– Use RMAN with a variety of third-party storage systems easily
With so many benefits, RMAN shold be used as primary backup-recovery tool.
Q 5
How important is Database Redundancy Set and where you should plan to keep it?
A 5
Database Redundancy Set is essential set of recovery-related files. As a DBA, you need to be well prepared for any kind of contingency situation.
It should contain below:
– Recent backups of all datafiles & control file (duplex or triplex the control file at database level)
– All archived redo logs made after the last backup
– Current control files and online redo file copies (duplex online redo files at database level)
– Oracle database-related configuration file copies (spfile, password file, tnsnames.ora and listener.ora files etc)
Operating system mirroring is good, but you should do database level mirroring wherever possible.
If you using ASM, try to have atleast Normal redundancy.
When setting up production systems, use at least two disk drives(one for the redundancy set and the other for the datafiles). They should be completely separated by using different volumes, file systems, disk controllers, and RAID devices to hold the two sets of files
You can set up FRA for keeping the redundancy set. Oracle recommends the flash recovery area as a logical candidate to keep a copy of all the files belonging to the redundancy set (which includes the most recent database backup) on disk.
Q 6
What is the benefit of making automatic control file backup to ON?
A 6
Remember that control file is absolutely necessary during a recovery.
Below command can be used to have automatic control file backup to be taken. This is highly recommended.
RMAN> configure controlfile autobackup on
Now at the end of every RMAN backup command, RMAN automatically backs up the control file.
Even when you make some changes via SQL*Plus( say creating a new tablespace or adding or renaming a datafile or an online redo log member), the control file is automatically backed up.
Also, you can restore RMAN’s backup and recovery information (called RMAN’s repository), when you lose all your control files and aren’t using the optional recovery catalog.
Q 7
What is the significance of RMAN view V$RMAN_OUTPUT?
A 7
V$RMAN_OUTPUT displays messages reported by RMAN. This is an in-memory view (means will not persist thru a database restart)and is not recorded in the controlfile. This information straight out of the database by using SQL queries.
Sometimes RMAN log files may have already been overwritten by the next backup or simply just deleted. This is an alternative way of accessing the RMAN output information
For Example:
Review the last two days worth of rman output:
select output
from v$rman_output
where session_recid in (select session_recid from v$rman_status
where start_time > sysdate-2)
order by recid ;
OUTPUT
———————————————————————————————————————————-
connected to target database: BRIJ (DBID=3142459675)
using target database control file instead of recovery catalog
echo set on
backup archivelog all not backed up delete all input;
Starting backup at 09-FEB-14
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=124 instance=BRIJ devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=126 instance=BRIJ devtype=DISK
….
…
Q 8
What all you can store in Flash Recovery Area(FRA)? Can one FRA directory be used for more than one database?
A 8
Oracle can store different kind of files under FRA:
– backupset: for RMAN regular backups.
– datafile: for RMAN image copies.
– autobackup: for control file autobackups.
– flashback: If your database runs in flashback mode, you will see flashback logs in this subdirectory.
– archivelog: for Archived redo logs
– controlfile: The control file, if configured to go to the flash recovery area.
– onlinelog: Online redo logs can also be made to go to the flash recovery area
You can use the same flash recovery area for as many databases as you want. The RMAN backup process will create a subdirectory called <SID_NAME>, the same name as the database you are backing up.
Q 9
Which views can be used for Checking Space Usage in the FRA?
A 9
Check Below..
SQL> select NAME,SPACE_LIMIT/1024/1024/1024 TOTAL_GB,SPACE_USED/1024/1024/1024 USED_GB,SPACE_RECLAIMABLE,NUMBER_OF_FILES from v$recovery_file_dest;
NAME TOTAL_GB USED_GB SPACE_RECLAIMABLE NUMBER_OF_FILES
————————————————– ———- ———- —————– —————
/u01/oracle/DB11G/fast_recovery_area 16 1.13197899 0 3
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
——————– —————— ————————- —————
CONTROL FILE 0 0 0
REDO LOG 0 0 0
ARCHIVED LOG .12 0 1
BACKUP PIECE 6.95 0 2
IMAGE COPY 0 0 0
FLASHBACK LOG 0 0 0
FOREIGN ARCHIVED LOG 0 0 0
7 rows selected.
Q 10
Is putting control file and online redo logs in Flash Recovery Area (FRA) advisable?
A 10
Control file is very important file for the database operation. Loosing a single control file will make the database unstable and will lead to interruption in service.
So we will always try to put control file in a safe and stable place.
Similarly online logs are equally important and loosing them can also cause database to crash, incomplete recovery and possible data loss.
CASE 1:
Usually the flash recovery area and the main database disks are located in such a way that the probability of both going down at the same time is very slim.
And If your flash recovery area is in a storage location as reliable as the main database storage, then you should put one control file and one redo member/log group there.
It will surely help you in quick and complete recovery.
CASE 2:
If your flash recovery area is NOT as reliable as the main database storage, the chance of failure in the flash recovery area is greater compared to the main database disks. If the flash recovery area fails, then you lose one of the control files and the online redo log. You will be able to start database easily by removing that control file from the control file parameter in the initialization parameter file (copying online log from the secondary Non-FRA location) and restarting it but you will have an interruption of production service, which is very undesirable.
Scenario A)
Besides FRA, we have multiplexed Control files to two other separate location, so risk of loosing control file (and fear of not able to do complete recovery) is minimized
We won’t be putting even a single control file in the FRA.
Scenario B)
Besides FRA, we have multiplexed Control files to only one other separate location, so risk of loosing control file and (and fear of not able to do complete recovery) is more. Complete recovery of database is of primary importance to you than the database interruption.
Here we can go and put the control file in FRA.
Q 11
How can you make sure that only one of the redo log member is created in FRA?
A 11
If you want only one member of the group in the flash recovery area and the other one in the regular database file location, you should define two parameters—the flash recovery area and db_create_file_dest.
SQL> Show parameter db_recovery_file_dest
NAME TYPE VALUE
———————————— ———– ——————————
db_recovery_file_dest string /u01/oracle/DB11G/fast_recovery_area
SQL> alter system set db_create_file_dest =’/u01/oracle/DB11G/oradata’;
System altered.
SQL> alter database add logfile group 4;
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_RECOVERY_DEST_FILE
———- ——- ——- ————————————————– ———————–
3 ONLINE /u01/oracle/DB11G/oradata/brij/redo03.log NO
2 ONLINE /u01/oracle/DB11G/oradata/brij/redo02.log NO
1 ONLINE /u01/oracle/DB11G/oradata/brij/redo01.log NO
4 ONLINE /u01/oracle/DB11G/oradata/brij/BRIJ/onlinelog/o1_mf_5_9hl8zjmt_.log NO
4 ONLINE /u01/oracle/DB11G/fast_recovery_area/BRIJ/onlinelog/o1_mf_5_9hl8zjsz_.log YES
Q 12
How can you create log of your RMAN activity?
A 12
Two ways to do it
A) WHILE STARTING RMAN
$ rman log=’tmp/rman_log.log’ OR $ rman log /tmp/rman_log.log append
(use with append clause if you don’t wanna overwrite existing file)
Also If you are running RMAN interactively and you want to see output on your terminal screen as well as have it written to a log file, use tee command:
$ rman | tee /tmp/rman.log
B) WHILE INSIDE RMAN
$rman
RMAN> spool log to ‘/tmp/rman_log.log’;
(use with append clause if you don’t wanna overwrite existing file “spool log to ‘/tmp/rman_log.log’ append.)
..
RMAN> spool log off;
** you can use any writeable directory and log file name.
Q 13
Can Recovery Catalog database also be shutdown from RMAN prompt like TARGET Database can be done?
A 13
All the shutdown and startup commands applies only to the target database. You can’t start and stop the recovery catalog instance from RMAN. The only way to start up and shut down the recovery catalog instance is by connecting to the recovery catalog database as the target database and by issuing the relevant commands to start or stop the instance.
Q 14
How to check the syntax of RMAN commands?
A 14
Start the RMAN client with the operating system command-line argument checksyntax.
$ rman checksyntax
Recovery Manager: Release 11.2.0.4.0 – Production on Wed Feb 12 14:36:22 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target /
The command has no syntax errors
RMAN> backup database;
The command has no syntax errors
You can also use the checksyntax argument to check the syntax of RMAN commands that are part of a command file.
Example:
$ rman checksyntax @/tmp/rmancmdfile
Q 15
Does using recovery catalog means RMAN won’t use the control file to store information?
A 15
No. Even when you choose to use a recovery catalog, backup information will continue to be stored in the control file as well by default.
Q 16
What is the benefit of using Recovery Catalog?
A 16
– provides larger storage capacity, thus enabling access to a longer history of backups
– you can create and store RMAN scripts in the recovery catalog and Any client that can connect to the recovery catalog and a target database can use these stored scripts
– Can service many target databases
– you can use ‘KEEP FOREVER’ clause of RMAN backup command.
– Allows you to list the data files and tablespaces that are or were in the target database at a given time
Q 17
What is the significance of ‘resync catalog’ RMAN command?
A 17
The resync catalog command is used in order to update or resynchronize a recovery catalog from the target database control file. Since sync is done from Target database control file, so you must connect to the recovery catalog as well as to the target database in order to perform the resynchronization.
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
When above command is executed, RMAN will first create a snapshot control file. It’ll then compare the contents of the recovery catalog to the contents of the snapshot control file and update the recovery catalog by adding the missing information and modifying the changed backup and schema related records.
It means that we will keep parameter control_file_record_keep_time longer than our backup interval, so that the data in the control file gets transferred to the recovery catalog before that data is overwritten.
When you issue certain RMAN commands such as the backup command, RMAN automatically performs a resynchronization.
Q 18
You want to move your recovery catalog from one database to another. How you can do it?
A 18
Moving Recovery catalog to another database is simple process
a) Create a new recovery catalog in the target database. You don’t need to register any database to it
b) Use the import catalog command in RMAN after connecting to the target database:
$ rman
RMAN> connect catalog rman_new/rman@target_database
RMAN> import catalog rman_old/rman@source_database;
The import catalog command will import the source recovery catalog contents into the target recovery catalog.
Q 19
What are the most important recovery catalog views?
A 19
Below are some of the frequently used views:
RC_STORED_SCRIPT: Information about RMAN scripts stored in the recovery catalog.
RC_UNUSABLE_BACKUPFILE_DETAILS: Lists the unusable backup files recorded in the recovery catalog.
RC_RMAN_STATUS: Similar to V$RMAN_STATUS view and shows the status of all RMAN operations. This view doesn’t contain information about any operations that are currently executing.
RC_RMAN_CONFIGURATION: Information about persistent configuration settings.
RC_DATAFILE: Shows all datafiles registered in the recovery catalog.
RC_DATABASE: Shows the databases registered in the recovery catalog.
RC_ARCHIVED_LOG: Provides historical information on both archived as well as unarchived redo logs.
Q 20
How to check the version of your recovery catalog?
A 20
You can easily check the version of your recovery catalog by issuing the following command from SQL*Plus after logging in as the recovery catalog owner:
RMAN@rmandb > select * from rcver;
VERSION
————
11.02.00.04
Q 21
What all files can NOT be backed up by RMAN?
A 21
1) Oracle home-related files
2) External files
3) Network configuration files
4) Password files
- Oracle Multitenant DB 4 : Parameters/SGA/PGA management in CDB-PDB - July 18, 2020
- Details of running concurrent requests in Oracle EBS - May 26, 2020
- Oracle Multitenant DB 3 : Data Dictionary Architecture in CDB-PDB - March 20, 2020
superb…! good job
good post
really Good , Thanks !!!
Excellent !
Very nice post
GOOD WORK
Productive work. More useful to refresh rman commands.
Very Nice,Thank you
Excellent Sir.
Good. Valuable info
good
Thanks a lot for your efforts for posting
Awesome !!!! Really Cool
Thanks !!! Neat Explanation
Very good info
Super questions and well answered. Thanks again buddy.
Very nice post… Keep doing the great work
great help for unemployed and students..thanks
excelent piece
Wonderfull explanation..
nice stuff
Thank you very much.
Good set of questions. Thanks for sharing your knowledge.
good
Good,very nice job.
Nice stuff bro…
Thanks….
wonderful questions and nice explanations. wonderful
Thanks ?