Crash recovery and AUTORESTART parameters, crashautorestart

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

Crash recovery and AUTORESTART parameters, crashautorestart
The impact of this parameter setting has been experienced twice in the production system:
For the first time, an unimportant system WAS installed on a virtual machine. All applications of this system (DB2 was ihs) were configured to/etc/rc. in local, each time the machine is started, the application is automatically pulled up, and then the virtual machine goes down. After restarting, check that all application processes are started normally, but access to the front-end page is abnormal and cannot be accessed, then report to the background for manual database connection:
SQL1015N The database is in an inconsistent state. SQLSTATE = 55025
Run the restart database dbname command according to the SQL1015N prompt. After the command is executed, the DATABASE can be connected normally.

The second is that the power of the host of an HA server fails and the system switches over. After switching to the slave server, the application is normally pulled up, but the front-end cannot be accessed, which is the same as the first time, the AUTORESTART parameter is set to OFF.

This parameter is interpreted as follows:
If the DB2 database is shut down due to power failure or exceptions, and the database is not shut down cleanly, the database will perform crash recovery at startup. however, if the database parameter AUTORESTART is set to OFF, DB2 will not perform crash recovery after the database is started. Crash recovery will be reflected in the db2diag. log.

This scenario is reproduced below:

/* 1 Set AUTORESTART to OFF */[db2inst1 @ limt ~] $ Db2 update database configuration for limtdb using autorestart off IMMEDIATEDB20000I The update database configuration command completed successfully. [db2inst1 @ limt ~] $ Db2 get db cfg for limtdb | grep-I AUTORESTART Auto restart enabled (AUTORESTART) = OFF [db2inst1 @ limt yunwei] $ db2 connect to limtdb Database Connection Information Database server = DB2/LINUXX8664 10.1.0 SQL authorization ID = DB2INST1 Local database alias = LIMTDB/* 2 insert a piece of data do not submit, for Database Inconsistency */[db2inst1 @ limt yunwei] $ db2 + c "insert into A values (15485, 'asdas ', 'asdas')" DB20000I The SQL command co Mpleted successfully. [db2inst1 @ limt yunwei] $/* 3 kill database, simulate abnormal downtime */[db2inst1 @ limt yunwei] $ ps-ef | grep db2sysdb2inst1 5287 5285 1 00:00:04 pts/1 00:00:00 db2sysc 0 db2inst1 5827 3612 0 pts/1 grep db2sys [db2inst1 @ limt yunwei] $ kill-9 5287/* 4 start the database, at this time, the database is not recovered because AUTORESTART is OFF */[db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $ db2start12/19/2014 08:13:04 0 SQL1063N DB2START proce Ssing was successful. SQL1063N DB2START processing was successful. [db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $/* 5 the error is returned because the db2bp process has no terminate */[db2inst1 @ limt yunwei] $ db2 connect to limtdbSQL0752N Connecting to a database is not permitted within a logical unit of work when the CONNECT type 1 setting is in use. SQLSTATE = 0A001 [db2inst1 @ limt yunwei] $ db2 terminateDB20000I The TERMINATE command Completed successfully. /* 6 Report database Inconsistency when The instance is started again */[db2inst1 @ limt yunwei] $ db2 connect to limtdbsql1015the database is in an inconsistent state. SQLSTATE = 55025/* 7 db2? SQL1015N has a suggestion: using the restart database command */[db2inst1 @ limt yunwei] $ db2 restart database limtdbDB20000I The restart database command completed successfully. /* 8 the Database can be normally connected */[db2inst1 @ limt yunwei] $ db2 connect to limtdb Database Connection Information database server = DB2/LINUXX8664 10.1.0 SQL authorization ID = DB2INST1 Local Database alias = LIMTDB /* 9 If AUTORESTART is set to ON, DATABASE downtime and RESTART (restart database is not required) */[db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $ db2 update database configuration for limtdb using autorestart on IMMEDIATEDB20000I The update database configuration command completed successfully. [db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $ db2 get db cfg for limtdb | grep-I AUTORESTART Auto restart enabled (AUTORESTART) = ON [db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $[db2inst1 @ limt yunwei] $ db2 + c "insert into A values (15485, 'asdas ', 'asdas ') "DB20000I The SQL command completed successfully. [db2inst1 @ limt yunwei] $ ps-ef | grep db2sysdb2inst1 5870 5868 1 00:00:03 pts/1 00:00:00 db2sysc 0 db2inst1 6122 3612 0 pts/1 grep db2sys [db2inst1 @ limt yunwei] $ kill-9 5870 [db2inst1 @ limt yunwei] $ db2start12/19/2014 08:16:35 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. [db2inst1 @ limt yunwei] $ db2 connect to limtdbSQL0752N Connecting to a database is not permitted within a logical unit of work when the CONNECT type 1 setting is in use. [db2inst1 @ limt yunwei] $ db2 terminateDB20000I The TERMINATE command completed successfully. [db2inst1 @ limt yunwei] $ db2 connect to limtdb Database Connection Information Database server = DB2/LINUXX8664 10.1.0 SQL authorization ID = DB2INST1 Local database alias = LIMTDB


Related Article

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.