DB2 online restore – “SQL1035N The database is currently in use.”

backupdb2restore

I am trying to do ONLINE RESTORE ROLLFORWARDING TO END OF LOGS AND COMPLETE. When I run this command I am getting error SQL1035N The database is currently in use. It does not allow any connections to it!

If I deactivate database and then run command I can restore but then my database is not available for users but it should be becuase it is live production system 24/7. How to resolve this?

Best Answer

[This answer was also posted to the duplicate question on Stack Overflow]

When you perform an online restore, DB2 must lock the tablespace(s) you are trying to restore. The restore process essentially overwrites the file on disk containing the tablespaces' data. This is incompatible with applications using data in the same tablespace while the restore occurs.

If your database has all data in a single tablespace, then an online restore is not particularly useful. If you have multiple tablespaces in the database, applications may be able to continue functioning while the corrupted tablespace(s) are restored, but of course this requires some planning in your application and database design.