#DB2安装补丁官方版本
#安装补丁官方版本
需要替换 database-name /backup/db2_settings /backup/FIXPACK 为实际名称
#https://www.ibm.com/docs/en/db2/11.1?topic=ifplu-installing-offline-fix-pack-updates-existing-db2-database-products
##############################Preparing to install a fix pack
#Backing up Db2 server configuration and diagnostic information
db2support /backup/db2_settings -d database-name -cl 0
#db2 LIST PACKAGES FOR SCHEMA schema-name SHOW DETAIL > /upgrade/sample_pckg.txt
db2 LIST PACKAGES FOR ALL SHOW DETAIL > /backup/db2_settings/sample_pckg.txt
db2audit describe > /backup/db2_settings/audit_instance-name.cfg
cp -R $INSTHOME/sqllib/function /backup/db2_settings/routine_backup
db2 GET DBM CFG > /backup/db2_settings/dbm_instname.cfg
db2 CONNECT TO database-name
db2 GET DB CFG FOR database-name SHOW DETAIL > /backup/db2_settings/db_database-name.cfg
db2look -d sample -e -o sample_tbs.db2 -l -x
db2set -all > /backup/db2_settings/reg_instname.txt
set |grep DB2 > /backup/db2_settings/env_instname.txt
##############################Checking fix pack prerequisites
#For AIX®, if Db2 database products already exist on the system and the Trusted Computing Base (TCB) is enabled, ensure it is in a consistent state.
tcbck -n ALL
du -k -s DB2DIR (至少5G剩余空间)
#Getting fix packs
#Extracting fix packs (Linux and UNIX)
cd /backup/FIXPACK
gunzip -c filename.tar.gz | tar -xvf -
##############################Stopping all Db2 processes
#Log on as root.
DB2DIR/instance/db2ilist
su - iname
. $HOME/sqllib/db2profile
db2 force applications all
db2 terminate
db2stop
db2licd -end # run at each physical partition
exit
#以下可选
su - aname
. $HOME/das/dasprofile
db2admin stop
exit
#Optional: On AIX®, run slibclean to unload unused shared libraries
/usr/sbin/slibclean
#Disable the fault monitor processes.
DB2DIR/bin/db2fm -i iname -D
DB2DIR/bin/db2fmcu
DB2DIR/instance/db2iset -i iname -all
DB2DIR/instance/db2iauto -off iname
#after fixpack
#DB2DIR/instance/db2iauto -on iname
$HOME/sqllib/bin/ipclean -a
##############################Installing offline fix pack updates to existing Db2 database products
#Installing offline fix pack updates to existing Db2 database products (Linux® and UNIX)
#To install a fix pack for a non Db2 pureScale instance:
#FP-image-path>./installFixPack -b current-installation-dir -p install-FP-dir
#Where FP-image-path is the directory that contains the fix pack image, current-installation-dir is where the current image is installed, and install-FP-dir can be set as /opt/ibm/db2/fixpack.
./installFixPack -b /opt/ibm/db2/V11 -p /opt/ibm/db2/fixpack
Update each instance by issuing the db2iupdt command from the fix pack directory. Following the example above:
/opt/ibm/db2/fixpack/instance> ./db2iupdt -d [-u fenced-ID] instance-name
##############################After installing a fix pack
#after fixpack
#DB2DIR/instance/db2iauto -on iname
#Log on as root.
DB2DIR/instance/db2ilist
DB2DIR/instance/db2iupdt iname
#可选
DB2DIR/instance/dasupdt
#as instance owner
db2updv111 -d dbname
#Restart the Db2 instances
db2start
#To bind the bind files:
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\db2schema.bnd BLOCKING ALL GRANT PUBLIC SQLERROR CONTINUE
db2 BIND path\@db2ubind.lst BLOCKING ALL GRANT PUBLIC ACTION ADD
db2 BIND path\@db2cli.lst BLOCKING ALL GRANT PUBLIC ACTION ADD
db2 terminate
2.rebind the packages
db2rbind dbname -l /backup/db2_settings/logfile all
3. spatial-enabled
db2 terminate
db2 CONNECT TO dbname
db2 BIND path\BND\@db2gse.lst
db2 terminate
4.If you connect to Db2 databases on host or System i servers, perform the following actions:
For Db2 for z/OS® or OS/390®:
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\@ddcsmvs.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD
db2 terminate
For Db2 databases on VM:
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\@ddcsvm.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD
db2 terminate
For Db2 databases on VSE:
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\@ddcsvse.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD
db2 terminate
For Db2 databases on System i:
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\@ddcs400.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC ACTION ADD
db2 terminate
5. If you connect to databases that are running on different operating systems (Linux®, UNIX or Windows) or at different Db2 versions or service levels, bind the database utilities and CLI bind files against those databases.
db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\@db2ubind.lst BLOCKING ALL GRANT PUBLIC ACTION ADD
db2 BIND path\@db2cli.lst BLOCKING ALL GRANT PUBLIC ACTION ADD
db2 terminate
6.If you are using a federated database, connect to the database and run the BIND command on the db2dsproc.bnd and db2stats.bnd bind files.
Perform the following actions:
db2 CONNECT TO dbname user USERID using PASSWORD
db2 bind path/db2dsproc.bnd blocking all grant public
db2 bind path/db2stats.bnd blocking all grant public
db2 terminate
#where, dbname represents the name of the federated database, and path represents the full path name of the directory where the bind files are located, such as $HOME/sqllib/bnd where $HOME represents the Db2 instance home directory.