Home » RDBMS Server » Backup & Recovery » AUTOMATIC SCRIPT TO RECOVER A STANDBY (standby automation by script)
AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273492] Wed, 10 October 2007 11:37 Go to next message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
I have a dr box configured as a standby database using standby control file ( not using dataguard )
The log files are manualy copied from the box. Is there a script to automat the recovery of this standby. I Do not want to use datagaurd, need to do this by script.

db is 10g.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273493 is a reply to message #273492] Wed, 10 October 2007 11:43 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
sqlplus << EOF
/ as sysdba
set echo on term on pause off lines 131
spool /tmp/apply.log
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;
RECOVER STANDBY DATABASE;
AUTO
SHUTDOWN IMMEDIATE;
SPOOL OFF
exit
EOF
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273642 is a reply to message #273493] Thu, 11 October 2007 03:06 Go to previous messageGo to next message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
I need to constantly apply the logs that a copied from the primary database at specified times using ftp cronjob. The standby database should be automatically applying the new logs that arrive after the ftp copy job puts new logs on the standby. so the script should be doing the automatic recovery of these logs.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273728 is a reply to message #273642] Thu, 11 October 2007 09:08 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
Examine the archive log generation time and on the basis of that schedule your cron job.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273738 is a reply to message #273728] Thu, 11 October 2007 09:33 Go to previous messageGo to next message
girish.rohini
Messages: 744
Registered: April 2005
Location: Delhi (India)
Senior Member
You can use the managed recovery of standby database.

start a background session by issuing
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION NO TIMEOUT;

This statement starts a detached server process and immediately returns control to the user. While the managed recovery process is performing recovery in the background, the foreground process that issued the RECOVER statement can continue performing other tasks. This does not disconnect the current SQL session.

--Girish
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273741 is a reply to message #273738] Thu, 11 October 2007 09:40 Go to previous messageGo to next message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
The plan is to use a cron job to be doing the recovery without human response.

- firt they is an ftp cron job that copies the archive logs from the live after every 1 hour.

- then there is a cron job script that does automaticall apply the copied logs.

- the database is kept mounted

My best option is not to use a standby but a normal database created from hotbackups see below :-

This automatic process also need to be set up for a dr server created with hot backup files - simulating a standby -- note we for this one we will not use a standby control file.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273743 is a reply to message #273492] Thu, 11 October 2007 09:44 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>- the database is kept mounted
Post the command that satisfies this requirement & allows the application of redo logfiles.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273756 is a reply to message #273743] Thu, 11 October 2007 10:20 Go to previous messageGo to next message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
sqlplus << EOF
/ as sysdba
set echo on term on pause off lines 131
spool /tmp/apply.log
RECOVER DATABASE UNTIL CANCEL;
AUTO
SPOOL OFF
exit
EOF

This will apply any new logs. this process is repeated when the cron job runs. simply logs on and runs the command recover database until cancel; next type auto... thats it.
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273760 is a reply to message #273492] Thu, 11 October 2007 10:22 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
> note we for this one we will not use a standby control file.
BUT the script depends upon using a STANDBY CONTROL FILE!
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273764 is a reply to message #273760] Thu, 11 October 2007 10:31 Go to previous messageGo to next message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
This one is not using a standby control file. Its constructed fron a hotbackup and a normal control file.

( hotbackup files + all control files and logs ) all copied from live and used to startup and mount the database.

archived logs copied

and then


sql> startup mount

sql> recover database until canel;

auto

SQl>
Re: AUTOMATIC SCRIPT TO RECOVER A STANDBY [message #273765 is a reply to message #273760] Thu, 11 October 2007 10:45 Go to previous message
mwansalovewell
Messages: 71
Registered: October 2007
Location: uk
Member
Is the script going to work with the commands i have shown?

first log on by cron script

log on
<< !
.
.
startup mount
recover database until cancel
auto
exit
!

next cron script run after new archives are copied.
just logon

<< !

/ as sysdba
.
.
recover datbase until cancel
auto
exit
!

and so on and so on .....

Previous Topic: Autmatic recovery on DR Server using hotbackups
Next Topic: RMAN Recovery
Goto Forum:
  


Current Time: Tue Nov 26 08:42:04 CST 2024