Professional Documents
Culture Documents
Ibm Db2 9.7: Troubleshooting Hands-On Lab
Ibm Db2 9.7: Troubleshooting Hands-On Lab
Contents
1. 2. 3. 4. 5. 6. 7. INTRODUCTION ...........................................................................................3 OBJECTIVES ................................................................................................3 SUGGESTED READING...............................................................................3 WORKING WITH THE HELP (?) COMMAND...............................................3 4.1 5.1 6.1 TRY IT: PRACTICE WITH THE HELP (?) COMMAND ............................................4 TRY IT: DIAGNOSE A PROBLEM USING THE DB2DIAG.LOG FILE ..........................4 TRY IT: GET MORE INFORMATION USING THE DB2 INFORMATION CENTER ........5 WORKING WITH THE DB2DIAG.LOG FILE ................................................4 WORKING WITH THE DB2 INFORMATION CENTER.................................5 SOLUTIONS..................................................................................................5 PRACTICE WITH THE HELP (?) COMMAND ................................................................5 DIAGNOSE A PROBLEM USING THE DB2DIAG.LOG .....................................................6 GET MORE INFORMATION USING THE DB2 INFORMATION CENTER .............................7
1.
Introduction
2.
Objectives
By the end of this lab, you will be able to: Work with the DB2 Help (?) command Diagnose a problem with the db2diag.log file Look for more information about a topic from the DB2 Information Center
3.
Suggested reading
Getting started with DB2 Express-C eBook (Appendix A) https://www.ibm.com/developerworks/wikis/display/DB2/FREE+Book+Getting+Started+with+DB2+Express-C A free eBook that can quickly get you up to speed with DB2
4.
When working with DB2, you may encounter problems, and a SQLCODE may be returned. You can find out more information about this SQLCODE using the DB2 help (?) command. For example, try the following for these SQLCODEs -104, -204 respectively: From the DB2 Command Window or Linux shell type: db2inst1@db2rules:~> db2 ? SQL0104N db2inst1@db2rules:~> db2 ? SQL0204N If you dont remember a DB2 command, or the full syntax of the command, you can also use the help (?) command. For example, lets say you partially remember a command that starts with LIST, but dont remember what follows after. You can try from the DB2 Command Window or Linux shell the following: db2inst1@db2rules:~> db2 ? LIST
Note that the HELP command will not work with SQL Statements. Use the DB2 Information Center for more information about SQL Statements.
4.1
1. Find out more information about these SQLCODEs: -805, +100 2. Find out the syntax of the BACKUP command using the help (?) command
5.
The db2diag.log file is another source of information for problems encountered while working with the DB2 server. Find the location of this file and take a look at its contents. The location of the file depends on the operating system: Windows Vista and later
ProgramData\IBM\DB2\
Windows XP/2003
C:\Documents and Settings\All Users\Application Data\IBM\DB2\DB2COPY1\<instance name>
Linux/UNIX
INSTHOME/sqllib/db2dump (INSTHOME is the home directory of the instance owner)
5.1
1. Rename the db2diag.log to db2diag.old.log. Next, issue these changes from the DB2 Command Window or Linux Shell:
db2inst1@db2rules:~> db2 update db cfg for sample using LOCKLIST 4 db2inst1@db2rules:~> db2 update db cfg for sample using MAXAPPLS 100
Review the db2diag.log, and find the entries corresponding to the above changes. 2. Issue the following from the DB2 command window:
db2inst1@db2rules:~> db2 connect to SAMPLE db2inst1@db2rules:~> db2stop
Review the db2diag.log. What error message do you get? 3. This is the end of this section. Reset the configuration parameter changes using these commands:
db2inst1@db2rules:~> db2 reset db cfg for sample db2inst1@db2rules:~> db2stop force db2inst1@db2rules:~> db2start
6.
The DB2 Information Center contains the DB2 online manuals. To access it, go to this site: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp
6.1
Try it: Get more information using the DB2 Information Center
1. Lets say you want to learn more details about the syntax of the CREATE TABLE statement. Look for this information in the DB2 Information Center.
7.
Solutions
Find out the syntax of the BACKUP command using the help (?) command: db2inst1@db2rules:~> db2 ? backup
A new db2diag.log file should have been generated. Take a look at the contents. What do you see? This is a sample of what you would see. Obviously, the timestamp will be different.
2011-05-07-23.03.38.359000-240 I1097H468 LEVEL: Event PID : 2448 TID : 8048 PROC : db2syscs.exe INSTANCE: DB2 NODE : 000 DB : SAMPLE APPHDL : 0-588 APPID: *LOCAL.DB2.080907152844 AUTHID : ARFCHONG EDUID : 8048 EDUNAME: db2agent (SAMPLE) FUNCTION: DB2 UDB, config/install, sqlfLogUpdateCfgParam, probe:20 CHANGE : CFG DB SAMPLE: "Locklist" From: "50" To: "4" 2011-05-07-23.04.16.468000-240 I1567H482 LEVEL: Event PID : 2448 TID : 8048 PROC : db2syscs.exe INSTANCE: DB2 NODE : 000 DB : SAMPLE APPHDL : 0-588 APPID: *LOCAL.DB2.080907152844 AUTHID : ARFCHONG EDUID : 8048 EDUNAME: db2agent (SAMPLE) FUNCTION: DB2 UDB, config/install, sqlfLogUpdateCfgParam, probe:20 CHANGE : CFG DB SAMPLE: "Maxappls" From: "40" <automatic> To: "100"
The message says GATEWAY_INUSE which maps to what you get from the DB2 Command window: SQL1025N The database manager was not stopped because databases are still active.
Copyright IBM Corporation 2011 All Rights Reserved. IBM Canada 8200 Warden Avenue Markham, ON L6G 1C7 Canada
IBM, IBM (logo), and DB2 are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. Linux is a trademark of Linus Torvalds in the United States, other countries, or both UNIX is a registered trademark of The Open Group in the United States, other countries, or both Windows is a trademark of Microsoft Corporation in the United States, other countries, or both. VMware is a trademark or VMware Inc. in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others. References in this publication to IBM products or services do not imply that IBM intends to make them available in all countries in which IBM operates. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-level systems and there is no guarantee that these measurements will be the same on generally available systems. Furthermore, some measurement may have been estimated through extrapolation. Actual results may vary. Users of this document should verify the applicable data for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. The information in this publication is provided AS IS without warranty. Such information was obtained from publicly available sources, is current as of July 2009, and is subject to change. Any performance data included in the paper was obtained in the specific operating environment and is provided as an illustration. Performance in other operating environments may vary. More specific information about the capabilities of products described should be obtained from the suppliers of those products.