How do Back Up with RMAN Command

Posted on 2003-11-05
Medium Priority
Last Modified: 2012-05-04
Hi All,
Please any one gave me the detail of the  database backup of the oracle 8.1.6 with the

 RMAN command .
If any one then please gave the command sequence in details .
sanjeev roy

Question by:sanjeevkumarr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 23

Accepted Solution

seazodiac earned 100 total points
ID: 9686252
Assume that you have set up RMAN repository:

then at the command prompt or shell:

$RMAN catalog rman/rman@<rman_repository_sid> target sys/password@<target_database_sid>

RMAN> register database;

RMAN> run {
allocate channel d1 type disk;
backup database;

LVL 10

Assisted Solution

SDutta earned 100 total points
ID: 9688249
Here is an extract from Oracle's Metalink note : RMAN 8.0 to 8i - Getting Started


The relevant portions are pasted here if you don't have access to metalink.

How To: Setup an Oracle 8 to 8i database for backup using Recovery Manager
All users wanting to learn more about RMAN and as a guide for usage.
RMAN: Setup and Usage from Oracle8 to 8i Environment
The purpose of this exercise is to give you some hands on experience using
Recovery Manager command line interface. We hope when you complete these labs
you will have a better understanding of how RMAN works and what is required to
use RMAN.
Note: The scripts were tested in an Oracle8 8.0.x database. Some changes may be required for them to work in Oracle8i.

1.0 RMAN Setup
We are assuming in this scenario that we have 2 databases RCAT and PROD. The SQL*Net connections should already be created and tested.

1.1 Decisions before creating the catalog owner and user.
You must decide if a recovery catalog will be used or if you will be using the target database controlfile.
It is always recommended that you use a recovery catalog. For larger system the use of a recovery catalog can increase the backup performance. Also if the target database controlfiles are lost recovery can become difficult if not impossible. The catalog can be created in a test or development database. You may also create an ordinary Oracle database to specifically be used for backup and recovery purposes.
In our lab there will be 2 databases. A target database and recovery catalog database. They will be on the same machine so hopefully we can accommodate have separate disks to house them both.
1.2 Generic setup of the recovery catalog:
1.2a In the database designated as the recovery database we need to create the user RMAN in Server Manager. This step is generic in 8.0.x - 8.1.x
svrmgrl> connect internal
svrmgrl> create tablespace CATALOG
datafile '/u01/oracle/rcat/cat1rcat.dbf
size 20M;
statement processed
svrmgrl> create user rman identified by rman
temporary tablespace TEMP
default tablespace CATALOG quota unlimited on
statement processed
svrmgrl> grant recovery_catalog_owner to rman;
statement processed
1.2b Now the RMAN user is ready to create the recovery catalog.
Note: This step only applies for an Oracle8 8.0.x catalog creation.
svrmgrl> connect rman/rman@rcat
svrmgrl> @?/rdbms/admin/catrman.sql
This only takes a few minutes to run. Once complete we'll have all the metadata required for the recovery catalog created under the RMAN schema and in the RMAN default tablespace.

1.2c In Oracle8i the catalog is created a little differently.
Note: This step only applies to Oracle8i 8.1.5 and greater.
From the UNIX shell run:
% rman catalog rman/rman
RMAN> create catalog;
This will generate the recovery catalog schema in the default tablespace for RMAN.

1.2d Now we have a recovery catalog and need to register the target database with the catalog to get the target databases controlfile information. What is RMAN looking at when we look at the controlfile?
Take a look at the v$controlfile_record_section view to determine what information we store in the controlfile in Oracle8 and up.
Back to the UNIX prompt:
% rman TARGET / RCVCAT rman/rman@rcat
( There are a number of ways to connect to the RMAN subsystem. If an @ symbol is used on the TARGET side of the command then an external passwordfile must be used and the INIT.ORA parameter REMOTE_LOGIN_PASSWORDFILE must be exclusive. Refer to your Oracle Server Administration guide for more information about password files.)
Recovery Manager: Release - Production
RMAN-06005: connected to target database: PROD
RMAN-06008: connected to recovery catalog database
RMAN> register database;
Once complete the DBID, DB_NAME, and structure are captured in the recovery catalog. To verify the registration run:
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-06240: List of Database Incarnations
RMAN-06241: DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
RMAN-06242: ------- ------- -------- --------------- ----- --------- -----------------
RMAN-06243: 1 2 PROD 3351020544 YES 1 10-AUG-99
Now we have the target database information stored in the recovery catalog.
Notice the current column (CUR) as this become important later. When the database is opened with the
RESETLOGS option the catalog must also be reset. This is accomplished by running:
### Note: This is an example. Only perform this step after a "resetlogs" on the target database. ###
RMAN> reset database;
This command lets RMAN know we have reset the TARGET database after an incomplete recovery. The next backup is the baseline for the new incarnation of the PROD database and the current TARGET would be listed separately in the list command. We'll cover this more later on.

2.0 Making Backups with Recovery Manager

2.0a We are ready to move to the next step now.
There are rules for everything and this is no exception. To begin making RMAN backups we need to know some things.

1. Limitations:
With the Oracle8 standard Edition you can allocate only 1 channel at a time. This means you will have to allocate then deallocate to switch between SBT_TAPE and disk channels.
The Oracle8 Enterprise Edition can allocate up to 4 channels with the default MML provided on the Oralce8 media. This is a limitation of the 3rd party MML not Recovery Manager.
The Oracle8 Standard Edition can only allocate only 1 channel at a time. If you have operations that require tape and disk channels you will have to write the allocate and release the channels when the operation requires, such as replicating the controlfile during restore.
With a fully licensed third party backup software that is on the Oracle BSP list you can get the MML directly from the vendor, link it in and then you are limited only be the 3rd party software capabilities.

2.1 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. Use the set snapshot controlfile name command to change the name of the snapshot control file; subsequent snapshot control files that RMAN creates use the name specified in the command.
For example, start RMAN and then enter:
set snapshot controlfile name to '/oracle/dba/prod/snap_prod.ctl';
You can also set the snapshot control file name to a raw device. This operation is important for OPS databases in which more than one instance in the cluster use RMAN because server sessions on each node must be able to create a snapshot control file with the same name and location. For example, enter:
set snapshot controlfile name to '/u01/backup/PROD/snap_prod.cf';
If one RMAN job is already backing up the control file while another needs to create a new snapshot control file, you may see the following message:
RMAN-08512: waiting for snapshot controlfile enqueue
Under normal circumstances, a job that must wait for the control file enqueue will wait for a brief interval and will then successfully retrieve the enqueue. Recovery Manager makes up to five attempts to get the enqueue and then fails the job. The conflict is usually caused when two jobs are both backing up the control file, and the job that starts backing up the control file first waits for service from the media manager.

2.2 Tescase 1 Cold backup

2.2a Taking a cold(offline) full backup up to a DISK channel.
svrmgrl> connect internal
svrmgrl> shutdown immediate;
svrmgrl> startup mount
% rman target / rcvcat rman/rman@rcat
run {
allocate channel c1 type disk format '/backup/u00/oracle/prod/df_%d_%p_%c';
backup (database);
sql 'alter database open';
release channel c1;

2.2b Verify the existence of the backupset in the catalog.
RMAN> list backupset of database;
RMAN-03022: compiling command: list
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-06230: List of Datafile Backups
RMAN-06231: Key File Type LV Completion_time Ckp SCN Ckp Time
RMAN-06232: ------- ---- ------ ---- ----------------------- ---------- -------------
RMAN-06233: 1386 5 Full 21-OCT-99 468068 21-OCT-99

2.2c The same full backup from 2.2a to SBT_TAPE
svrmgrl> connect internal
svrmgrl> shutdown immediate;
svrmgrl> startup mount
% rman target / rcvcat rman/rman@rcat
run {
allocate channel t1 type 'SBT_TAPE'
format 'df_%d_%p_%c';
backup (database);
sql 'alter database open';
release channel t1;

2.2d HOT/OPEN backup (online) using incremental level 0
Note: The database must be in archivelog mode to run hot/open backups.
Verify this with the "archive log list" command:

1. Start svrmgrl and connect internal
svrmgrl> connect internal
svrmgrl> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination '/u01/oracle/prod/archive'
Oldest online log sequence 151
Next log sequence to archive 152
Current log sequence 152
As long as archivelog mode is set we can continue now.

2. Start Recovery Manager and run a hot/open database backup. In this scenario we are performing a hot/open backup of the database and another backup of the archived redologs deleting the logs after backup. This avoids the DBA having to keep up with the log_archive_dest space management.
% rman target / rcvcat rman/rman@rcat
RMAN> run {
allocate channel c1 type disk;
format '/backup/u00/oracle/prod/df_%d_%s_%p';
backup (database include current controlfile);
release channel c1;
allocate channel c1 type disk format '/backup/u00/oracle/prod/al_%d_%s_%p';
backup (archivelog all delete input);
release channel c1;

2.2e So far we have only allocated 1 channel. This will create a set of input buffers and output buffers.
Let's talk about backups and backup types. What types of backups can we do?
1. Full - All used blocks are copied to output.
2. Incremental - Backing up all used blocks since a backup => LEVEL N
Level is a base number used at block level to identify if the block is => the incremental number specified. It's really not that bad.
If I back up using an LEVEL 2 incremental backup strategy then 1st I would have a full or LEVEL 0 incremental backup for the baseline starting on Sunday.
Then perform a LEVEL 2 backup on Monday and then again on Tuesday, I only backup what changes each day. When I do a LEVEL 1 backup on Wednesday the I get all blocks that have changed since the LEVEL 0 backup because LEVEL 1 is < the 2 it continues to backup what the level 2 backups had already done a backup of the 2 days before. Next run the LEVEL 2 backups Thursday, Friday, and Saturday, then back to the Sunday Level 0 backup so we get a fresh copy of all used blocks in the database.
LVL - Sunday Monday Tuesday Wednesday Thursday Friday Saturday
0 Baseline ( All Used Blocks )
2 ---------|
2 ------------|
1 ---------------------------------------------|
2 ---------------|
2 -----------|
2 -------------|
0 Baseline New
With this strategy we can restore and recover a database only having to restore 2-3 incrementals besides the baseline to recover the database to as current a state as possible. The nice thing is when you tell RMAN to recover it will try and perform a complete recovery and when you set until for incomplete recovery RMAN still determines what backups will be needed to recover until a point in time, a logseq, or an scn number. All set until recoveries are still resolved to an scn by RMAN if "until time" or "until logseq" are used.
set snapshot controlfile name to '@snapcf_TARGET.f';
run {
allocate channel t1 type 'sbt_tape';
sql "alter system archive log current";
backup incremental level 2;
format 'df_%t_%s_%p' database;
sql "alter system archive log all";
backup format 'cf_%t_%s_%p' current controlfile;
Incremental backups are only available in the Oracle Enterprise Edition. The levels 0 and 1-4 are only reference points. One level does not backup blocks any differently. But the level that was last used will be retained in the block header so when you specify a higher level the candidate blocks are verified in descending order.

2.3 Backing up just the archivelogs
You can select to backup the archived log files in the LOG_ARCHIVE_DEST and remove them with the "delete input" option to reclaim the space avoiding time spent scrambling to clear the space after it runs out of disk resources and the database has stopped. If space management is priority due to lots of archive redo logs you can create a script to backup the files to tape and remove them upon backup completion. Schedule as a CRON job to run as often as needed.
Run {
set command id 'RMAN';
allocate channel t1 type 'sbt_tape';
allocate channel t2 type 'sbt_tape';
filesperset 20
format 'al_%t_%s_%p'
archivelog all
delete input;
release channel t1;
With many files you may want to allocate additional channels to increase backup performance. By limiting FILESPERSET we can cause multiple sets to be created and each set copied in parallel to tape.

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question