SQL0752N Error message and explanation of this error is:
Connecting to a database is not permitted within a logical unit of work when the CONNECT type 1 setting is in use.
SQL0752N error usually occurs on redirected restore.
SQL0752N Error means, one or more of your databases is in restore pending state. You must fix problems about restore pending database.
First of all you must get output of this simple command:
[db2inst2@localhost NODE0000]$ db2 get db cfg for test | grep -i pending Backup pending = NO Rollforward pending = NO Restore pending = YES
As you may see, our DB2 dabatase is in restore pending state. (It also might be in rollforward pending state, but firstly you must solve restore pending issue first)
Main reason of this error is an error on restore operation. Usually this kind of errors and problems occur in redirected restore. Because DB2 knows how to handle restore operation while you are restoring a database to same instance.
On redirected restore, you need to set some paths and files to complete restore.
First of all drop test database.
db2 drop db test
If you don’t use generated script to make a redirected restore, you’ll be more likely to fail. Because a redirected restore script can help you to avoid mistakes.
db2 restore db test from /home/yigitozdemir/backups taken at 20050304090733 redirect generate script test_node0000.clp
This command generates a redirected restore script. You can set, log path, db path and table space paths using this script.
Open your redirected restore script via vim (or your other favorite text editor).
Set you log path, database path and table space paths. Be careful about these values. Your restore may fail because of these values. For example, if you are trying to restore, to a file table space, and you already have a folder on same path, you will get SQL0752N error.
After editing you clp file run this command to complete restore:
db2 -tvf test_node000.clp
If you have successfully complete restore, you must get this output:
[db2inst2@localhost NODE0000]$ db2 get db cfg for test | grep -i pending Backup pending = NO Rollforward pending = NO Restore pending = NO
Now your database is ready.