Connecting to RMAN without Recovery Catalog :

Note : The current active sid name is MICRON

C:\>rman nocatalog

C:\>connect target /

NOTE :

After connecting to RMAN and before taking the backup u need to first check whether the target database in is archive mode and automatic archival is enabled or not as shown in the below screen shot.

Summary of the steps shown in the above screen shot is

1)checked whether the database is in archive mode & automatic archival is enabled or not.so exceuted the following command.

SQL>archive log list;

Which showed the database is in archived mode but automatic archival is not enable.so next inorder to enable it….follow the below steps

2)shutdown database

SQL>shutdown immediate

3)Open the database in mount state

SQL>startup mount

4)execute the command to start archiving

SQL>alter system set log_archive_start=true scope=spfile;

5)Finally , Open the database

SQL>alter database open;

6)Now, again execute the command to check both conditions

SQL>archive log list;

The output shows that database is in archive log mode & automatic archival is enabled.

Now that the database is in archive log mode u can start taking online backups :

There are 2 methods to take backups:

1)By manually entering the Backup Commands

2)By running Backup Scripts USING OS FILES

METHOD 1:

->Perform full database backup of all the datafiles to a local disk in D:\backups directory

Syntax:

RMAN>run{allocate channel d1 type disk;

2>backup full format ‘d:\backups\rman_%d_%u.bus’

3>database;}

Output :

Note 1 :

If u see in the 1st -half of the output , there is an error message.

First i started rman with no catalog option.Then while I connected to the target database in the following manner :

Rman > connect target sys/sys

I got the error message as- insufficient priviledges( shown in the screen shot).

Reason :

I have created a password file earlier and set the password as micron for security, which is y the following error occurred.So inorder to overcome this I have connected as

Rman>connect target sys/micron

Now,after executing this command , I have connected & executed the command to take backup successfully (check the output]

Note 2 :

Backup location : D:\backups

Backup name : RMAN_MICRON_07JI35OB.BUS

METHOD 2 :

RUNNING THE BACKUP SCRIPTS USING OS FILES

1)open a text document

2)type the backup script in it

Example : (see the screen shot also)

# this script takes a full backup of the database.

run{

# allocate a channel

allocate channel d1 type disk;

# issue the backup command

backup full format ‘d:\rman_%d_%u.bus’ database;

}

3)

Save it as rmn extension

For example : fullbackup1.rmn (as shown in above screen shot)

Save the file in the directory from where u ll execute the script.

For example c:\ Documents and Settings \ anupama >

In this case put the script in directory called anupama

4)Then take backup from the command prompt

c:\ Documents and Settings \ anupama >rman target sys/micron nocatalog @fullback1.rmn

Note :

If u want to store the output then u can create a log file which will contain the output in a text format.the file will be in default directory (if u didn’t specify the path)i.e..,from where u executed the command.Here in this case it will be in directory called anupama.

So within the command u should mention the name of the log file and if want location also as shown in the following screen shot.

Syntax :

c:\ Documents and Settings \ anupama >rman target sys/micron nocatalog @fullback1.rmn log=fullback1.log

screen shot :

If u include “log=fullback1.log “ statement then output will be displayed in the log file instead of appearing in the screen of the prompt.The log file will be created automatically once the statement is executed.

Screen shot of the log file:

Another way to run the script :

1)start rman with no catalog option

C:\>rman nocatalog

2)connect to target

Rman>connect target sys/micron

Where username =sys

Password =micron

3)run the script

Rman>@fullback1.rmn

Where fullback1.rmn=script name with rmn extension.

See the above 3 steps in the following screen shot :

NOTE 1 :

Running SQL commands from within RMAN prompt :

Sometimes u wish to run SQL commands from within RMAN.In this situation u should follow the following format :

RMAN>sql “alter system switch logfile”;

Here the point is u have to put ur SQL statement within double quotes but if there is single quote marks in ur SQL statement itself then use double quote marks shown below:

RMAN>sql “ alter database datafile ‘ ‘d:\oracle\oradat\user01.dbf’ ’ offline ;

NOTE 2 :

Running OS commands within RMAN prompt :

You can also run O/S commands using a similar technique with the host command:

RMAN > host “dir” ;

NOTE 3 :

If you do not use a catalog, make sure that your control files are backed up via the ALTER DATABASE BACKUP CONTROLFILE command.

NOTE 4 :

You may need to increase the size of the init.ora parameter CONTROL_FILE_RECORD_KEEP_TIME.

This parameter controls the number of days backup and recovery information is stored in the control file before it can be overwritten. The default is seven days. You must ensure that you run your backups at least once during that seven-day period.

Advertisement