이전 글: 2022.04.19 - [Database/Oracle Database] - 18c 신기능 - 오라클 샤딩 (Sharding) - #2 설치 사례 - 준비
Oracle Database Software 설치
shard catalog, shard 가 위치할 인스턴스 “inst-scatalog”, “inst-shard1”, “inst-shard2”에 Oracle Database Software 설치합니다. 여기서는 rpm으로 Oracle Database Software를 설치했습니다. 아래 사이트에서 “Oracle Database 19c (19.3) for Linux x86-64 (RPM)” 다운로드합니다.
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
각 세 서버 “inst-scatalog”, “inst-shard1”, “inst-shard2”에, 아래와 같이 rpm을 업로드부터 Database Software 설치까지 수행했습니다.
youjung@YOUJUNG-KR MINGW64 ~/Downloads
$ sftp -o ProxyCommand='ssh -i C:\\Users\\youjung\\.ssh\\id_rsa opc@132.145.146.238 -W %h:%p %r' -i C:\\Users\\youjung\\.ssh\\id_rsa opc@10.0.2.2
Connected to opc@10.0.2.2.
s put oracle-database-ee-19c-1.0-1.x86_64.rpm
Uploading oracle-database-ee-19c-1.0-1.x86_64.rpm to /home/opc/oracle-database-ee-19c-1.0-1.x86_64.rpm
oracle-database-ee-19c-1.0-1.x86_64.rpm 100% 2570MB 2.8MB/s 15:09
ssh 접속, 파일 소유권 변경합니다.
[opc@inst-scatalog ~]$ mv oracle-database-ee-19c-1.0-1.x86_64.rpm /tmp
[opc@inst-scatalog ~]$ sudo -s
[root@inst-scatalog opc]# chown root:root /tmp/oracle-database-ee-19c-1.0-1.x86_64.rpm
Preinstallation RPM 설치합니다.
[root@inst-scatalog opc]# yum install oracle-database-preinstall-19c -y
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed
:
:
Complete!
Database software 설치합니다.
[root@inst-scatalog opc]# cd /tmp
[root@inst-scatalog tmp]# yum localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm -y
Loaded plugins: langpacks, ulninfo
Examining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
oracle-database-ee-19c x86_64 1.0-1 /oracle-database-ee-19c-1.0-1.x86_64 6.9 G
Transaction Summary
==============================================================================================
Install 1 Package
Total size: 6.9 G
Installed size: 6.9 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : oracle-database-ee-19c-1.0-1.x86_64 1/1
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure
Verifying : oracle-database-ee-19c-1.0-1.x86_64 1/1
Installed:
oracle-database-ee-19c.x86_64 0:1.0-1
Complete!
Shard Director Software 설치
아래 GSM 설치 문서 참조했습니다.
shard director가 위치할 인스턴스 “inst-sdirector”에 shard director software (global service manager-GSM software) 설치했습니다.
아래 사이트에서 “Oracle Database 19c Global Service Manager (GSM/GDS) (19.3) for Linux x86-64” 를 다운로드 받을 수 있습니다.
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
먼저“inst-sdirector”에 아래 설치파일을 업로드합니다.
youjung@YOUJUNG-KR MINGW64 ~/Downloads
$ sftp -i C:\\Users\\youjung\\.ssh\\id_rsa opc@132.145.146.238
Connected to opc@132.145.146.238.
s put LINUX.X64_193000_gsm.zip
Uploading LINUX.X64_193000_gsm.zip to /home/opc/LINUX.X64_193000_gsm.zip
LINUX.X64_193000_gsm.zip 100% 915MB 4.9MB/s 03:05
GSM 설치 시 14GB 이상의 swap size가 필요합니다. 이미 14GB 이상의 swap이 확보되어 있다면, 아래 swap size 조정 작업은 하지 않아도 됩니다만, 현재 8GB이므로 여기에서는 8GB swap file을 추가하는 방식으로 swap size를 변경했습니다.
[root@inst-sdirector ~]# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 8388604 0 -2
[root@inst-sdirector ~]# cat /proc/swaps
Filename Type Size Used Priority
/dev/sda2 partition 8388604 0 -2
[root@inst-sdirector ~]# cat /etc/fstab | grep swap
UUID=ffa35d76-0947-49fe-b030-3bf270640b7a swap swap defaults,_netdev,x-initrd.mount 0 0
swap file를 만들고, 이를 활성화한 다음, 서버 재부팅 시에도 반영되도록 /etc/fstab 파일에 아래 내용 추가합니다.
[root@inst-sdirector opc]# dd if=/dev/zero of=/root/swapfile count=1024 bs=8388608
1024+0 records in
1024+0 records out
8589934592 bytes (8.6 GB) copied, 117.564 s, 73.1 MB/s
[root@inst-sdirector opc]# mkswap -c /root/swapfile
Setting up swapspace version 1, size = 8388604 KiB
no label, UUID=b9434230-d884-449b-ba37-755ccac401e9
[root@inst-sdirector opc]# swapon /root/swapfile
swapon: /root/swapfile: insecure permissions 0644, 0600 suggested.
[root@inst-sdirector opc]# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 8388604 0 -2
/root/swapfile file 8388604 0 -3
[root@inst-sdirector opc]# vi /etc/fstab
...
/root/swapfile swap swap defaults 0 0
...
[root@inst-sdirector opc]# cat /etc/fstab | grep swap
UUID=ffa35d76-0947-49fe-b030-3bf270640b7a swap swap defaults,_netdev,x-initrd.mount 0 0
/root/swapfile swap swap defaults 0 0
Preinstallation RPM 설치합니다. 설치 유저가 root는 안되고, 미리 설치되어야 할 패키지가 많으므로 Oracle Database Preinstall 패키지를 설치했습니다. GSM 설치 시 별도 OS 유저로 생성할 수 도 있으나, 여기서는 oracle 유저로 설치했습니다.
[root@inst-sdirector opc]# yum install oracle-database-preinstall-19c -y
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed
:
:
Complete!
파일 소유권을 oracle로 변경 후 압축을 해제합니다.
[root@inst-sdirector opc]# mv LINUX.X64_193000_gsm.zip /tmp
[root@inst-sdirector opc]# chown oracle:oinstall /tmp/LINUX.X64_193000_gsm.zip
[root@inst-sdirector opc]# su - oracle
[oracle@inst-sdirector ~]$ unzip /tmp/LINUX.X64_193000_gsm.zip
...
inflating: gsm/welcome.html
GSM 설치는 Oracle Universal Installer 할 수 있지만, 여기서는 Silent 모드로 수행했습니다. 압축을 푼 GSM 설치 파일에서 response file “/gsm/response/gsm_install.rsp”을 열어서 설치 경로 등을 수정합니다.
[oracle@inst-sdirector ~]$ vi ~/gsm/response/gsm_install.rsp
...
#-------------------------------------------------------------------------------
# Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall
#-------------------------------------------------------------------------------
# Inventory location.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory
#-------------------------------------------------------------------------------
# Complete path of the Oracle Home
#-------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1
#-------------------------------------------------------------------------------
# Complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle
response 파일에 나온 디렉토리 생성 및 소유권 변경, 권한 변경합니다.
[oracle@inst-sdirector ~]$ exit
logout
[root@inst-sdirector opc]# mkdir -p /u01/app/oraInventory
[root@inst-sdirector opc]# mkdir -p /u01/app/oracle/product/19c/dbhome_1
[root@inst-sdirector opc]# chown -R oracle:oinstall /u01
[root@inst-sdirector opc]# su - oracle
Last login: Thu Nov 21 02:24:04 GMT 2019 on pts/0
[oracle@inst-sdirector ~]$ chmod -R 775 /u01/app/oraInventory
[oracle@inst-sdirector ~]$ chmod -R 775 /u01/app/oracle
설치를 실행합니다. 매뉴얼과는 다르게 response file의 full path를 기술했습니다.
[oracle@inst-sdirector ~]$ cd ~/gsm
[oracle@inst-sdirector gsm]$ ./runInstaller -silent -responseFile /home/oracle/gsm/response/gsm_install.rsp -showProgress -ignorePrereq
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 551 MB. Actual 25843 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-12-02_01-21-27AM. Please wait ...[oracle@inst-sdirector gsm]$ The response file for this session can be found at:
/u01/app/oracle/product/19c/dbhome_1/install/response/gsm_2019-12-02_01-21-27AM.rsp
Prepare in progress.
.................................................. 8% Done.
Prepare successful.
Copy files in progress.
.................................................. 13% Done.
.................................................. 19% Done.
.................................................. 27% Done.
.................................................. 33% Done.
.................................................. 38% Done.
.................................................. 43% Done.
.................................................. 48% Done.
.................................................. 53% Done.
.................................................. 58% Done.
.................................................. 64% Done.
.................................................. 69% Done.
.................................................. 74% Done.
.................................................. 79% Done.
Copy files successful.
Link binaries in progress.
Link binaries successful.
Setup files in progress.
........................................
Setup files successful.
Setup Inventory in progress.
Setup Inventory successful.
..........
Finish Setup in progress.
.................................................. 84% Done.
Finish Setup successful.
The installation of Oracle Distributed Service and Load Management was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2019-12-02_01-21-27AM.log' for more details.
Setup Oracle Base in progress.
Setup Oracle Base successful.
.................................................. 95% Done.
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19c/dbhome_1/root.sh
Successfully Setup Software.
.................................................. 100% Done.
The log of this install session can be found at:
/u01/app/oraInventory/logs/installActions2019-12-02_01-21-27AM.log
이제 root 유저로 “orainstRoot.sh”과 “root.sh”을 수행합니다.
[oracle@inst-sdirector gsm]$ exit
logout
[root@inst-sdirector opc]# sh /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@inst-sdirector opc]# sh /u01/app/oracle/product/19c/dbhome_1/root.sh
Check /u01/app/oracle/product/19c/dbhome_1/install/root_inst-sdirector_2019-11-21_03-37-56-440329838.log for the output of root script
GSM 설치 유저인 oracle 유저 profile에 GSM 관련 경로 지정합니다.
[root@inst-sdirector opc]# su - oracle
Last login: Thu Nov 21 03:26:52 GMT 2019 on pts/1
[oracle@inst-sdirector ~]$ vi .bash_profile
...
export TZ=Asia/Seoul
export ORACLE_BASE='/u01/app/oracle'
export ORACLE_HOME='/u01/app/oracle/product/19c/dbhome_1'
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
...
[oracle@inst-sdirector ~]$ source .bash_profile
gdsctl 명령이 정상 수행되는 지 확인합니다.
[oracle@inst-sdirector ~]$ gdsctl
GDSCTL: Version 19.0.0.0.0 - Production on Thu Nov 21 12:44:17 KST 2019
Copyright (c) 2011, 2019, Oracle. All rights reserved.
Welcome to GDSCTL, type "help" for information.
Warning: GSM is not set automatically because gsm.ora does not contain GSM entries. Use "set gsm" command to set GSM for the session.
Current GSM is set to GSMORA
GDSCTL>
Shard Catalog Database 설치
Catalog 설치 호스트 “inst-scatalog”에서 설치합니다. 먼저 oracle 유저 환경 변수 설정합니다.
[root@inst-scatalog tmp]# su - oracle
Last login: Mon Dec 2 00:51:24 GMT 2019
[oracle@inst-scatalog ~]$ vi .bash_profile
...
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=SCATALOG
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
...
[oracle@inst-scatalog ~]$ source .bash_profile
[oracle@inst-scatalog ~]$ echo $ORACLE_SID
SCATALOG
[oracle@inst-scatalog ~]$ which dbca
/opt/oracle/product/19c/dbhome_1/bin/dbca
데이터베이스 디렉토리를 생성합니다.
[oracle@inst-scatalog ~]$ mkdir -p /opt/oracle/oradata/SCATALOG
dbca silent 모드로 non-CDB 데이터베이스를 생성했습니다.
[oracle@inst-scatalog ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName SCATALOG -sid SCATALOG -sysPassword Welcome123## -systemPassword Welcome123## -emConfiguration NONE -datafileDestination /opt/oracle/oradata -storageType FS -characterSet AL32UTF8
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/SCATALOG.
Database Information:
Global Database Name:SCATALOG
System Identifier(SID):SCATALOG
Look at the log file "/opt/oracle/cfgtoollogs/dbca/SCATALOG/SCATALOG.log" for further details.
리스너 파일 생성하고, 리스너 시작 및 상태 확인합니다.
[oracle@inst-scatalog ~]$ vi $ORACLE_HOME/network/admin/listener.ora
...
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = inst-scatalog.subnetshard.demovcn.oraclevcn.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = SCATALOG)
(ORACLE_HOME = /opt/oracle/product/19c/dbhome_1)
(SID_NAME = SCATALOG)
)
)
...
[oracle@inst-scatalog ~]$ lsnrctl start
...
The command completed successfully
[oracle@inst-scatalog ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-NOV-2019 03:36:29
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 22-NOV-2019 03:36:14
Uptime 0 days 0 hr. 0 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /opt/oracle/diag/tnslsnr/inst-scatalog/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=inst-scatalog.subnetshard.demovcn.oraclevcn.com)(PORT=1521)))
Services Summary...
Service "SCATALOG" has 1 instance(s).
Instance "SCATALOG", status READY, has 1 handler(s) for this service...
Service "SCATALOGXDB" has 1 instance(s).
Instance "SCATALOG", status READY, has 1 handler(s) for this service...
The command completed successfully
TNS 접속 정보 설정 및 연결을 확인합니다.
[oracle@inst-scatalog ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
...
SCATALOG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = inst-scatalog.subnetshard.demovcn.oraclevcn.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = SCATALOG)
)
)
...
[oracle@inst-scatalog ~]$ tnsping SCATALOG
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 22-NOV-2019 03:44:10
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = inst-scatalog.subnetshard.demovcn.oraclevcn.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = SCATALOG)))
OK (0 msec)
데이터베이스에 접속을 테스트합니다.
[oracle@inst-scatalog ~]$ sqlplus sys@SCATALOG as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 22 03:45:31 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
SCATALOG OPEN
<END>
다음 글로 이어집니다: