Uninstall DB2 in Linux
In case you need to clean up a big mess and re-install fresh. From the shell / bash / your choice for a command line.
- Drop all databases
db2 "list database directory"
# For each database (replace $db with actual name)
db2 "drop database $db"
- Login as the Administrative Server Owner (normally dasusr1) and stop it
su dasusr1
db2admin stop
- Stop each of the DB2 instances that exist.
e.g.
su db2inst1
db2 "force application all"
db2stop force
db2terminate - Remove the Administrative Server (replace V9.7 with current version. Install path might be different if the installation was personalized)
sudo su
/opt/ibm/db2/V9.7/instance/dasdrop - Drop all the instances
e.g.
# still as root, sudo su. Repeat for each instance.
/opt/ibm/db2/V9.7/instance/db2idrop db2inst1
# just in case you feel like using db2inst1 again while avoiding those nasty SQL1005N.
# reference: directory structure DB2 database Linux is available here
rm -rf /home/db2inst1/sqllib
rm -rf /home/db2inst1/db2inst1
- Uninstall DB2
/opt/ibm/db2/V9.7/install/db2_deinstall -a
- The execution completed successfully. Congratulations!
To reinstall you can either use db2setup (quite comprehensive and easy to use GUI) or if our a real *nix ninja you might want to consider db2_install and manually configuring all the necessary users / authorizations / etc.
In case you feel like messing up your system so you can use my guide to un-install DB2 but you don’t have DB2 – I can also help you with that. DB2 Express-C is completely free and has no limitations other than a maximum use of 2GB of ram and 2 processors. Sounds nice – try it! [http://www-01.ibm.com/software/data/db2/express]
If you would love to see blazing fast XML storage and querying you should also give pureXML a try [http://www-01.ibm.com/software/data/db2/xml]. It comes bundled with Express-C with exactly the same capabilities as the Enterprise version of DB2. I’m thinking of writing a beginners guide to pureXML somewhere in the future in the blog – maybe after the masters thesis. I think that would get everyone really excited about this technology. Maybe some screen-casts!









