概述
转自:http://www.db2china.net/home/space.php?uid=3431&do=blog&id=25313
1.安装DB2 V9.7的介质程序和注册新版本License
2.升级数据库前的检查
db2ckupgrade was unsuccessful. Please look at logfile for more details.
[dbonl@ /dbonl]vi /tmp /db2ckupd.log
"/tmp/db2ckupd.log" 12 lines, 160 characters
Version of DB2CKUPGRADE being run : VERSION 9. 7.
Database : 'dbonl'
* * ERROR * *
SQL1015N The database is in an inconsistent state. SQLSTATE = 55025
Database is consistent = NO
[dbonl@/dbonl]db2 ? SQL1015N
SQL1015N The database is in an inconsistent stat.
Explanation :
The possible causes of the inconsistent state include :
... ...
[dbonl@/dbonl]db2 force applications all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
[dbonl@/dbonl]db2stop
05 / 17 / 2012 14 : 44 : 19 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
[dbonl@/dbonl]db2start
05 / 17 / 2012 14 : 44 : 24 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
db2ckupgrade was successful. Database(s) can be upgraded.
[dbonl@/dbonl]db2 get db cfg|grep -i consistent
Database is consistent = YES
[dbonl@/dbonl]db2 get db cfg|grep -i pending
Backup pending = NO
Rollforward pending = NO
Restore pending = NO
3.正式执行升级操作
3.1 检查和升级实例
实例类型 | 节点类型 | 升级支持 |
---|---|---|
客户机 - DB2 客户机的缺省类型1 | 客户机 |
|
独立 - DB2 Personal Edition(PE)的缺省类型 | 带有本地客户机的数据库服务器 |
|
wse - DB2 Workgroup Server Edition(WSE)的缺省类型 | 带有本地和远程客户机的数据库服务器 |
|
ese - DB2 Enterprise Server Edition (ESE) 的缺省类型 | 带有本地和远程客户机的分区数据库服务器或 带有本地和远程客户机的企业服务器版 |
|
SQL1064N DB2STOP processing was successful.
[dbonl@/dbonl]db2 terminate
DB20000I The TERMINATE command completed successfully.
具有 root 用户权限的用户登录 DB2 数据库服务器,在目标 DB2 V9.7 副本位置运行 db2iupgrade 命令来对现有实例进行升级。通过运行 db2start 命令来重新启动实例: db2start通过运行 db2level 命令验证实例是否正在 DB2 V9.7 上运行: db2level-------------升级实例结束,此时DB不可用------------
[YOU HAVE NEW MAIL]
db2ckupgrade was successful.
Database(s) can be upgraded.
[YOU HAVE NEW MAIL]
DBI1070I Program db2iupgrade completed successfully.
[YOU HAVE NEW MAIL]
[dbonl@/dbonl]db2start
SQL1063N DB2START processing was successful.
[dbonl@/dbonl]db2level
DB21085I Instance "dbonl" uses "64" bits and DB2 code release "SQL09075" with level identifier "08060107".
Informational tokens are "DB2 v9.7.0.5", "s111017", "IP23285", and Fix Pack "5".
Product is installed at "/opt/IBM/db2/V9.7".
[dbonl@/dbonl]db2 connect to dbonl
SQL5035N The database must be upgraded to the current release. SQLSTATE = 55001
经验一:错误的db directory注册信息(CATALOG)将导致升级失败。root@tldba:/opt/IBM/db2/V9.7/instance # cat /dbonl/upgrade.log Version of DB2CKUPGRADE being run: VERSION 9.7. Database: 'TEST' ** ERROR ** Database cannot be connected.[dbonl@/]db2 list db directory System Database Directory Number of entries in the directory = 4 Database 1 entry: Database alias = APSDBBKE Database name = APSDBBKE Node name = HISNODE Database release level = b.00 Comment = Directory entry type = Remote Authentication = SERVER Catalog database partition number = -1 Alternate server hostname = Alternate server port number = Database 2 entry: Database alias = TEST Database name = TEST Local database directory = /dbonl Database release level = b.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number = Database 3 entry: Database alias = APSDBHIS Database name = APSDBHIS Node name = HISNODE Database release level = b.00 Comment = Directory entry type = Remote Authentication = SERVER Catalog database partition number = -1 Alternate server hostname = Alternate server port number = Database 4 entry: Database alias = dbonl Database name = dbonl Local database directory = /apsonllog Database release level = b.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number = [dbonl@/]db2 connect to TESTSQL1032N No start database manager command was issued. SQLSTATE=57019[dbonl@/]db2start05/17/2012 15:11:29 0 0 SQL1063N DB2START processing was successful.SQL1063N DB2START processing was successful.[dbonl@/]db2 connect to TESTSQL0332N Character conversion from the source code page "819" to the target code page "1386" is not supported. SQLSTATE=57017[dbonl@/]db2set -all[i] DB2COMM=tcpip[i] DB2CODEPAGE=1386[g] DB2SYSTEM=tldba[dbonl@/]db2 uncatalog db testDB20000I The UNCATALOG DATABASE command completed successfully.DB21056W Directory changes may not be effective until the directory cache is refreshed.[dbonl@/]db2stop force05/17/2012 15:11:58 0 0 SQL1064N DB2STOP processing was successful.SQL1064N DB2STOP processing was successful.[dbonl@/]db2 terminateDB20000I The TERMINATE command completed successfully.
经验二:错误的/etc/hosts,将导致db2nodes.cfg中主机名无法与本地IP通讯,升级将失败。root@tldba:/opt/IBM/db2/V9.7/instance # ./db2iupgrade -u dbonl dbonl -d
DBI1124E Instance dbonl cannot be upgraded.。。。。。。root@tldba:/opt/IBM/db2/V9.7/instance # ping tldba
192.168.4.11 tldbaroot@tldba:/opt/IBM/db2/V9.7/instance # ping tldba
64 bytes from 192.168.4.11: icmp_seq=1 ttl=255 time=0 ms 3.2升级DAS
DBI1074E Administration server does not exist.
Explanation :
An attempt was made to update or upgrade an administration server. An administration server does not exist.
User response :
Create an administration server using the dascrt command.
3.3升级数据库
可选:重命名或删除 db2diag 日志文件,以便创建新文件。
DB20000I The UPGRADE DATABASE command completed successfully.
[dbonl@ /dbonl]iduid = 3001(dbonl) gid = 1(staff) groups = 3000(db2grp)
[dbonl@/dbonl]db2level
DB21085I Instance "dbonl" uses "64" bits and DB2 code release "SQL09075" with level identifier "08060107".
Informational tokens are "DB2 v9.7.0.5", "s111017", "IP23285", and Fix Pack "5".
Product is installed at "/opt/IBM/db2/V9.7".
[dbonl@/dbonl]db2 connect to dbonl
Database Connection Information
Database server = DB2 /AIX64 9. 7. 5
SQL authorization ID = dbonl
Local database alias = dbonl
[dbonl@ /dbonl]exit
root@tldba:/opt/IBM/db2/V9.7/instance # su - apsdbbke
[apsdbbke@ /apsdbbke]db2 connect to apsdbbke
Database Connection Information
Database server = DB2 /AIX64 9. 1. 0
SQL authorization ID = APSDBBKE
Local database alias = APSDBBKE
[apsdbbke@/apsdbbke]db2level
DB21085I Instance "apsdbbke" uses "64" bits and DB2 code release "SQL09010" with level identifier "02010107".
Informational tokens are "DB2 v9.1.0.0", "s060629", "AIX64", and Fix Pack "0".
Product is installed at "/opt/IBM/db2/V9.1".
- 如果按照 DB2 服务器的升级前任务中建议的那样将 diaglevel 数据库管理器配置参数设置为 3 或更高值,那么将此参数重新设置为升级之前设置的值。
[apsdbbke@/apsdbbke]db2 get dbm cfg|grep -i diaglevel
Diagnostic error capture level (DIAGLEVEL) = 3 - 调整日志空间大小。如果您按照 DB2 服务器升级前任务中建议的那样更改了日志空间设置,那么将数据库配置参数 logfilsiz、logprimary 和 logsecond 重新设置
为它们在升级之前具有的值。确保为 DB2 服务器分配了足够的日志空间。
[apsdbbke@/apsdbbke]db2 get db cfg|grep LOGFILSIZLog file size (4KB) (LOGFILSIZ) = 1024[apsdbbke@/apsdbbke]db2 get db cfg|grep LOGPRIMARYNumber of primary log files (LOGPRIMARY) = 30[apsdbbke@/apsdbbke]db2 get db cfg|grep LOGSECONDNumber of secondary log files (LOGSECOND) = 12 - 确保外部例程的现有库在升级之前保留在原始位置,必要时,从您在备份 DB2 服务器配置和诊断信息中执行的备份来复原这些库。
- 升级之后激活数据库,以启动数据库和所有必需的数据库服务。
(不需要,自动激活)db2 active database dbonl - 管理 DB2 服务器行为发生的更改。DB2 V9.7 中引入了新的注册表变量、新的配置参数以及注册表变量和配置参数的新缺省值,它们可以影响 DB2 服务器的行为。数据库
的物理设计特征以及安全性也会发生更改,这些更改也会产生影响。 - 设置安全性以管理已升级数据库中的数据库审计。如果已升级数据库中启用了审计设施,请授予安全性管理员(SECADM)权限,以允许用户使用 DDL 语句来配置和管理数据
库审计。 - 如果在升级数据库期间自动收集某些系统目录表的统计信息失败,请更新这些系统目录表的统计信息。
- 在已升级的数据库中重新绑定程序包,以验证程序包并使用更新的统计信息或新索引信息。
db2rbind database–name -l logfile all -u userid -p password
[dbonl@/dbonl]db2rbind dbonl -l /tmp/rebind.log all -u dbonl -p dbonl
Rebind done successfully for database 'dbonl'. - 迁移 DB2 说明表,以保留先前收集的说明表信息。
- 如果您在版本低于 9.7 的发行版中创建了具有 XML 列的表,请重新创建这些表以将 XML 存储器对象转换为 V9.7 格式,从而访问新功能(例如,压缩 XML 数据和收集统
计信息)以估计 XML 列的直接插入长度。 - 确保符合系统临时表空间页大小要求,以容纳来自查询或定位更新的结果集的最大行大小,如有必要,请创建一个具有更大页大小的系统临时表空间。
- 如果您从 DB2 支持服务机构获得了定制的代码页转换表,那么将那些表的所有文件从 DB2OLD/conv 复制到 DB2DIR/conv,其中 DB2OLD 是 DB2 V9.1 或 DB2 UDB V8
副本所在的位置,而 DB2DIR 是 DB2 V9.7 副本所在的位置。不必复制标准代码页转换表。 - 如果在 Windows 操作系统上已对现有 DB2 V9.1 或 DB2 UDB V8 副本进行升级,那么可以复原定制的代码页转换表,它作为 DB2 服务器的升级前任务的一部分备份到了
DB2PATHconv 目录,其中 DB2PATH 是 DB2 V9.7 副本所在的位置。 - 如果您在 DB2 V9.1 或者 DB2 UDB V8 中创建了写至表事件监视器,请重新创建写至表事件监视器,以便在您升级到 DB2 V9.7 之后可以成功地激活这些监视器。
- 验证 DB2 服务器升级是否成功。测试应用程序和工具以确保 DB2 服务器按预期工作。请参阅验证 DB2 服务器的升级以了解详细信息。
[dbonl@/dbonl]db2batch -d dbonl -f sqllib/samples/clp/testdata.db2 -o r 0 p 3* Timestamp: Thu May 17 2012 16:05:46 BEIST---------------------------------------------* SQL Statement Number 1:CREATE TABLE EMPL (ENO INTEGER, LASTNAME VARCHAR(30),HIREDATE DATE, SALARY INTEGER);
......
* Summary Table:Type Number Repetitions Total Time (s) Min Time (s) Max Time (s) Arithmetic Mean Geometric Mean Row(s) Fetched Row(s) Output--------- ----------- ----------- -------------- -------------- -------------- --------------- -------------- -------------- -------------Statement 1 1 0.314030 0.314030 0.314030 0.314030 0.314030 0 0Statement 2 1 0.047687 0.047687 0.047687 0.047687 0.047687 0 0Statement 3 1 0.000374 0.000374 0.000374 0.000374 0.000374 100 0Statement 4 1 0.064868 0.064868 0.064868 0.064868 0.064868 0 0* Total Entries: 4* Total Time: 0.426958 seconds* Minimum Time: 0.000374 seconds* Maximum Time: 0.314030 seconds* Arithmetic Mean Time: 0.106740 seconds* Geometric Mean Time: 0.024545 seconds---------------------------------------------* Timestamp: Thu May 17 2012 16:05:48 BEIST - 完成对 DB2 服务器进行升级之后,备份数据库。
- 如果您具有可恢复的数据库,那么 UPGRADE DATABASE 命令使用 .MIG 扩展名重命名了活动日志路径中的所有日志文件。在验证数据库升级成功并且备份数据库之后,您可
以删除位于活动日志路径中的 S*.MIG 文件。
最后
以上就是务实钥匙为你收集整理的D_db2_upgrade的全部内容,希望文章能够帮你解决D_db2_upgrade所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复