Setting Environment Variable in RMAN scripts [message #252329] |
Wed, 18 July 2007 11:36 |
ksintrakool
Messages: 20 Registered: July 2006 Location: Las Vegas
|
Junior Member |
|
|
Hi All,
Is there a way to set environment variable in RMAN scripts?
I have a shell script to call a RMAN script which that RMAN script uses environment variable from my shell script.
Thank you,
|
|
|
Re: Setting Environment Variable in RMAN scripts [message #252360 is a reply to message #252329] |
Wed, 18 July 2007 12:46 |
DreamzZ
Messages: 1666 Registered: May 2007 Location: Dreamzland
|
Senior Member |
|
|
Whats you OS??
I have this for solaris you can try something like
>more ds_daily_backup.com
#!/bin/ksh
. $HOME/.profile_ds<<<<<<<contains all the environment variable setting + mount points etc
sqlplus oracle/dsoracle @$DS_SCRIPT/ds_ora_errors_report.sql >/dev/null 2>&1
$DS_SCRIPT/rman_maint_ds.com
$DS_SCRIPT/archive_switch_ds.sql
$DS_SCRIPT/ds_rman_bu.com
$DS_SCRIPT/mlog_errors_ds.com
$DS_SCRIPT/rman_maint_ds.com
[Updated on: Wed, 18 July 2007 12:47] Report message to a moderator
|
|
|
Re: Setting Environment Variable in RMAN scripts [message #252421 is a reply to message #252329] |
Wed, 18 July 2007 15:25 |
ksintrakool
Messages: 20 Registered: July 2006 Location: Las Vegas
|
Junior Member |
|
|
Thank you DreamzZ
I might have to be more clear
My RMAN script is...
run{
# CONTROLFILE BACKUP SCRIPT
allocate channel t1 device type disk format '$BACKUP_DEST/CF-D_%d-id-%I_%f_%u.DB
F';
backup current controlfile;
sql 'alter database backup controlfile to trace';
sql "alter database backup controlfile to ''/$BACKUP_DEST/$CONTLFILE''";
release channel t1;
}
Is it possible for me to set BACKUP_DEST and $CONTLFILE in RMAN script? Wring now I pass these 2 varilables from an OS script.
Thanks,
|
|
|
Re: Setting Environment Variable in RMAN scripts [message #252432 is a reply to message #252421] |
Wed, 18 July 2007 16:06 |
DreamzZ
Messages: 1666 Registered: May 2007 Location: Dreamzland
|
Senior Member |
|
|
Quote: | Is it possible for me to set BACKUP_DEST and $CONTLFILE in RMAN script? Wring now I pass these 2 varilables from an OS script.
|
Yes
heres mine backup script sample which answers your question.
backup as compressed backupset database;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup archivelog all format '$GAM_ORABACKUP/al_%U.bck';
backup current controlfile
tag = cf1
format '$GAM_ORABACKUP/cf_%U.bck';
Its running succecfully with cron job.
|
|
|
|
Re: Setting Environment Variable in RMAN scripts [message #252436 is a reply to message #252435] |
Wed, 18 July 2007 17:00 |
DreamzZ
Messages: 1666 Registered: May 2007 Location: Dreamzland
|
Senior Member |
|
|
I am using k shell,and i created the .sh file for Enviroment variables like this
omzesp01DS:/export/home/oracle$
>. .profile_gam
omzesp01ESPAM:/export/home/oracle$
>cd $GAM_SCRIPT
omzesp01ESPAM:/export/home/oracle/gam7.2/script$
>more gam_setup.sh
#!/bin/ksh
#
# This script contains common environment setup for the GAM system.
# Setting up 'HOME' and 'HOST' names for GAM Scripts
HOME=/export/home/oracle;
HOST="`hostname`";
export HOME
export HOST
#
# Directory structure
#
export GAM_DIR=$HOME/gam7.2
export GAM_DB=$HOME/gam7.2/db
export GAM_DBA=$HOME/gam7.2/dba
export GAM_SCRIPT=$HOME/gam7.2/script
export ESPGAM_DATA_DIR=$HOME/gam7.2/db_load
export ESPGAM_LOG_DIR=$HOME/gam7.2/db_load/log
export ESPGAM_ARCH_DIR=$HOME/gam7.2/db_load/archive
#
# ORACLE environment variables
#
export ORACLE_HOME=/opt/oracle/10.2.0
export ORACLE_AGENT_HOME=/opt/oracle/AGENT10.2.0/agent10g
export ORACLE_BASE=/opt/oracle/10.2.0
export ORACLE_SID=ESPAM
export LD_LIBRARY_PATH=/opt/app/ba/weblogic/lib/solaris/oci815_8
PATH=$ORACLE_HOME/bin:/jdk1.1.5/bin:/opt/SUNWspro/bin:/opt/SUNWvxva/bin:/opt/SUNWconn/bin:/:/usr/sbin:/usr/bin:/usr/ccs/bin:/opt/NSCPnav/bin:$PATH
# Changing this to use the 100s instead of the 200s!
# 8/23/05 therpin omzimp01
export ORA_DEV0=/u200
export ORA_DEV1=/u201
export ORA_DEV2=/u202
.
.
.
|
|
|
Re: Setting Environment Variable in RMAN scripts [message #252651 is a reply to message #252329] |
Thu, 19 July 2007 10:00 |
ksintrakool
Messages: 20 Registered: July 2006 Location: Las Vegas
|
Junior Member |
|
|
Thank you.
I am currently doing what you suggested on my scripts.
I would like to set a value to an enviornment variable in a RMAN script instread of setting it in an OS script.
Can I do something like "setenv BACKUP_DEST /.../..." in my RMAN script?
I know "sentenv BACKUP_DEST /.../..." doesn't work in RMAN script.
I have seen "send" commend in RMAN script, but it doesn't work for me.
Any more input are welcome.
|
|
|
|
|