Disclaimer

Thursday 2 September 2021

RMAN

 RECOVERY  MANAGER (RMAN)

 

How do u know how much RMAN task has been completed?

By querying v$rman_status or v$session_longops

 

What is snapshot control file?

The snapshot CONTROLFILE is a copy of the CONTROLFILE that RMAN utilizes during long running operation (such as backup). RMAN needs a read consistent view of the CONTROLFILE for the backup operation, but by its nature the control file is extremely volatile. 

Instead of putting lock on the control file and causing all kinds of db enqueue problems, RMAN makes a copy of controlfile called snapshot controlfile. The snapshot is refreshed at the beginning of every backup.

 

What is the difference between auxiliary channel and maintenance channel ?

AUXILIARY:

Specifies a connection between RMAN and an auxiliary database instance.

An auxiliary instance is used when executing the DUPLICATE or TRANSPORT TABLESPACE command,

and when performing TSPITR with RECOVER TABLESPACE . When specifying this option, the auxiliary instance must be started but not mounted

 

Command to delete archive logs older than 7days?

RMAN> delete archivelog all completed before sysdate-7;

 

What is the difference between backup set and backup piece?

Backup set is logical and backup piece is physical.

 

RMAN command to backup for creating standby database?

RMAN> duplicate target database to standby database ....

 

How to do cloning by using RMAN?

RMAN> duplicate target database …

 

How to put manual/user-managed backup in RMAN (recovery catalog)?

By using catalog command.

RMAN> CATALOG START WITH '/tmp/backup.ctl';

 

Retaining Backups for a Long Time

Use the keep option with the backup command to retain backups beyond what’s mandated by the retention polices that you’ve configured.

run{

backup database tag quarterly keep until time 'sysdate+180'

restore point 2007Q1;

}

You can use the keep forever option during a backup command to exempt a backup copy from any retention policies:

run

{

backup database tag quarterly keep forever

restore point Y2007Q1;

}

 

Restarting Backups After a Backup Crash

Use the restartable backup feature to back up only those files that failed to be backed up the

first time around. Use the not backed up since time clause of the backup command to restart a backup after it partially completes

RMAN> backup not backed up since time 'sysdate-1' database plus archivelog;

 

Updating Image Copies

By using incrementally updated image copies, you can avoid making time-consuming full image copy backups of datafiles. To use the incrementally updated backups feature, you first make a full image copy backup of a datafile and, at regular intervals, update the initial image

copy of the datafile with level 1 incremental backups of that datafile. You use the backup ... for recover of copy form of the backup command to incrementally

update an image copy, as shown here:

run {

recover copy of database with tag 'incr_update';

backup incremental level 1 for recover of copy with tag 'incr_update'

database;

}

By running the previous script daily, you’ll never have to apply more than a day’s worth of redo to recover the database, thus dramatically reducing the time needed to perform a media recovery of the database.

 

Using LogMiner to Find an SCN

A user accidentally dropped a table. You want to find the SCN associated with that drop statement so that you can restore the database to the SCN just prior to the accidental drop. You can use LogMiner to find SCNs associated with DML and DDL statements. LogMiner requires supplemental logging to be enabled to be able to display information about DML statements. Enable supplemental logging by issuing the following SQL:

Recovering a Subset of Datafiles  You want to perform incomplete recovery on a subset of datafiles in your database. The basic procedure is to determine which datafiles you don’t want to restore and recover and

then use alter database datafile ... offline for drop for the datafiles to be excluded.

 

Skipping Tablespaces During Database Duplication

You want to skip certain tablespaces when duplicating a database

run

{

allocate channel C1 device type disk;

allocate auxiliary channel C2 device type disk;

duplicate database to aux skip tablespace users, tools;

}

As soon as RMAN opens the new auxiliary database, it’ll start dropping all tablespaces that are part of the skip tablespace command. The tablespace drop is done using the option including contents cascade constraints. RMAN drops the tablespaces in a reverse sorted list of tablespace names. You’ll get errors if you try to exclude tablespaces that contain indexes used for enforcing unique or primary keys.

 

Resynchronizing a Duplicate Database

You want to synchronize a duplicate database with its parent database Once you create a duplicate database from a source database, you can periodically “update”

or synchronize the duplicate database by simply rerunning the duplicate command over again, in essence re-creating the duplicate database

RMAN> connect auxiliary sys/sammyy1@dupdb

RMAN> duplicate target database to dupdb

logfile

group 1 ('/duplogs/redo01a.log',

'/duplogs/redo01b.log') size 200k reuse,

group 2 ('/duplogs/redo02a.log',

'/duplogs/redo02b.log') size 200k reuse;

You can schedule this script for running on a daily or a weekly basis, thus creating a new and up-to-date duplicate database on a continuous basis.

 

Image copies:

An image copy is a copy of a single file (datafile, archivelog, or controlfile)

  It is very similar to an O/S copy of the file

  It is not a backupset or a backup piece

  No compression is performed

 

Snapshot Controlfile:

When RMAN needs to resynchronize from a read-consistent version of the control file, it creates a temporary snapshot control file   The default name for the snapshot control file is port-specific

 

Can I restore or duplicate my RMAN backup between two different platforms such as Solaris to Linux?

In general, you cannot restore or duplicate between two different platforms.

 

Connection hanging? what are the possibilities?

Possibilities for Oracle hanging include:

External issues - The network being down, Kerberos security issues, SSO or a firewall issue can cause an Oracle connection to hang.

One way to test this is to set sqlnet.authentication_services=(none) in your sqlnet.ora file and retry connecting.

Listener is not running - Start by checking the listener (check lsnrctl stat). Also, see my notes on diagnosing Oracle network connectivity issues.

No RAM - Over allocation of server resources, usually RAM, whereby there is not enough RAM to spawn another connection to Oracle.

Contention - It is not uncommon for an end-user session to “hang” when they are trying to grab a shared data resource that is held by another end-user.

The end-user often calls the help desk trying to understand why they cannot complete their transaction, and the Oracle professional must quickly identify the source of the contention."

 

How to make RMAN backup or restore faster?

To make it faster, it can be configured to use PARALLELISM with multiple channels:

 

How to identify all the corrupted segments in the database reported by RMAN?

Step 1: Identify the corrupt blocks (Datafile Block Corruption - Intra block corruption)

RMAN> backup validate check logical database;

To make it faster, it can be configured to use PARALLELISM with multiple channels:

RMAN> run {

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

allocate channel d4 type disk;

backup validate check logical database;

}

Step2:  Using the view v$database_block_corruption:

SQL> select * from v$database_block_corruption;

 

          FILE#          BLOCK#          BLOCKS CORRUPTION_CHANGE# CORRUPTIO

------------------------------------------------------------------------------------------------------------

              6              10                          1          8183236781662                      LOGICAL

              6              42                          1                  0                                      FRACTURED

              6              34                          2                  0                                      CHECKSUM

              6              50                          1      8183236781952                          LOGICAL

              6              26                          4                  0                                      FRACTURED

 

Datafile Block Corruption - Intra block corruption

It refers to intra block corruptions that may cause different errors like ORA-1578, ORA-8103, ORA-1410, ORA-600 etc.

Oracle classifies the corruptions as Physical and Logical

To identify both Physical and Logical Block Corruptions use the "CHECK LOGICAL" option,  It checks the complete database for both corruptions without actually doing a backup

 

Solution1:

RMAN> backup check logical validate database;

RMAN> backup check logical database;

Solution2:

 Chek the view V$DATABASE_BLOCK_CORRUPTION to identify the block corruptions detected by RMAN

Solution3: DBVerify - Identify Datafile Block Corruptions

->DBVERIFY identify Physical and Logical Intra Block Corruptions by default

->Dbverify cannot be run for the whole database in a single command

->It does not need a database connection either

dbv  file=   blocksize=

 

RMAN Vs DBVerify - Datafile Intra Block Corruption

->When the logical option is used by RMAN, it does exactly the same checks as DBV does for intra block corruption.

->RMAN can be run with PARALLELISM using multiple channels making it faster than DBV which can not be run in parallel in a single command.

->DBV checks for empty blocks. In 10g RMAN may not check blocks in free extents when Locally Managed Tablespaces are used. In 11g RMAN checks for both free and used extents.

->Both DBV and RMAN (11g) can check for a range of blocks. RMAN: VALIDATE DATAFILE 1 BLOCK 10 to 100;. 

DBV: start=10 end=100

->RMAN keeps corruption information in the control file (v$database_block_corruption, v$backup_corruption). DBV does not.

->RMAN may not report the corruption details like what is exactly corrupted in a block reported as a LOGICAL corrupted block. DBV reports the corruption details in the screen or in a log file.

->DBV can scan blocks with a higher SCN than a given SCN.

->DBV does not need a connection to the database.

 

Integrating RMAN with a Media Manager on UNIX:

On UNIX, Oracle accesses the media management library through the UNIX shared library libobk.so. This file must exist somewhere in the system path. It is highly recommended that you place libobk.so in $ORACLE_HOME/lib, which is where Oracle searches first.

You do not need to start or shut down the instance when installing the media management library.

To integrate the media manager on UNIX:

If an old libobk.so symbolic link already exists in $ORACLE_HOME/lib, then remove it before installing the media manager.

$ rm $ORACLE_HOME/lib/libobk.so After installation, check your media management vendor documentation to determine where the media management library is installed. For example, suppose that the library is installed as /vendor/lib/oracle_lib.so.

Either changes the name of the installed media management library to $ORACLE_HOME/lib/libobk.so, or created a symbolic link to the library called libobk.so. For example, you can create a symbolic link to the library as follows:

$ ln -s /vendor/lib/oracle_lib.so $ORACLE_HOME/lib/libobk.so

Alternatively, you can simply change the name of the library to libobk.so

 $mv /vendor/lib/oracle_lib.so $ORACLE_HOME/lib/libobk.so

 

No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...