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 > Issue With Redirected Restore

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-15-09, 19:47
ca1cu1on ca1cu1on is offline
Registered User
 
Join Date: Dec 2009
Location: Montreal, QC
Posts: 5
Question Issue With Redirected Restore

Scenario:
Typically I receive snapshots of a production database and restore them in another environment for testing. This specific situation is the same as any other, except when I run the redirected restore, I get some errors. My process is to create a user, then an instance with the same name, create the directory for the database under the instance (e.g. /home/data/$INSTANCE/$DATABASE_2) and launch the restore script, pointing to the snapshot I received.


Environment:
DB2 V9.1 on AIX 6.1 TL02


Restore Script:
db2 "RESTORE DATABAE $DATABASE_1 TAKEN AT $SNAPSHOT TO '/home/data/$INSTANCE/$DATABASE_2' INTO $DATABASE_2 WITH 2 BUFFERS BUFFER 1024 REDIRECT WITHOUT ROLLING FORWARD WITHOUT PROMPTING"

db2 "set tablespace containers for 0 using (path '/home/data/$INSTANCE/$DATABASE_2/space1')"
db2 "set tablespace containers for 1 using (path '/home/data/$INSTANCE/$DATABASE_2/space2')"
db2 "set tablespace containers..
.
.
db2 restore db $DATABASE_1 continue
db2 rollforward database $DATABASE_2 to end of logs and stop


Errors:
Once the script reaches the set tablespace (verified by running manually, one by one) for every "set tablespace..." command I receive
SQL1024N A database connection does not exist. SQLSTATE=08003
SQL1024N A database connection does not exist. SQLSTATE=08003
.
.

Once at the "restore db $DATABASE_1 continue" I get
SQL2008N The callerac parameter is not within valid range or the requested
action is out of sequence.


I don't understand why when I "set tablespace containers..." it is looking for a connection to the database that doesn't exist yet. I think once the SQL1024N errors are addressed, the SQL2008N will also disappear. Anyway, I've already checked the DB2 doc, didn't see much, so any additional help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 12-15-09, 19:59
shtflusty shtflusty is offline
Registered User
 
Join Date: Dec 2009
Posts: 1
Hello

Excellent ! I like it very much
Reply With Quote
  #3 (permalink)  
Old 12-15-09, 20:21
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Verify that the first step of redirected restore (restore... redirect) doesn't generate any error.
Reply With Quote
  #4 (permalink)  
Old 12-15-09, 20:53
ca1cu1on ca1cu1on is offline
Registered User
 
Join Date: Dec 2009
Location: Montreal, QC
Posts: 5
When running the first step (redirected restore), I get this:
SQL2537N Roll-forward is required following the Restore.

But at the end of the script, after the restore, I have:
db2 rollforward database $DATABASE_2 to end of logs and stop
Reply With Quote
  #5 (permalink)  
Old 12-15-09, 20:56
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
remove "WITHOUT ROLLING FORWARD" from the first step.
Reply With Quote
  #6 (permalink)  
Old 12-16-09, 09:52
ca1cu1on ca1cu1on is offline
Registered User
 
Join Date: Dec 2009
Location: Montreal, QC
Posts: 5
For now, it appears to be working...That is the set tablespace containers completed successfully, the restore continue was invoked and the directory is growing.

Can you explain why removing "WITHOUT ROLLING FORWARD" fixed this issue?
Reply With Quote
  #7 (permalink)  
Old 12-16-09, 10:11
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by ca1cu1on View Post

Can you explain why removing "WITHOUT ROLLING FORWARD" fixed this issue?
Possibly you were restoring from an online backup, which requires rollforward operation. Only offline backups can be restored without rolling forward.
Reply With Quote
  #8 (permalink)  
Old 12-17-09, 20:34
ca1cu1on ca1cu1on is offline
Registered User
 
Join Date: Dec 2009
Location: Montreal, QC
Posts: 5
After the restore, am I supposed to run:
db2 rollforward database $DATABASE_2 to end of logs and stop?

If so, I am receiving errors, the rollforward fails. Will post specific SQL####N on failed rollforward tomorrow. If I recall correctly it was SQL6059N.

I get a SQL1117N when trying to connect after rollforward failed. So I tried:
db2 rollforward database $DATABASE_2 stop as well as db2 rollforard database $DATABASE_2 complete
neither would bring the db out of rollforward pending state.

Also, there did not appear to be any log files. I have dropped the database and restored again specifying the logtarget path:
db2 "RESTORE DATABAE $DATABASE_1 TAKEN AT $SNAPSHOT TO '/home/data/$INSTANCE/$DATABASE_2' INTO $DATABASE_2 logtarget $LOGPATH WITH 2 BUFFERS BUFFER 1024 WITHOUT ROLLING FORWARD REDIRECT WITHOUT PROMPTING"

The state of the database tomorrow should be restore completed successfully...so is it required to rollforward after the restore?

Sorry for the delay in responses, it is a 12 hour import.

Last edited by ca1cu1on; 12-17-09 at 21:41.
Reply With Quote
  #9 (permalink)  
Old 12-17-09, 22:04
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You have to issue the rollforward db command if you're restoring from an online image. If the logs are included in the image, then you can restore them during db restore or as a separate step and then use them during rollforward (specify "overflow log path" and "noretrieve" parameters). Please see example on p.14 here:
http://download.boulder.ibm.com/ibmd...RFAQ_0508I.pdf
Reply With Quote
  #10 (permalink)  
Old 12-18-09, 11:12
ca1cu1on ca1cu1on is offline
Registered User
 
Join Date: Dec 2009
Location: Montreal, QC
Posts: 5
First, the database restored successfully, as did the rollforward. Thank you for the assistance!

However, when executing the command:
db2 rollforward db $DBNAME to end of logs and stop overflow log path ($LOGTARGET)
as shown in the example FAQ link, did not work. I would receive a syntax error of `(' not expected, so I took off the '()', then I got a syntax error that expected token missing `('.

That didn't make sense, so I go into db2 command and execute the same command
db2 => rollforward db $DBNAME to end of logs and stop overflow log path ($LOGTARGET)
which also didn't work.

DB2 claimed LOGTARGET was an invalid path, check filesystem, ownership...well it is in the filesystem housing the instance, in a directory under the instance and owned by the instance.

So I just ran db2 => rollforward db $DBNAME to end of logs and stop
And it worked...presumably because I restored again with LOGTARGET listed in restore command?

Anyway, thanks again for your assistance.
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