IBM Support

75 ways to demystify DB2: #30: Techtip: Do we need exclusive database connection while restoring just logs?

Technical Blog Post


Abstract

75 ways to demystify DB2: #30: Techtip: Do we need exclusive database connection while restoring just logs?

Body

No, you don't. Few days back, customer asked me "Why DB2 needs exclusive connection while retrieving just logs? We do understand that during restore DB2 may need exclusive connection but we are trying to restore just logs here".

This is my repro of what customer was saying:

db2 backup database DSTEST97 online include logs          
Backup successful. The timestamp for this backup image is : 20150416113124

<<Here in other session I created a connection to database DSTEST97 >>

db2 restore database DSTEST97 logs from /home/db2v97 taken at 20150416113124 logtarget /tmp
SQL1035N  The database is currently in use.  SQLSTATE=57019

<<I disconnected the connection created in another session>>

db2 restore database DSTEST97 logs from /home/db2v97 taken at 20150416113124 logtarget /tmp
DB20000I  The RESTORE DATABASE command completed successfully.

===

Answer to this is, like all other backup and restore operations, default log retrieval is also a offline process which needs exclusive connection. One can exclusively specify 'online' in command to make sure logs are retrieved offline and no exclusive connection is required.

For eg:

db2 restore database DSTEST97 logs online from /home/db2v97 taken at 20150416113124 logtarget /tmp

That made it work! Hope you can use this next time while retrieving logs.  Let me know if you have any questions on this.

Thanks,

-Swati Thorve

 

 

 

 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11141114