Friday, July 4, 2014

Script to drop disconnect and drop DB2 database

#!/bin/sh
 
db2 "connect to emmdb"
 
# Not sure if the following is actually need if the database needs to be restarted
# because of the 'currently in use' issues. However it should disconnect all application
# connected to the database.
 
db2 "quiesce database immediate force connections"
db2 "unquiesce database"
 
db2 "force application all"
 
# Note the following will impact all databases and applications connected to this instance
# Only perform these steps if the above is not a problem.
# These steps take care of 'The database is currently in use' issues after doing the above
 
db2stop force
db2start
 
# Finally drop the database
db2 "drop database emmdb"

No comments:

Post a Comment