当前数据库版本:
[db2inst2@localhost ~]$ db2level
DB21085I Instance "db2inst2" 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_01".
实例中只存在一个示例数据库:
[db2inst2@localhost ~]$ 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/db2inst2
Database release level = d.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
数据库中表空间:
[db2inst2@localhost SAMPLE]$ db2 list tablespaces
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 3
Name = IBMDB2SAMPLEREL
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 4
Name = IBMDB2SAMPLEXML
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 5
Name = SYSTOOLSPACE
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 6
Name = SYSTOOLSTMPSPACE
Type = System managed space
Contents = User Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 7
Name = TEST
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
表空间TEST有表:
[db2inst2@localhost ~]$ db2 "select tabname,tbspaceid,tbspace from syscat.table
s where tbspace='TEST'"
TABNAME TBSPACEID TBSPACE -------------------------------------
T1 7 TEST
1 record(s) selected.
表t1中有数据:
[db2inst2@localhost ~]$ db2 "select * from t1"
ID NAME
----------- ----------
1 a
2 b
3 c
4 d
4 record(s) selected.
下面打补丁:
解压后的补丁包如下:
[db2inst2@localhost db2pack]$ ls
server v9.7fp7_linuxia32_server.tar.gz
停止实例:
[db2inst2@localhost ~]$ db2 force applications all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
[db2inst2@localhost ~]$ db2stop
2012-12-25 15:30:33 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
DAS不属于要更新的DB2副本:
[root@localhost bin]# ./db2daslevel
DB21089I DB2 Administration Server "dasusr" uses DB2 code release "DB2 v9.7.0.7" with level identifier "08080107". Informational tokens are "s121002", "IP23373", and Fix Pack "7". Product is installed at "/opt/ibm/db2/V9.7/das".
安装修订包:
[root@localhost server]# ./installFixPack -b /opt/ibm/db2/V9.7_01/
安装后检查:
[root@localhost server]# su - db2inst2
[db2inst2@localhost ~]$ db2level
DB21085I This instance or install (instance name, where applicable:
"db2inst2") 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_01".
[db2inst2@localhost ~]$ db2start
12/25/2012 16:34:31 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst2@localhost ~]$ 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/db2inst2
Database release level = d.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
[db2inst2@localhost ~]$ db2 connect to sample
Database Connection Information
Database server = DB2/LINUX 9.7.7
SQL authorization ID = DB2INST2
Local database alias = SAMPLE
[db2inst2@localhost ~]$ db2 list tablespaces
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 3
Name = IBMDB2SAMPLEREL
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 4
Name = IBMDB2SAMPLEXML
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 5
Name = SYSTOOLSPACE
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 6
Name = SYSTOOLSTMPSPACE
Type = System managed space
Contents = User Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 7
Name = TEST
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
[db2inst2@localhost ~]$ db2 "select * from t1"
ID NAME
----------- ----------
1 a
2 b
3 c
4 d
4 record(s) selected.
[db2inst2@localhost ~]$ db2 "delete from t1 where id=4"
DB20000I The SQL command completed successfully.
[db2inst2@localhost ~]$ db2 "select * from t1"
ID NAME
----------- ----------
1 a
2 b
3 c
3 record(s) selected.
[db2inst2@localhost ~]$ db2 "insert into t1 values(4,'d')"
DB20000I The SQL command completed successfully.
[db2inst2@localhost ~]$ db2 "select * from t1"
ID NAME
----------- ----------
1 a
2 b
3 c
4 d
4 record(s) selected.
[db2inst2@localhost ~]$ db2 "update t1 set name='e' "
DB20000I The SQL command completed successfully.
[db2inst2@localhost ~]$ db2 " select * from t1"
ID NAME
----------- ----------
1 e
2 e
3 e
4 e
4 record(s) selected.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25744374/viewspace-751614/ ,如需转载,请注明出处,否则将追究法律责任。