Oracle 12C setup

GCP 환경에서 오라클(Oracle)DB 12C 구축하기

오라클DB 설치전 OS 환경 셋업

-- XWindows GUI 패키지

yum -y groups install GNOME Desktop

yum install -y xorg-x11-apps

yum install xterm

-- 계정정보 설정

root / [id] [pw] / [pw]

yum install -y unzip

-- ssh 외부접속 사용 설정

vi /etc/ssh/sshd_config

PermitRootLogin yes PasswordAuthentication yes

-- OS 정보 [root]instance-1:/root># uname -a

Linux instance-1 3.10.0-1160.25.1.el7.x86_64 #1 SMP Wed Apr 28 21:49:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

-- oracle 계정생성

groupadd dba

useradd -d dba oracle

passwd oracle

-- oracle directory 설정

mkdir /u01 -- ORACLE_BASE

mkdir /u01/media -- Oracle 설치파일

mkdir /oradata

mkdir /oradata/system -- system datafile PATH

mkdir /oradata/redo -- redo log PATH

mkdir /oradata/data -- datafile PATH

-- 소유권 변환

chown -R oracle:dba /u01

chown -R oracle:dba /oradata

-- oracle 설치파일 전송

/u01/media cd /u01/media unzip V839960-01.zip

-- Oracle 설치

Xmanager Xstart로 진행

$ cd /u01/media/database $ ./runInstaller y

설치중 필요 패키지 설치

yum install compat-libcap1-1.10

yum install libstdc++-devel yum install sysstat-10.1.5

yum install gcc-c++ yum install ksh

yum install libaio-devel

yum install smartmontools

필요한 패키지 설치 및 FiX & check script 실행

[root]gcpora12c:/root># /tmp/CVU_12.2.0.1.0_oracle/runfixup.sh

All Fix-up operations were completed successfully.

[root]gcpora12c:/root># uname -a

Linux gcpora12c 3.10.0-1160.25.1.el7.x86_64 #1 SMP Wed Apr 28 21:49:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

[root]gcpora12c:/root># ulimit -s 8192

[root]gcpora12c:/root># vi /etc/security/limits.conf

[root]gcpora12c:/root># sysctl -p

[root]gcpora12c:/root># ulimit -s

8192

[root]gcpora12c:/root># ulimit -s 10240

[root]gcpora12c:/root># ulimit -s

10240

[root]gcpora12c:/root># sysctl -p

[root]gcpora12c:/root># ulimit -s 10240

Oracle 설치 확

[root]gcpora12c:/root># su - oracle

Last login: Wed May 19 02:47:52 UTC 2021 from 125.133.174.101 on pts/0 [oracle]gcpora12c:/home/oracle>$ sqlplus " / as sysdba"

SQL*Plus: Release 12.2.0.1.0 Production on Wed May 19 03:23:42 2021

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to an idle instance.

SQL>

XStart 화면에서

dbca

네트 워크 설정

TNS설정

ifconfig -> 내부 IP 지정

listner , tns 설정

[oracle]gcpora12c:/oradata>$ ps -ef | grep tns

root 29 2 0 01:44 ? 00:00:00 [netns] oracle 16746 1 0 03:59 ? 00:00:00 /u01/product/12.2.0/bin/tnslsnr LISTENER -inherit oracle 17018 12510 0 04:03 pts/0 00:00:00 grep --color=auto tns

[oracle]gcpora12c:/oradata>$ lsnrctl status listener

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-MAY-2021 04:03:10

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521)))

STATUS of the LISTENER

Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 19-MAY-2021 03:59:46 Uptime 0 days 0 hr. 3 min. 23 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/product/12.2.0/network/admin/listener.ora Listener Log File /u01/diag/tnslsnr/gcpora12c/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "ENCORESY" has 1 instance(s). Instance "ENCORESY", status READY, has 1 handler(s) for this service... Service "ENCORESYXDB" has 1 instance(s). Instance "ENCORESY", status READY, has 1 handler(s) for this service... The command completed

successfully [oracle]gcpora12c:/oradata>$ cd $ORACLE_HOME [oracle]gcpora12c:/u01/product/12.2.0>$ cd network [oracle]gcpora12c:/u01/product/12.2.0/network>$ cd admin [oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ ls -l

total 16 -rw-r--r--. 1 oracle dba 368 May 19 03:59 listener.ora drwxr-xr-x. 2 oracle dba 64

May 19 03:19 samples -rw-r--r--. 1 oracle dba 1441 Aug 28 2015 shrept.lst -rw-r--r--. 1 oracle dba 175 May 19 04:00 sqlnet.ora -rw-r--r--. 1 oracle dba 318 May 19 04:02 tnsnames.ora [oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ vi listener.ora

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ [oracle]gcpora12c:/u01/product/12.2.0/network/admin>$

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ lsnrctl stop listener

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-MAY-2021 04:03:33

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521))) The command completed successfully [oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ [oracle]gcpora12c:/u01/product/12.2.0/network/admin>$

tns 상태 확

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ ps -ef | grep tns root 29 2 0 01:44 ? 00:00:00 [netns] oracle 17052 12510 0 04:03 pts/0 00:00:00 grep --color=auto tns

listner 를 open시킨다.

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ lsnrctl start listener

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-MAY-2021 04:03:42

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Starting /u01/product/12.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production System parameter file is /u01/product/12.2.0/network/admin/listener.ora Log messages written to /u01/diag/tnslsnr/gcpora12c/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521)))

Alias listener Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 19-MAY-2021 04:03:42 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/product/12.2.0/network/admin/listener.ora Listener Log File /u01/diag/tnslsnr/gcpora12c/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gcpora12c.asia-northeast3-a.c.sixth-emissary-289210.internal)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully

tnsnames.ora 의 내 내부 IP를 확인한다.

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ cat tnsnames.ora

tnsnames.ora Network Configuration File: /u01/product/12.2.0/network/admin/tnsnames.ora

Generated by Oracle configuration tools.

ENCORESY = (DESCRIPTION = (ADDRESSLIST = (ADDRESS = (PROTOCOL = TCP)(HOST =GCPIP)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ENCORESY) ) )

tnsping이 아래와 같이 성공한다면 이제 접속이 가능하다.

[oracle]gcpora12c:/u01/product/12.2.0/network/admin>$ tnsping encoresy

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 19-MAY-2021 04:03:54

Copyright (c) 1997, 2016, Oracle. All rights reserved.

Used parameter files: /u01/product/12.2.0/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.178.0.9)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ENCORESY))) OK (0 msec)

Last updated