Upgrade your complex DB2 UDB Environment: Tips and Tricks

46
Upgrade your complex DB2 UDB Environment: Tips and Tricks

description

Upgrade your complex DB2 UDB Environment: Tips and Tricks. Ben S. Prusinski, Database Administrator. 12 Years IT Experience Network and Database Administration with DB2 UDB, Oracle, SQL Server and SAP R/3. Financial Services and Government Project Experience. - PowerPoint PPT Presentation

Transcript of Upgrade your complex DB2 UDB Environment: Tips and Tricks

Page 1: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Upgrade your complex DB2 UDB Environment: Tips and Tricks

Page 2: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Ben S. Prusinski, Database Administrator

• 12 Years IT Experience

• Network and Database Administration with DB2 UDB, Oracle, SQL Server and SAP R/3.

• Financial Services and Government Project Experience

Page 3: Upgrade your complex DB2 UDB Environment: Tips and Tricks

OverviewThis presentation will be in workshop hands-on format. It will cover the best method for upgrading a complex environment from DB2 UDB 7.1 to DB2 UDB 8.1. It will also cover “gotchas” for performing database migration from old hardware and operating systems to new hardware and operating system versions.

Page 4: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Upgrade your Complex DB2 UDB Database Environment

• I will cover migration from DB2 UDB 7.2 with Fixpak6 on AIX 4.3.3 to DB2 UDB 8.1 on Fixpak3 with AIX 5.2L.

Page 5: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Overview

• 1. Planning

• 2. Hardware/Operating system migration

• 3. Database Migration

• 4. Problem Resolution

• 5. Conclusion

Page 6: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Many companies today have a critical need for the updated versions of DB2 UDB 8.1 ESE and AIX 5.2L that will allow better performance and scalability for mission critical business applications. In addition with the new release of DB2 UDB for AIX, database self- managing SMART initiatives and self- healing features will provide a more robust and stable enterprise database environment for LPL’s mission-critical applications.

Page 7: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Planning your DB2 UDB Upgrade

• Total: 4-6 weeks to install new hardware, configure disk/filesystems, install new version of DB2 database server software, upgrade database instances, migrate databases and upgrade DB2 UDB clients

Page 8: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Preparation Steps for the Migration/Upgrade

Hardware and Operating System

1. Best to upgrade to new version of AIX first rather than attempt to migrate everything at once.2. Check with IBM Support for version compatibility for AIX and DB2 UDB: 32 bit versus 64 bit.3. Fixpak issues

Page 9: Upgrade your complex DB2 UDB Environment: Tips and Tricks

AIX upgrade with DB2 upgrade:

Check versions with upgrade for AIX and DB2 with IBM DB2/AIX support to clarify issues on version compatabilityNo issues with DB2 UDB 7.2 (with Fixpack 6) and AIX 5.2L 32 bit(There are only problems with AIX 5.1L and DB2 UDB 7.2)

Page 10: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Upgrade migration scenarios:

- Migrate DB2 UDB from current database server to a new server

- Migrate DB2 UDB from same server to same server- version upgrade

- Migrate 32 bit DB2 UDB 7.2 to 64 bit DB2 version 8.1

Page 11: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Migrate DB2 UDB from current database server to a new server

• Take offline full backup of current database• Db2 backup database acctview use tsm• Perform redirected restore of database to new server- db2 restore database acctview use tsm

taken at 20031219143225 into acctview replace existing redirect without rolling forward

- db2 set tablespace containers for 0 … - db2 restore database acctview continue

Page 12: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Moving to new hardware1.    Install DB2 UDB 8.1.2 and fixpaks on new hardware and configure disk layouts and filesystems for DB2 and AIX2.    Perform a complete offline backup for DB2 databases3.    FTP over the backup image to the new database servers4.    Perform a redirected restore from old hardware to new hardware after install version 8.1.25.    take backup of database on new servers6.    test database connection and environments7.    test stored procedures

Page 13: Upgrade your complex DB2 UDB Environment: Tips and Tricks

More tips on migration with new AIX server

TEST new version of AIX 5.2L with DB2 UDB database and application. ENABLE ALL AIX UNIX Filesystems to support large file sizes larger than 2Gb to avoid problems with DB2 UDB tablespaces and containers- especially with SMS based tablespaces.

Page 14: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Next step in migration:

On new database server at LPL we migrated to an IBM p690:

Allocate at least 2 Gb of disk space in /usr/opt filesystem.

Page 15: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Additional Preparation

- collect additional DB2 UDB database configurations: db2 get db cfg for acctview. Db2 get dbm cfg for acctview - extract ddl for db2 dbusing db2look utility- get DB2 partition layout for nodes (DB2 EEEE now ES version only)- get db2set parameters very important- get DB2 and AIX filesystem layout- get DB2 and AIX logical disk volume layout- update db2 diag level to diaglevel 4- collect disk and filesystem layout AIX for DB2 prep

Page 16: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Install DB2 UDB 8.1 and FP3 for DB2 on sandbox (unixtest) Shutdown current version of DB2. Shutdown DB2 Database Server: db2inst1> db2stop Shutdown DB2 Administrative Instance: db2inst1> db2admin stop

Page 17: Upgrade your complex DB2 UDB Environment: Tips and Tricks

 Shutdown database instances for DB2 UDB$ db2stop08-06-2003 14:33:29 0 0 SQL1064N DB2STOP processing was successful.SQL1064N DB2STOP processing was successful. $ db2admin stopSQL4407W The DB2 Administration Server was stopped successfully. 

Page 18: Upgrade your complex DB2 UDB Environment: Tips and Tricks

NOTE: During the sandbox installation for new version DB2 UDB, it failed because space ran out on /home and /home/db2inst2  Also need to re-install with new name for DB2 Admin instance- call it dasuser instead of db2as!!!!! 2. Free up additional space under /home/db2inst2 the new DB2 UDB 8.1 instance directory Re-run db2setup installation program to resolve failed installation.

Page 19: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Installing DB2 UDB 8.1 for 32 bit AIX 5.2Llogin as the AIX UNIX superuser- root # mount -oro -vcdrfs /dev/cd0 /mnt; cd /mnt# cp ese.sbcs.tar.Z /usr# cd /usr# zcat ese.sbcs.tar.Z| tar -xf -# cd ese.sbcs# ./db2setup

Page 20: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Filesystem and Disk space requirements – bare minimum DB2 UDB V8.1 Database: 169Mb/usr/opt/db2_08_01 /usr need 2Gb/usr/opt need 2Gb /home need 2-4Gb:Admin Client- 145MbUsed by DB2 DBA to administer DB2 remotely and locally servers

Page 21: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Additional Filesystem and Disk space requirements for the database upgrade

Runtime client- 60Mbused by users to connect who do not have an Admin or Application client Application Clients- 180Mb(Used for developing stored procedures, DB2 applications, etc) 

Page 22: Upgrade your complex DB2 UDB Environment: Tips and Tricks

More configuration details for the migration Configuration Setup DB2 V8.1- db2inst2 is new DB2 V8.1 database instance- dasusr1 is new DB2 V8.1 Admin database instance (DAS)- TCP/IP= db2c_db2inst2- TCP/IP Port: 50002 under /etc/services Warehouse DB V8.1:- DWCTRLDBSchema: IWHUser: db2inst2 Configuration Setup DB2 7.2:-db2inst1 is V7.2 DB2 UDB instance-> /home/db2inst1-db2as is V7.2 DB2 UDB Admin database instance (DAS) server-> /home/db2as

Page 23: Upgrade your complex DB2 UDB Environment: Tips and Tricks

PART II: Upgrade DB2 7.2 Instance to DB2 UDB 32 bit 8.1.2 instance

Page 24: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Login as the DB2 7.2 database instance owner, db2inst1 Run the DB2 8.1 DB2CKMKIG utility before starting migration db2inst1> cd /home/db2inst2/sqllib/bin or wherever you installed the new version of DB2 8.1 instance also located under /usr/opt/db2_08_01/instance or on the DB2 UDB 8.1.2 CD-ROM you have mounted during the v8 installation. HOWEVER do not run the db2ckmig utility nor db2imig from here it will not work! 

Page 25: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Database Migration Check for DB2 UDB Upgrade db2inst1> ./home/db2inst2/sqllib/bin/db2ckmig -eSAMPLE -l /home/db2inst1/upgrade -u db2inst1 -p db2

NOTE: the log file for the upgrade check must be unix filesystem writable or you will get the error message"cannot open log file" Check to make sure it ran successful and current version. 

Page 26: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Migrate the current DB2 7.2 database instance to the 8.1 version of DB2 UDB

Page 27: Upgrade your complex DB2 UDB Environment: Tips and Tricks

$ db2 list database directory  System Database Directory  Number of entries in the directory = 1 Database 1 entry:  Database alias = SAMPLE Database name = SAMPLE Local database directory = /home/db2inst1 Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0

Page 28: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Syntax: /DB2DIR/instance/db2imigr -u db2fenc1 InstNamewhere DB2DIR is either /usr/opt/db2_08_01 on AIX  NOTE: db2fenc1 is only required when migrate from client instance to a server. LOGIN AS DB2INST1 (v7.2 instance owner/user) cd /usr/opt/db2_08_01/instance  CHANGE PERMISSIONS to allow db2inst1 to run the commands in this directory see Unix admin: ./db2imigr -u db2fenc1 db2inst1  

Page 29: Upgrade your complex DB2 UDB Environment: Tips and Tricks

$ ./db2imigr -u db2fenc1 db2inst1DBI1052E You must be root to execute this program. Explanation: This program can only be run under the root user ID. Specialprivileges are required to execute this program. User Response: Login as root and issue the command again.  

Page 30: Upgrade your complex DB2 UDB Environment: Tips and Tricks

root> cd /usr/opt/db2_08_01/instanceroot> ./db2imigr -u db2fenc1 db2inst1 db2ckmig was successful. Database(s) can be migrated. DBI1070I Program db2imigr completed successfully.

Page 31: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Check to make sure the instance has been upgraded to new DB2 version: $ db2levelDB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08010"with level identifier "01010106".Informational tokens are "DB2 v8.1.1.0", "s021023", "", and FixPak "0".Product is installed at "/usr/opt/db2_08_01".

Page 32: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Check database directory for db2inst1 to ensure it has been upgraded to new version of DB2:  $ db2 list db directory  System Database Directory  Number of entries in the directory = 1 Database 1 entry:  Database alias = SAMPLE Database name = SAMPLE Local database directory = /home/db2inst1 Database release level = a.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 

Page 33: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Start the DB2 UDB 8.1 database instance  $ db2start08-07-2003 15:23:35 0 0 SQL1063N DB2START processing was successful.SQL1063N DB2START processing was successful. NOTE: you still need to run the database migration to complete the rest of the database upgrade:

Page 34: Upgrade your complex DB2 UDB Environment: Tips and Tricks

$ db2 connect to sample user db2inst1 using db2SQL5035N The database requires migration to the current release.SQLSTATE=55001 The database migration has to still be completed

Page 35: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Migrate the database to new release of DB2 8.1: Syntax:db2 migrate database {database alias} user {username} using {password} db2 migrate database SAMPLE user db2inst1 using mypassword options: update statistics, rebind packages, revoke execute privileges [ db2undgp -r ] migrate db2explain tables

Page 36: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Compare pre-migration DB2 configuration parameter settings, database manager configuration settings, tablespace records and packages records to newly upgrade database instance to ensure no errors occurred in the upgrade and migration!!!

Page 37: Upgrade your complex DB2 UDB Environment: Tips and Tricks

$ db2 migrate database SAMPLEDB20000I The MIGRATE DATABASE command completed successfully. $ db2 connect to SAMPLE  Database Connection Information  Database server = DB2/6000 8.1.0 SQL authorization ID = DB2INST1 Local database alias = SAMPLE

Page 38: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Next take complete offline backup of the new database after the upgrade- very important!

db2 backup database SAMPLE use tsm

Page 39: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Migrate the DB2 Administrative (DAS) database instance over to DB2 8.1 $ ./dasmigr db2as mydas1 DBI1052E You must be root to execute this program. Explanation: This program can only be run under the root user ID. Specialprivileges are required to execute this program. User Response: Login as root and issue the command again.

Page 40: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Try out some of the new features in DB2 UDB 8.1  DB2 Health Monitor: graphical and command line   

Page 41: Upgrade your complex DB2 UDB Environment: Tips and Tricks

$ db2 get health snapshot for dbm  Database Manager Health Snapshot Node type = Enterprise Server Edition withlocal and remote clientsInstance name = db2inst1Snapshot timestamp = 08-08-2003 08:24:05.824699 Number of database partitions in DB2 instance = 1Start Database Manager timestamp = 08-07-2003 15:23:29.033376Instance highest severity alert state = Not yet evaluated Health Indicators:  Not yet evaluated

Page 42: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Conclusion:

Performing a complex database migration for DB2 UDB is a challenging and daunting task for any DB2 UDB database professional Make sure to plan carefully and test in a sandbox and/or development environment before upgrading your production and QA servers.

Page 43: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Final caveats: You will still need to keep the DB2 7.2 clients until all the servers have been upgraded. 

Page 44: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Comments/Questions?

Page 45: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Additional Resources:

Quick Beginnings AIX and DB2 UDB 8.1 Release Notes for DB2 UDB 8.1 on AIX Installing DB2 UDB 8.1 Server Installing DB2 UDB 8.1 clients Release Notes- installing DB2 UDB 8.1 Fixpack 3

IBM Support:http://www.ibm.com/software/data/db2/library

IBM Redbooks:http://www.redbooks.ibm.com Up and Running with DB2 UDB ESE: Partitioning for Performance in an e-Business Intelligence World, SG24-6917-00

Page 46: Upgrade your complex DB2 UDB Environment: Tips and Tricks

Upgrade Your Complex DB2 UDB Environment Tips and Tricks

Session Code:Speaker: Ben S. PrusinskiEmail: [email protected]