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 > db2 backup/restore problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-04, 19:19
ddlldd2000 ddlldd2000 is offline
Registered User
 
Join Date: May 2003
Location: Toronto
Posts: 29
db2 backup/restore problem

I installed DB2 7.2 PE on Windows 2000 and do the following test:
1. db2sampl
2. db2 create table test (a int)
3. db2 insert into test(100)
4. db2 backup db sample
5. db2 update db cfg for sample using logretain on
6. db2stop
7. db2start
8. db2 backup db sample online
9. db2 update db cfg for sample using trackmod on
10. db2stop
11. db2start
12. db2 insert into test(200)
12. db2 backup db sample online
13. db2 insert into test(300)
A database connection does not exist. Why? online backup will force disconnection database? This is my first question.
So I submit "db2 connect to sample"
14. db2 insert into test(400)
15. db2 backup db sample online incremental
16. db2 drop db sample
17. db2 restore db sample incremental taken at 20040107182023



My question is:
First, at step 13, why the database lost connection?
Second, at step 17, when I droped database and did not record the timestamp, how do I restore database sample?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 01-18-04, 01:49
cchattoraj cchattoraj is offline
Registered User
 
Join Date: Mar 2003
Posts: 343
If you do not specify a timestamp to the restore command, it will restore from the last good backup. ie you simply leave out the taken at clause.
Reply With Quote
  #3 (permalink)  
Old 01-19-04, 04:59
nitingm nitingm is offline
Registered User
 
Join Date: Jul 2003
Location: Austin, TX, USA
Posts: 278
Online Backup

Hi ,

For Q 13 I would add that online backup requires exclusive usage of logs and tablespaces hence users are forced of the system. This is essential to maintain database integrity.

The answer for Q17 is already given by chattoraj.

For Incremenatal Backups pls refer to this link it explains a good details

http://www-106.ibm.com/developerwork...5adamache.html

Cheers

Nitin.
__________________
HTH

Nitin

Ask the experienced rather than the learned
Reply With Quote
  #4 (permalink)  
Old 01-19-04, 07:51
Ravi Ravi is offline
Registered User
 
Join Date: Jul 2001
Location: Bangalore, India
Posts: 28
You can know the timestamp when the backup was taken by checking the backup image file name and the folder under which it is stored. For ex: Your backup image timestamp is "20040107182023", so you should find a file by name "182023.001" under a folder by name "20040107" in the default backup folder structure. So, the combination of the folder name and the backup image filename gives you the timestamp.
Also you can run "db2ckbkp" command with various options on the backup image file to get more details.

HTH
Ravi
Reply With Quote
  #5 (permalink)  
Old 01-19-04, 10:34
cchattoraj cchattoraj is offline
Registered User
 
Join Date: Mar 2003
Posts: 343
An online backup does not require exclusive lock on tablespaces or logs - an offline backup does.
Reply With Quote
  #6 (permalink)  
Old 01-19-04, 12:07
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
A backup command always creates a new connection to the database and at the end terminates it ...

As you were doing all the sqls and commands in the same session, at 12 db2 terminated the exisiting connection and made a new connection (the default CLP behaviour) and at the end of step 12 terminated the connection it created ... So, at step 13 , you did not have a connection

This is how I interpret the behaviour

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #7 (permalink)  
Old 01-20-04, 20:41
ddlldd2000 ddlldd2000 is offline
Registered User
 
Join Date: May 2003
Location: Toronto
Posts: 29
Quote:
Originally posted by sathyaram_s
A backup command always creates a new connection to the database and at the end terminates it ...

As you were doing all the sqls and commands in the same session, at 12 db2 terminated the exisiting connection and made a new connection (the default CLP behaviour) and at the end of step 12 terminated the connection it created ... So, at step 13 , you did not have a connection

This is how I interpret the behaviour

Cheers
Sathyaram
Sathyaram, what you write here is absolutely right and I used test to prove it.

1. A backup command always creates a new connection (it ends the first connect at the same time), it terminates the new connection at the end too.
2. A backup command will not terminate other connections except itself.
Reply With Quote
  #8 (permalink)  
Old 01-20-04, 20:42
ddlldd2000 ddlldd2000 is offline
Registered User
 
Join Date: May 2003
Location: Toronto
Posts: 29
Quote:
Originally posted by cchattoraj
An online backup does not require exclusive lock on tablespaces or logs - an offline backup does.
definitely right
Reply With Quote
  #9 (permalink)  
Old 01-20-04, 20:43
ddlldd2000 ddlldd2000 is offline
Registered User
 
Join Date: May 2003
Location: Toronto
Posts: 29
Quote:
Originally posted by Ravi
You can know the timestamp when the backup was taken by checking the backup image file name and the folder under which it is stored. For ex: Your backup image timestamp is "20040107182023", so you should find a file by name "182023.001" under a folder by name "20040107" in the default backup folder structure. So, the combination of the folder name and the backup image filename gives you the timestamp.
Also you can run "db2ckbkp" command with various options on the backup image file to get more details.

HTH
Ravi
Very good idea, and I see the result immediately
Reply With Quote
  #10 (permalink)  
Old 01-20-04, 20:45
ddlldd2000 ddlldd2000 is offline
Registered User
 
Join Date: May 2003
Location: Toronto
Posts: 29
Thanks all your help! You guys do a very good job for me!!
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