Pythontr

husonet | Tarih: 07.12.2012

Debian Oracle Server Kurulumu

# ilk paket guncelleme
aptitude update && aptitude full-upgrade

# gerekli paketler
aptitude install vim tmux unzip openssh-server shorewall

# ssh ayarları
vim /etc/ssh/sshd_config
Port 33022
PermitRootLogin no
AllowUsers boran
UseDNS no

# shorewall ayarları
cp /usr/share/doc/shorewall/examples/one-interface/interfaces /etc/shorewall/
cp /usr/share/doc/shorewall/examples/one-interface/policy /etc/shorewall/
cp /usr/share/doc/shorewall/examples/one-interface/zones /etc/shorewall/
cp /usr/share/doc/shorewall/examples/one-interface/rules /etc/shorewall/

vim /etc/shorewall/rules
#fw
ACCEPT fw net icmp
# net
ACCEPT net fw tcp 1521
ACCEPT net fw tcp 22
HTTP/ACCEPT net fw
Ping/ACCEPT net fw

vim /etc/default/shorewall
startup=1



# Kernel ayarları yapalim (Gerekli Ise Yapalım)
# 1.Yol
# Satirin en sonuna ekleyelim.
# 4 CPU core ve 32 GB RAM öngörülerek yapılmıştır.
vim /etc/sysctl.conf
kernel.sem = 250 32000 100 128
kernel.shmmax = 2147483648
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744


# Kernel 2 yol
vim /etc/sysctl.d/60-oracle.conf
# Oracle 11g XE kernel parameters
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912

# yeni kernel parametrelerini yükleyelim
sudo service procps start

# ORA-00845: MEMORY_TARGET Ayarlaması
su -

cat > /etc/init.d/oracle-shm <<-EOF
#! /bin/sh
# /etc/init.d/oracle-shm
#
#
case "\$1" in
start)
echo "Starting script /etc/init.d/oracle-shm"
# Run only once at system startup
if [ -e /dev/shm/.oracle-shm ]; then
echo "/dev/shm is already mounted, nothing to do"
else
mkdir /var/lock/subsys 2>/dev/null
touch /var/lock/subsys/listener
rm /dev/shm 2>/dev/null
mkdir /dev/shm 2>/dev/null
mount -t tmpfs shmfs -o size=16384m /dev/shm
touch /dev/shm/.oracle-shm
#rm -f /dev/shm
#mkdir /dev/shm
#mount -t tmpfs shmfs -o size=2048m /dev/shm
#touch /dev/shm/.oracle-shm
fi
;;
stop)
echo "Stopping script /etc/init.d/oracle-shm"
echo "Nothing to do"
;;
*)
echo "Usage: /etc/init.d/oracle-shm {start|stop}"
exit 1
;;
esac
#
### BEGIN INIT INFO
# Provides: oracle-shm
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Fix to allow Oracle 11g use AMM.
### END INIT INFO
EOF


# Servisin otomatik açılırken çalışması için
chmod 755 /etc/init.d/oracle-shm
update-rc.d oracle-shm defaults 01 99

reboot

cat /etc/mtab | grep shm

tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
shmfs /dev/shm tmpfs rw,size=16384m 0 0

# Oracle Kurulumu
aptitude install libaio1 alien fakeroot

mkdir /home/boran/download
cd /home/boran/download/
wget www.boranyazilim.com/download/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
cd Disk1
alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
rm oracle-xe-11.2.0-1.0.x86_64.rpm

ln -s /usr/bin/awk /bin/awk
mkdir /var/lock/subsys

cat > /sbin/chkconfig <<-EOF
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Debian based Linux (by dude)
# Only run once.
echo "Simulating /sbin/chkconfig..."
if [[ ! \`tail -n1 /etc/init.d/oracle-xe | grep INIT\` ]]; then
cat >> /etc/init.d/oracle-xe <<-EOM
#
### BEGIN INIT INFO
# Provides: OracleXE
# Required-Start: \$remote_fs \$syslog
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Oracle 11g Express Edition
### END INIT INFO
EOM
fi
update-rc.d oracle-xe defaults 80 01
EOF


chmod 755 /sbin/chkconfig

cd /home/boran/download/Disk1
dpkg --install ./oracle-xe_11.2.0-2_amd64.deb


# Ayarlar
/etc/init.d/oracle-xe configure

# Oracle kullanicisina password olusturalim
passwd oracle

su - oracle

cp /etc/skel/.bash_logout ./
cp /etc/skel/.bashrc ./
cp /etc/skel/.profile ./
echo "" >>./.profile
echo '. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >>./.profile

vim .bashrc
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export PATH=$ORACLE_HOME/bin:$PATH


https://forums.oracle.com/forums/thread.jspa?threadID=2301639
http://sysadminnotebook.blogspot.com/2012/10/installing-oracle-11g-r2-express.html