Home » RDBMS Server » Backup & Recovery » Getting error backup controlfile to trace in RMAN script
Getting error backup controlfile to trace in RMAN script [message #193349] Fri, 15 September 2006 16:13 Go to next message
ksintrakool
Messages: 20
Registered: July 2006
Location: Las Vegas
Junior Member
Hi All,

Does anyone know how I include the following command in RMAN script?

sql "alter database backup controlfile to ''$BACKUP_DEST/$ORACLE_SID_CF_backup_$FILE_TIMESTAMP.dbf''";

BACKUP_DEST, ORACLE_SID and FILE_TIMESTAMP are environment variables.

I keep getting error cannot create file $BACKUP_DEST/$ORACLE_SID_CF_backup_$FILE_TIMESTAMP.dbf

Thanks,
Re: Getting error backup controlfile to trace in RMAN script [message #193350 is a reply to message #193349] Fri, 15 September 2006 16:16 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
What make you think the "SQL" knows how to do environmental variable substitution?
Re: Getting error backup controlfile to trace in RMAN script [message #193353 is a reply to message #193349] Fri, 15 September 2006 16:31 Go to previous messageGo to next message
ksintrakool
Messages: 20
Registered: July 2006
Location: Las Vegas
Junior Member
I use environment variables in RMAN scripts to tell RMAN where to backup. Since the 'sql' is in the RMAN script, this makes me forgot to think that it is actually in sql.

What I try to accomplice is creating a script to backup control file to different destinations, so I can use one script with many databases. Any idea?

Thanks,
Re: Getting error backup controlfile to trace in RMAN script [message #193354 is a reply to message #193353] Fri, 15 September 2006 16:54 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
All you need is a little tweak in the syntax.

oracle@dubbel:~> export MYFILE=/mytracefile
oracle@dubbel:~> export MYDIR=/tmp
oracle@dubbel:~> rman

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 15 10:49:45 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

RMAN> connect target /

connected to target database: PRIMARY (DBID=1438506724)

RMAN> sql "alter database backup controlfile to trace as ''/$MYDIR/$MYFILE''";

using target database control file instead of recovery catalog
sql statement: alter database backup controlfile to trace as ''/$MYDIR/$MYFILE''

RMAN> host
2> ;

oracle@dubbel:~> ls -lrt /tmp/mytracefile
-rw-r--r--  1 oracle oinstall 8520 2006-09-15 10:50 /tmp/mytracefile
Re: Getting error backup controlfile to trace in RMAN script [message #193358 is a reply to message #193349] Fri, 15 September 2006 17:10 Go to previous message
ksintrakool
Messages: 20
Registered: July 2006
Location: Las Vegas
Junior Member
It works. THANKS a bunch Mahesh Rajendran.
Previous Topic: I deleted listener.log file !!!!
Next Topic: Data recovery using a dump File
Goto Forum:
  


Current Time: Mon Dec 23 12:15:07 CST 2024