If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Ideas for automating a monthly redirected restore

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-11, 13:20
Tracygirl Tracygirl is offline
Registered User
 
Join Date: Aug 2011
Location: Columbus, OH
Posts: 22
Question Ideas for automating a monthly redirected restore

Hello DB2 Friends!

I am trying to automate a monthly process to load a test database from a prod backup via a redirected restore. Both the backup and the restore are executed using a korn shell script. The backup job is kicked off by a scheduler application (Control M) but I can't have it kick off the restore too because I have to edit the restore script giving it the timestamp of the backup image.

Does anyone know how I can read the sysout from the backup job, get the time stamp to pass to the redirected restore as a parameter.

I've checked with our scheduler application and it doesn't seem possible, so I'm thinking I may have to script something. I can grunt through some scritpting, but I was wondering if there were any better ideas.

Thanks!!!!
Reply With Quote
  #2 (permalink)  
Old 09-19-11, 14:34
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Do the backup to an empty directory and then you can omit the TAKEN AT clause on the restore. You can rollforward to END OF BACKUP and STOP NORETRIEVE.

I assume this is DB2 LUW, but your use of the term sysout makes me wonder (or maybe you are an ex-mainframe DBA?).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 09-19-11, 14:46
Tracygirl Tracygirl is offline
Registered User
 
Join Date: Aug 2011
Location: Columbus, OH
Posts: 22
Thumbs up

Thanks, Marcus_A. This is exactly what I was looking for. This is for DB2 LUW, which I didn't specify. I am an ex-mainframe developer, that's where sysout-speak comes from. Thanks again
Reply With Quote
  #4 (permalink)  
Old 09-19-11, 15:42
Tracygirl Tracygirl is offline
Registered User
 
Join Date: Aug 2011
Location: Columbus, OH
Posts: 22
[QUOTE=Marcus_A;6518943] You can rollforward to END OF BACKUP and STOP NORETRIEVE.
QUOTE]

Marcus_A, my current redirected restore does "rollforward db scdtptst to end of logs and complete" I'm not sure I understand the difference with what you mentioned.
Reply With Quote
  #5 (permalink)  
Old 09-19-11, 15:45
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by Tracygirl View Post
Marcus_A, my current redirected restore does "rollforward db scdtptst to end of logs and complete" I'm not sure I understand the difference with what you mentioned.
END OF BACKUP is the minimum rollforward point that must be done when restoring an online backup. If you have additional logs and want to go to end of logs, that is fine.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 09-20-11 at 01:10.
Reply With Quote
  #6 (permalink)  
Old 09-19-11, 17:11
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Another option is to extract the timestamp from the history file and pass it to the restore. Something similar to:

db2 "restore db test taken at `db2 list history backup all for db test | grep 'B D' | head -1 | cut -c 9-22`"
Reply With Quote
  #7 (permalink)  
Old 09-19-11, 17:21
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Actually, the history file on your test server won't have this info until the db is restored. So, the history file needs to be restored first. Or just get the timestamp from your backup job or use Marcus's method.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On