07 October,2015 by Tom Collins
If you need to change DB2 version , you have to either a)uninstall the old version or b) upgrade it to the new version. In these notes, I am uninstalling the old version.
In this example, I am changing DB2 versions from DB2 10.1 ESE to DB2 10.1 WSE
Step 1: Contact application owners to shutdown application connections to the DB2 instances stopped. You can check for any live connections with:
db2 list applications
Step 2: Backup, export or db2move.
This decision depends on the circumstances
# mkdir /backups
# cd /backups # db2look -d DBNAME -e -o DBNAME.DDL
# db2move DBNAME export
To backup all databases: DB2 - Backup all databases on Primary Server
Now you have all of your data in the directory /backups as local backups.
To save space I gzip the files
gzip *.001
I prefer to be ultra cautious and complete FULL OFFLINE backups onto the remote backup system
Step 3: Drop your databases or UNCATALOG DATABASES. If I'm doing an inplace version change, I prefer to use the UNCATALOG method .
# db2start
SQL1063N DB2START processing was successful.
# db2 drop database DBNAME DB20000I
The DROP DATABASE command completed successfully. # db2 list db directory SQL1067W The system database directory is empty. SQLSTATE=01606
OR UNCATALOG
Before you issue the UNCATALOG command make a note of local db directory
db2 UNCATALOG DB <db_name>
Step 4: Stop and remove DB2 Administration Server (DAS)
DB2DIR is the path you installed DB2 (example : /opt/ibm/db2/V10.1 ) and INSTHOME is the db2 instance owner’s home directory (example: /db2myinst).
$ cd DB2DIR/das/bin
$ ./db2admin stop
SQL4407W The DB2 Administration Server was stopped successfully.
$ echo switch to the root user
$ su
# cd DB2DIR/instance
# ./dasdrop
SQL4410W The DB2 Administration Server is not active.
DBI1070I Program dasdrop completed successfully.
DB2 Database Administration Server (DAS) Notes - DBA DB2
Step 5: Stop and drop DB2 instances.
Use db2ilist command to list the instances. Then for each one of them, you have to issue the following commands to stop and remove.
# cd DB2DIR/bin
# ./db2ilist
db2myinst
# cd INSTHOME
# . profile
# su - db2inst1
$ db2stop force
SQL1032N No start database command was issued. SQLSTATE=57019
$ db2 terminate
DB20000I The TERMINATE command completed successfully.
Once you've stopped the DB2 instance . You have to do these for all instances. Next, we will remove the instances. You have to complete this step for all DB2
instances
# cd DB2DIR/instance
# ./db2idrop db2inst1
DBI1070I Program db2idrop completed successfully.
Step 6: Issue db2_deinstall command.
.
# cd DB2DIR/install
# ./db2_deinstall -a
DBI1016I Program db2_deinstall is performing uninstallation. Please wait.
The execution completed successfully.
For more information see the DB2 uninstallation log at:
"/tmp/db2_deinstall.log.6709"
The execution completed successfully.
Step 7: INSTALL DB2 platform including fixpacks - in our case , we are migrating from DB2 10.1.03 from ESE to WSE
This is an example. Refer to your organisations standardised method of installing DB2
Run the installation program:./db2prereqcheck . Fix any outstanding issues
• Run the installation program:./db2_install
• The default path will be : /opt/ibm/db2/V10.1 –
• Specify one or more keywords : WSE
Do you want to install the PureScale feature ? No
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.10784".
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2_install.log.10784".
Step 8 : CREATE DB2 INSTANCES
This is an example. Refer back to your installation scripts for any install and post-install tasks
/opt/ibm/db2/V10.1/instance/db2icrt -u db2fmy db2my
Step 9: CATALOG DATABASES
CATALOG DB <db_name> ON <local_directory>
How to uninstall DB2 - DBA DB2
DB2 TOOLS CATALOG – Is it required? - DBA DB2
DB2 Version 9.7 Documentation - DBA DB2
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |