As a user with DBADM
privileges I enter
db2pd -db mydb -locks showdetail
from the DB2 CLP. The command then fails with message
Database mydb not activated on database partition 0.
Option -locks requires -db <database> or -alldbs option and active database.
I verified that the database is active:
C:\Windows\system32>db2 list active databases
Active Databases
Database name = MYDB
Applications connected currently = 0
Database path = C:\DB2\NODE0000\SQL00002\
I also googled the error message and found an IBM support page for TSM which suggests my environment variable %db2instance%
might not be set appropriately. However, everything appears to be in order:
C:\Windows\system32>set %db2instance%
DB2CLP=DB20FADE
DB2INSTANCE=DB2
DB2PATH=C:\Program Files\IBM\SQLLIB
What other reasons could there be, that db2pd
is giving me the above error message?
I'm running DB2 v9.7.4 on Windows 7 Embedded.
Best Answer
db2pd
requires Administrator authority on Windows, in the command shell you are executing it. Setting your ID as a member of the Administrators group on the local machine is not sufficient.IBM adds "DB2 Command Window - Administrator" in your Start Menu to give you a DB2 Command Window that has administrator privileges (which is the recommended method). Alternatively if you are using a normal command window (cmd.exe), you would have to start it by right clicking "Command Prompt" and choosing "Run as Administrator".
It might be possible to use
runas
to executedb2pd
, but it's probably easier to just start the command window directly with administrator privileges.