db2命令php
DB2開啓監控mysql
2017-04-01 10:08:35| 分類: db2 |舉報 |字號 訂閱linux
下載LOFTER 個人照片書 |轉自:http://blog.csdn.net/hanzheng260561728/article/details/50878666
Install
DB2 10.5 on Redhat Linux 6.5 for x86_64c++
Byadmin-Last updated:Tuesday, June 10, 2014 -Save
& Share-Leave a Commentredis
Install DB2 10.5 on Redhat Linux 6.5 for x86_64
近期發如今互聯網上關於DB2 10.5的安裝資料仍是不多,如是打算髮一篇關於DB2 10.5在Redhat Linux 6.5上安裝的步驟,其實其安裝和DB2之前的安裝過程相似,簡要的安裝步驟以下,供參考。
1.安裝配置環境
操做系統版本: Red Hat Enterprise Linux Server release 6.5 (Santiago) 數據庫版本: DB2/LINUXX8664 10.5.3sql
[root@xuhz ~]# uname -a
Linux xuhz 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@xuhz ~]# uname -r
2.6.32-431.el6.x86_64
[root@xuhz ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)數據庫
2.安裝數據庫軟件
2.1 上傳安裝軟件和license文件到某文件夾服務器
[root@xuhz ~]# cd /software/
[root@xuhz software]# ls -l
total 1359328
drwxrwxrwx. 6 honcho honcho 4096 Jun 9 05:05 aese_c
-rwxrwxrwx. 1 honcho honcho 1391940725 Jun 9 05:05 DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar.gzapp
2.2 解壓縮安裝包tcp
[root@xuhz software]# gunzip DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar.gz
[root@xuhz software]# tar -xvf DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar
2.3 安裝前預檢測
[root@xuhz software]# ls -l
drwxrwxrwx. 6 honcho honcho 4096 Jun 9 05:05 aese_c
-rwxrwxrwx. 1 honcho honcho 1560576000 Jun 9 05:05 DB2_Svr_10.5.0.3_Linux_x86-64PVU.tar
drwxr-xr-x. 5 root root 4096 Feb 7 08:33 server
[root@xuhz software]# cd server/
[root@xuhz server]# ls
db2 db2checkCOL_readme.txt db2checkCOL.tar.gz db2ckupgrade db2_deinstall db2_install db2ls db2prereqcheck db2setup ibm_im installFixPack nlpack
[root@xuhz server]# ./db2prereqcheck -v 10.5.0.3 -s -o /tmp/db_check.log
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3".
Summary of prerequisites that are not met on the current system: DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
Requirement not matched for DB2 database "Server" with pureScale feature. Version: "10.5.0.3".
Summary of prerequisites that are not met on the current system: DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3588W The db2prereqcheck utility was unable to validate the configuration of the log_mtts_per_seg parameter on the following host machine: "xuhz". Reason code: "1".
DBT3566E The db2prereqcheck utility detected that the service named "rdma" is not enabled on host "xuhz".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
DBT3563E The db2prereqcheck utility determined that SELinux is enabled, which is not supported with GPFS.
上述報錯IBM 給出了以下解釋:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: library-file-name. Explanation You can verify installation prerequisites for DB2 database using the db2prereqcheck utility. This message is returned when the db2prereqcheck utility cannot find the 32-bit version of a required library file. If the named file is missing, 32-bit database applications might not function properly. User response Respond to this message in one of the following ways: 1> If you do not intend to use 32-bit applications with DB2 database, then no response is required. 2> If you do intend to use 32-bit applications with DB2 database, ensure that the named 32-bit library file exists on the system before installing DB2 database.
目前平臺不打算使用32bit applications,故能夠忽略以上警告信息。
2.4 採用命令行來安裝數據庫軟件
[root@xuhz server]# ./db2_install
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
DBI1324W Support of the db2_install command is deprecated. For
more information, see the DB2 Information Center.
Default directory for installation of products - /opt/ibm/db2/V10.5
***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no] -------------------- 這裏選擇安裝目錄,選擇推薦目錄便可
yes
Specify one of the following keywords to install DB2 products.
SERVER
CONSV
EXP
CLIENT
RTCL
Enter "help" to redisplay product names. --------------- 選擇安裝產品類型,這裏選擇SERVER
Enter "quit" to exit.
***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no] ---------------- 選擇是否安裝pureScale功能,這裏選擇不安裝
no
Requirement not matched for DB2 database "Server" . Version: "10.5.0.3".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
DB2 installation is being initialized.
Total number of tasks to be performed: 48
Total estimated time for all tasks to be performed: 1873 second(s)
Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end
...................................................................................................................
...................................................................................................................
Task #50 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #50 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.2881".
2.5 註冊liences
[root@xuhz adm]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name: "DB2 Enterprise Server Edition"
License type: "License not registered"
Expiry date: "License not registered"
Product identifier: "db2ese"
Version information: "10.5"
[root@xuhz adm]# cd /software/aese_c/db2/license
[root@xuhz license]# ls
db2aese_c.lic sam32.lic UNIX Windows
[root@xuhz license]# /opt/ibm/db2/V10.5/adm/db2licm -a db2aese_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/V10.5/license/en_US.iso88591"
[root@xuhz license]# /opt/ibm/db2/V10.5/adm/db2licm -l
Product name: "DB2 Advanced Enterprise Server Edition"
License type: "CPU Option"
Expiry date: "Permanent"
Product identifier: "db2aese"
Version information: "10.5"
Enforcement policy: "Soft Stop"
3.配置DB2 Instance
3.1 建立用戶和組
用戶用途 用戶名 用戶組
實例全部者 db2inst1 db2iadm1
受防禦的用戶 db2fenc1 db2fadm1
DB2 管理服務器用戶 dasusr1 dasadm1
注:實例全部者主目錄是將在其中建立DB2實例的位置;受防禦的用戶用於在DB2數據庫所使用的地址空間以外運行用戶定義的函數(UDF)和存儲過程;DB2管理服務器用戶的用戶標識用於在系統上運行DB2管理服務器。
[root@xuhz ~]# groupadd db2iadm1
[root@xuhz ~]# groupadd db2fadm1
[root@xuhz ~]# groupadd dasadm1
[root@xuhz ~]# useradd -u 600 -g db2iadm1 -m -d /home/db2inst1 db2inst1
[root@xuhz ~]# useradd -u 601 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
[root@xuhz ~]# useradd -u 602 -g dasadm1 -m -d /home/dasusr1 dasusr1
[root@xuhz ~]# passwd db2inst1
Changing password for user db2inst1.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@xuhz ~]# passwd db2fenc1
Changing password for user db2fenc1.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@xuhz ~]# passwd dasusr1
Changing password for user dasusr1.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
3.2 建立DAS
[root@xuhz ~]# cd /opt/ibm/db2/V10.5/instance/
[root@xuhz instance]# ./dascrt -u dasusr1
DBI1070I Program dascrt completed successfully.
注:版本9.7中已經不推薦使用「DB2 管理服務器(DAS)」,在之後的發行版中可能會將其除去。DAS在DB2 pureScale環境中不受支持。
3.3 建立DB2 Instance
[root@xuhz instance]# ./db2icrt -u db2fenc1 db2inst1
DBI1446I The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
.......................................................................................................
.......................................................................................................
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.8120".
Required: Review the following log file also for warnings or errors:
"/tmp/db2icrt_local.log.*"
DBI1070I Program db2icrt completed successfully.
[db2inst1@xuhz ~]$ db2ilist
db2inst1
4.配置DB2服務器的TCP/IP通訊
4.1 設置DB2服務器的通訊協議
[root@xuhz ~]# su - db2inst1
[db2inst1@xuhz ~]$ db2set -all
[i] DB2AUTOSTART=NO
[g] DB2SYSTEM=xuhz
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
[db2inst1@xuhz ~]$ db2set DB2COMM=tcpip
[db2inst1@xuhz ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=NO
[g] DB2SYSTEM=xuhz
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
4.2 更新服務器上services文件
[db2inst1@xuhz ~]$ cat /etc/services |grep DB2
ibm-db2 523/tcp # IBM-DB2
ibm-db2 523/udp # IBM-DB2
questdb2-lnchr 5677/tcp # Quest Central DB2 Launchr
questdb2-lnchr 5677/udp # Quest Central DB2 Launchr
DB2_db2inst1 60006/tcp # DB2 鏈接服務端口
DB2_db2inst1_1 60007/tcp
DB2_db2inst1_2 60008/tcp
DB2_db2inst1_3 60009/tcp
DB2_db2inst1_4 60010/tcp
DB2_db2inst1_END 60011/tcp
4.3 更新服務器數據庫管理文件
[db2inst1@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
TCP/IP Service name (SVCENAME) =
SSL service name (SSL_SVCENAME) =
[db2inst1@xuhz ~]$ db2 update dbm cfg using SVCENAME 60006
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
[db2inst1@xuhz ~]$ db2 get dbm cfg |grep SVCENAME
TCP/IP Service name (SVCENAME) = 60006
SSL service name (SSL_SVCENAME) =
4.4 驗證通訊端口狀態
[db2inst1@xuhz ~]$ db2start
06/09/2014 19:38:44 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst1@xuhz ~]$ netstat -an |grep 60006
tcp 0 0 0.0.0.0:60006 0.0.0.0:* LISTEN
5. 建立數據庫
[db2inst1@xuhz ~]$ db2 create db honcho using codeset UTF-8 territory CN pagesize 8192
DB20000I The CREATE DATABASE command completed successfully.
[db2inst1@xuhz ~]$ db2 connect to honcho
Database Connection Information
Database server = DB2/LINUXX8664 10.5.3
SQL authorization ID = DB2INST1
Local database alias = HONCHO
至此,DB2數據庫軟件安裝和數據庫實例及數據庫建立完成,相比Oracle的安裝而言DB2的安裝步驟更加簡單。
閱讀(355)| 評論(0)