Home » RDBMS Server » Backup & Recovery » rman backup script not running??
rman backup script not running?? [message #236664] Thu, 10 May 2007 10:43 Go to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Hi all,

I have created an rman cold backup script and when I run it, it just hangs...I mean nothings happens. Here is my script and the output when I run it:

##########################
# RMAN Cold Backup Script
##########################
#!/bin/bash
date
set ORACLE_SID=fprcdev
echo "RMAN Cold Backup about to begin for $ORACLE_SID ..."
rman
connect CATALOG rman/rman@fprccat
connect TARGET sys/passwd@fprcdev
run {
shutdown immediate
startup mount
allocate channel d1 type disk;
backup full
tag cold_backup
(database);
release channel d1;
alter database open
}
echo "RMAN Cold Backup for $ORACLE_SID is complete"

[oracle@rh-development scripts]$ ./backup_cold.sh
Thu May 10 10:36:54 CDT 2007
RMAN Cold Backup about to begin for FPRCDEV ...





Re: rman backup script not running?? [message #236666 is a reply to message #236664] Thu, 10 May 2007 10:49 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

Hi,
what is your database size ?

and i think you have to wait because it will take time to copy complete database files from source to target database.

Regards
Taj
Re: rman backup script not running?? [message #236673 is a reply to message #236664] Thu, 10 May 2007 10:55 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Also if you have many transactions going on, "shutdown immediate" can take a while (even hours with big transactions).

Regards
Michel
Re: rman backup script not running?? [message #236678 is a reply to message #236664] Thu, 10 May 2007 11:05 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Oh ok. Well my database is 11GB. But does the script look ok?

Also, I did an RMAN backup manually (i.e. gave the BACKUP DATABASE command from the rman prompt) 2 days ago and the whole things was done in less than 1 minute (47 secs).

I can try it I guess after hours and see if it makes a difference.
Re: rman backup script not running?? [message #236686 is a reply to message #236678] Thu, 10 May 2007 11:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So I think it is "shutdown immediate" that takes so long.

Btw, why don't you take online backup?

Regards
Michel
Re: rman backup script not running?? [message #236691 is a reply to message #236686] Thu, 10 May 2007 11:24 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Ok. Well, we are not doing online backups because it's a dev environment. It's weird right now because this dev is the prod too. We are building the dev, stag and prod environments right now.

But thanks for your help all. I will try the backup after hours and if it still doesn't work then I shall post something.

Just a quick question. Can I put in comments with echo inside the RMAN script?

like

run{
echo "Database is shutting down"
shutdown immediate
echo "Database has been shutdown successfully"
..
..

[Updated on: Thu, 10 May 2007 11:24]

Report message to a moderator

Re: rman backup script not running?? [message #236707 is a reply to message #236691] Thu, 10 May 2007 12:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is not necessary when RMAN runs you should have something like:
C:\>type r.rcv
run {
  shutdown immediate
  startup mount
  backup full database;
  alter database open;
}

C:\>rman target / cmdfile r.rcv

Recovery Manager: Release 10.2.0.3.0 - Production on Jeu. Mai 10 19:08:18 2007

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

connected to target database: MIKA (DBID=1492747861)

RMAN> run {
2>   shutdown immediate
3>   startup mount
4>   backup full database;
5>   alter database open;
6> }
7>
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     209715200 bytes

Fixed Size                     1289748 bytes
Variable Size                155189740 bytes
Database Buffers              50331648 bytes
Redo Buffers                   2904064 bytes

Starting backup at 10/05/2007 19:08:44
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 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:\ORACLE\BASES\MIKA\SYSTEM01.DBF
input datafile fno=00002 name=D:\ORACLE\BASES\MIKA\UNDOTBS01.DBF
input datafile fno=00004 name=D:\ORACLE\BASES\MIKA\TS_D0101.DBF
input datafile fno=00003 name=D:\ORACLE\BASES\MIKA\SYSAUX01.DBF
input datafile fno=00008 name=D:\ORACLE\BASES\MIKA\TEST_8K.DBF
input datafile fno=00009 name=D:\ORACLE\BASES\MIKA\TEST_8K_ASSM.DBF
input datafile fno=00005 name=D:\ORACLE\BASES\MIKA\TS_I0101.DBF
input datafile fno=00011 name=D:\ORACLE\BASES\MIKA\TEST.DBF
channel ORA_DISK_1: starting piece 1 at 10/05/2007 19:08:46
...

Regards
Michel
Re: rman backup script not running?? [message #236731 is a reply to message #236707] Thu, 10 May 2007 14:10 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Ok, I will try that.

QUESTION:
I have a recovery catalog. Should I connect to it for the backup or should I just connect to the target database using the controlfile and then later resync the the backup into the catalog?

Thanks Michel.

[Updated on: Thu, 10 May 2007 14:10]

Report message to a moderator

Re: rman backup script not running?? [message #236734 is a reply to message #236731] Thu, 10 May 2007 14:21 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use your recovery catalog.
My example was just... an example made on my laptop so I did not create a recovery catalog just to post the example. Smile

Regards
Michel
Re: rman backup script not running?? [message #236737 is a reply to message #236664] Thu, 10 May 2007 15:24 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Merci! Smile
Re: rman backup script not running?? [message #236991 is a reply to message #236734] Fri, 11 May 2007 09:20 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Ok, I ran the script yesterday and it dodn't run. However, I think that I have figured out part of the problem. For some reason it is not going to the next line it my script. Here is my modified script;

##########################
# RMAN Cold Backup Script
##########################
#!/bin/bash
date
ORACLE_SID=fprcdev; export ORACLE_SID
export ORACLE_HOME
echo "RMAN Cold Backup about to begin for $ORACLE_SID ..."
$ORACLE_HOME/bin/rman - - - - - it is not executing below this line
connect CATALOG rman/rman@fprccat
connect TARGET sys/passwd@fprcdev
run {
shutdown immediate
startup mount
backup full database;
alter database open
}
echo "RMAN Cold Backup for $ORACLE_SID is complete"

[oracle@rh-development scripts]$ ./backup_cold.sh
Fri May 11 09:16:16 CDT 2007
RMAN Cold Backup about to begin for fprcdev ...

Recovery Manager: Release 10.2.0.3.0 - Production on Fri May 11 09:16:16 2007

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

RMAN>


[Updated on: Fri, 11 May 2007 09:21]

Report message to a moderator

Re: rman backup script not running?? [message #236993 is a reply to message #236991] Fri, 11 May 2007 09:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It's a shell issue. Either put your script and use it as I did in my example or use something like:
$ORACLE_HOME/bin/rman <<EOF
connect CATALOG rman/rman@fprccat 
connect TARGET sys/passwd@fprcdev
run {
shutdown immediate
startup mount
backup full database;
alter database open
}
EOF

Regards
Michel
Re: rman backup script not running?? [message #236996 is a reply to message #236993] Fri, 11 May 2007 09:49 Go to previous messageGo to next message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
I'm almost there...It connected to both the target and catalog databases. But now I'm getting a syntax error:


#!/bin/bash
date
ORACLE_SID=fprcdev; export ORACLE_SID
export ORACLE_HOME
echo "RMAN Cold Backup about to begin for $ORACLE_SID ..."
$ORACLE_HOME/bin/rman <<EOF
connect CATALOG rman/rman@fprccat
connect TARGET sys/passwd@fprcdev
run {
shutdown immediate
startup mount
backup full database;
alter database open
}
EOF
echo "RMAN Cold Backup for $ORACLE_SID is complete"


[oracle@rh-development scripts]$ ./backup_cold.sh
Fri May 11 09:45:34 CDT 2007
RMAN Cold Backup about to begin for fprcdev ...

Recovery Manager: Release 10.2.0.3.0 - Production on Fri May 11 09:45:34 2007

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

RMAN>
connected to recovery catalog database

RMAN>
connected to target database: FPRCDEV (DBID=3921599547)

RMAN> 2> 3> 4> 5> 6>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "}": expecting one of: "resetlogs, ;"
RMAN-01007: at line 6 column 1 file: standard input

RMAN>

Recovery Manager complete.
RMAN Cold Backup for fprcdev is complete
Re: rman backup script not running?? [message #237015 is a reply to message #236996] Fri, 11 May 2007 10:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68651
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
";" is missing at the end "alter database open".
That's what RMAN tells:
Quote:
syntax error: found "}": expecting one of: "resetlogs, ;"

Regards
Michel
Re: rman backup script not running?? [message #237027 is a reply to message #237015] Fri, 11 May 2007 12:05 Go to previous message
shaseeb
Messages: 113
Registered: April 2007
Location: Madison, WI
Senior Member
Thank you.
Previous Topic: Catalog database on Windows Server and target Database on Linux??
Next Topic: backup from 3 machine to 1 tape
Goto Forum:
  


Current Time: Tue May 14 08:31:30 CDT 2024