linux学习记录
分类:
2011-05-06 17:16:30
来自: 推动者社区
1、安装介质准备
通过ftp将db2安装介质和License文件传到AIX系统里。
# pwd
/software
# ls
DB2_Enterprise_Svr_Ed_AIX_5L_v91.tar db2_install installFixPack db2
aix5300-07 db2setup lost+found
2、安装DB2产品
以root用户执行:
# ./db2_install
Default directory for installation of products - /opt/IBM/db2/V9.1
***********************************************************
Do you want to choose a different directory to install [yes/no] ?
no
Specify one or more of the following keywords,
separated by spaces, to install DB2 products.
CLIENT
RTCL
ESE
Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
ESE
DB2 installation is being initialized.
Total number of tasks to be performed: 45
Total estimated time for all tasks to be performed: 826
Task #1 start
Description: Enabling Asynchronous I/O
Estimated time 2 second(s)
Task #1 end
Task #2 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #2 end
Task #3 start
Description: GSKit support
Estimated time 19 second(s)
Task #3 end
Task #4 start
Description: Product Messages - English
Estimated time 10 second(s)
Task #4 end
Task #5 start
Description: Base client support
Estimated time 131 second(s)
Task #5 end
Task #6 start
Description: IBM Software Development Kit (SDK) for Java(TM)
Estimated time 81 second(s)
Task #6 end
Task #7 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #7 end
Task #8 start
Description: Replication with MQ Server
Estimated time 23 second(s)
Task #8 end
Task #9 start
Description: Run-time Environment
Estimated time 87 second(s)
Task #9 end
Task #10 start
Description: SQL procedures
Estimated time 3 second(s)
Task #10 end
Task #11 start
Description: ICU Utilities
Estimated time 41 second(s)
Task #11 end
Task #12 start
Description: SQL Replication Support
Estimated time 21 second(s)
Task #12 end
Task #13 start
Description: Base server support
Estimated time 48 second(s)
Task #13 end
Task #14 start
Description: Connect support
Estimated time 3 second(s)
Task #14 end
Task #15 start
Description: Java support
Estimated time 6 second(s)
Task #15 end
Task #16 start
Description: Java Common files
Estimated time 19 second(s)
Task #16 end
Task #17 start
Description: Spatial Extender client
Estimated time 6 second(s)
Task #17 end
Task #18 start
Description: Base application development tools
Estimated time 18 second(s)
Task #18 end
Task #19 start
Description: Administration Server
Estimated time 7 second(s)
Task #19 end
Task #20 start
Description: Communication support - TCP/IP
Estimated time 3 second(s)
Task #20 end
Task #21 start
Description: Parallel Extension
Estimated time 3 second(s)
Task #21 end
Task #22 start
Description: Replication tools
Estimated time 13 second(s)
Task #22 end
Task #23 start
Description: Relational wrappers common
Estimated time 3 second(s)
Task #23 end
Task #24 start
Description: DB2 data source support
Estimated time 8 second(s)
Task #24 end
Task #25 start
Description: DB2 LDAP support
Estimated time 4 second(s)
Task #25 end
Task #26 start
Description: DB2 Instance Setup wizard
Estimated time 4 second(s)
Task #26 end
Task #27 start
Description: Control Server
Estimated time 3 second(s)
Task #27 end
Task #28 start
Description: XML Extender
Estimated time 10 second(s)
Task #28 end
Task #29 start
Description: First Steps
Estimated time 3 second(s)
Task #29 end
Task #30 start
Description: DB2 Web Tools
Estimated time 12 second(s)
Task #30 end
Task #31 start
Description: Product Signature for DB2 Enterprise Server Edition
Estimated time 6 second(s)
Task #31 end
Task #32 start
Description: XML Extender samples
Estimated time 3 second(s)
Task #32 end
Task #33 start
Description: ADT sample programs
Estimated time 21 second(s)
Task #33 end
Task #34 start
Description: Sample database source
Estimated time 4 second(s)
Task #34 end
Task #35 start
Description: Spatial Extender samples
Estimated time 3 second(s)
Task #35 end
Task #36 start
Description: Informix data source support
Estimated time 5 second(s)
Task #36 end
Task #37 start
Description: Setting DB2 library path
Estimated time 120 second(s)
Task #37 end
Task #38 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #38 end
Task #39 start
Description: Updating global registry
Estimated time 20 second(s)
Task #39 end
Task #40 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #40 end
Task #41 start
Description: Updating the db2ls link
Estimated time 1 second(s)
Task #41 end
Task #42 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #42 end
Task #43 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #43 end
Task #44 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #44 end
Task #45 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #45 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.340158".
3、安装License。
以root用户执行:
# cd /opt/IBM/db2/V9.1/adm
# ./db2licm -a /tmp/license/db2ese_c.lic
LIC1402I License added successfully.
如果还有其他license,可以在一并添加。
至此,DB2产片安装完成。
4、创建DB2组和用户
创建用户的Home:
# mkdir /home/db2inst1
# mkdir /home/db2fenc1
# mkdir /home/dasusr1
创建组:
# mkgroup -A id=117 db2iadm1
# mkgroup -A id=118 db2fadm1
# mkgroup -A id=119 dasadm1
创建用户:
# mkuser -a id=221 pgrp=dbiadm1 home=/home/db2inst1 db2inst1
# mkuser -a id=222 pgrp=db2fadm1 home=/home/db2fenc1 db2fenc1
# mkuser -a id=223 pgrp=dasadm1 home=/home/db2adm1 dasusr11
修改用户密码:
# passwd db2inst1
Changing password for "db2inst1"
db2inst1's New password:
Enter the new password again:
# passwd db2fenc1
Changing password for "db2fenc1"
db2fenc1's New password:
Enter the new password again:
# passwd db2adm1
Changing password for "db2adm1"
db2adm1's New password:
Enter the new password again:
5、创建实例和数据库
以root用户执行:
# cd /opt/IBM/db2/V9.7
# ls
.metadata bin das doc include32 java map samples tools
Readme bnd dasfcn function infopop lib32 misc security32
adm cfg db2xml ha install lib64 msg security64
adsm conv default.env include instance license profiles.reg tivready
# cd instance
# ls
common daslist dasutil db2iauto db2idbm db2iexec db2imchk db2ipcld db2isrv db2iuadm db2uit
dascrt dasmigr db2ckmig db2icknm db2idefs db2iinfo db2imigr db2iset db2istop db2iupdt native
dasdrop dasupdt db2clpid db2icrt db2idrop db2ilist db2instcfg db2isetup db2istrt db2iutil
# ./db2icrt -p 50000 -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.
创建样本数据库:
# su - db2inst1
$ db2sampl
Starting the DB2 instance...
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Stopping the DB2 instance...
'db2sampl' processing complete.
$ 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/db2inst1
Database release level = b.00
Comment = A sample database
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
$ db2 connect to sample
SQL1032N No start database manager command was issued. SQLSTATE=57019
$ db2start
12/23/2009 18:14:48 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
$ db2 connect to sample
Database Connection Information
Database server = DB2/AIX64 9.7
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
$ db2 "select * from staff"
ID NAME DEPT JOB YEARS SALARY COMM
------ --------- ------ ----- ------ --------- ---------
10 Sanders 20 Mgr 7 98357.50 -
20 Pernal 20 Sales 8 78171.25 612.45
30 Marenghi 38 Mgr 5 77506.75 -
40 O'Brien 38 Sales 6 78006.00 846.55
50 Hanes 15 Mgr 10 80659.80 -
60 Quigley 38 Sales - 66808.30 650.25
70 Rothman 15 Sales 7 76502.83 1152.00
80 James 20 Clerk - 43504.60 128.20
90 Koonitz 42 Sales 6 38001.75 1386.70
100 Plotz 42 Mgr 7 78352.80 -
110 Ngan 15 Clerk 5 42508.20 206.60
120 Naughton 38 Clerk - 42954.75 180.00
130 Yamaguchi 42 Clerk 6 40505.90 75.60
140 Fraye 51 Mgr 6 91150.00 -
150 Williams 51 Sales 6 79456.50 637.65
160 Molinare 10 Mgr 7 82959.20 -
170 Kermisch 15 Clerk 4 42258.50 110.10
180 Abrahams 38 Clerk 3 37009.75 236.50
190 Sneider 20 Clerk 8 34252.75 126.50
200 Scoutten 42 Clerk - 41508.60 84.20
210 Lu 10 Mgr 10 90010.00 -
220 Smith 51 Sales 7 87654.50 992.80
230 Lundquist 51 Clerk 3 83369.80 189.65
240 Daniels 10 Mgr 5 79260.25 -
250 Wheeler 51 Clerk 6 74460.00 513.30
260 Jones 10 Mgr 12 81234.00 -
270 Lea 66 Mgr 9 88555.50 -
280 Wilson 66 Sales 9 78674.50 811.50
290 Quill 84 Mgr 10 89818.00 -
300 Davis 84 Sales 5 65454.50 806.10
310 Graham 66 Sales 13 71000.00 200.30
320 Gonzales 66 Sales 4 76858.20 844.00
330 Burke 66 Clerk 1 49988.00 55.50
340 Edwards 84 Sales 7 67844.00 1285.00
350 Gafney 84 Clerk 5 43030.50 188.00
35 record(s) selected.
$ db2licm -l
Product name: "DB2 Enterprise Server Edition"
License type: "User"
Expiry date: "Permanent"
Product identifier: "db2ese"
Version information: "9.7"
Number of licensed authorized users: "25"
Annotation: "-2;(_u)"
Features:
DB2 Database Partitioning: "Not licensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization: "Not licensed"
DB2 Advanced Access Control: "Not licensed"
DB2 Geodetic Data Management: "Not licensed"
Homogeneous Federation for DB2: "Not licensed"
DB2 Pure XML ESE: "Not licensed"