Skip to content

Instantly share code, notes, and snippets.

@steegi
Created June 16, 2012 17:53
Show Gist options
  • Save steegi/2942084 to your computer and use it in GitHub Desktop.
Save steegi/2942084 to your computer and use it in GitHub Desktop.
Script to drop disconnect and drop DB2 database
#!/bin/sh
db2 "connect to sugarult"
# 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 sugarult"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment