Linux下為DB2 9.7打補丁

like052629發表於2015-08-21

一、檢視當前資料庫版本

[db2inst@localhost ~]$ db2level

DB21085I  Instance "db2inst" uses "32" bits and DB2 code release "SQL09075"

with level identifier "08060107".

Informational tokens are "DB2 v9.7.0.5", "s111017", "IP23291", and Fix Pack

"5".

Product is installed at "/opt/ibm/db2/V9.7".

 

當前補丁包版本為5,更新至最新補丁包pack 7

 

二、下載並解壓補丁包

注意,補丁包下載並解壓縮至的目錄路徑中不能包含任何空格。如果該目錄路徑中包含空格,那麼安裝將失敗。

[root@localhost db2pack]# tar -xvf v9.7fp7_linuxia32_server.tar.gz

 

三、停止所有DB2程式

1、停止例項

[root@localhost db2pack]# su - db2inst

[db2inst@localhost ~]$ db2 force applications all               --斷開所有應用程式

DB20000I  The FORCE APPLICATION command completed successfully.

DB21024I  This command is asynchronous and may not be effective immediately.

 

[db2inst@localhost ~]$ db2 terminate             --斷開當前與資料庫連線並關閉後臺程式

DB20000I  The TERMINATE command completed successfully.

[db2inst@localhost ~]$ db2stop                      --停止例項

2012-12-04 00:24:23     0   0   SQL1064N  DB2STOP processing was successful.

SQL1064N  DB2STOP processing was successful.

[db2inst@localhost bin]$ db2licd –end      --在每一個物理分割槽執行

 

2、如果DB2管理伺服器(DAS)屬於要更新的DB2副本,則停止DAS

[db2inst@localhost ~]$ su - dasusr

密碼:

[dasusr@localhost ~]$ db2admin stop   --停止DAS

SQL4410W  The DB2 Administration Server is not active.

 

3、可選:在AIX上,在安裝前執行slibclean以從記憶體中解除安裝未使用的共享庫:

/usr/sbin/slibclean

 

4、禁用故障監視器程式。

DB2DIR/bin/db2fm –I iname -D

[db2inst@localhost bin]$ db2fm -i db2inst –D        --停止故障監視器程式守護程式

必須對DB2副本中的每個例項執行一次。

 

5、如果啟動了故障監視器協調程式(FMC),要阻止例項自動啟動:

 

[db2inst@localhost bin]$ db2fmcu      --確定是否啟動了故障監視器協調程式(FMC

Warning: db2fmcu not running as root.

FMC: down

這裡FMC沒有啟動,如果啟動,則輸出內容類似於:FMC: up: PID = 3415

 

 

如果啟動了FMC確定是否有例項被配置為在系統每次重新啟動就自動啟動

DB2DIR/instance/db2iset –I iname –all

[root@localhost instance]# /opt/ibm/db2/V9.7/instance/db2iset

DB2COMM=tcpip

DB2AUTOSTART=YES

 

阻止例項自動啟動db2iauto –off iname

[root@localhost instance]# db2iauto -off db2inst

 

6、確保對要更新的例項清除了所有DB2程式間通訊。

[db2inst@localhost /]$ ipclean         --清除要更新的例項所有DB2程式間通訊,在每個物理分割槽中執行

ipclean: Removing DB2 engine and client's IPC resources for db2inst.

 

四、安裝補丁包

有兩種方法安裝補丁包:

一種是安裝新的DB2資料庫產品,使用db2setup命令安裝處於特定補丁包級別的新DB2資料庫產品。相當於安裝DB2

另一種是更新現有的DB2資料庫產品,即通常所說的打補丁。使用installFixPack命令。

這裡用第二種。

 

[root@localhost server]# ./installFixPack -b /opt/ibm/db2/V9.7

 

 

五、安裝後任務

[root@localhost server]# db2level

DB21085I  This instance or install (instance name, where applicable: "db2inst")

uses "32" bits and DB2 code release "SQL09077" with level identifier

"08080107".

Informational tokens are "DB2 v9.7.0.7", "s121002", "IP23373", and Fix Pack

"7".

Product is installed at "/opt/ibm/db2/V9.7".

 

1、更新例項以使用新的DB2級別。

安裝補丁包後,必須更新該DB2副本中的所有現有例項。預設情況下,installFixPack命令將自動更新DB2例項。但是,如果發生錯誤,可以手動更新

1)、作為root使用者登入。

2)、透過發出以下命令確定與DB2副本相關聯的例項:

[root@localhost instance]# db2ilist

db2inst

3)、如果對db2profiledb2cshrc指令碼進行了任何更改,備份這些指令碼或者將更改分別複製到userprofileusercshrc指令碼中。由於db2iupdt命令覆蓋db2profiledb2cshrc指令碼,因此此操作是必須的。它不覆蓋userprofileusercshrc指令碼。

4)、對每個例項發出以下命令:

DB2DIR/instance/db2iupdt iname

Iname表示例項名稱,DB2DIR表示安裝了DB2副本的位置。

 

[root@localhost instance]# /opt/ibm/db2/V9.7/instance/db2iupdt db2inst

DBI1070I  Program db2iupdt completed successfully.

 

db2iupdt 命令的作用:

FUNCTION: db2iupdt - update a DB2 instance after installation/removal

- of a new DB2 release (of the same version)

                      - of additional DB2 products

                       (eg. updating a client to a server)

-          of a patch/PTF

5)、如果DAS屬於安裝了修訂包的DB2副本,要發出以下命令:

DB2DIR/instance/dasupdt

 

[root@localhost instance]# /opt/ibm/db2/V9.7/instance/dasupdt

SQL4410W  The DB2 Administration Server is not active.

SQL4406W  The DB2 Administration Server was started successfully.

DBI1070I  Program dasupdt completed successfully.

 

2可選:更新資料庫中的系統目錄物件以支援修訂包。如果希望使用特定於修訂包的功能,則強烈建議執行此任務。如果安裝了修訂包來建立新的安裝,那麼不必執行此任務,因為目前沒有資料庫。

對於應用了修訂包的DB2副本中的每個例項,執行下列操作:

1)、作為例項所有者登入。

2)、對每個資料庫發出以下命令:db2updv97 –d dbname

 

[db2inst@localhost ~]$ db2updv97 -d sampl

 

 

_________________________________________________________________________    

                                                                             

                    _____   DB2 Service Tools   _____                         

                                                                             

                            I      B      M                                  

                                                                             

                               db2updv97                                     

                                                                             

   This tool is a service utility designed to update a DB2 Version 9.7       

   database to the current fixpak level.                                     

                                                                             

_________________________________________________________________________    

 

 

DB2 Universal Database Version 9.7, 5622-044 (c) Copyright IBM Corp. 2009

Licensed Material - Program Property of IBM

IBM DATABASE 2 Database update to current fix pack tool

 

db2updv97 completed successfully for database 'sampl'.

 

[db2inst@localhost ~]$ db2updv97 -d test

 

 

_________________________________________________________________________    

                                                                             

                    _____   DB2 Service Tools   _____                        

                                                                              

                            I      B      M                                  

                                                                             

                               db2updv97                                      

                                                                             

   This tool is a service utility designed to update a DB2 Version 9.7       

   database to the current fixpak level.                                     

                                                                              

_________________________________________________________________________    

 

 

DB2 Universal Database Version 9.7, 5622-044 (c) Copyright IBM Corp. 2009

Licensed Material - Program Property of IBM

IBM DATABASE 2 Database update to current fix pack tool

 

db2updv97 completed successfully for database 'test'.

 

3、重新啟動例項和DAS

如果安裝修訂包來更新現有安裝,那麼此步驟是必需的。如果安裝了修訂包來建立新安裝,那麼此步驟不是必需的。

[db2inst@localhost ~]$ db2start         --對於每個例項!

12/04/2012 17:48:17     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

 

[db2inst@localhost ~]$ su - dasusr

密碼:

[dasusr@localhost ~]$ db2admin start

SQL4409W  The DB2 Administration Server is already active.

 

4可選。如果在安裝修訂包之前發出了db2iauto命令以阻止例項自動啟動,對這些例項啟用自動啟動。

[db2inst@localhost ~]$ db2iauto -on db2inst

 

5、對繫結檔案進行繫結

在為伺服器安裝修訂包過程中,將自動繫結資料庫應用程式(IMPORTEXPORTREORG和命令列處理器)和CLI繫結檔案。但是,如果在客戶機上安裝修訂包或發生錯誤,那麼可以手動繫結資料庫實用程式和CLI繫結檔案。

1)、如果在具有現成資料庫的DB2資料庫產品基礎上安裝修訂包,對每個資料庫執行一次下列命令:

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND path/db2schema.bnd BLOCKING ALL GRANT PUBLIC SQLERROR CONTINUE

db2 BIND BLOCKING ALL GRANT PUBLIC ACTION ADD

db2 BIND BLOCKING ALL GRANT PUBLIC ACTION ADD

db2 terminate

 

db2ubind.lstdb2cli.lst包含DB2資料庫產品所使用的必須繫結檔案列表。已繫結的程式包將返回SQL0719N錯誤。這是期望的行為。

[db2inst@localhost bnd]$ db2 bind db2schema.bnd blocking all grant public sqlerror continue

 

LINE    MESSAGES FOR db2schema.bnd

------  --------------------------------------------------------------------

        SQL0061W  The binder is in progress.

        SQL0091N  Binding was ended with "0" errors and "0" warnings.

[db2inst@localhost bnd]$ db2 bind @db2ubind.lst blocking all grant public action add

 

LINE    MESSAGES FOR db2ubind.lst

------  --------------------------------------------------------------------

        SQL0061W  The binder is in progress.

 

LINE    MESSAGES FOR db2ajgrt.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLABH02" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2ueiwi.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUAH19" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uigsi.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUCH05" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2ucktb.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUJH0A" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uiici.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUDH02" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uiict.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUEH01" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uexpm.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUBH05" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uimpm.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUFH13" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uImpInsUpdate.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUPH03" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uiDescribe.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUPH00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2ugtpi.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUHH03" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2pctsp.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLP1H02" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uredp.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUIH00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2clpcs.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLC2H23" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2clprr.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLC3H22" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2clpur.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLC4H22" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2clprs.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLC5H22" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2clpnc.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLC6H22" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2arxcs.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLA1H00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2arxrr.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLA2H00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2arxrs.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLA4H00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2arxnc.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLA5H00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2arxur.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLA3H00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2dropv.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLE3H01" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uimtb.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUKH08" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uqtpd.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUMH00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uqtnm.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLULH00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2ulxld.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUNH01" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uiXmlparse.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUZH00" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2uipkg.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.SQLUOH01" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2ats_sps.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.ATSH04" already exists.  SQLSTATE=42710

 

LINE    MESSAGES FOR db2_adminotm.bnd

------  --------------------------------------------------------------------

        SQL0719N  Bind error for user "DB2INST ". Package

                  "NULLID.AOTMH01" already exists.  SQLSTATE=42710

        SQL0082C  An error has occurred which has terminated

                  processing.

        SQL0092N  No package was created because of previous errors.

        SQL0091N  Binding was ended with "34" errors and "0"

                  warnings.

[db2inst@localhost bnd]$ db2 bind @db2cli.lst blcoking all grant public action add

SQL0104N  An unexpected token "blcoking" was found following "". 

Expected tokens may include:  "ACTION".  SQLSTATE=42601

[db2inst@localhost bnd]$ db2 bind @db2cli.lst blocking all grant public action add

 

LINE    MESSAGES FOR db2cli.lst

------  --------------------------------------------------------------------

        SQL0061W  The binder is in progress.

        SQL0091N  Binding was ended with "0" errors and "0" warnings.

 

2)、如果在具有現成資料庫的DB2產品基礎上安裝修訂包,要執行REBINDdb2rbind命令來重新繫結程式包

安裝修訂包後,某些程式包會被標記為無效。應用程式受此使用被標記為無效的程式包時,會隱式地重新繫結這些程式包。要消除此開銷並確保重新繫結操作成功,要手動重新繫結所有程式包。

 [db2inst@localhost ~]$ db2rbind test -l logfile all

 

 Rebind done successfully for database 'TEST'.

 

--logfile是在程式包重新生效期間要用於記錄錯誤的檔名。

 

3)、如果在具有支援空間的現有資料庫的DB2資料庫產品基礎上安裝修訂包,要對每個資料庫執行下列命令:

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND

db2 terminate

 

4)、如果連線至主機或System i 伺服器上的DB2資料庫,要執行下列操作:

l     對於 z/OS® OS/390® 上的 DB2 資料庫:

db2 terminate

db2 CONNECT TO dbname user USERIN using PASSWORD

db2 BIND BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD

db2 terminate

l     對於VM上的DB2資料庫:

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD

db2 terminate

l     對於VSE上的DB2資料庫:

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD

db2 terminate

l     對於System i 上的資料庫:

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD

db2 terminate

5)、如果連線至正在不同作業系統(LinuxUNIXWindows)或在不同DB2版本或服務級別執行的資料庫,那麼對這些資料庫繫結資料庫實用程式和CLI繫結檔案。

db2 terminate

db2 CONNECT TO dbname user USERID using PASSWORD

db2 BIND BLOCKING ALL GRANT PUBLIC ACTION ADD

db2 BIND BLOCKING ALL GRANT PUBLIC ACTION ADD

db2 terminate

 

db2ubind.lstdb2cli.lst包含DB2資料庫產品所使用的必須繫結檔案列表。已繫結的程式包將返回SQL0719錯誤。這是期望的行為。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28258625/viewspace-1778536/,如需轉載,請註明出處,否則將追究法律責任。

相關文章