RMAN scripts needed?
Hi all,
I need RMAN scripts to perform both online and offline backup/recover in windows and unix.
I am using oracle 9i.
Could you post some examples or links for me?
Your help would be greatly appreciated.
I found few links for you.
http://oracle.ittoolbox.com/documents/popular-q-and-a/sample-of-rman-script-1391
http://www.mydatabasesupport.com/content/view/267/60/
http://orafaq.cs.rmit.edu.au/scripts/index.htm#BRR
Similar Messages
-
Hi guys,
I need you help in creating rman scripts.
my plan is the following:
- at night i would like to make a backup of the database, archivelogs, control file and spfile. then delete the archivelogs on disk.
- during the day i would like to make every hour, a backup level 1, archivelogs and crontrol file.
my questions are:
for the night backup is the following script ok?
run {
set command id to 'xxx';
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
BACKUP INCREMENTAL LEVEL 0 DATABASE;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
change archivelog all;
backup archivelog all delete input;
backup current controlfile;
BACKUP SPFILE;
release channel t1;
release channel t2;
and for the daily backup (run on every hour) what do you think about this? is it ok?
run {
set command id to 'xxx';
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup archivelog all not backed up 1 times;
backup current controlfile;
release channel t1;
release channel t2;
please help.
Message was edited.Hi Alanm,
Right now the DB is generating many archives, that doesn't mean that we cant adapt the script in the future if less archives are generated.
By saying "You don't have to make the archive log script an incremental 1 backup" you mean that, since we are already making a backup at night to the archives, theres no need to make them also during the incremental 1?
and for the rest, do you thing the script is ok? -
RMAN script errors out for some DB's
I have a single RMAN script that uses env variables to execute RMAN for two databases. It runs fine. I cloned the two DB's (changed DBID's), all four are on the same host. Now I try to use same script for all four. I receive an error when trying to run against the cloned databases. Here is script:
spool log to full.log append;
connect catalog rman/xxxxxx@iasrman
connect target /
run {
sql 'ALTER SYSTEM SWITCH LOGFILE';
backup incremental level 0 database diskratio=0 plus archivelog delete input;
And here is error, it stops same place everytime, input appreciated.
Recovery Manager: Release 9.2.0.5.0 - 64bit Production
RMAN>
connected to recovery catalog database
RMAN>
connected to target database: PRSMQ02 (DBID=944525168)
RMAN> 2> 3> 4>
sql statement: ALTER SYSTEM SWITCH LOGFILE
Starting backup at 30-MAY-07
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=20 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=19 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=18 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=17 devtype=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: sid=11 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=25 recid=25 stamp=623931644
channel ORA_DISK_1: starting piece 1 at 30-MAY-07
channel ORA_DISK_2: starting archive log backupset
channel ORA_DISK_2: specifying archive log(s) in backup set
input archive log thread=1 sequence=26 recid=26 stamp=623931644
channel ORA_DISK_2: starting piece 1 at 30-MAY-07
channel ORA_DISK_1: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931649_s59_s1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/q02/archive/prism/log_prsmq02_25.arc recid=25 stamp=623931644
channel ORA_DISK_2: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931649_s60_s1 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_2: deleting archive log(s)
archive log filename=/q02/archive/prism/log_prsmq02_26.arc recid=26 stamp=623931644
Finished backup at 30-MAY-07
Starting backup at 30-MAY-07
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00009 name=/q02/oradata01/prsmdata/Data_13.dbf
input datafile fno=00016 name=/q02/oradata01/prsmdata/Data_20.dbf
input datafile fno=00025 name=/q02/oradata01/prsmdata/Data_04.dbf
input datafile fno=00005 name=/q02/oraindx01/prsmdata/Index_11.dbf
input datafile fno=00020 name=/q02/oradata01/prsmdata/Tools02.dbf
input datafile fno=00022 name=/q02/oraindx01/prsmdata/index_12.dbf
channel ORA_DISK_1: starting piece 1 at 30-MAY-07
channel ORA_DISK_2: starting incremental level 0 datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00010 name=/q02/oradata01/prsmdata/Data_14.dbf
input datafile fno=00015 name=/q02/oradata01/prsmdata/Data_19.dbf
input datafile fno=00024 name=/q02/oradata01/prsmdata/Data_03.dbf
input datafile fno=00003 name=/q02/oratmp01/prsmdata/rbs01.dbf
input datafile fno=00001 name=/q02/orasys01/prsmdata/system01.dbf
input datafile fno=00012 name=/q02/orasys01/prsmdata/system02.dbf
channel ORA_DISK_2: starting piece 1 at 30-MAY-07
channel ORA_DISK_3: starting incremental level 0 datafile backupset
channel ORA_DISK_3: specifying datafile(s) in backupset
input datafile fno=00008 name=/q02/oradata01/prsmdata/Data_12.dbf
input datafile fno=00014 name=/q02/oradata01/prsmdata/Data_18.dbf
input datafile fno=00023 name=/q02/oradata01/prsmdata/Data_02.dbf
input datafile fno=00028 name=/q02/oradata01/prsmdata/Data06.dbf
input datafile fno=00019 name=/q02/oratmp01/prsmdata/rbs02.dbf
input datafile fno=00021 name=/q02/orasys01/prsmdata/DRSYS.dbf
channel ORA_DISK_3: starting piece 1 at 30-MAY-07
channel ORA_DISK_4: starting incremental level 0 datafile backupset
channel ORA_DISK_4: specifying datafile(s) in backupset
input datafile fno=00007 name=/q02/oradata01/prsmdata/Data_11.dbf
input datafile fno=00013 name=/q02/oradata01/prsmdata/Data_17.dbf
input datafile fno=00018 name=/q02/oradata01/prsmdata/Data_01.dbf
input datafile fno=00006 name=/q02/oradata01/prsmdata/Tools01.dbf
input datafile fno=00002 name=/q02/oradata01/prsmdata/Users01.dbf
input datafile fno=00026 name=/q02/oradata01/prsmdata/Data05.dbf
channel ORA_DISK_4: starting piece 1 at 30-MAY-07
channel ORA_DISK_5: starting incremental level 0 datafile backupset
channel ORA_DISK_5: specifying datafile(s) in backupset
input datafile fno=00004 name=/q02/oradata01/prsmdata/Data_15.dbf
input datafile fno=00011 name=/q02/oradata01/prsmdata/Data_16.dbf
input datafile fno=00017 name=/q02/oradata01/prsmdata/Data_22.dbf
input datafile fno=00027 name=/q02/oradata01/prsmdata/Data_05.dbf
channel ORA_DISK_5: starting piece 1 at 30-MAY-07
channel ORA_DISK_1: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s61_s1 comment=NONE
channel ORA_DISK_1: starting piece 2 at 30-MAY-07
channel ORA_DISK_2: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s62_s1 comment=NONE
channel ORA_DISK_2: starting piece 2 at 30-MAY-07
channel ORA_DISK_3: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s63_s1 comment=NONE
channel ORA_DISK_3: starting piece 2 at 30-MAY-07
channel ORA_DISK_4: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s64_s1 comment=NONE
channel ORA_DISK_4: starting piece 2 at 30-MAY-07
channel ORA_DISK_5: finished piece 1 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s65_s1 comment=NONE
channel ORA_DISK_5: starting piece 2 at 30-MAY-07
channel ORA_DISK_2: finished piece 2 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s62_s2 comment=NONE
channel ORA_DISK_2: starting piece 3 at 30-MAY-07
channel ORA_DISK_1: finished piece 2 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s61_s2 comment=NONE
channel ORA_DISK_1: starting piece 3 at 30-MAY-07
channel ORA_DISK_4: finished piece 2 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s64_s2 comment=NONE
channel ORA_DISK_4: starting piece 3 at 30-MAY-07
channel ORA_DISK_5: finished piece 2 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s65_s2 comment=NONE
channel ORA_DISK_5: starting piece 3 at 30-MAY-07
channel ORA_DISK_3: finished piece 2 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s63_s2 comment=NONE
channel ORA_DISK_3: starting piece 3 at 30-MAY-07
channel ORA_DISK_2: finished piece 3 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s62_s3 comment=NONE
channel ORA_DISK_2: starting piece 4 at 30-MAY-07
channel ORA_DISK_4: finished piece 3 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s64_s3 comment=NONE
channel ORA_DISK_4: starting piece 4 at 30-MAY-07
channel ORA_DISK_1: finished piece 3 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s61_s3 comment=NONE
channel ORA_DISK_1: starting piece 4 at 30-MAY-07
channel ORA_DISK_2: finished piece 4 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s62_s4 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:53:23
channel ORA_DISK_5: finished piece 3 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s65_s3 comment=NONE
channel ORA_DISK_5: starting piece 4 at 30-MAY-07
channel ORA_DISK_3: finished piece 3 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s63_s3 comment=NONE
channel ORA_DISK_3: starting piece 4 at 30-MAY-07
channel ORA_DISK_4: finished piece 4 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s64_s4 comment=NONE
channel ORA_DISK_4: starting piece 5 at 30-MAY-07
channel ORA_DISK_1: finished piece 4 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s61_s4 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:59:04
channel ORA_DISK_3: finished piece 4 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s63_s4 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 01:00:10
channel ORA_DISK_5: finished piece 4 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s65_s4 comment=NONE
channel ORA_DISK_5: backup set complete, elapsed time: 01:00:25
channel ORA_DISK_4: finished piece 5 at 30-MAY-07
piece handle=/iasrman/q02/prsmq02/prsmq02_df623931654_s64_s5 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 01:01:40
Finished backup at 30-MAY-07
Starting backup at 30-MAY-07
current log archived
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 05/30/2007 11:22:38
RMAN-06004: ORACLE error from recovery catalog database: ORA-03114: not connected to ORACLEconnect target /You need to inform the connection string to target database.
Can to be explicitly or with 'export sid' in your script. -
RMAN script failed while creating Data Guard 11g
Hi Friends,
I am creating Physical Standby (11g) using RMAN (ACTIVE) on windows using the doc : Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE [ID 1075908.1]
The folder structure on Primary DB and on Physical Standby is totally different.
while executing RMAN script i got errors for lot of locations and i specified the proper location in RMAN script itself (ex set diagnostic_dest = 'c:\app\' , set db_recovery_file_dest='C:\app\flash_recovery_area')
Location of control files on Primary DB:
D:\oradata\MESSTG\CONTROL01.CTL
D:\oradata\flash_recovery\messtg\MESSTG\CONTROL02.CTL
Location of control files (planned) on Physical Standby DB:
C:\app\oradata\MESSTDBY\CONTROL01.CTL
C:\app\flash_recovery_area\MESSTDBY\CONTROL02.CTL
How to specify control file location of Physical standby in set control_files?
Also i have 2 control files on Primary DB so do i need to specify both the control files , if so how?
I tried different combination in RMAN script but all are failed:
set control_files='D:\oradata\MESSTG\CONTROL01.CTL','C:\app\oradata\MESSTDBY\CONTROL01.CTL'
RMAN Error is :
while using set control_files=: C:\app\oradata\MESSTDBY\CONTROL01.CTL
contents of Memory Script:
backup as copy current controlfile for standby auxiliary format 'D:\ORADATA\MESSTG\CONTROL01.CTL';
restore clone controlfile to 'C:\APP\ORADATA\MESSTDBY\CONTROL01.CTL' from
'D:\ORADATA\MESSTG\CONTROL01.CTL';
executing Memory Script
Starting backup at 16-APR-13
channel prmy1: starting datafile copy
copying standby control file
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
released channel: stby
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/16/2013 14:18:41
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on prmy1 channel at 04/16/2013 14:18:41
ORA-17628: Oracle error 19505 returned by remote Oracle server
RMAN>
Error 2)
while using set control_files='D:\oradata\MESSTG\CONTROL01.CTL','C:\app\oradata\MESSTDBY\CONTROL01.CTL'
contents of Memory Script:
backup as copy current controlfile for standby auxiliary format 'D:\ORADATA\MESSTG\CONTROL01.CTL';
executing Memory Script
Starting backup at 16-APR-13
channel prmy1: starting datafile copy
copying standby control file
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
released channel: stby
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/16/2013 13:22:33
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on prmy1 channel at 04/16/2013 13:22:33
ORA-17628: Oracle error 19505 returned by remote Oracle server
RMAN>
Regards,
DBHi,
Can you paste here you rman script ?
I think following script can help you.
duplicate target database for standby
from active database
spfile
set "control_files"="d:\oradata\<standbydbuniquename>\CONTROL01.CTL"
set "db_name"="<DBNAME>"
set "db_unique_name"="<STANBYD DBA UNIQUENAME>"
set "db_file_name_convert"="C:\app\oracle\oradata\<dbname>","d:\oradata\<standbydbuniquename>"
set "log_file_name_convert"="C:\app\oracle\oradata\<dbname>","d:\oradata\<standbydbuniquename>"
set "db_recovery_file_dest"="D:\fast_recovery_area"
nofilenamecheck;C:\app\oracle\oradata\<dbname> - it is primary database dafiles location
D:\oradata\<standbydbuniquename> - it is standby database datafile location.
Don't forget creation of diagnostinc dests.
Regards
Mahir M. Quluzade -
We have decided to abandon user managed hot backups and go with RMAN. Could you critizize the following approach and see if we are missing anything? I am making whole database backup and controlfile and archivelogs. I am using RMAN catalog.
In a Unix script setting all of the environment variables and then
connect target ********
connect catalog *********
configure snapshot controlfile to '${ORACLE_HOME}/snapshot_${ORACLE_SID}_${TIMESTAMP}_ctl';
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup database plus archivelogs;
release channel c1;
release channel c2;
p.s. control file autobackup is on
Also, I have these questions:
1. How do I direct the output of this backup to a file?
2. Is there a way to check for errors within this file to see if the backup went ok?
3. Would anyone have a unix shell script example of the above?
4. How do I make sure that catalog is synched with control file and what is on the file system?
5. Is it customary to delete archive logs via RMAN script if, say, my policy is to keep it on the file system for 7 days?
thank you for any input!Hi,
You didnot mention the db version, assumed it's 10g.
If you planned to schedule this job at os level, you might use crontab (unix). The snapshot controlfile config can set with catalog once, so it's not needed to include in your backup script. Like wise your retention can set as "recovery window of 7 days".
1. How do I direct the output of this backup to a file?
==> inside rman script you might use the following command,
set log to '/home/oracle/rmanbkp.log';
2. Is there a way to check for errors within this file to see if the backup went ok?
==> you might check in the logfile for ORA- and RMAN- errors.
3. Would anyone have a unix shell script example of the above?
I use to schedule this job either by OEM or crontab using rman script file.
4. How do I make sure that catalog is synched with control file and what is on the file system?
RMAN will do auto sync with controlfile.
5. Is it customary to delete archive logs via RMAN script if, say, my policy is to keep it on the file system for 7 days?
Upon successful backup you may delete the archivelogs or you might decide to keep it for 7 days and then delete by applying "delete obsolete" command.
Thanks,
Nirmal -
RMAN script problem to create logical standby database !
Dear Friends ,
I am using Oracle10g database . I want to create a logical standby database . I create two database :
Primary : orcl
standby : orclsby1
Every steps I followed successfully , but when I am going to create "standby database" from "primary database" using rman then I found the following error :
The script is below which I have to run in Primary (orcl) database :
Script :
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'orcl','orclsby1'
set db_unique_name='orclsby1'
set db_file_name_convert='/orcl/','/orclsby1/'
set log_file_name_convert='/orcl/','/orclsby1/'
set control_files='/u01/app/oracle/oradata/orclsby1.ctl'
set log_archive_max_processes='5'
set fal_client='orclsby1'
set fal_server='orcl'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(orcl,orclsby1)'
set log_archive_dest_1='service=orcl ASYNC
valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=orcl'
Problem which I got :
[oracle@localhost DG]$ rman target sys/sys123@orcl auxiliary sys/sys123@orclsby1
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Oct 19 15:58:17 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1227832857)
connected to auxiliary database: ORCLSBY1 (not mounted)
RMAN> @cr_phys_sby1.txt
RMAN> run {
2> allocate channel prmy1 type disk;
3> allocate channel prmy2 type disk;
4> allocate channel prmy3 type disk;
5> allocate channel prmy4 type disk;
6> allocate auxiliary channel stby type disk;
7> duplicate target database for standby from
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "from": expecting one of: "dorecover, db_file_name_convert, nofilenamecheck, ;"
RMAN-01007: at line 7 column 39 file: cr_phys_sby1.txt
I try to edit the above script using 'nofilenamecheck' 'dorecover' etc. , but cannot resolve the problem . Would u plz help me .... where the problem is .
Both databases are running on Oracle10g platform .
Waiting for ur kind reply .. ...You need to:
- create a SPFILE manually for standby database
- use the RMAN command: DUPLICATE TARGET DATABASE FOR STANDBY
- remove all SPFILE statements from RMAN script. -
RMAN scripts & variables/parameters
Hi
We are using RMAN with TSM. There are a number of 9i and 8i databases. I tried to set the environment up to with as few scripts as possible to cover the variety of databases. I provide various variables/parameters to handle the differences between the various databases.
In the 9i environment I "CONFIGURE" as much as possible to avoid setting changes in the actual backup script. That gives me a fairly clean generic backup script which also avoids manual channel allocations ie :
run
backup incremental level=0
not backed up since time='SYSDATE-(8/24)'
check logical
filesperset=4
format='/LVL0_%d_%T_%U'
(database include current controlfile)
plus archivelog format '/ARC_%d_%T_%U' delete all input;
However due to the lack of "CONFIGURE" in 8i I cannot configure automatic channels. Therefor my script has to change to :
run
allocate channel ch01 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch02 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch03 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch04 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
backup incremental level=0
check logical
filesperset=4
format='/LVL0_%d_%T_%U'
(database include current controlfile)
(archivelog all format '/ARC_%d_%T_%U' delete input);
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
I have multiple database instances on the same server & would like to have a single generic script with a variable/parameter to change the "tdpo.opt" file for each instance. The alternate is to have a complete set of scripts for each DB instance with everything hard coded.
The question is : Can I pass variables/parameters to a RMAN script? If yes, how do I go about it?
Maybe there are other ideas out there to do this. The key to me in this whole execise is to reduce maintenance & increase flexibility.
Your responses will be appreciated
CMI was hoping to get away from building part of the backup script ie the channel allocation in the RMAN statement.Don't know how you expect to do this when it's required for 8i databases ?
Well since you are looking to accommodate 8i & 9i database and you need to manually allocate channels for the 8i databases, then you could configure your script to include an IF..THEN block that will run one set of RUN commands if the database name that is passed in is in a certain list and run the other RUN block if it isn't. You could maintain two "here document" blocks, one for 8i and one for 9i. Therefore, all of the commands can reside in one generic script.
For example, you could configure your single, generic script as:
# add your logic checking here to see if a 9i database sid
# was passed in as a parameter. If so run the following code
rman target / log=${sid}bkp_log append << !1
run
backup incremental level=0
not backed up since time='SYSDATE-(8/24)'
check logical
filesperset=4
format='/LVL0_%d_%T_%U'
(database include current controlfile)
plus archivelog format '/ARC_%d_%T_%U' delete all input;
!1
# if not run the following (ie. 8i databases)
rman target / log=${sid}bkp_log append << !2
run
allocate channel ch01 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch02 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch03 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
allocate channel ch04 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin/tdpo_${ORACLE_SID}.opt)';
backup incremental level=0
check logical
filesperset=4
format='/LVL0_%d_%T_%U'
(database include current controlfile)
(archivelog all format '/ARC_%d_%T_%U' delete input);
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
!2then you could call this generic script with the appropriate command line parameters.
Hope I'm following your explanation/requirement. -
Hi guys,
someone can tell me if is possible to edit rman script in Backup Jobs definition of Grid?
I've scheduled some jobs backup and I need to edit script but don't find where i can edit it..
thanks
Andreahi,
yes this is possible.
from grid, select the database and then scroll down to the bottom of the page, there you will see a section called Related Lin ks,
one of these is jobs.
select this and you will then get a page which shows any scheduled jobs, completed jobs.
there are also a number of options one of which is 'edit', this will allow you to edit your job.
hope this helps
Alan -
Oracle Online Backup through EMC Networker - RMAN Script
Hi,
For taking online oracle backup through EMC Networker, we configure the RMAN script to connect to the target database, create the media channels, backup format etc. The password for the sys or rman user entered in the RMAN script is in clear-text format.
Due to security reasons, I don't want the passwords to be entered in the RMAN script. Is there any option for configuring RMAN script without mentioning the username/password to connect to the target database ?
Thanks & Regards,
Shreejesh.When you have to connect remotely to RMAN, you cannot hide the password, you can only define very restricted access for the script itself. Remote OS authentication will not work, because the target db user needs SYSDBA privilege, which cannot be granted to an externally identified user.
Werner -
Hi,
I have wriiten RMAN script to report need backup?below the code
#!/bin/ksh
export ORACLE_SID=test1
echo $ORACLE_SID
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
echo $ORACLE_HOME
export PATH
echo $PATH
RMAN=$ORACLE_HOME/bin/rman
$RMAN target sys/sys@test1 nocatalog
RUN {
report need backup;}
exit;
echo "Completd"The problem is that when i run the script it goes into the RMAN prompt and doesnt run "report need backup". I guess its unable to recognize the run command.below the error
./full_db_hot_backup.sh[14]: RUN: not found [No such file or directory]
./full_db_hot_backup.sh: line 14: syntax error at line 15: `}' unexpectedWrite as following
$ORACLE_HOME/bin/rman << EOF
connect target /
run
report need backup;
exit
EOF
Talip Hakan Ozturk
http://taliphakanozturken.wordpress.com/ -
Understanding order of commands in RMAN script
I just started working at a new job and the prior DBA had already left before I got there. I'm looking at his RMAN script to backup the 11gR2 single instance database and I can't understand what is the need for two "crosscheck backup" commands? Wouldn't it be prudent to also have a "crosscheck backup of archivelog all" command as well? Also, what is the point of having the "restore database preview" command in the daily backup script?
run
crosscheck backup;
recover copy of database with tag 'ORA$OEM_LVL1_ILANDB_PRIM' until time 'SYSDATE-1';
backup incremental level 1 for recover of copy with tag 'ORA$OEM_LVL1_ILANDB_PRIM' database plus archivelog delete all input;
delete noprompt obsolete;
restore database preview;
crosscheck backup;
}Here is how RMAN is currently configured. How do you suggest I clean this up?
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/app/oracle/fast_recovery_area/ORCL/fullbackup/full_bkp_${DD}/%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/app/oracle/fast_recovery_area/ILANDB/fullbackup/full_bkp_%d_DB_%u_%s_%p';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE EXCLUDE FOR TABLESPACE 'WEBTASK_DATA';
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORCL.f'; # default -
How to store the value into variable and access it in RMAN script
I want to create a variable and dynamically assign a numeric value to it (may get the value may be from SQL )and access the value in RMAN script.
Thanks...RajRaj,
We have been getting this type of request and it is not possible via RMAN to do that.
BUT--You could write a sql/plus script to query your variable and produce the RMAN script with the new value.
Just a suggestion.
Tammy -
Can I call an external program from my rman script
Hi
Is it possible to do an external call to a bat-file in a rman script?
My script looks like this (it's pretty much generated from EM):
$rman_script="backup device type disk tag '%TAG' database;
sql 'alter system archive log current';
backup device type disk tag '%TAG' archivelog all not backed up delete all input;
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;
Can i somehow make an external call before at the end?
Regards
Klaus MogensenYou can use the HOST command.
-
How to pass a shell variable to rman scripts
I want to backup datafile to different directory
depending on the current time,and I can do this to
pass a shell variable to rman scripts,and this
variable will used as part of format ,like this:
backup incremental level=0
tag rman_inc0_bck
filesperset 5
format '$(DIR)/rman_fulldb_%u_%s_%p_%d'
(database include current controlfile)
and $(DIR) is shell variable ,but rman will not
recognize this ,how to achieve this?You could send your script to rman thru a pipe | or <<
echo "backup incremental level=0
tag rman_inc0_bck
filesperset 5
format '$(DIR)/rman_fulldb_%u_%s_%p_%d'
(database include current controlfile);" | rman target /You could also create a "temp script" and then use it from rman with cmdfile
sed "s,XXXDIR,$(DIR)," yourtemplate > /tmp/rmanscript.$$
rman target / cmdfile /tmp/rmanscript.$$
rm /tmp/rmanscript.$$ -
Schedule rman script in Windows 2003
Oracle 10.2. I wrote a rman script and tried to schedule auto run in Windows 2003 server. I got this errors:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-12560: TNS:protocol adapter error
The batch file name: rman_backup.bat
content: rman target / cmdfile rman_backup.rcv log rman_backup.log
Here is how I set it up:
go to Control Panel>Scheduled Tasks>Add Scheduled Task, find rman_backup.bat, choose the run time and finish it. When asking for user name and password, I supply the user which is in oracle dba group.
But when it run, it just produced the above error and won't run.
Please advise
S.
in SQLnet.log
fatal NI connect error 12560, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracleORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(CONNECT_DATA=(SID=ORCL)(CID=(PROGRAM=D:\oracle\product\10.2.0\db_1\bin\rman.exe)(HOST=W3TY5Z203)(USER=WELC))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 10.2.0.4.0 - Production
Time: 30-MAR-2010 11:27:00
Tracing not turned on.
Tns error struct:
ns main err code: 12560
TNS-12560: TNS:protocol adapter error
ns secondary err code: 0
nt main err code: 530
TNS-00530: Protocol adapter error
nt secondary err code: 2
nt OS err code: 0here is example of script we are using to backup database from windows scheduler:
set oracle_home=d:\oracle\ora920
set path=d:\perl\bin;d:\oracle\ora920\bin;c:\winnt;c:\WINDOWS\system32;
set PERL5LIB=''
set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
set TNS_ADMIN=d:\oracle\ora920\network\admin
d:
cd \scripts
set oracle_sid=car
rman target sys/car_$z3br4 catalog rman/oemrp_pwd@oemrp @rman_level0_car.rman > rman_level0_car.log
perl email_log.pl "RMAN Level 0 Log" d:\scripts\rman_level0_car.log CARthis script backing up 9i database. 10g and 11g database we backing up via EM grid control.
You can change this script to backup 10g or 11g databses as well.
Maybe you are looking for
-
How can I acquire a copy of Mac OS X 10.5 Leopard?
I need to upgrade my iMac from Tiger v10.4.11 to Leopard v10.5. I have all the upgrades from 10.5.1 on but I'm unable to find the original Leopard software. My computer still works flawlessly but I need to upgrade to take advantage of software update
-
Help me out to run Interactive forms in CE7.1
Hi experts, I am new to this SAP webdynPro for java World.Can you please help me to run interactive Forms. I have installed CE7.1 Dev_studio and J2EEServer.To Develop Adobe Interactive Forms i have installed Adobe Designer7.1. When i run the Applicat
-
Unexpected token `(' in my bash script [Solved]
I've been working on a bash script, and I'm trying to get it to move all directories that are not named certain names to another directory. EDIT: Fixed the thing papajoke pointed out #!/bin/bash mv ~/Downloads/!(folders|pics|docs|code|archives|vids|s
-
ActionPerformed JButton vs JMenuItem
I'm having problem with implementing actionPerformed. I have a JButton and a JMenuItem and I want their functionality to be the same (actually I want to get rid of the button and just use the menu item). However the following code performs correctly
-
Set byteArray as sharedProperty. Write data to byteArray. Set byteArray length to zero. Clear byteArray. Memory use is bigger and bigger. Bug#3555791