SWAP=/mnt/sda1/tmp/swap
MEM=1G
####################################
# load util
st2 glib2 make gcc libaio binutils net-tools
st2 bash sed
st2 bzip2-lib
sudo ln -s /usr/local/lib/libbz2.so /usr/local/lib/libbz2.so.1
sudo ln -s /usr/bin/awk /bin
####################################
# add lib path
sudo ln -s /lib /lib64
#sudo ln -s /usr/local/lib /usr/local/lib64
#sudo ln -s /usr/lib /usr/lib64
#sudo ln -s /var/lib /var/lib64
#echo /u01/app/oracle/product/11.2.0/xe/lib | sudo tee -a /etc/ld.so.conf
#sudo ldconfig
####################################
# Create User oracle:dba
sudo addgroup dba
sudo adduser -D oracle -G dba
sudo passwd -d oracle
echo "
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib:\$ORACLE_HOME/lib
export LD_LIBRARY_PATH
PATH=\$PATH:/usr/local/bin
export PATH
. $ORACLE_HOME/bin/oracle_env.sh
" | sudo tee -a /home/oracle/.ashrc
####################################
# install RPM
sudo rpm -i Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm
####################################
# Create Folder ??
sudo mkdir -p /var/lock/subsys
#sudo mkdir -p /u01/app/oracle/oradata
#sudo mkdir -p /u01/app/oracle/diag
sudo mkdir -p /u01/app/oracle/product/11.2.0/xe/config/log
sudo mkdir -p /u01/app/oracle/product/11.2.0/xe/config/seeddb
####################################
# fix script executable
sudo chmod a+x /u01/app/oracle/product/11.2.0/xe/config/scripts/*.sh
sudo chmod a+x /etc/init.d/oracle-xe
sudo ln -s /u01/app/oracle/product/11.2.0/xe/lib/libagtsh.so.1.0 /u01/app/oracle/product/11.2.0/xe/lib/libagtsh.so
####################################
# change owner to oracle:dba
sudo chown -R oracle:dba /u01
####################################
# set memory
sudo sed -i -e "s/%memory_target%/${MEM}/" /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
sudo sed -i -e "s/%memory_target%/${MEM}/" /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora
####################################
# set swap
#mkswap $SWAP
sudo swapon $SWAP
####################################
# change kernel setting
echo "250 32000 100 128" | sudo tee /proc/sys/kernel/sem
echo "4294967295" |sudo tee /proc/sys/kernel/shmmax
echo "4096" | sudo tee /proc/sys/kernel/shmmni
echo "2097152" | sudo tee /proc/sys/kernel/shmall
echo "6815744" | sudo tee /proc/sys/fs/file-max
echo "9000 65500" | sudo tee /proc/sys/net/ipv4/ip_local_port_range
cat /proc/sys/kernel/sem \
/proc/sys/kernel/shmmax \
/proc/sys/kernel/shmmni \
/proc/sys/kernel/shmall \
/proc/sys/fs/file-max \
/proc/sys/net/ipv4/ip_local_port_range
####################################
# configure oracle
sudo /etc/init.d/oracle-xe status
sudo /etc/init.d/oracle-xe configure
sudo /etc/init.d/oracle-xe status
# sudo /etc/init.d/oracle-xe start
####################################
# login
# sqlplus system
####################################
# set for remote login
# SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);