Results 1 to 10 of 10
  1. #1
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29

    Unanswered: 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!

  2. #2
    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.

  3. #3
    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

  4. #4
    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

  5. #5
    Join Date
    Mar 2003
    Posts
    343
    An online backup does not require exclusive lock on tablespaces or logs - an offline backup does.

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  7. #7
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    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.

  8. #8
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    Originally posted by cchattoraj
    An online backup does not require exclusive lock on tablespaces or logs - an offline backup does.
    definitely right

  9. #9
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    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

  10. #10
    Join Date
    May 2003
    Location
    Toronto
    Posts
    29
    Thanks all your help! You guys do a very good job for me!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •