Crash Recovery (crash recovery) with AutoRestart parameters

Source: Internet
Author: User
Tags db2 connect db2 connect to

The impact of this parameter setting has been experienced two times in the production system:
For the first time there is a set of less important systems installed on the virtual machine, and all applications of this system (DB2 was IHS) are configured to/etc/ rc.local, each boot machine will automatically pull up the application, and then a virtual machine down, after restarting to check that each application process starts normally, but the foreground page access exception is inaccessible, and then to the background to manually connect to the database report:
sql1015n the database is a inconsistent state. sqlstate=55025
According to sql1015n hint: need to execute restart Database dbname command, after execution, then databases can connect normally

The second is a set of HA server host power failure system switchover, after switching to the standby, check that the application is normally pulled up, but the foreground is inaccessible, and the first time is the same problem, the AutoRestart parameter is set off

This parameter is explained as follows:
If the DB2 database suffers a power outage or shuts down unexpectedly, the database does not shut down cleanly, then the database will be crash recovery when it is started. However, if the database parameter AutoRestart is set to OFF, DB2 does not crash RECOVERY after starting the database. About crash recovery, in the Db2diag.log log will have a relevant expression

This scenario is reproduced below:

[CPP]View Plaincopy
    1. /* 1 set AutoRestart to OFF */
    2. [Email protected] ~]$ DB2 UPDATE DATABASE CONFIGURATION for limtdb USING autorestart OFF IMMEDIATE
    3. Db20000i the UPDATE DATABASE CONFIGURATION command completed successfully.
    4. [[Email protected] ~]$ DB2 get DB cfg for limtdb|grep-i AutoRestart
    5. Auto restart enabled (autorestart) = OFF
    6. [Email protected] yunwei]$ DB2 connect to Limtdb
    7. Database Connection Information
    8. Database Server = db2/linuxx8664 10.1.0
    9. SQL Authorization ID = Db2inst1
    10. Local Database alias = Limtdb
    11. /* 2 Insert a piece of data but not commit, for the database is inconsistent */
    12. [[Email protected] yunwei]$ DB2 +c "INSERT into A values (15485, ' Asdas ', ' Asdas ')"
    13. db20000i the SQL command completed successfully.
    14. [Email protected] yunwei]$
    15. /* 3 Kill database to simulate abnormal outage conditions */
    16. [Email protected] yunwei]$ Ps-ef|grep Db2sys
    17. Db2inst1 5287 5285 1 08:07 pts/1 00:00:04 DB2SYSC 0
    18. Db2inst1 5827 3612 0 08:12 pts/1 00:00:00 grep db2sys
    19. [Email protected] yunwei]$ kill-9 5287
    20. /* 4 Start the database and the database does not crash recovery because AutoRestart is off */
    21. [Email protected] yunwei]$
    22. [Email protected] yunwei]$ Db2start
    23. 12/19/2014 08:13:04 0 0 sql1063n db2start processing was successful.
    24. SQL1063N Db2start processing was successful.
    25. [Email protected] yunwei]$
    26. [Email protected] yunwei]$
    27. /* 5 Here the error is because the DB2BP process has not terminate */
    28. [Email protected] yunwei]$ DB2 connect to Limtdb
    29. SQL0752N connecting to a database are not permitted within a logical unit of
    30. Work when the CONNECT type 1 setting are in use. sqlstate=0a001
    31. [Email protected] yunwei]$ DB2 terminate
    32. db20000i the TERMINATE command completed successfully.
    33. /* 6 Report database inconsistency when starting again */
    34. [Email protected] yunwei]$ DB2 connect to Limtdb
    35. sql1015n the database is a inconsistent state. sqlstate=55025
    36. /* 7 DB2? SQL1015N has one suggestion: using the RESTART DATABASE command*/
    37. [Email protected] yunwei]$ DB2 restart database Limtdb
    38. db20000i the RESTART DATABASE command completed successfully.
    39. / * 8 database can be connected normally * /
    40. [Email protected] yunwei]$ DB2 connect to Limtdb
    41. Database Connection Information
    42. Database Server = db2/linuxx8664 10.1.0
    43. SQL Authorization ID = Db2inst1
    44. Local Database alias = Limtdb
    45. /* 9 The following is the setting AutoRestart to on the case of database downtime restart (no need to execute restart) */
    46. [Email protected] yunwei]$
    47. [Email protected] yunwei]$ DB2 UPDATE DATABASE CONFIGURATION for limtdb USING AutoRestart on IMMEDIATE
    48. Db20000i the UPDATE DATABASE CONFIGURATION command completed successfully.
    49. [Email protected] yunwei]$
    50. [[Email protected] yunwei]$ DB2 get DB cfg for limtdb|grep-i AutoRestart
    51. Auto restart enabled (AutoRestart) = On
    52. [Email protected] yunwei]$
    53. [Email protected] yunwei]$
    54. [[Email protected] yunwei]$ DB2 +c "INSERT into A values (15485, ' Asdas ', ' Asdas ')"
    55. db20000i the SQL command completed successfully.
    56. [Email protected] yunwei]$ Ps-ef|grep Db2sys
    57. Db2inst1 5870 5868 1 08:13 pts/1 00:00:03 DB2SYSC 0
    58. Db2inst1 6122 3612 0 08:16 pts/1 00:00:00 grep db2sys
    59. [Email protected] yunwei]$ kill-9 5870
    60. [Email protected] yunwei]$ Db2start
    61. 12/19/2014 08:16:35 0 0 sql1063n db2start processing was successful.
    62. SQL1063N Db2start processing was successful.
    63. [Email protected] yunwei]$ DB2 connect to Limtdb
    64. SQL0752N connecting to a database are not permitted within a logical unit of
    65. Work when the CONNECT type 1 setting are in use.
    66. [Email protected] yunwei]$ DB2 terminate
    67. db20000i the TERMINATE command completed successfully.
    68. [Email protected] yunwei]$ DB2 connect to Limtdb
    69. Database Connection Information
    70. Database Server = db2/linuxx8664 10.1.0
    71. SQL Authorization ID = Db2inst1
    72. Local Database alias = Limtdb

Crash Recovery (crash recovery) with AutoRestart parameters

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.