Monday, February 2, 2009

Rman scripts execution diference from either os prompt or rman prompt

There is small but effective difference to know about a rman script execution initiated from operating system prompt or recovery manager prompt . let us check:

my script w.txt has the following contents:

backup datafile 1;
backup datafile 45;
show all;

notice in line number 2 of the file i have mentioned the datafile 45,which does not exist in my database. so, check what happens when we execute the script .

1) try executing this from rman prompt:

RMAN> @C:\w.txt

OUTPUT :
RMAN> backup datafile 1;
Starting backup at 02-FEB-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\LION\DATA\SYSTEM.DBF
channel ORA_DISK_1: starting piece 1 at 02-FEB-09
channel ORA_DISK_1: finished piece 1 at 02-FEB-09
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
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 02-FEB-09
channel ORA_DISK_1: finished piece 1 at 02-FEB-09
piece handle=D:\LION\FRA\LION\BACKUPSET\2009_02_02\O1_MF_NCSNF_TAG20090202T120308_4RF35FLV_.BKP tag=TAG20090202T120308 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 02-FEB-09

RMAN> backup datafile 45;
Starting backup at 02-FEB-09using channel ORA_DISK_1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of backup command at 02/02/2009 12:03:29
RMAN-20201: datafile not found in the recovery catalog
RMAN-06010: error while looking up datafile: 45
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 OFF; # default
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 'E:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFLION.ORA'; # default
RMAN> **end-of-file**



2) Now try to execute the same from OS prompt:

C:\ershad>rman target /@database @c:\w.txt

OUTPUT:
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Feb 2 12:03:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: LION (DBID=396604920)
RMAN> backup datafile 1;

2> backup datafile 45;
3> show all;
4>Starting backup at 02-FEB-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\LION\DATA\SYSTEM.DBF
channel ORA_DISK_1: starting piece 1 at 02-FEB-09
channel ORA_DISK_1: finished piece 1 at 02-FEB-09
piece handle=D:\LION\FRA\LION\BACKUPSET\2009_02_02\O1_MF_NNNDF_TAG20090202T120348_4RF36564_.BKP tag=TAG20090202T120348 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
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 02-FEB-09
channel ORA_DISK_1: finished piece 1 at 02-FEB-09
piece handle=D:\LION\FRA\LION\BACKUPSET\2009_02_02\O1_MF_NCSNF_TAG20090202T120348_4RF36OY2_.BKP tag=TAG20090202T120348 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02Finished backup at 02-FEB-09
Starting backup at 02-FEB-09using channel ORA_DISK_1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of backup command at 02/02/2009 12:04:08

RMAN-20201: datafile not found in the recovery catalog
RMAN-06010: error while looking up datafile: 45
Recovery Manager complete.



Analysis:

1) when invoke rman scripts from rman prompt it will execute the script line by line. so , it will not end in between it gets one or more statement wrong. it will end at the last statement of the file
2) But while running rman script from os prompt ,rman will first parse the complete file then execution all the statement one by one . so, any error in parsing or execution stage will terminate rman session.
As you can see , in the second one , "show all" was not executed from my script as the second statement fails .

thanks ,
have a nice day........................................

Silence does not always mark wisdom.
Samuel Taylor Coleridge.

No comments: