修改IP,网关等:
# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
en0 1500 link#2 0.21.5e.b9.c2.c0 1516273 0 638142 0 0
en0 1500 192.168.0 192.168.0.223 1516273 0 638142 0 0
en1 1500 link#3 0.21.5e.b9.c2.c1 1291 0 314 0 0
en1 1500 10.1.5 10.1.5.223 1291 0 314 0 0
lo0 16896 link#1 11560 0 11560 0 0
lo0 16896 127 127.0.0.1 11560 0 11560 0 0
lo0 16896 ::1%1 11560 0 11560 0 0
=========================================================
修改文件系统大小:
# chfs -a size=10G /
Filesystem size changed to 20971520
# chfs -a size=10G /usr
Filesystem size changed to 20971520
# chfs -a size=10G /var
Filesystem size changed to 20971520
# chfs -a size=30G /home
Filesystem size changed to 62914560
# chfs -a size=5G /tmp
Filesystem size changed to 10485760
# chfs -a size=5G /opt
Filesystem size changed to 10485760
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.00 9.82 2% 10078 1% /
/dev/hd2 10.00 7.91 21% 47248 3% /usr
/dev/hd9var 10.00 9.69 4% 8167 1% /var
/dev/hd3 5.00 5.00 1% 39 1% /tmp
/dev/fwdump 0.75 0.75 1% 4 1% /var/adm/ras/platform
/dev/hd1 30.00 30.00 1% 5 1% /home
/dev/hd11admin 0.25 0.25 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 5.00 4.76 5% 8747 1% /opt
/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
===============================================================================
修改系统用户limits参数:
# vi /etc/security/limits
default:
fsize = -1
core = -1
cpu = -1
data = -1
rss = -1
stack = -1
nofiles = -1
===============================================================================
修改 Paging Space(交换空间)为物理内存的1.5倍
# lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk1 rootvg 512MB 2 yes yes lv 0
# lspv hdisk1
PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvg
PV IDENTIFIER: 00c9b7b6dfdc6406 VG IDENTIFIER 00c9b7b600004c00000001426b7f7633
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 256 megabyte(s) LOGICAL VOLUMES: 5
TOTAL PPs: 546 (139776 megabytes) VG DESCRIPTORS: 1
FREE PPs: 463 (118528 megabytes) HOT SPARE: no
USED PPs: 83 (21248 megabytes) MAX REQUEST: 1 megabyte
FREE DISTRIBUTION: 110..106..29..109..109
USED DISTRIBUTION: 00..03..80..00..00
MIRROR POOL: None
# chps -s 38 hd6 ----再将hd6扩大38个pp
# lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk1 rootvg 10240MB 1 yes yes lv 0
#
=================================================================================
系统内存:
# prtconf -m
Memory Size: 7712 MB
=================================================================================
安装中文语言包
# locale -a
C
POSIX
ZH_CN.UTF-8
ZH_CN
Zh_CN.GB18030
Zh_CN
en_US.8859-15
en_US.ISO8859-1
en_US
zh_CN.IBM-eucCN
zh_CN
==================================================================================
安装ssh
# lssrc -a | grep ssh ----查看ssh服务
sshd ssh 3473702 active
==================================================================================
安装DB2:
# ./db2_install
Default directory for installation of products - /opt/IBM/db2/V9.7
***********************************************************
Do you want to choose a different directory to install [yes/no] ?
yes
Enter full path name for the install directory -
------------------------------------------------
/opt/IBM/db2/V9.7
Specify one of the following keywords to install DB2 products.
AESE
ESE
CONSV
WSE
CLIENT
RTCL
Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
ESE
DB2 installation is being initialized.
Total number of tasks to be performed: 48
Total estimated time for all tasks to be performed: 2507
Task #1 start
Description: Enable IOCP
Estimated time 1 second(s)
iocp0 Task #1 end
Task #2 start
。。。。。。。。。。。
。。。。。。。。。。。。。
。。。。。。。。。。。。。。。
Task #49 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #49 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.3539096".
#
============================================================
创建用户:
# ls -l /home
total 0
drwxr-xr-x 2 db2fenc1 db2adm 256 Nov 19 13:01 db2fenc1
drwxr-xr-x 3 db2inst1 db2grp 256 Nov 19 13:06 db2inst1
drwxr-xr-x 2 db2inst2 db2grp 256 Nov 19 13:02 db2inst2
drwxr-xr-x 2 db2inst3 db2grp 256 Nov 19 13:03 db2inst3
drwxr-xr-x 2 db2user1 db2adm 256 Nov 19 13:03 db2user1
=============================================================
创建实例:
# ./db2icrt -p 50001 -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.
# ./db2icrt -p 50002 -u db2fenc1 db2inst2
DBI1070I Program db2icrt completed successfully.
# ./db2icrt -p 50003 -u db2fenc1 db2inst3
DBI1070I Program db2icrt completed successfully.
=============================================================
$ db2licm -l
Product name: "DB2 Enterprise Server Edition"
License type: "Trial"
Expiry date: "02/16/2014"
Product identifier: "db2ese"
Version information: "9.7"
Product name: "DB2 Connect Server"
License type: "Trial"
Expiry date: "02/16/2014"
Product identifier: "db2consv"
Version information: "9.7"
=============================================================
安装许可证:
# ./db2licm -a /opt/db2ese_c.lic
LIC1402I License added successfully.
LIC1426I This product is now licensed for use as outlined in your License Agreement. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/IBM/db2/V9.7/license/en_US.iso88591"
#
# su - db2inst1
$ db2licm -l
Product name: "DB2 Enterprise Server Edition"
License type: "CPU Option"
Expiry date: "Permanent"
Product identifier: "db2ese"
Version information: "9.7"
Enforcement policy: "Soft Stop"
Features:
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization: "Not licensed"
DB2 Advanced Access Control: "Not licensed"
IBM Homogeneous Replication ESE: "Not licensed"
Product name: "DB2 Connect Server"
License type: "Trial"
Expiry date: "02/16/2014"
Product identifier: "db2consv"
Version information: "9.7"
============================================================
设置数据库全局变量: (每个实例都要设置)
# su - db2inst1
$ db2set
DB2COMM=tcpip
$ db2set DB2CODEPAGE=1386
$ db2set DB2TERRITORY=86
$ db2set DB2_RR_TO_RS=YES
$ db2set
DB2TERRITORY=86
DB2_RR_TO_RS=YES
DB2COMM=tcpip
DB2CODEPAGE=1386
============================================================
创建payment数据库:
$ db2 create db payment on /home/db2inst2/payment using codeset GBK territory CN
DB20000I The CREATE DATABASE command completed successfully.
$ db2 connect to payment
Database Connection Information
Database server = DB2/AIX64 9.7.7
SQL authorization ID = DB2INST2
Local database alias = PAYMENT
$ db2 list tables
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
0 record(s) selected.
$
============================================================
从生产上备份了一份数据传到DB2INST2实例下。
$ ls
payment payment1119_move.tar.gz sqllib
$ gzip -d payment1119_move.tar.gz
$ ls
payment payment1119_move.tar sqllib
$ tar -xvf payment1119_move.tar
$ ls
payment payment1119_move payment1119_move.tar sqllib
$ cd payment1119_move
$ ls
EXPORT.out tab18.ixf tab3.ixf tab41.ixf tab52.msg tab64.msg tab76.msg tab88.msg
ceratab.ddl tab18.msg tab3.msg tab41.msg tab53.ixf tab65.ixf tab77.ixf tab89.ixf
db2move.lst tab19.ixf tab30.ixf tab42.ixf tab53.msg tab65.msg tab77.msg tab89.msg
tab1.ixf tab19.msg tab30.msg tab42.msg tab54.ixf tab66.ixf tab78.ixf tab9.ixf
tab1.msg tab2.ixf tab31.ixf tab42a.001.lob tab54.msg tab66.msg tab78.msg tab9.msg
tab10.ixf tab2.msg tab31.msg tab43.ixf tab55.ixf tab67.ixf tab79.ixf tab90.ixf
tab10.msg tab20.ixf tab32.ixf tab43.msg tab55.msg tab67.msg tab79.msg tab90.msg
tab100.ixf tab20.msg tab32.msg tab44.ixf tab56.ixf tab68.ixf tab8.ixf tab91.ixf
tab100.msg tab21.ixf tab33.ixf tab44.msg tab56.msg tab68.msg tab8.msg tab91.msg
tab101.ixf tab21.msg tab33.msg tab45.ixf tab57.ixf tab69.ixf tab80.ixf tab92.ixf
tab101.msg tab22.ixf tab34.ixf tab45.msg tab57.msg tab69.msg tab80.msg tab92.msg
tab11.ixf tab22.msg tab34.msg tab46.ixf tab58.ixf tab7.ixf tab81.ixf tab93.ixf
tab11.msg tab23.ixf tab35.ixf tab46.msg tab58.msg tab7.msg tab81.msg tab93.msg
tab11a.001.lob tab23.msg tab35.msg tab47.ixf tab59.ixf tab70.ixf tab82.ixf tab94.ixf
tab12.ixf tab24.ixf tab36.ixf tab47.msg tab59.msg tab70.msg tab82.msg tab94.msg
tab12.msg tab24.msg tab36.msg tab48.ixf tab6.ixf tab71.ixf tab83.ixf tab95.ixf
tab13.ixf tab25.ixf tab37.ixf tab48.msg tab6.msg tab71.msg tab83.msg tab95.msg
tab13.msg tab25.msg tab37.msg tab49.ixf tab60.ixf tab72.ixf tab84.ixf tab96.ixf
tab14.ixf tab26.ixf tab38.ixf tab49.msg tab60.msg tab72.msg tab84.msg tab96.msg
tab14.msg tab26.msg tab38.msg tab5.ixf tab61.ixf tab73.ixf tab85.ixf tab97.ixf
tab15.ixf tab27.ixf tab39.ixf tab5.msg tab61.msg tab73.msg tab85.msg tab97.msg
tab15.msg tab27.msg tab39.msg tab50.ixf tab62.ixf tab74.ixf tab86.ixf tab98.ixf
tab16.ixf tab28.ixf tab4.ixf tab50.msg tab62.msg tab74.msg tab86.msg tab98.msg
tab16.msg tab28.msg tab4.msg tab51.ixf tab63.ixf tab75.ixf tab87.ixf tab99.ixf
tab17.ixf tab29.ixf tab40.ixf tab51.msg tab63.msg tab75.msg tab87.msg tab99.msg
tab17.msg tab29.msg tab40.msg tab52.ixf tab64.ixf tab76.ixf tab88.ixf
$db2 -tvf ceratab.ddl ----导入表结构
$db2move payment import ----导入数据
......
..........
..............
* IMPORT: table "DB2INST2"."TEXT_SAF"
-Rows read: 0
-Inserted: 0
-Rejected: 0
-Committed: 0
Disconnecting from database ... successful!
End time: Tue Nov 19 15:43:51 2013
=============================================================================
设置归档:
$ pwd
/home/db2inst2
$ mkdir payment_archive_log
$ mkdir payment_bak ------创建归档日志目录和备份目录
配置归档参数:
$
$ db2 update db cfg for payment using LOGFILSIZ 4000
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
$ db2 update db cfg for payment using LOGPRIMARY 30
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
$ db2 update db cfg for payment using LOGSECOND 50
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
$ db2 update db cfg for payment using LOGARCHMETH1 DISK:/home/db2inst2/payment_archive_log
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
$ db2 connect reset
DB20000I The SQL command completed successfully.
$ db2 connect to payment
SQL1116N A connection to or activation of database "PAYMENT" cannot be made
because of BACKUP PENDING. SQLSTATE=57019
$ db2 backup db payment to /home/db2inst2/payment_bak
Backup successful. The timestamp for this backup image is : 20131119155502
$ db2 connect to payment
Database Connection Information
Database server = DB2/AIX64 9.7.7
SQL authorization ID = DB2INST2
Local database alias = PAYMENT
$
==========================================================================