본문 바로가기
다른 DBMS/DB2

[AIX7] DB2 11.1.4 설치하기

by 취미툰 2022. 12. 9.
반응형

테스트를 위한 DB2를 설치하고 정리한 글입니다.

 

아래 사이트의 순서 및 명령어를 많이 참고하였습니다.

출처 : https://gomu92.tistory.com/44

 

DB2 server v11.5 설치 & 실행 가이드(db2 그룹/계정 생성, instance 생성, service 설정, db/tableSpace 생성 …)

-DB2 server v11.5 바이너리 설치하는 노드의 OS 정보. $cat /etc/*release* DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS" NAME="Ubuntu" VERSION="18.04.5 LTS (Bionic Beaver)" ID=ubuntu ID_L

gomu92.tistory.com

아래 사이트는 공식사이트인데 참고를 많이 하지는 않았지만 첨부하겠습니다

https://www.ibm.com/docs/ko/db2/11.1?topic=idds-installing-db2-servers-using-db2-setup-wizard-linux-unix 

 

DB2 설치 마법사를 사용하여 DB2 서버 설치(Linux 및 UNIX)

이 태스크에서는 Linux® 및 UNIX 운영 체제에서 Db2 설치 마법사를 시작하는 방법에 대해 설명합니다. DB2 설치 마법사는 설치 환경 설정을 정의하고 시스템에 DB2 데이터베이스 제품을 설치하는 데

www.ibm.com

 

1.DB2의 설치파일을 다운받기.

IBM 사이트 접속하기

https://www.ibm.com/support/fixcentral

 

IBM 지원 센터: Fix Central

Power Systems 및 System Storage용 시스템 코드 업데이트는 보증 또는 IBM 하드웨어 유지보수 서비스 계약이 적용되는 IBM 시스템에서만 사용할 수 있습니다. 일부 예외가 적용됩니다. IBM 하드웨어 유지

www.ibm.com

해당 창에서 제품,버전,플랫폼을 선택하고 계속을 누릅니다.

 

그 다음창에서는 따로 건드리지 않고 수정사항 찾아보기에 선택되있으면 계속을 누릅니다.

 

server fin pack 클릭합니다.

(이 과정에서 로그인 및 회원가입이 필요합니다.)

파일을 다운받습니다.

https://www.ibm.com/support/fixcentral/swg/downloadFixes?parent=ibm%7EInformation%20Management&product=ibm/Information+Management/DB2&release=11.1.*&platform=AIX&function=fixId&fixids=DB2-aix64-server_t-11.1.4.7-FP007&includeRequisites=1&includeSupersedes=0&downloadMethod=http 

이제 파일은 준비되었고 서버에 업로드 후 설치를 진행합니다.

 

 

2.(root유저로 수행) DB 엔진 설치

 

압축을 해제합니다.

$gzip -d  v11.1.4fp7_aix64_server_t.tar.gzip

$tar xvf v11.1.4fp7_aix64_server_t.tar

$ls
$ ls
server_t                       v11.1.4fp7_aix64_server_t.tar

 

3.server_t로 들어가서 db2_install을 수행합니다

저는 에러가 발생해서 -f sysreq 로 강제로 옵션을 주고 설치를 진행하였습니다.

설치전에 db2prereqcheck로 사전 준비사항을 확인합니다. 

$ ./db2prereqcheck -v 11.1.0.0

==========================================================================

Checking prerequisites for DB2 installation. Version "11.1.0.0". Operating system "AIX"

Validating "IOPORTS" ...
The input/output completion Port (IOCP) is installed on host "dbarac1".
The input/output completion Port (IOCP) is  enabled on host "dbarac1".
   Requirement matched.

Validating "kernel level " ...
   Required minimum operating system kernel level: "7.1".
   Actual operating system kernel level: "7.2".
   Requirement matched.

Validating "AIX technology level and service pack " ...
   Required minimum technology level: "0" Service pack: "0"
   Actual technology level: "0" Service pack: "2"
   Requirement matched.

Validating "XL C/C++ Runtime" ...
   Required minimum "XL C/C++ Runtime" level:  "13.1.2.0"
   Actual version:  "13.1.3.1"
   Requirement matched.
DBT3533I  The db2prereqcheck utility has confirmed that all installation prerequisites were met.

==========================================================================

Checking prerequisites for DB2 installation with the DB2 pureScale Feature.  Version: "11.1.0.0".  Operating system: "AIX".

Validating "IOPORTS" ...
The input/output completion Port (IOCP) is installed on host "dbarac1".
The input/output completion Port (IOCP) is  enabled on host "dbarac1".
   Requirement matched.

Validating "prereqSAM" ...
prereqSAM: Error: Prerequisite checking for the ITSAMP installation failed:  AIX 7200-00
prereqSAM: One or more required packages are not installed: Java (32-bit) 6.0.0.265
prereqSAM: For details, refer to the 'Error:' entries in the log file:  /tmp/prereqSAM.24.log
DBT3613E  The db2prereqcheck utility failed to verify the prerequisites for TSA. Ensure your machine meets all the TSA installation prerequisites.
   ERROR : Requirement not matched.

Validating "free space" ...
The directory "/tmp" has enough space on host "dbarac1".
   Requirement matched.

Validating "free space" ...
The directory "/var" has enough space on host "dbarac1".
   Requirement matched.

Validating "free space" ...
The directory "/usr" has enough space on host "dbarac1".
   Requirement matched.
Requirement not matched for DB2 database "Server" with pureScale feature . Version: "11.1.0.0".
Summary of prerequisites that are not met on the current system:
DBT3613E  The db2prereqcheck utility failed to verify the prerequisites for TSA. Ensure your machine meets all the TSA installation prerequisites.

 

db2_install을 수행합니다

To accept those terms, enter "yes". Otherwise, enter "no" to cancel the install process. [yes/no]
yes

...생략

Install into default directory (/opt/IBM/db2/V11.1) ? [yes/no]
no
Enter the full path of the base installation directory:

------------------------------------------------
/db2/db2test

 

...생략

***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no]
no

이부분이 중요합니다 yes로 하면 에러가 나면서 안되더라구요.. 왜안되는지는 좀더 공부후에 기회가 되면 정리하겠습니다.

 

$ ./db2_install -f sysreq
  The force option "-f sysreq" is used to force the installation ...

Read the license agreement file in the db2/license directory.

***********************************************************
To accept those terms, enter "yes". Otherwise, enter "no" to cancel the install process. [yes/no]
yes


Default directory for installation of products - /opt/IBM/db2/V11.1

***********************************************************
Install into default directory (/opt/IBM/db2/V11.1) ? [yes/no]
no
Enter the full path of the base installation directory:

------------------------------------------------
/db2/db2test


Specify one of the following keywords to install DB2 products.

  SERVER
  CONSV
  CLIENT
  RTCL

Enter "help" to redisplay product names.

Enter "quit" to exit.

***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no]
no
DB2 installation is being initialized.

 Total number of tasks to be performed: 55
Total estimated time for all tasks to be performed: 3806 second(s)

Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end

Task #2 start
Description: Base Client Support for installation with root privileges
Estimated time 3 second(s)
Task #2 end

Task #3 start
Description: Product Messages - English
Estimated time 14 second(s)
Task #3 end

Task #4 start
Description: Base client support
Estimated time 539 second(s)
Task #4 end

Task #5 start
Description: Java Runtime Support
Estimated time 3 second(s)
Task #5 end

Task #6 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #6 end

Task #7 start
Description: Base server support for installation with root privileges
Estimated time 8 second(s)
Task #7 end

Task #8 start
Description: Global Secure ToolKit
Estimated time 138 second(s)
Task #8 end

Task #9 start
Description: Java support
Estimated time 13 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 42 second(s)
Task #11 end

Task #12 start
Description: Java Common files
Estimated time 17 second(s)
Task #12 end

Task #13 start
Description: Base server support
Estimated time 1508 second(s)
Task #13 end

Task #14 start
Description: Relational wrappers common
Estimated time 3 second(s)
Task #14 end

Task #15 start
Description: DB2 data source support
Estimated time 15 second(s)
Task #15 end

Task #16 start
Description: ODBC data source support
Estimated time 301 second(s)
Task #16 end

Task #17 start
Description: Teradata data source support
Estimated time 5 second(s)
Task #17 end

Task #18 start
Description: Spatial Extender server support
Estimated time 21 second(s)
Task #18 end

Task #19 start
Description: Scientific Data Sources
Estimated time 8 second(s)
Task #19 end

Task #20 start
Description: JDBC data source support
Estimated time 20 second(s)
Task #20 end

Task #21 start
Description: IBM Software Development Kit (SDK) for Java(TM)
Estimated time 329 second(s)
Task #21 end

Task #22 start
Description: DB2 LDAP support
Estimated time 5 second(s)
Task #22 end

Task #23 start
Description: DB2 Instance Setup wizard
Estimated time 25 second(s)
Task #23 end

Task #24 start
Description: Structured file data sources
Estimated time 8 second(s)
Task #24 end

Task #25 start
Description: Integrated Flash Copy Support
Estimated time 3 second(s)
Task #25 end

Task #26 start
Description: Oracle data source support
Estimated time 8 second(s)
Task #26 end

Task #27 start
Description: Connect support
Estimated time 3 second(s)
Task #27 end

Task #28 start
Description: Application data sources
Estimated time 6 second(s)
Task #28 end

Task #29 start
Description: Spatial Extender client
Estimated time 4 second(s)
Task #29 end

Task #30 start
Description: SQL Server data source support
Estimated time 8 second(s)
Task #30 end

Task #31 start
Description: Communication support - TCP/IP
Estimated time 3 second(s)
Task #31 end

Task #32 start
Description: Tivoli SA MP
Estimated time 300 second(s)
Task #32 end

Task #33 start
Description: Base application development tools
Estimated time 45 second(s)
Task #33 end

Task #34 start
Description: Parallel Extension
Estimated time 3 second(s)
Task #34 end

Task #35 start
Description: EnterpriseDB code
Estimated time 4 second(s)
Task #35 end

Task #36 start
Description: Replication tools
Estimated time 96 second(s)
Task #36 end

Task #37 start
Description: Sample database source
Estimated time 4 second(s)
Task #37 end

Task #38 start
Description: itlm
Estimated time 3 second(s)
Task #38 end

Task #39 start
Description: DB2 Text Search
Estimated time 122 second(s)
Task #39 end

Task #40 start
Description: Command Line Processor Plus
Estimated time 6 second(s)
Task #40 end

Task #41 start
Description: Sybase data source support
Estimated time 4 second(s)
Task #41 end

Task #42 start
Description: Informix data source support
Estimated time 6 second(s)
Task #42 end

Task #43 start
Description: Federated Data Access Support
Estimated time 3 second(s)
Task #43 end

Task #44 start
Description: First Steps
Estimated time 3 second(s)
Task #44 end

Task #45 start
Description: Product Signature for DB2 Server Edition
Estimated time 9 second(s)
Task #45 end

Task #46 start
Description: Guardium Installation Manager Client
Estimated time 22 second(s)
Task #46 end

Task #47 start
Description: Setting DB2 library path
Estimated time 180 second(s)
Task #47 end

Task #48 start
Description: Installing or updating DB2 HA scripts for IBM Tivoli System Automation for Multiplatforms (Tivoli SA MP)
Estimated time 40 second(s)
Task #48 end

Task #49 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #49 end

Task #50 start
Description: Updating global registry
Estimated time 20 second(s)
Task #50 end

Task #51 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #51 end

Task #52 start
Description: Updating the db2ls and db2greg link
Estimated time 1 second(s)
Task #52 end

Task #53 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #53 end

Task #54 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #54 end

Task #55 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #55 end

Task #56 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #56 end

The execution completed with warnings.

For more information see the DB2 installation log at
"/tmp/db2_install.log.34734514".

db2 버전 확인

$ ./db2ls

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID
---------------------------------------------------------------------------------------------------------------------
/db2/db2test                     11.1.4.7        7                            Thu Dec  8 15:40:26 2022 KST             0

db는 설치가 완료되었고, OS 유저를 생성하여 인스턴스를 생성합니다.

 

 

3.DB 인스턴스 생성 

OS 유저를 생성합니다.

실제로 db가 띄어져서 사용하는 유저는 db2test이고, db2fenc1과 dasusr1은 설치시 필요한 유저입니다.

제 생각에는 관리를 위해서 db가 띄어져서 운영되는 유저에 준하는 권한을 가진 유저일것이라 판단됩니다.

useradd -g db2iadm1 -m -d /home/db2test db2test
useradd -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
useradd -g dasadm1 -m -d /home/dasusr1 dasusr1

 

확인

cat /etc/group
...생략

db2iadm1:!:203:db2inst1,root,db2test
db2fadm1:!:204:db2fenc1
dasadm1:!:205:db2inst1,dasusr1

 

(root로 수행)

$ ./db2/db2test/instance/db2icrt -u db2fenc1 db2test
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 #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end

Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end

Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end

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.22217084".
DBI1070I  Program db2icrt completed successfully.


[]root@dbarac1:/db2/db2test/instance$ su - db2test
$ cat .profile


PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.

export PATH

if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.

# The following three lines have been added by IBM DB2 instance utilities.
if [ -f /home/db2test/sqllib/db2profile ]; then
    . /home/db2test/sqllib/db2profile
fi

 

(db2test유저로 수행)

##통신프로토콜 설정
$ db2set db2comm=tcpip
$
$
##서비스 네임 설정
$ db2 update dbm cfg using svcename DB2_db2test
DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
$

##서비스네임 확인
$ db2 get dbm cfg |grep SVCE
 TCP/IP Service name                          (SVCENAME) = DB2_db2test
 SSL service name                         (SSL_SVCENAME) =

##프로토콜 확인
$ cat /etc/services |grep DB2_db2test
DB2_db2test     60006/tcp
DB2_db2test_1   60007/tcp
DB2_db2test_2   60008/tcp
DB2_db2test_3   60009/tcp
DB2_db2test_4   60010/tcp
DB2_db2test_END 60011/tcp

##DB open
$ db2start
SQL8007W  There are "90" day(s) left in the evaluation period for the product
"DB2 Advanced Enterprise Server Edition". For evaluation license terms and
conditions, refer to the License Agreement document located in the license
directory in the installation path of this product. If you have licensed this
product, ensure the license key is properly registered. You can register the
license by using the db2licm command line utility. The license key can be
obtained from your licensed product CD.
12/08/2022 16:01:22     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

DB 및 인스턴스 생성은 완료되었습니다.

 

아래에는 실제로 테이블을 생성해보고 되는지 확인해보겠습니다

4.오브젝트 생성

$ db2 connect to db2test

   Database Connection Information

 Database server        = DB2/AIX64 11.1.4.7
 SQL authorization ID   = DB2TEST
 Local database alias   = DB2TEST


$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 11.1.4.7

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

버퍼풀 및 테이블스페이스 생성

db2 => create bufferpool bufferpool8k size 1000 pagesize 8k
DB20000I  The SQL command completed successfully.
db2 => create tablespace db2test
DB20000I  The SQL command completed successfully.

테이블스페이스 확인

db2 => list tablespace show detail
SQL0104N  An unexpected token "show" was found following "TABLESPACE".
Expected tokens may include:  "CONTAINERS".  SQLSTATE=42601
db2 => list tablespaces show detail


 Tablespace ID                        = 3
 Name                                 = DB2TEST
 Type                                 = Database managed space
 Contents                             = All permanent data. Large table space.
 State                                = 0x0000
   Detailed explanation:
     Normal
 Total pages                          = 8192
 Useable pages                        = 8160
 Used pages                           = 96
 Free pages                           = 8064
 High water mark (pages)              = 96
 Page size (bytes)                    = 4096
 Extent size (pages)                  = 32
 Prefetch size (pages)                = 32
 Number of containers                 = 1

 

테이블 생성 및 데이터 삽입

db2 => create table test (a int,b varchar(10))
DB20000I  The SQL command completed successfully.

db2 => select * From test

A           B
----------- ----------

  0 record(s) selected.
  
  db2 => insert into test values (1,'test')
DB20000I  The SQL command completed successfully.

db2 => commit
DB20000I  The SQL command completed successfully.
db2 => select * From test

A           B
----------- ----------
          1 test

  1 record(s) selected.

끝.

반응형

댓글