In this post we will discuss about one of the most encountered error SQL1035N and what to do if we encounter it. In general, connection to database will be of two modes.
- Shared mode - Default mode and multiple users can access database at the same time.
- Exclusive mode - This mode is like single user mode and needed when performing specific tasks like Offline backup etc.
At times when we attempt to perform some operations like Offline backup, we will encounter SQL1035N
> db2 -v "backup db SAMPLE to /tmp"
backup db SAMPLE to /tmp
SQL1035N The operation failed because the specified database cannot be
connected to in the mode requested. SQLSTATE=57019
>
backup db SAMPLE to /tmp
SQL1035N The operation failed because the specified database cannot be
connected to in the mode requested. SQLSTATE=57019
>
Below is explanation as per IBM documentation,
"When a user connects to a database, the connection is in shared mode by default. If another user is already connected to the same database in exclusive mode, then the shared connection attempt will fail with this message.
Similarly, if a user attempts to access a database in exclusive mode but the database is already being accessed in shared mode or if the DB is already active, then the connect attempt will fail with this message."
To solve this, try below steps and reissue the command
- Check if the DB is active and has connections
- >db2 "list active databases"
- If DB is active and has connections, then close connections and deactivate db to close connections
- >db2 "list applications for db <dbname>" --take application handle and run
- >db2 "force application(apphndl1, apphndl2, ...)"
- >db2 "deactivate db <dbname>"
- If DB is active and has NO connections, then deactivate db
- >db2 "deactivate db <dbname>"
No comments:
Post a Comment