DB2 troubleshooting records

Source: Internet
Author: User
Tags db2 sql error sql error

1. Use SQL to implement cross tabulation.

SQL Server provides the limit keyword to help implement cross-tabulation, but DB2 does not seem to have an equivalent value. The implementation method is slightly more complex. The following is an example.

Select Location,
Max ( Case When Metric = ' PH '   Then Value End ) As PH,
Max ( Case   When Metric = ' Hg '   Then Value End ) As Hg ,
Max ( Case   When Metric = ' Fe '   Then Value End ) As Fe,
Max ( Case   When Metric = ' Mn '   Then Value End ) As Mn
From Data_view
Group   By Location

The data_view table/view has three fields: location, metric, and value. The data is as follows:

Location1 pH 1.142575278063135
Location1 Hg 0.0018310994140037379
Location1 fe 0.2974983113601452
Location1 Mn 0.09548843270448454
Location2 pH 6.096025515217242
Location2 Hg 0.005575948698159294
Location2 fe 0.32657056877142043
Location2 Mn 0.009418315198912612

The resulting crosstab chart:

Location pH Hg Fe Mn
Location1 1.142575278063135 0.0018310994140037379 0.2974983113601452 0.09548843270448454
Location2 6.096025515217242 0.005575948698159294 0.32657056877142043 0.009418315198912612

Reference link:

Explain Query
Another method (difficult to use after experiment)
Another method (it feels complicated and has not been tried)

2. "Error 500: DB2 SQL error: sqlcode:-954, sqlstate: 57011, sqlerrmc: NULL"

If the app heap zone is insufficient, you can use "DB2 update dB CFG for dbname using applheapsz 1024. Note that you need to restart DB2 for the change to take effect.

3. Restore A (Restore) Database

In the control center, select the top layer of xxx.0 when selecting the database backup path. The timestamp must be consistent with the backup path (you can view the folder and file name in the backup path, such as 20081007165742 ). The command line format for restoring the database is as follows:

DB2 restore < Dbname > Incremental from < ImagePath > Taken < Timestamp >

4. The system prompts "sql2570n" when restoring the database"

For example, because sql2570n is not compatible with the operating system or the specified restore command is incorrect, the source operating system on the target operating system "NT-32"
Failed to restore the backup created on the AIX-32. Cause Code: "1 ".

Follow the user response corresponding to error code (1) and use db2move for practical purposes.Program: "To use this specific backup image, you should
The operating system is "compatible with recovery ".
. To move a database from one operating system type to another Operating System
System type. Use db2move
Utility. To learn about the platforms that are compatible with each other
For more information about the db2move utility, use
Backup and recovery, or use different operating systems.
In the DB2 Information Center (

Search in http://publib.boulder.ibm.com/infocenter/db2luw/v9"

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.