DB2 Programming Skills (10) _DB2

Source: Internet
Author: User
Tags db2
The DB2 tutorial being looked at is: DB2 Programming Tips (10). 4.11 DB2 environment variable
DB2 after reloading, set the DB2 environment variable in the following way to ensure that the SP can compile
Put the set_cpl on AIX, chmod +x set_cpl, and then run the

The content 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, only temporary changes
Db2=>db2set Db2options=+c----or-C, permanent change

4.13 Changing isolation Levels
Db2set db2_sqlroutine_prepopts=cs| rr| Rs|ur

The interaction environment changes the isolation level of the session,
DB2 Change Isolation to UR
Note that you can change the isolation level only if you are not connected to a database.

4.14 The parameters of management db\instance
Get DB CFG for Head (DB)
Get dbm CFG (instance)

4.15 Eliminate version problems after upgrade
DB2 bind @db2ubind. LST
DB2 bind @db2cli. LST

4.16 View the deadlock of a database table
When you use the command center to query the data, be aware that if you use interactive query data, the command center will give the recorded records added S lock. At this point, if you want to update the record, because update to use X lock, exclusive lock, will be locked waiting.

First, turn on the monitor switch
DB2 update dbm CFG using Dft_mon_lock on
Snapshot
DB2 get snapshot for Locks on Cleardb >snap.log
Tables
Bufferpools
Tablespaces
Database
Then look at the contents of the Snap.log.
Lock can look at the locks of each application according to the application handle (application handle).
After monitoring, don't forget to turn the monitor off
DB2 update dbm CFG using dft_mon_lock off


<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.