Home » RDBMS Server » Backup & Recovery » Environment variable not evaluated in rman (Oracle 11gR2,11.2.0.1.0,RHEL 5.0)
Environment variable not evaluated in rman [message #486749] Mon, 20 December 2010 01:11 Go to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Friends

I m facing problem of os environment variables not evaluated in rman scripts. Here below i'm displaying my try. please suggest/correct me where i made mistake.

[oracle1@WBH-DB1 smbshare]$ export BACKUP_DIR=/home/myrman/backup

[oracle1@WBH-DB1 smbshare]$ echo $BACKUP_DIR
/home/myrman/backup

[oracle1@WBH-DB1 smbshare]$ rman target sys/devadmin@mydata.wbh-db1 catalog rman_cat/rman_cat@myrman.wbh-db1

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 20 12:32:35 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: MYDATA (DBID=2873395220)
connected to recovery catalog database

RMAN> run {
backup
format '$BACKUP_DIR/rman_CTL__%d.%U.bak'
(current controlfile);
}

Starting backup at 20-DEC-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 20-DEC-10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/20/2010 12:33:
09
ORA-07217: sltln: environment variable cannot be evaluated.

RMAN>


Regards

Jimit
Re: Environment variable not evaluated in rman [message #486755 is a reply to message #486749] Mon, 20 December 2010 01:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
It is the expected behaviour.
Try:
rman ... <<EOF
run { backup format '$BACKUP_DIR/rman_CTL__%d.%U.bak' (current controlfile); }
exit
EOF

Regards
Michel
Re: Environment variable not evaluated in rman [message #486763 is a reply to message #486755] Mon, 20 December 2010 02:29 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Michel

Actually i have created one .sh file which is as below, i incorporate your suggestion, but still it giving me some other error. Which may be different from earlier one.
RmanBackup.sh file
echo "setting variables"
export ORACLE_SID=myrman
export TDAY=`date +%Y-%m-%d`
export BACKUP_DIR=/home/myrman/backup
export LOGFILE=$BACKUP_DIR/RmanBackup$TDAY.log
echo "end of setting variables"
echo "Backup Started at `date` \n" >$LOGFILE
echo "ORACLE_SID = "$ORACLE_SID
rman <<EOF
connect target sys/devadmin@mydata.wbh-db1 
connect catalog rman_cat/rman_cat@myrman.wbh-db1
run {
backup
format '$BACKUP_DIR/rman_CTL__%d.%U.bak'
(current controlfile);
}
exit
EOF
echo "Backup Finished at `date` \n" >>$LOGFILE


Calling RmanBackup.sh file
[oracle1@WBH-DB1 smbshare]$ ./RmanBackup.sh
setting variables
end of setting variables
: No such file or directoryome/myrman/backup
ORACLE_SID = myrman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 20 13:51:29 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN>
connected to target database: MYDATA (DBID=2873395220)

RMAN>
connected to recovery catalog database

RMAN> 2> 3> 4> 5>
Starting backup at 20-DEC-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 20-DEC-10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/20/2010 13:51:
37
/rman_CTL__MYDATA.4vm01kn7_1_1.bak"home/myrman/backup
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

RMAN>

Recovery Manager complete.
: No such file or directoryhome/myrman/backup


Directory exists
[oracle1@WBH-DB1 smbshare]$ ll -ltrh /home/myrman/backup/
total 0


Please suggest me,what i m missing

Regards

Jimit
Reg

[Updated on: Mon, 20 December 2010 02:30]

Report message to a moderator

Re: Environment variable not evaluated in rman [message #486768 is a reply to message #486763] Mon, 20 December 2010 02:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
It seems you have a "carriage return" character in your variable value.

Regards
Michel
Re: Environment variable not evaluated in rman [message #486770 is a reply to message #486768] Mon, 20 December 2010 02:59 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Michel

I'm not getting clearly what you suggest, i try to remove all trailing space and proper enter tab after every command line but still it is giving me an error. please suggest.

Regards

Jimit
Re: Environment variable not evaluated in rman [message #486771 is a reply to message #486770] Mon, 20 December 2010 03:12 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
The problem is not in the script, it is in the variable value.
Try
ll -ltrh "$BACKUP_DIR"

Regards
Michel

[Updated on: Mon, 20 December 2010 03:13]

Report message to a moderator

Re: Environment variable not evaluated in rman [message #486774 is a reply to message #486771] Mon, 20 December 2010 03:33 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Michel

i have tried to once again to set all the parameter's but it still gives me an error. here i'm giving your required output. Also i have given full rights the that folder. such as

chmod -R 777 /home/myrman/backup/


[oracle1@WBH-DB1 smbshare]$ ll -ltrh $BACKUP_DIR
total 0


Regards

Jimit

Re: Environment variable not evaluated in rman [message #486778 is a reply to message #486774] Mon, 20 December 2010 03:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
ll -ltrh $BACKUP_DIR

This is NOT what I posted:
Quote:
ll -ltrh "$BACKUP_DIR"

Regards
Michel
Re: Environment variable not evaluated in rman [message #486795 is a reply to message #486778] Mon, 20 December 2010 05:36 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Michel

It was my mistake,i forget quotes. Here once again i m displaying my try.

RmanBackup.sh file
echo "setting variables"
export ORACLE_SID=myrman
export TDAY=`date +%Y-%m-%d`
export BACKUP_DIR=/home/myrman/backup
export LOGFILE=$BACKUP_DIR/RmanBackup$TDAY.log
echo "end of setting variables"
echo "Backup Started at `date` \n" >$LOGFILE
rman <<EOF
connect target sys/devadmin@mydata.wbh-db1
connect catalog rman_cat/rman_cat@myrman.wbh-db1
run {
backup
format '$BACKUP_DIR/rman_CTL__%d.%U.bak'
(current controlfile);
}
exit
EOF
echo "Backup Finished at `date` \n" >>$LOGFILE


Run RmanBackup.sh file
[oracle1@WBH-DB1 smbshare]$ ./RmanBackup.sh
setting variables
end of setting variables
: No such file or directoryome/myrman/backup

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 20 17:02:49 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN>
connected to target database: MYDATA (DBID=2872293250)

RMAN>
connected to recovery catalog database

RMAN> 2> 3> 4> 5>
Starting backup at 20-DEC-10
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=132 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 20-DEC-10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/20/2010 17:02:
58
/rman_CTL__MYDATA.5sm01vu1_1_1.bak"home/myrman/backup
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

RMAN>

Recovery Manager complete.
: No such file or directoryhome/myrman/backup


Listing the Backup_Dir
[oracle1@WBH-DB1 smbshare]$ ll -ltrh "BACKUP_DIR"
ls: BACKUP_DIR: No such file or directory


Regards

Jimit

[Updated on: Mon, 20 December 2010 05:39]

Report message to a moderator

Re: Environment variable not evaluated in rman [message #486798 is a reply to message #486795] Mon, 20 December 2010 06:00 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Listing the Backup_Dir

Code: [Select all] [Show/ hide][oracle1@WBH-DB1 smbshare]$ ll -ltrh "BACKUP_DIR"
ls: BACKUP_DIR: No such file or directory

Now you missed the $ to your variable name.

Regards
Michel
Re: Environment variable not evaluated in rman [message #486803 is a reply to message #486798] Mon, 20 December 2010 06:15 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Sorry Michel

I'm frustrated by all this, i have tried various things and not succeeded. I'm doing some silly mistake but not getting it for whole day. Laughing on my own. sorry again and pasting the result.

[oracle1@WBH-DB1 smbshare]$ ll -ltrh "$BACKUP_DIR"
ls: : No such file or directory


Regards

Jimit
Re: Environment variable not evaluated in rman [message #486807 is a reply to message #486803] Mon, 20 December 2010 06:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
As I said, you have a not printable character in your value
and "ls" as "rman" can't then find the directory.

I bet if you read the file with "vi" you will find "^M" character at the end of the line:
export BACKUP_DIR=/home/myrman/backup
(if not at all the lines).

Regards
Michel
Re: Environment variable not evaluated in rman [message #486810 is a reply to message #486807] Mon, 20 December 2010 06:31 Go to previous messageGo to next message
jimit_shaili
Messages: 237
Registered: June 2006
Location: India, Ahmedabad
Senior Member
Dear Michel

You are absolutely right,100% right. First i have created this file with vi editor and during modification i opened or created again with Utlraedit with windows machine. After your suggestion i delete the file and once again create with vi. It is working ok on first shot without any error. Thanks for your extended support.

Regards

Jimit
Re: Environment variable not evaluated in rman [message #487668 is a reply to message #486755] Wed, 29 December 2010 13:01 Go to previous messageGo to next message
devisri
Messages: 1
Registered: December 2010
Location: usa
Junior Member
hi,
your help is really appreciable thanks alot Michel

[Updated on: Wed, 29 December 2010 13:02]

Report message to a moderator

Re: Environment variable not evaluated in rman [message #488742 is a reply to message #487668] Mon, 10 January 2011 22:22 Go to previous messageGo to next message
dineshoraeng
Messages: 1
Registered: January 2011
Location: Bangalore
Junior Member
Hi,

Good Morning...

what is 0 level & 1 level backup in RMAN and how can spacifify it?
Re: Environment variable not evaluated in rman [message #488747 is a reply to message #488742] Mon, 10 January 2011 23:22 Go to previous message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Database Backup and Recovery Basics

Regards
Michel

Previous Topic: When was last full backup?
Next Topic: backup datafile/datafile using ".rman file"
Goto Forum:
  


Current Time: Thu Nov 21 20:19:13 CST 2024