Upgrade your Complex DB2 Environment

advertisement
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
Overview
This 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.
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.
Overview
•
•
•
•
•
1. Planning
2. Hardware/Operating system migration
3. Database Migration
4. Problem Resolution
5. Conclusion
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.
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
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
AIX upgrade with DB2 upgrade:
Check versions with upgrade for AIX and
DB2 with IBM DB2/AIX support to clarify
issues on version compatability
No 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)
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
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
Moving to new hardware
1. Install DB2 UDB 8.1.2 and fixpaks on new
hardware and configure disk layouts and
filesystems for DB2 and AIX
2. Perform a complete offline backup for DB2
databases
3. FTP over the backup image to the new
database servers
4. Perform a redirected restore from old
hardware to new hardware after install version
8.1.2
5. take backup of database on new servers
6. test database connection and environments
7. test stored procedures
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.
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.
Additional Preparation
- collect additional DB2 UDB database configurations: db2
get db cfg for acctview. Db2 get dbm cfg for acctview
- extract ddl for db2 db
using 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
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
Shutdown database instances for DB2
UDB
$ db2stop
08-06-2003 14:33:29
0 0 SQL1064N
DB2STOP processing was successful.
SQL1064N DB2STOP processing was
successful.
$ db2admin stop
SQL4407W The DB2 Administration
Server was stopped successfully.
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.
Installing DB2 UDB 8.1 for 32 bit AIX 5.2L
login 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
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- 145Mb
Used by DB2 DBA to administer DB2 remotely
and locally servers
Additional Filesystem and Disk space
requirements for the database upgrade
Runtime client- 60Mb
used by users to connect who do not have an
Admin or Application client
Application Clients- 180Mb
(Used for developing stored procedures, DB2
applications, etc)
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:
- DWCTRLDB
Schema: IWH
User: 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
PART II: Upgrade DB2 7.2 Instance to
DB2 UDB 32 bit 8.1.2 instance
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!
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.
Migrate the current DB2 7.2 database
instance to the 8.1 version of DB2 UDB
$ 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
Syntax: /DB2DIR/instance/db2imigr -u db2fenc1 InstName
where 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
$ ./db2imigr -u db2fenc1 db2inst1
DBI1052E You must be root to execute this
program.
Explanation:
This program can only be run under the root
user ID. Special
privileges are required to execute this program.
User Response:
Login as root and issue the command again.
root> cd /usr/opt/db2_08_01/instance
root> ./db2imigr -u db2fenc1 db2inst1
db2ckmig was successful. Database(s)
can be migrated.
DBI1070I Program db2imigr completed
successfully.
Check to make sure the instance has
been upgraded to new DB2 version:
$ db2level
DB21085I 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".
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
Start the DB2 UDB 8.1 database instance
$ db2start
08-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:
$ db2 connect to sample user db2inst1
using db2
SQL5035N The database requires
migration to the current release.
SQLSTATE=55001
The database migration has to still be
completed
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
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!!!
$ db2 migrate database SAMPLE
DB20000I 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
Next take complete offline backup of the
new database after the upgrade- very
important!
db2 backup database SAMPLE use tsm
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.
Special
privileges are required to execute this program.
User Response:
Login as root and issue the command again.
Try out some of the new features in DB2
UDB 8.1
DB2 Health Monitor: graphical and
command line
$ db2 get health snapshot for dbm
Database Manager Health Snapshot
Node type
with
local and remote clients
Instance name
Snapshot timestamp
08:24:05.824699
= Enterprise Server Edition
= db2inst1
= 08-08-2003
Number of database partitions in DB2 instance = 1
Start Database Manager timestamp
= 08-07-2003
15:23:29.033376
Instance highest severity alert state
= Not yet evaluated
Health Indicators:
Not yet evaluated
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.
Final caveats:
You will still need to keep the DB2 7.2 clients
until all the servers have been upgraded.
Comments/Questions?
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
Upgrade Your Complex DB2 UDB
Environment Tips and Tricks
Session Code:
Speaker: Ben S. Prusinski
Email: ben.prusinski@lpl.com
Download