Monthly Archives: April 2011

You are browsing the site archives by month.

Keep your databases active

Do  you have applications that are slow to respond sometimes especially when you connect and disconnect. DB2 to save resources allocates memory (bufferpools etc) and deallocates memory at the first and last connection respectively. Using the following command you can activate the database and the memory will still allocated and your applications should respond better:

ACTIVATE DATABASE <Database Name>

To do this you need to log on as a user that has sysadm, sysctrl or sysmaint privileges, e.g the instance owner. You have to be aware the if you ever want to stop the instance properly you will have to run the deactivate database command, otherwise you will get an error message stating that there are still connections and the database can’t be stopped. So the following will do that for you:

DEACTIVATE DATABASE <Database Name>

Again to do this you need to log on as a user that has sysadm, sysctrl or sysmaint privileges, e.g the instance owner. This will not stop the connections that are currently running against the database, but it will allow you to run the db2stop force command, or wait for them to finish before stopping you instance.

The full syntax for activating the database can be found here. The full syntax for deactivating the database can be found here.