The db2 tutorial I am watching is: DB2 programming skills (10). 4.11 db2 environment variables
After reinstalling db2, set the environment variables of db2 in the following way to ensure that sp can be compiled
Put set_cpl on AIX, chmod +x set_cpl, and then run it
Contents of set_cpl
db2set DB2_SQLROUTINE_COMPILE_COMMAND="xlc_r -g \
-I$HOME/sqllib/include SQLROUTINE_FILENAME.c \
-bE:SQLROUTINE_FILENAME.exp -e SQLROUTINE_ENTRY \
-o SQLROUTINE_FILENAME -L$HOME/sqllib/lib -lc -ldb2"
db2set DB2_SQLROUTINE_KEEP_FILES=1
4.12 db2 command environment settings
db2=>list command options
db2=>update command options using C off--or on, just temporary change
db2=>db2set db2options=+c --c, permanently change
4.13 Change the isolation level
DB2SET DB2_SQLROUTINE_PREPOPTS=CS|RR|RS|UR
The interactive environment changes the isolation level of the session.
db2 change isolation to UR
Please note that this can be used to change the isolation level only when there is no database connection.
4.14 Manage db\instance parameters
get db cfg for head(db)
get dbm cfg(instance)
4.15 Eliminate version issues after upgrading
db2 bind @
db2 bind @
4.16 View the deadlock of database tables
When querying data with the command center, be careful. If interactive query data is used, the command center will add an s lock to the checked record. At this time, if you want to update the record, since the update needs to use an x lock and exclusive lock, it will be locked waiting.
First, turn on the monitoring switch
db2 update dbm cfg using dft_mon_lock on
Snapshot
db2 get snapshot for Locks on cleardb >
tables
bufferpools
tablespaces
database
Then look at the content.
For Lock, you can view the lock status of each application according to the Application handle (application handle).
After monitoring is completed, don't forget to turn off the monitor.
db2 update dbm cfg using dft_mon_lock off
After reinstalling db2, set the environment variables of db2 in the following way to ensure that sp can be compiled
Put set_cpl on AIX, chmod +x set_cpl, and then run it
Contents of set_cpl
db2set DB2_SQLROUTINE_COMPILE_COMMAND="xlc_r -g \
-I$HOME/sqllib/include SQLROUTINE_FILENAME.c \
-bE:SQLROUTINE_FILENAME.exp -e SQLROUTINE_ENTRY \
-o SQLROUTINE_FILENAME -L$HOME/sqllib/lib -lc -ldb2"
db2set DB2_SQLROUTINE_KEEP_FILES=1
4.12 db2 command environment settings
db2=>list command options
db2=>update command options using C off--or on, just temporary change
db2=>db2set db2options=+c --c, permanently change
4.13 Change the isolation level
DB2SET DB2_SQLROUTINE_PREPOPTS=CS|RR|RS|UR
The interactive environment changes the isolation level of the session.
db2 change isolation to UR
Please note that this can be used to change the isolation level only when there is no database connection.
4.14 Manage db\instance parameters
get db cfg for head(db)
get dbm cfg(instance)
4.15 Eliminate version issues after upgrading
db2 bind @
db2 bind @
4.16 View the deadlock of database tables
When querying data with the command center, be careful. If interactive query data is used, the command center will add an s lock to the checked record. At this time, if you want to update the record, since the update needs to use an x lock and exclusive lock, it will be locked waiting.
First, turn on the monitoring switch
db2 update dbm cfg using dft_mon_lock on
Snapshot
db2 get snapshot for Locks on cleardb >
tables
bufferpools
tablespaces
database
Then look at the content.
For Lock, you can view the lock status of each application according to the Application handle (application handle).
After monitoring is completed, don't forget to turn off the monitor.
db2 update dbm cfg using dft_mon_lock off