Uputstvo za instalaciju Oracle 12c softvera (u ovom primeru 12.2.0.1), bez baze – nju ćemo u nekom drugom uputstvu kasnije preko dbca. Iako ne deluje tako – ovo je uprošćeno uputstvo. Instalaciju radimo na CentOS 7 Minimal Linux mašini pa sam dodao i deo za instalaciju samog GUI-a a sem same instalacije Oracle softvera uradićemo još neka sitna podešavanja poput podešavanja firewalla, proširenja swap prostora i slično.

# Treba nam GUI za instalaciju, pa cemo da ga instaliramo
yum update -y # Update svega
yum groupinstall "X Window System" -y
yum install gnome-classic-session gnome-terminal control-center liberation-mono-fonts bc vim unzip -y
 
# Gasi selinux (Oracle preporuka)
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux

# Proverite da li ste postavili hostname i ako niste - postavite. 
# U ovom slucaju komanda ce nam dati: centos7.draza
cat /etc/hostname
 
# Dodajte ip adresu hostu. U ovom slucaju koristimo IP - 192.168.56.201 ali cemo ga uspricati pomocu hostname
echo "$(ip addr | grep "state UP\|venet" -A2 | grep 'inet ' | tail -n1 | awk '{print $2}' | cut -f1 -d'/') $(hostname) $(hostname -s)" >> /etc/hosts
# Proverite obavezno. Ako imate vise IP adresa, obrisite onu koja nije primarna
cat /etc/hosts # Provera
 
# Pravljenje Oracle korisnika
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle -c "Oracle Korisnik"
passwd oracle # Postaviti neku zajebanu lozinku
 
# Skinuti sa http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html 
# i prekopirati na /home/oracle
mv linuxx64_12201_database.zip /home/oracle/
cd /home/oracle/
unzip linuxx64_12201_database.zip
rm -f linuxx64_12201_database.zip
chown -R oracle:oinstall database
 
# Dodati kernel parametre preporučene od strane Oraclea
cp /etc/sysctl.conf ~/sysctl.conf_`date +%Y%m%d`_BEKAP
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.panic_on_oops = 1" >> /etc/sysctl.conf #Orabug 19212317
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048576" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter = 2" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter = 2" >> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
# Neke poje peporuke ali vi promenite kako mislite da treba
TOTAL_RAM=$(echo $(( `awk '/MemTotal/ {print $2}' /proc/meminfo` * 1024 )))
SHMMAX=`printf %.0f $(echo "$TOTAL_RAM * 0.8" | bc -l)` ; echo "kernel.shmmax = $SHMMAX"
SHMALL=`printf %.0f $(echo "$SHMMAX / $(getconf PAGE_SIZE)" | bc -l)` ; echo "kernel.shmall = $SHMALL"
echo "For DB use: "`printf %.0f $(echo "($SHMMAX * 0.8) / (1024*1024)" | bc -l)`" MB" # 80% SHMMAX-a
echo "kernel.shmmax = ${SHMMAX}" >> /etc/sysctl.conf #80% RAM-a za x64
echo "kernel.shmall = ${SHMALL}" >> /etc/sysctl.conf  #SHMAX/4096
sysctl -p
sysctl -a
 
# Limiti za Oracle korisnika, preporuceni od strane Oraclea
cp /etc/security/limits.conf ~/limits.conf_`date +%Y%m%d`_BEKAP
echo "oracle soft nproc 2047" >> /etc/security/limits.conf
echo "oracle hard nproc 16384" >> /etc/security/limits.conf
echo "oracle soft nofile 1024" >> /etc/security/limits.conf
echo "oracle hard nofile 65536" >> /etc/security/limits.conf
echo "oracle soft stack 10240" >> /etc/security/limits.conf
echo "oracle hard stack 32768" >> /etc/security/limits.conf
 
################  VARIJABLE ######################
####### Ovde postavite svoje vrednosti  ##########
SID_BAZE="TESTBAZA"
DB_CHARACTERSET="AMERICAN_AMERICA.AL32UTF8" 
LOKACIJA_ZA_ORACLE_INSTALL="/home/app/oracle" 
ORACLE_UNQNAME="test"
ORACLE_VERZIJA="12.1.0"
##################################################
cp /home/oracle/.bash_profile ~/oracle_bash_profile_`date +%Y%m%d`_BEKAP #Bekap pre svega
ORACLE_BASE=${LOKACIJA_ZA_ORACLE_INSTALL}
ORACLE_HOME=$ORACLE_BASE/product/${ORACLE_VERZIJA}/dbhome_1
mkdir -p ${LOKACIJA_ZA_ORACLE_INSTALL}
mkdir -p `dirname ${LOKACIJA_ZA_ORACLE_INSTALL}`/oraInventory
chown -R oracle:oinstall ${LOKACIJA_ZA_ORACLE_INSTALL}
if [ `dirname "$LOKACIJA_ZA_ORACLE_INSTALL"` != "/" ] ; then chown -R oracle:oinstall `dirname "$LOKACIJA_ZA_ORACLE_INSTALL"` ; fi
chown -R oracle:oinstall `dirname ${LOKACIJA_ZA_ORACLE_INSTALL}`/oraInventory
echo "#--- Oracle varijable ---# " >> /home/oracle/.bash_profile
echo "TMP=/tmp; export TMP" >> /home/oracle/.bash_profile
echo "TMPDIR=\$TMP; export TMPDIR" >> /home/oracle/.bash_profile
echo "ORACLE_HOSTNAME=`hostname`; export ORACLE_HOSTNAME" >> /home/oracle/.bash_profile 
echo "ORACLE_UNQNAME=${ORACLE_UNQNAME}; export ORACLE_UNQNAME" >> /home/oracle/.bash_profile 
echo "ORACLE_BASE=${LOKACIJA_ZA_ORACLE_INSTALL}; export ORACLE_BASE" >> /home/oracle/.bash_profile
echo "ORACLE_HOME=\${ORACLE_BASE}/product/${ORACLE_VERZIJA}/dbhome_1; export ORACLE_HOME" >> /home/oracle/.bash_profile
echo "ORACLE_SID=${SID_BAZE}; export ORACLE_SID" >> /home/oracle/.bash_profile
echo "ORACLE_TERM=xterm; export ORACLE_TERM" >> /home/oracle/.bash_profile
echo "PATH=\${ORACLE_HOME}/bin:\$PATH; export PATH" >> /home/oracle/.bash_profile
echo "LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH" >> /home/oracle/.bash_profile
echo "CLASSPATH=\${ORACLE_HOME}/jlib:\${ORACLE_HOME}/rdbms/jlib; export CLASSPATH" >> /home/oracle/.bash_profile
echo "NLS_LANG=${DB_CHARACTERSET}; export NLS_LANG" >> /home/oracle/.bash_profile
 
# Zamena firewalld sa iptables - lakše je za rad (tačnije, da se ne lažemo - navika)
# Ako instalirate samo za test, mozete i ugasiti firewall (prve 3 linije samo okinite)
systemctl stop firewalld
systemctl disable firewalld
yum -y install iptables-services
systemctl start iptables
systemctl start ip6tables
systemctl enable iptables
systemctl enable ip6tables
 
# Osnovna postavka iptables sa otvorenim ssh, VNC i Oracle portom. Sve ostalo (za sad) close
ORACLE_PORT=1521
SSH_PORT=22
VNC_PORT=5901
echo "#"'!'"/bin/sh" >> /root/FIREWALL.sh
echo "service iptables stop" >> /root/FIREWALL.sh
echo "iptables -F" >> /root/FIREWALL.sh
echo "iptables -X" >> /root/FIREWALL.sh
echo "service iptables save" >> /root/FIREWALL.sh
echo "iptables -A INPUT -p tcp --dport ${ORACLE_PORT} -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A INPUT -p tcp --dport ${SSH_PORT} -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A INPUT -p tcp --dport ${VNC_PORT} -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A INPUT -s 127.0.0.1 -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A INPUT -i lo -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A OUTPUT -o lo -j ACCEPT" >> /root/FIREWALL.sh
echo "iptables -A INPUT -j DROP" >> /root/FIREWALL.sh
echo "service iptables save" >> /root/FIREWALL.sh
echo "service iptables restart" >> /root/FIREWALL.sh
echo "exit 0" >> /root/FIREWALL.sh
chmod +x /root/FIREWALL.sh
/root/FIREWALL.sh
 
 
############ Provera SWAP prostora #############
# RAM: Izmedju 1024-2048 MB  ---> SWAP: RAM x 2
# RAM: Izmedju 2049-16384 MB ---> SWAP: RAM x 1
# RAM: 16385 i više MB       ---> SWAP: 16GB
################################################
 
# Provera
echo "RAM: "$(( `awk '/MemTotal/ {print $2}' /proc/meminfo` / 1024 ))"MB | ""SWAP: "$(( `awk '/SwapTotal/ {print $2}' /proc/meminfo` / 1024 ))" MB"
 
# Ako treba na osnovu prethodnog pregleda dodati još swap prostora
SWAP_U_GB=1 # POSTAVI SVOJU VREDNOST
SWAP_FAJL="/mnt/SWAP/swapfile01.img"
mkdir -p `dirname ${SWAP_FAJL}`
df -h `dirname ${SWAP_FAJL}`
[ -f ${SWAP_FAJL} ] && echo "Fajl postoji, MENJAJ NAZIV u prvom koraku" || echo "Sve OK, nastavi"
dd if=/dev/zero of=${SWAP_FAJL} bs=1024 count=${SWAP_U_GB}M
chmod 0600 ${SWAP_FAJL}
mkswap ${SWAP_FAJL}
cp /etc/fstab ~/`date +%Y%m%d`_bekap_fstab #Bekap
echo "${SWAP_FAJL}  swap  swap  sw  0  0" >> /etc/fstab 
mount -a #Prijavljuje li kakvu gresku
swapon ${SWAP_FAJL}
grep Swap /proc/meminfo

# Ako instalaciju radite na RedHat-u 7, morate aktivirati dodatni repo jer u standardnom 
# nedostaje compat-libstdc++-33. Okinite (po https://access.redhat.com/solutions/300513):
# subscription-manager repos --enable=rhel-7-server-optional-rpms
 
# Instalacija potrebnih paketa
yum install binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 libaio-devel smartmontools net-tools
 
# Neki dodatni paketi preporučeni od strane oracle-rdbms-server-12cR1-preinstall ua Oracle Linuxu
yum install bind-libs bind-utils gssproxy keyutils libbasicobjects libcollection libevent libini_config libnfsidmap libpath_utils libref_array libtirpc libverto-tevent nfs-utils quota quota-nls rpcbind tcp_wrappers
 
# Reboot, da povuče sve
reboot
 
# Logovanje putem TightVNC-a. Ako nemate instalirajte odavde: http://www.tightvnc.com/download.php
yum install tigervnc-server -y
su - oracle
vncserver
# Konektujte se putem TightVNC-a na IP_ADRESA:1. 
# GUI će vam trebati i za instalaciju baze podataka (sad instaliramo samo softver)
# Posle instalacije i pravljenja baze ugasite VNC server komandom: vncserver -kill :1
 
 
# Pokrenite instalaciju i ispratite korake prilikom instalacije 
cd database
./runInstaller
# Ako je potrebno povecati TMPFS, zbog greske prilikom kreiranja baze:
# ORA-00845: MEMORY_TARGET not supported on this system
# Obično stavljam dodeljenu oracle memoriju (SGA+PGA)*2
VELICINA_TMPFS_U_GB=10
echo "tmpfs     /dev/shm     tmpfs     size=${VELICINA_TMPFS_U_GB}g     0 0" >> /etc/fstab
mount -o remount tmpfs
df -h | grep '/dev/shm'

Ako vam audit nad bazom nije bitan (može da dovede na nekim verzijama SYSAUX tablespace na ogromne vrednosti) tj ako se nećete njime baviti, posle instalacije baze (dbca) ugasite ga sa:

sqlplus / as sysdba
noaudit policy ORA_SECURECONFIG;