Friday, September 26, 2008

RMAN Process - From START to FINISH

To illustrate it, Let us explain it with an example. Let us backup our PRODUCTION database using RMAN.

C$>rman
rman>connect target /
rman>backup database;

That's it.

Let us explian the above example.

RMAN makes the bequeath connection to the target database that we have set up in our env. This means it checks the ORACLE_SID for an instance name and then spawns a server process at that instance, logging is as SYSDBA user. This connects us as the internal database user SYS. RMAN immediately spawns the channel processes that will use to perform the backup. In this case we are using default settings, so only one channel is allocated.

We are not using I/O slaves, so the process allocates memory in the PGA.

Next RMAN compilesa call to sys.dbms_rcvman to request the database schematic information from the target database control file, starting with a determination of the target database version. It gathers version information from the control files along with control file information itself like type of control file, current sequence number, when it was created etc.

Becuse this is a full backup, RMAN requests information for each datafile in the database and determines if any files are offline. RMAN ignores all disk affinity information and concentartes on compiling the list of files for inclusion in the backupset.

After the list is compiled, RMAN is ready to begin the backup process itself. To guarantee consistency, it the builds a snapshot control files, if one already exists it overwrites it with a new one.

After this RMAN creates a call to the DBMS_BACKUP_RESTORE package to create a backup piece. The backup piece will be built in the default file location.

RMAN has the file list, so it can allocate the memory buffers for performing the read from DISK, with 20 files RMAN allocates input buffer size 128 MB . 4 per file for total memory utilzation of 10 MB for input buffers. RMAN will only allocate 4 output buffers each of size 1 MB. This brings the total memory utilization 14MB for the backup.

After the memory is allocated, RMAN initilize the BACKUP PIECE. backup piece will be given unique name that guarnatees uniqueness.

RMAN then determines if there will be enough space for backup to be successful. It does by using a pessimistic algorithm that assumes that backup will be the same size as sum of the size of all the datafiles. Due to null compression this will not be the case.

Once the backup piece is initiated, then the channel process can begin the database backup process.
a) If you are using spfile, it backs it up automatically to the backupset,
b) RMAN then will backup the current control file to the backupset,
This control file backup is automatic whenever the SYSTEM tablespace is backed up, this behaviour is changed if you have CONTROL FILE AUTOBABKUP turned on.
c) Now its time to begin the datafile reads to pull data blocks into the memory. The channel process does this by doing a read-ahead on the disk and pulling several blocks into memeory at the same time. then memory-to-memory write from input buffer to output buffer occurs.

During this write, RMAN determines if the block has ever been initialized, or block header information is still zeroed out. If it is an unused block, the write to the output buffer never occur and the block is discarded. If the block has been used, RMAN performs the checksum on the block. If the header and footer of the block did not match, RMAN indicates a corrupt block and aborts the backup. If the block has been initialized and it passes the checksum, then the block is written into output buffer.

Once the output buffers fills its capacity, we dump the buffer to the backup file location.

RMAN buffers are being filled up with blocks from all the datafiles so there is no order to the blocks in the dump file.

While the blocks are being written out to backup piece, the status of the backup is being polled by the RMAN shadow process. It checks in on the RPCs at the target and passes the information to v$session_lonops for your review.

Once every block in the datafile has been read into an output buffer and its status determines, then RMAN completes the file backup by writing the datafile header out to the backup piece.

After all the files have their file headers written to the backup piece, RMAN makes a final call to sys.dbms_backup_restore which writes backup information to the control files. This information includes the name of the backup piece, the checkpoint SCN at the time it started and the time it completed.

And that it.

What is auxiliary Database?

The auxiliary database refers to the instance that will become host to restored files from the target database in the event of a TSPITR, a duplication operation or the creation of a standby database using RMAN backups.

How to use recovery catalog?

To use a recovery catalog, you first connect from RMAN to the target database. Then you make a second NET connection to the recovery catalog from within RMAN,

Rman> connect target /
rman> connect catalog rman/password@rcat

The connect string you pass to the catalog is for the user that owns the RMAN catalog.

Unlike the target the connection to the catalog is not SYSDBA

There are two package inside the RECOVERY CATALOG

DBMS_RCVMAN and dbms_rcvcat.

Recovery Catalog

Recovery Catalog is a repository for metadata about RMAN backups. You can say that recovery catalog is a merely a copy of pertinent information out of control file that RMAN requires for backup and recovery purpose.

Wednesday, September 24, 2008

How to create RMAN catalog in 10g

Create a rcat - recovery catalog database with database configuration assistant

C:\> sqlplus SYS/pass@rcat AS SYSDBA

SQL> CREATE SMALLFILE TABLESPACE catalog_tbs DATAFILE ‘C:\ORACLE\10.2\datafile\cat_tbs.dbf’ SIZE 100M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

SQL> CREATE USER rcat IDENTIFIED BY rcat DEFAULT TABLESPACE catalog_tbs QUOTA UNLIMITED ON catalog_tbs;

SQL> GRANT recovery_catalog_owner TO rcat;

SQL> Grant connect, resource to rcat;

SQL> exit

C:\> rman catalog rcat/rcat@rcat

RMAN> create catalog;

RMAN> exit

C:\>rman target orcl catalog rcat/rcat@rcat

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Sep 24 21:21:27 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: RCAT (DBID=376666761)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> report schema;

RMAN - Basics for Beginners

WHAT IS RMAN ?

Recovery Manager is a tool that: manages the process of creating backups and also manages the process of restoring and recovering from them.

WHY USE RMAN ?

  • No extra costs …Its available free
  • RMAN introduced in Oracle 8 it has become simpler with newer versions and easier than user managed backups
  • Proper security
  • You are 100% sure your database has been backed up.
  • Its contains detail of the backups taken etc in its central repository
  • Facility for testing validity of backups also commands like crosscheck to Check the status of backup.
  • Faster backups and restores compared to backups without RMAN
  • RMAN is the only backup tool which supports incremental backups.
  • Oracle 10g has got further optimized incremental backup which has resulted in improvement of performance during backup and recovery time
  • Parallel operations are supported
  • Better querying facility for knowing different details of backup
  • No extra redo generated when backup is taken..compared to online backup without RMAN which results in saving of space in hard disk
  • RMAN an intelligent tool
  • Maintains repository of backup metadata
  • Remembers backup set location
  • Knows what need to backed up
  • Knows what is required for recovery
  • Knows what backup are redundant

UNDERSTANDING THE RMAN ARCHITECTURE

  • An oracle RMAN comprises of RMAN EXECUTABLE This could be present and fired even through client side TARGET DATABASE This is the database which needs to be backed up
  • RECOVERY CATALOG Recovery catalog is optional otherwise backup details are stored in target database controlfile
  • It is a repository of information queried and updated by Recovery Manager
  • It is a schema or user stored in Oracle database
  • One schema can support many databases
  • It contains information about physical schema of target database datafile and archive log, backup sets and pieces

Recovery catalog is a must in following scenarios

  • In order to store scripts
  • For tablespace point in time recovery

Media Management Software

Media Management software is a must if you are using RMAN for storing backup in tape drive directly.

Backups in RMAN

Oracle backups in RMAN are of the following type

RMAN complete backup OR RMAN incremental backup

These backups are of RMAN proprietary nature

IMAGE COPY

Its again a kind of backup. The advantage of uing Image copy is its not in RMAN proprietary format.

Backup Format

RMAN backup is not in oracle format but in RMAN format. Oracle backup comprises of backup sets and it consists of backup pieces. Backup sets are logical entity. In oracle 9i it gets stored in a default location.

There are two type of backup sets

  1. Datafile backup sets,
  2. Archivelog backup sets

One more important point of data file backup sets is it do not include empty blocks. A backup set would contain many backup pieces. A single backup piece consists of physical files which are in RMAN proprietary format.

You can go to RMAN prompt by just typing rman. RMAN executable is present in ORACLE_HOME/bin location.

bash-2.05$ rman

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 23 02:16:55 2007Copyright (c) 1982, 2005, Oracle. All rights reserved.

RMAN>
You can use target connect to connect to database. The database it will connect to depends on the environment variable ORACLE_HOME.

RMAN> connect target

connected to target database: ORCL (DBID=1156435946)

Alternatively you can use “rman TARGET SYS/oracle@test NOCATALOG” to connect to the RMAN of “test” instance.

Here we will be using target database control file to store all the information required for RMAN, like backupsets and backup image information etc.

Backup Database:

RMAN> shutdown immediate

using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

RMAN> startup mount;

connected to target database (not started)
Oracle instance started
database mountedTotal System Global Area 1258291200 bytes

Fixed Size 1978336 bytes
Variable Size 318771232 bytes
Database Buffers 922746880 bytes
Redo Buffers 14794752 bytes

RMAN> backup database;

Starting backup at 23-JUL-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/dy/oracle/product/oradata/orcl/system01.dbf
input datafile fno=00003 name=/dy/oracle/product/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/dy/oracle/product/oradata/orcl/example01.dbf
input datafile fno=00002 name=/dy/oracle/product/oradata/orcl/undotbs01.dbf
input datafile fno=00004 name=/dy/oracle/product/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-JUL-07
channel ORA_DISK_1: finished piece 1 at 23-JUL-07
piece handle=/dy/oracle/product/flash_recovery_area/ORCL/backupset/2007_07_23/

o1_mf_nnndf_TAG20070723T031355_3b8zv57d_.bkp tag=TAG20070723T031355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-JUL-07
channel ORA_DISK_1: finished piece 1 at 23-JUL-07
piece handle=/dy/oracle/product/flash_recovery_area/ORCL/backupset/2007_07_23/

o1_mf_ncsnf_TAG20070723T031355_3b8zy7xr_.bkp tag=TAG20070723T031355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:06
Finished backup at 23-JUL-07

Creating RMAN Catalog

You can also create a repository for RMAN to store all this information. Repository will be just another small database which can store the catalog information. Creating a catalog is a 3 step process

1) Create database which will hold the catalog. Else you can use the existing database also. All you need is to create a seperate tablespace for holding the information about RMAN catalog.

2) Create RMAN tablespace and RMAN user

SQL> create tablespace rman_tbs datafile ‘/dy/oracle/product/db10g/dbf/rman01.dbf’ size 500M EXTENT MANAGEMENT LOCAL segment SPACE MANAGEMENT AUTO ;

Tablespace created.

SQL> create user rman identified by rman
2 default tablespace rman_tbs
3 TEMPORARY TABLESPACE TEMPTS1
4 QUOTA UNLIMITED ON rman_tbs account unlock;

User created.

After creating user, you need to grant RECOVERY_CATALOG_OWNER role to that user.

3) Create RMAN catalog.

bash-2.05$ rman catalog rman/rman@test

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 23 04:37:10 2007Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to recovery catalog database

RMAN> create catalog

recovery catalog created

For registering the database, you need to get connected to database as well as catalog at the same time. Here is how you can do.

RMAN> connect target

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

The above error is because the database we connected to is not found in the catalog database. We can register the database in catalog.

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

Registering database will also resynch the information present in the target database control file and catalog database. Since we have taken 1 backup early, it will synchup that information with RMAN catalog. We can check the same using LIST BACKUP command at RMAN prompt.

RMAN> list backup;

List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
18 Full 573.48M DISK 00:01:26 23-JUL-07
BP Key: 20 Status: AVAILABLE Compressed: NO Tag: TAG20070723T031355
Piece Name: /dy/oracle/product/flash_recovery_area/ORCL/backupset/2007_07_23/
o1_mf_nnndf_TAG20070723T031355_3b8zv57d_.bkp
List of Datafiles in backup set 18
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——— —-
1 Full 562487 23-JUL-07 /dy/oracle/product/oradata/orcl/system01.dbf
2 Full 562487 23-JUL-07 /dy/oracle/product/oradata/orcl/undotbs01.dbf
3 Full 562487 23-JUL-07 /dy/oracle/product/oradata/orcl/sysaux01.dbf
4 Full 562487 23-JUL-07 /dy/oracle/product/oradata/orcl/users01.dbf
5 Full 562487 23-JUL-07 /dy/oracle/product/oradata/orcl/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
19 Full 6.80M DISK 00:00:05 23-JUL-07
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20070723T031355
Piece Name: /dy/oracle/product/flash_recovery_area/ORCL/backupset/2007_07_23/
o1_mf_ncsnf_TAG20070723T031355_3b8zy7xr_.bkp
Control File Included: Ckp SCN: 562487 Ckp time: 23-JUL-07
SPFILE Included: Modification time: 23-JUL-07

RMAN Command line

Backing up the Controlfile and Spfile

The control file can be automatically backed up after each RMAN backup and database structure change as a way to protect the RMAN repository (when we are not using a seperate catalog for RMAN).
RMAN> configure controlfile autobackup on;

Backing up control file

RMAN> backup current controlfile;

Creating Image copy of all datafiles in database

These are the image copies and are stored in ORACLE format and not in RMAN format. Backupsets and backuppieces are stored in internal RMAN format. Hence these image copies can be used for manual restore and recovery as well.

RMAN> backup as copy database;

Creating backupsets of all datafiles in database

If you specify BACKUP AS BACKUPSET, then RMAN stores its backups in backup sets. A backup set, consisting of one or more backup pieces, contains the physical file data being backed up. This backupset is written in a format that only RMAN can access. Only RMAN can create and restore backup sets. Backup sets can be written to disk or tape, and they are the only type of backup which RMAN can use to write backups to tape.

RMAN> backup as backupset database;

Backup individual tablespace as backupsets

RMAN> backup tablespace system, HTMLDB;

Backup individual tablespace as image copies

RMAN> backup as copy tablespace system;

Backup individual files as image copies

RMAN> backup as copy datafile ‘/dy/oracle/product/db10g/dbf/system01.dbf’;

Backup individual files as Backupsets

RMAN> backup datafile ‘/dy/oracle/product/db10g/dbf/system01.dbf’;

Backup archivelogs

We can backup the archive logs according to the output of some search condition. Example we want to backup only those archivelogs which starts with “ARCH_616814159_”.

RMAN> backup acrchivelog like ‘%ARCH_616814159_%’;

Copy archivelogs from some time stamp.

Suppose we want to copy the archivelogs of last 2 days, then we can use the following commands.

RMAN> BACKUP ARCHIVELOG from time ’sysdate-2′;

Backup all archivelog files

RMAN> Backup archivelog all;

Backup archivelog between some time.

RMAN> BACKUP ARCHIVELOG FROM TIME ‘SYSDATE-30′ UNTIL TIME ‘SYSDATE-7′;

Specifying copies while backing up.

RMAN> backup copies 2 datafile ‘/dy/oracle/product/db10g/dbf/cs_tbs01.dbf’;

Remember that copies option cannot be used with image copies. It can be used only with backupsets.

Giving tags to backups

RMAN> BACKUP TAG ‘weekly_full_db_bkup’ DATABASE MAXSETSIZE 100M;

Backing up backupsets
RMAN> BACKUP BACKUPSET ALL;

Backup imagecopies

RMAN> Backup as copy backupset all;

List Imagecopies

RMAN> list copy;

List Backupsets

RMAN> list backup;

Restoring and Recovering the database

Use the RESTORE and RECOVER commands for RMAN restore and recovery of physical database files.

RMAN> STARTUP FORCE MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN;

Recovering Current Tablespaces

RMAN> SQL ‘ALTER TABLESPACE users OFFLINE’;
RESTORE TABLESPACE users;
RECOVER TABLESPACE users;
SQL ‘ALTER TABLESPACE users ONLINE;

Recovering Current Datafiles

RMAN> SQL ‘ALTER DATABASE DATAFILE 7 OFFLINE’;
RESTORE DATAFILE 7;
RECOVER DATAFILE 7;
SQL ‘ALTER DATABASE DATAFILE 7 ONLINE’;

Recovering Individual Data Blocks

RMAN can recover individual corrupted datafile blocks. When RMAN performs a complete scan of a file for a backup, any corrupted blocks are listed in V$DATABASE_BLOCK_CORRUPTION. Corruption is usually reported in alert logs, trace files or results of SQL queries. Use BLOCKRECOVER to repair all corrupted blocks:

RMAN> BLOCKRECOVER CORRUPTION LIST;

You can also recover individual blocks, as shown in this example:
RMAN> BLOCKRECOVER DATAFILE 7 BLOCK 233, 235 DATAFILE 4 BLOCK 101;

Managing RMAN repository

As you know that if you do not use a recovery catalog, then control file of the target database is used as RMAN repository and eventually after some time the control file records for RMAN information will get overwritten.
Set this initialization parameter in the parameter file of the target database to determine how long records are kept:

CONTROL_FILE_RECORD_KEEP_TIME =

You can configure a retention policy to be used by RMAN to determine which backups are considered obsolete. This allows you to remove files from the repository that are no longer needed to meet your retention requirements. This policy can be based on a recovery window (the maximum number of days into the past for which you can recover) or redundancy (how many copies of each backed-up file to keep).

Two Parameters are used to set retention policies.

You can specify the days days between the current time and the earliest point of recoverability, this is called RECOVERY WINDOW. RMAN does not consider any full or level 0 incremental backup as obsolete if it falls within the recovery window.
Alternatively the REDUNDANCY parameter will instruct to store the number of copies of backup in RMAN repository. If the number of backups for a specific datafile or control file exceeds the REDUNDANCY setting considers the extra backups as obsolete.

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

This will make the REDUNDANCY setting to 3. Meaning that it will at max store 3 copies of backups and ikmages of datafile. Any more images or backups are consider obsolete.

When we run the below command

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

it will configure new retention policy based on the RECOVERY WINDOW of 7 days. This means that all the backups which falls outside this window will be considered obsolute. So in this case you need to have backup scheduled every week to have atleast 1 valid backup.

Remember that at any point of time, only one policy can be active. It can be either REDUNDANCY or RECOVERY WINDOW.

When you change the retention policy to another one, it will suspend the previous policy as shown below.

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

Cross checking the available backups

RMAN> CROSSCHECK BACKUP;

Crosscheck is needed when an archivelog file or backup is manually removed, i.e., not deleted by RMAN. This command ensures that data about backups in the recovery catalog or control file is synchronized with corresponding data on disk or in the media management catalog. The CROSSCHECK command operates only on files that are recorded in the recovery catalog or the control file.

The CROSSCHECK command does not delete any files that it is unable to find, but updates their repository records to EXPIRED. Then, you can run DELETE EXPIRED to remove the repository records for all expired files as well as any existing physical files whose records show the status EXPIRED.

If some backup pieces or copies were erroneously marked as EXPIRED, for example, because the media manager was misconfigured, then after ensuring that the files really do exist in the media manager, run the CROSSCHECK BACKUP command again to restore those files to AVAILABLE status.

RMAN> CROSSCHECK COPY;

This will validate the image copies.

Deleting the backups

The DELETE command removes RMAN backups and copies from DISK marks the records in control file as DELETED or removes the records from the recovery catalog (if you use a catalog).

RMAN> DELETE BACKUPSET 101, 102, 103;

RMAN> delete controlfilecopy ‘%ctl’; # Pattern search is allowed.

RMAN> delete archivelog until sequence 20;

This will delete all the archives from the oldest one till the sequence we have specified.

RMAN> delete backup of tablespace system;

RMAN> DELETE ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE DISK;

List commands

RMAN> list backup;

RMAN> list copy;

RMAN> list incarnation of database;

RMAN> list expired backupset;

RMAN> list expired copy;

RMAN> list backup of tablespace sysaux;

RMAN> list copy of datafile 3;

Reporting in RMAN

RMAN> report need backup;

Reports which database files need to be backed up to meet a configured or specified retention policy

RMAN> report unrecoverable;

Reports which database files require backup because they have been affected by some NOLOGGING operation such as a direct-path insert

RMAN> report need backup recovery window of 7 days;

Displays objects requiring backup to satisfy a recovery window-based retention policy.

Suppose in the above command we want to skip a perticular tablespace like perfstat then we can use the below command.

RMAN> report need backup recovery window of 2 days database skip tablespace perfstat;

RMAN> report need backup redundancy 3;

Displays objects requiring backup to satisfy a redundancy-based retention policy.

RMAN> report need backup days 7;

Displays files that require more than n days’ worth of archived redo log files for recovery.

RMAN> report need backup incremental 7;

Displays files that require application of more than n incremental backups for recovery.

RMAN> report need backup redundancy 2 datafile 3;

Gives report of files with less than 2 redundant backups.

RMAN> report need backup tablespace htmldb;

Report of files that must be backed up to satisfy current retention policy for this tablespace (htmldb)

RMAN> report need backup incremental 2;

Report of files that need more than 2 incrementals during recovery

RMAN> report need backup device type disk;

Report of files that must be backed up to satisfy current retention policy for database

RMAN> report obsolete;
Shows backups that are obsolete according to the current retention policy.

You can add the options RECOVERY WINDOW and REDUNDANCY with this command as given below.

RMAN> report obsolete recovery window of 3 days;

RMAN> report obsolete redundancy 2;

RMAN> report schema;

This command lists and displays information about the database files.

RMAN> report schema at time ’sysdate - 14′;

This command gives report on schema 14 days ago.

RMAN> report schema at SCN 10000;

This gives report on schema at scn 10000.

RMAN> report schema at sequence 55 thread 1;

Gives report of schema at sequence 55.

RMAN configuration

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128′; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/dy/oracle/product/db10g/dbs/snapcf_test.f’; # default

We can change each of these parameters as per our requirements.

You can return any setting to its default value by using CONFIGURE… CLEAR

RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;

RMAN> CONFIGURE RETENTION POLICY CLEAR;

By default, RMAN sends all backups to an operating system specific directory on disk. So default setting for DEVICE TYPE is DISK. You can configure to make backups by default on tape or any other device as given below.

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;

You can configure backup sets or image copies as the default for a perticular device type, using either of the following commands:

RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY; # Default becomes image copies
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; # Default becomes uncompressed

You can configure RMAN to use compressed backupsets by default on a particular device type, by using the CONFIGURE DEVICE TYPE command with the BACKUP TYPE TO COMPRESSED BACKUPSET option, as shown in the following examples.

RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;

RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;

To disable compression you can use below command

RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET;

RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO BACKUPSET;

You can configure the parallelism for a device type.

RMAM> CONFIGURE DEVICE TYPE sbt PARALLELISM 2;

You can turn on/off controlfile autobackup using

RMAN> configure controlfile autobackup off;

RMAN> configure controlfile autobackup on;

We can configure RMAN channel to write backups and images in a specific format.

The following command configures RMAN to write disk backups to the /backup directory

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘/backup/ora_df%t_s%s_s%p’;

%t is replaced with a four byte time stamp,
%s with the backup set number, and
%p with the backup piece number.

You can also configure format for controlfile autobackup as well.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO ’string’;

For example, you can run the following command:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘?/oradata/cf_%F’;

Here %F will be replaced by following

c-IIIIIIIIII-YYYYMMDD-QQ, where:

IIIIIIIIII stands for the DBID.
YYYYMMDD is a time stamp of the day the backup is generated
QQ is the hex sequence that starts with 00 and has a maximum of FF

You can clear the format using following command.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

ASH Report using OEM

Run ASH Report
Specify the time period for the report.
Start Date

(Example: 12/15/03)
Start TimeAMPM
End Date

(Example: 12/15/03)
End TimeAMPM
Report Results

ASH Report For ORCL/orcl

DB NameDB IdInstanceInst numReleaseRACHost
ORCL1193379843orcl110.2.0.3.0NOSACHCHIDA-PC

CPUsSGA SizeBuffer CacheShared PoolASH Buffer Size
2584M (100%)360M (61.6%)184M (31.5%)4.0M (0.7%)


Sample TimeData Source
Analysis Begin Time:24-Sep-08 10:22:32V$ACTIVE_SESSION_HISTORY
Analysis End Time:24-Sep-08 10:27:32V$ACTIVE_SESSION_HISTORY
Elapsed Time: 5.0 (mins)
Sample Count: 11
Average Active Sessions: 0.04
Avg. Active Session per CPU: 0.02
Report Target:None specified

ASH Report


Back to Top

Top Events

Back to Top

Top User Events

EventEvent Class% ActivityAvg Active Sessions
db file sequential read User I/O 54.55 0.02
CPU + Wait for CPU CPU 36.36 0.01

Back to Top Events
Back to Top

Top Background Events

EventEvent Class% ActivityAvg Active Sessions
os thread startup Concurrency 9.09 0.00

Back to Top Events
Back to Top

Top Event P1/P2/P3 Values

Event% EventP1 Value, P2 Value, P3 Value% ActivityParameter 1Parameter 2Parameter 3
db file sequential read 54.55 "1","27757","1" 9.09 file# block# blocks
"1","60501","1" 9.09
"3","3834","1" 9.09

Back to Top Events
Back to Top

Load Profile

Back to Top

Top Service/Module

ServiceModule% ActivityAction% Action
SYS$USERS Admin Connection 72.73 UNNAMED 72.73
emagent.exe 18.18 UNNAMED 18.18
SYS$BACKGROUND UNNAMED 9.09 UNNAMED 9.09

Back to Load Profile
Back to Top

Top Client IDs

Client ID% ActivityAvg Active SessionsUserProgramService
SYS@Sachchida-PC@Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US 72.73 0.03 SYS OMS SYS$USERS

Back to Load Profile
Back to Top

Top SQL Command Types

  • 'Distinct SQLIDs' is the count of the distinct number of SQLIDs with the given SQL Command Type found over all the ASH samples in the analysis period
SQL Command TypeDistinct SQLIDs% ActivityAvg Active Sessions
PL/SQL EXECUTE 1 72.73 0.03
INSERT 1 9.09 0.00
SELECT 1 9.09 0.00

Back to Load Profile
Back to Top

Top SQL

Back to Top

Top SQL Statements

SQL IDPlanhash% ActivityEvent% EventSQL Text
8u809k64x3nzd 72.73 db file sequential read 45.45 begin DBMS_WORKLOAD_REPOSITORY...
72.73 CPU + Wait for CPU 27.27 begin DBMS_WORKLOAD_REPOSITORY...
3kmkqn10x3m0x 1983056714 9.09 db file sequential read 9.09 INSERT INTO DBSNMP.MGMT_SNAPSH...
cp5caasd2udnw 3838994914 9.09 CPU + Wait for CPU 9.09 /* OracleOEM */ SELEC...

Back to Top SQL
Back to Top

Top SQL using literals

No data exists for this section of the report.

Back to Top SQL
Back to Top

Complete List of SQL Text

SQL IdSQL Text
3kmkqn10x3m0xINSERT INTO DBSNMP.MGMT_SNAPSHOT_SQL( SNAP_ID, SQL_ID, HASH_VALUE, CHILD_NUMBER, ELAPSED_TIME, EXECUTIONS) SELECT :B2 , SQL_ID, HASH_VALUE, -1, ELAPSED_TIME, EXECUTIONS FROM V$SQLAREA WHERE EXECUTIONS > :B1 AND PARSING_USER_ID NOT IN (SELECT USER_ID FROM DBA_USERS WHERE USERNAME IN ('SYS', 'SYSMAN', 'DBSNMP'))
8u809k64x3nzdbegin DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT(); end;
cp5caasd2udnw /* OracleOEM */ SELECT TO_CHAR(CAST(md.end_time AS TIMESTAMP) AT TIME ZONE 'GMT', 'YYYY-MM-DD HH24:MI:SS TZD') time, md.user_wait_time_pct, md.db_time_ps db_time_users, md.cpu_time_ps db_cpu_users, DECODE(:1, 'TRUE', md.host_cpu_usage_pct, NULL) host_cpu_usage_pct, wcd.users userio_users, :2 max_cpu_cnt FROM (SELECT DISTINCT wait_class_id FROM v$event_name WHERE wait_class = 'User I/O' AND :3 = 'TRUE') wcn, (SELECT wait_class_id, intsize_csec, end_time, time_waited / intsize_csec users FROM v$waitclassmetric_history WHERE end_time >= SYSDATE - 15/(60*24)) wcd, (SELECT intsize_csec, end_time, SUM(CASE WHEN metric_name = 'Database Wait Time Ratio' THEN value ELSE 0 END) user_wait_time_pct, SUM(CASE WHEN metric_name = 'Database Time Per Sec' THEN value / 100 ELSE 0 END) db_time_ps, SUM(CASE WHEN metric_name = 'CPU Usage Per Sec' THEN value / 100 ELSE 0 END) cpu_time_ps, SUM(CASE WHEN metric_name = 'Host CPU Utilization (%)' THEN value ELSE 0 END) host_cpu_usage_pct FROM v$sysmetric_history WHERE metric_name IN ('Database Wait Time Ratio', 'Database Time Per Sec', 'CPU Usage Per Sec', 'Host CPU Utilization (%)') AND group_id = 2 AND end_time >= SYSDATE - 15/(60*24) GROUP BY intsize_csec, end_time) md WHERE wcn.wait_class_id = wcd.wait_class_id AND wcd.intsize_csec = md.intsize_csec AND wcd.end_time = md.end_time AND :4 != 'BASIC' ORDER BY md.end_time ASC

Back to Top SQL
Back to Top

Top PL/SQL Procedures

  • 'PL/SQL entry subprogram' represents the application's top-level entry-point(procedure, function, trigger, package initialization or RPC call) into PL/SQL.
  • 'PL/SQL current subprogram' is the pl/sql subprogram being executed at the point of sampling . If the value is 'SQL', it represents the percentage of time spent executing SQL for the particular plsql entry subprogram
PLSQL Entry Subprogram% ActivityPLSQL Current Subprogram% Current
SYS.DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT#1 63.64 UNKNOWN_PLSQL_ID <9278,17> 36.36
SQL 27.27
DBSNMP.MGMT_RESPONSE.GET_METRIC_CURS 9.09 SQL 9.09


Back to Top

Top Sessions

Back to Top

Top Sessions

  • '# Samples Active' shows the number of ASH samples in which the session was found waiting for that particular event. The percentage shown in this column is calculated with respect to wall clock time and not total database activity.
  • 'XIDs' shows the number of distinct transaction IDs sampled in ASH when the session was waiting for that particular event
  • For sessions running Parallel Queries, this section will NOT aggregate the PQ slave activity into the session issuing the PQ. Refer to the 'Top Sessions running PQs' section for such statistics.
Sid, Serial#% ActivityEvent% EventUserProgram# Samples ActiveXIDs
143, 346 72.73 db file sequential read 45.45 SYS OMS 5/300 [ 2%] 2
CPU + Wait for CPU 27.27 3/300 [ 1%] 1
139, 16 18.18 CPU + Wait for CPU 9.09 DBSNMP emagent.exe 1/300 [ 0%] 0
db file sequential read 9.09 1/300 [ 0%] 1
162, 1 9.09 os thread startup 9.09 SYS ORACLE.EXE (CJQ0) 1/300 [ 0%] 0

Back to Top Sessions
Back to Top

Top Blocking Sessions

No data exists for this section of the report.

Back to Top Sessions
Back to Top

Top Sessions running PQs

No data exists for this section of the report.

Back to Top Sessions
Back to Top

Top Objects/Files/Latches

Back to Top

Top DB Objects

  • With respect to Application, Cluster, User I/O and buffer busy waits only.
Object ID% ActivityEvent% EventObject Name (Type)Tablespace
9087 36.36 db file sequential read 36.36 SYS.WRH$_OSSTAT_NAME (TABLE) SYSAUX
335 9.09 db file sequential read 9.09 SYS.KOTTD$ (TABLE) SYSTEM
9640 9.09 db file sequential read 9.09 DBSNMP.MGMT_SNAPSHOT (TABLE) SYSAUX

Back to Top Objects/Files/Latches
Back to Top

Top DB Files

  • With respect to Cluster and User I/O events only.
File ID% ActivityEvent% EventFile NameTablespace
3 45.45 db file sequential read 45.45 C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF SYSAUX
1 9.09 db file sequential read 9.09 C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF SYSTEM

Back to Top Objects/Files/Latches
Back to Top

Top Latches

No data exists for this section of the report.

Back to Top Objects/Files/Latches
Back to Top

Activity Over Time

  • Analysis period is divided into smaller time slots
  • Top 3 events are reported in each of those slots
  • 'Slot Count' shows the number of ASH samples in that slot
  • 'Event Count' shows the number of ASH samples waiting for that event in that slot
  • '% Event' is 'Event Count' over all ASH samples in the analysis period
Slot Time (Duration)Slot CountEventEvent Count% Event
10:22:32 (28 secs) 1 os thread startup 1 9.09
10:25:00 (1.0 min) 3 db file sequential read 3 27.27
10:26:00 (1.0 min) 7 CPU + Wait for CPU 4 36.36
db file sequential read 3 27.27


Back to Top

End of Report

RMAN Recovery - All data files or tables using OEM

Perform Recovery
Perform Recovery


Whole Database Recovery


Restore all datafiles

Specify Time, SCN or log sequence. The backup taken at or prior to that time will be used. No recovery will be performed in this operation.
Object Level Recovery
Object Type
Operation Type


Flashback Existing Tables


Flashback Dropped Tables

Encryption

Host Credentials
To perform recovery, supply operating system login credentials to access the target database.
* Username


* Password



Save as Preferred Credential
Overview
  • Restore and/or recover the entire database or selected objects
  • Restore files to a new location
  • Recover tablespaces to a point-in-time based on a timestamp, system change number (SCN), or log sequence number
  • Recover datafile data blocks that are marked as corrupted, or based on datafile block IDs or tablespace block addresses
  • Flashback database or tables to a specific system change number (SCN) or timestamp