01. 필요한 패키지 설치
dnf -y install glibc-devel
dnf -y install ksh
dnf -y install libaio-devel
dnf -y install libstdc++-devel
dnf -y install make
dnf -y install nfs-utils
dnf -y install psmisc
dnf -y install sysstat
dnf -y install xorg-x11-utils
dnf -y install xorg-x11-xauth
dnf -y install libnsl*
curl -o compat-libcap1-1.10-7.el7.x86_64.rpm "http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm"
curl -o compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm "http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm"
dnf localinstall compat-libcap1-1.10-7.el7.x86_64.rpm -y
dnf localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm -y
02.사용자 및 그룹 추가
groupadd -g 1501 oinstall
groupadd -g 1502 dba
groupadd -g 1503 oper
groupadd -g 1504 backupdba
groupadd -g 1505 dgdba
groupadd -g 1506 kmdba
groupadd -g 1507 racdba
useradd -u 1501 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba -c "Oracle Database" oracle
echo 'Password' | passwd oracle --stdin
03.사용자 limit 값 추가
vi /etc/security/limits.d/30-oracle.conf
---------------------------------------
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
---------------------------------------
04.sysctl 추가
vi /etc/sysctl.d/98-oracle.conf
---------------------------------------
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
---------------------------------------
sysctl -p /etc/sysctl.d/98-oracle.conf
05.GRUB_CMDLINE_LINUX에 'transparent_hugepage=never' 추가
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
vi /etc/default/grub
---------------------------------------
GRUB_CMDLINE_LINUX="resume=UUID=7c106dd4-b200-410e-ad8c-3e9ed9d6e9af transparent_hugepage=never"
---------------------------------------
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
06. Oracle DB 다운로드
https://www.oracle.com/kr/database/technologies/oracle-database-software-downloads.html
19.3 - Enterprise Edition (also includes Standard Edition 2)
Linux x86-64 RPM 다운로드
07.설치 진행
wget --no-check-certificate "https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm"
dnf localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm -y
rpm -Uvh oracle-database-ee-19c-1.0-1.x86_64.rpm
/etc/init.d/oracledb_ORCLCDB-19c configure
09.권한설정 스크립트 실행 (root 권한으로 실행)
chown -R oracle:oinstall /opt/oracle
/opt/oracle/oraInventory/orainstRoot.sh
/opt/oracle/product/19c/dbhome_1/root.sh
10.oracle 계정에 환경 변수 추가
su - oracle
vi ~/.bash_profile
---------------------------------------
# for Oracle
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=db
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export ORA_INVENTORY=$ORACLE_BASE/oraInventory
export ORACLE_SID=ORCLCDB
export PDB_NAME=pdb1
export DATA_DIR=$ORACLE_BASE/oradata
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=KOREAN_KOREA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
---------------------------------------
source ~/.bash_profile
11.리스너 실행
lsnrctl start
12.테스트
su - oracle
sqlplus / as sysdba
-- 오라클 데이타베이스명을 확인
SELECT NAME, DB_UNIQUE_NAME FROM v$database;
-- 오라클 SID를 확인
SELECT instance FROM v$thread;
13.systemd 스크립트 등록
# 부팅시 dbstart 유틸리티를 사용하도록 설정(N→Y)
sed -i 's/:N$/:Y/g' /etc/oratab
vi /usr/lib/systemd/system/oracle_instance.service
---------------------------------------
[Unit]
Description=a service to start oracle databases automatically
After=syslog.target network.target
[Service]
Type=oneshot
RemainAfterExit=yes
Restart=no
Environment=ORACLE_BASE=/opt/oracle
Environment=ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
Environment=ORACLE_SID=ORCLCDB
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/dbstart ORACLE_HOME
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/dbshut ORACLE_HOME
User=oracle
Group=oinstall
[Install]
WantedBy=multi-user.target
---------------------------------------
vi /usr/lib/systemd/system/oracle_listener.service
---------------------------------------
[Unit]
Description=a service to start oracle listener automatically
After=syslog.target network.target
[Service]
Type=oneshot
RemainAfterExit=yes
Restart=no
Environment=ORACLE_BASE=/opt/oracle
Environment=ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
Environment=ORACLE_SID=ORCLCDB
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/lsnrctl stop
User=oracle
Group=oinstall
[Install]
WantedBy=multi-user.target
---------------------------------------
systemctl daemon-reload
systemctl enable oracle_listener.service
systemctl enable oracle_instance.service
systemctl restart oracle_listener.service
systemctl restart oracle_instance.service
14. initorcl.ora
su - oracle
cp -f /opt/oracle/product/19c/dbhome_1/dbs/init.ora /opt/oracle/product/19c/dbhome_1/dbs/initorcl.ora
vi /opt/oracle/product/19c/dbhome_1/dbs/initorcl.ora
---------------------------------------
db_name='ORCLCDB'
memory_target=1G
processes = 150
audit_file_dest='/opt/oracle/admin/ORCLCDB/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/opt/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/opt/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = ('/opt/oracle/oradata/ORCLCDB/control01.ctl', '/opt/oracle/oradata/ORCLCDB/control02.ctl')
compatible ='11.2.0'
---------------------------------------
mkdir /opt/oracle/fast_recovery_area
chown -R oracle:oinstall /opt/oracle/fast_recovery_area
15.alert 로그 확인
tail -n 100 /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/alert_ORCLCDB.log
16. 수동 시작 및 종료
sqlplus / as sysdba
-- 강제 종료
shutdown immediate
-- 시작
startup open