husonet | Tarih: 16.10.2017
Debian için Oracle 12c Kurulumu
Debian dağıtımları için Oracle 12c kurulumunun adım adım anlatımı.
Kurulum yapılan sunucu bilgileri.
İşletim sistemi: Debian Jessie
Database: Oracle 12c kurulumu
Gereksinimler
dpkg --add-architecture i386
apt-get update
apt-get install sudo rlwrap original-awk binutils libpcap-dev gcc g++ libc6 libc6-dev ksh libaio1 libstdc++-4.8-dev libXi6 libXtst6 make sysstat build-essential gcc-multilib lib32z1 lib32ncurses5 libstdc++5 rpm xauth
Kullanıcı ve Kullanıcı gruplarının oluşturulması
addgroup --system oinstall
addgroup --system dba
adduser --system --ingroup oinstall --shell /bin/bash oracle
adduser oracle dba
oinstall ve dba gruplarına kullanıcı ekleme
gpasswd -a $USER oinstall
gpasswd -a $USER dba
Sembolik linkler
mkdir -p /usr/lib64
ln -s /etc /etc/rc.d
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/basename /bin/basename
ln -s /usr/bin/rpm /bin/rpm
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib64/
ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
Dizinleri oluştur
mkdir -p /u01/app/oracle
mkdir -p /u01/oracle-install
Dizin yetkilendirmesi
chown -R oracle:dba /u01/app/
chown -R oracle:oinstall /u01/oracle-install
Oracle Kurulumu
su - oracle
cd /u01/oracle-install # oracle sitesinden indirilen kurulum dosyaları bu dizinde olmalı
# dosyalar acildiktan sonra,
cd database
./runInstaller -IgnoreSysPreReqs
İlk önce software kurulacak ve kurulum görsel olarak devam edecek resimler daha sonra eklenecek.
Kurulumumuza oracle kullanıcısıyla devam ediyoruz.
Database Oluşturma
su - oracle
cd /u01/app/oracle/product/12.2.0/dbhome_1/bin/
./dbca -silent -createDatabase -templateName /u01/app/oracle/product/12.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc -gdbname orclpdm -sid orcl -responseFile NO_VALUE -characterSet AL32UTF8 -emConfiguration LOCAL
tsnnames.ora oluşturulmasi
./netca
Sistem değişkenlerinin oluşturulması
su - oracle
profile
vim .profile
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
bashrc
vim .bashrc
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
export ORACLE_OWNER=oracle
export ORACLE_SID=orcl
export ORACLE_HOME_LISTNER=/u01/app/oracle/product/12.2.0/dbhome_1/network/admin
export TNS_ADMIN=/u01/app/oracle/product/12.2.0/dbhome_1/network/admin
export LD_LIBRARY_PATH=/u01/app/oracle/product/12.2.0/dbhome_1/lib
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
Oracle Servisi Oluşturma
dbora
su -
vim /etc/init.d/dbora
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
#export ORACLE_HOME_LISTNER=$ORACLE_HOME
export ORACLE_HOME_LISTNER=$ORACLE_HOME/network/admin
export ORACLE_OWNR=oracle
export ORACLE_OWNER=oracle
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_HOSTNAME=boran
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
#su $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
#su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_OWNER -c "/u01/app/oracle/scripts/startup.sh >> /u01/app/oracle/scripts/startup_shutdown.log 2>&1"
touch /var/lock/subsys/dbora
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORACLE_OWNER -c "/u01/app/oracle/scripts/shutdown.sh >> /u01/app/oracle/scripts/startup_shutdown.log 2>&1"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
#su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
#su $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f /var/lock/subsys/dbora
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
startup.sh
vim /u01/app/oracle/scripts/startup.sh
# Start Database
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF
shutdown.sh
vim /u01/app/oracle/scripts/shutdown.sh
# Stop Database
sqlplus / as sysdba << EOF
SHUTDOWN IMMEDIATE;
EXIT;
EOF