您好,登錄后才能下訂單哦!
#! /bin/bash
echo "#########oracle9R204 的一個簡單的安裝腳本 ##############################"
#
# 為系統添加oracle的用戶和用戶組
#
groupadd dba
groupadd oinstall
useradd -c "Oracle software owner" -g oinstall -G dba oracle
passwd oracle
# 創建oracle 的安裝目錄
mkdir /oracle/oracle
mkdir /oracle/oracle/product
mkdir /oracle/oracle/product/9.2.0
chown -R oracle.oinstall /oracle/oracle
mkdir /var/opt/oracle
chown oracle.dba /var/opt/oracle
chmod 755 /var/opt/oracle
#更改gcc,g++版本
cd /usr/bin
mv gcc gcc323
mv g++ g++323
ln -s gcc296 gcc
ln -s g++296 g++
#設置Oracle配置文件
echo "oracle soft nofile 65536" >> /etc/security/limits.conf
echo "oracle hard nofile 65536" >> /etc/security/limits.conf
#最大的進程數量
echo "oracle soft nproc 16384" >> /etc/security/limits.conf
echo "oracle hard nproc 16384" >> /etc/security/limits.conf
#修改配置/etc/sysctl.conf
echo "#################################################### " >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
# shmmax內核參數定義單個共享內存段的最大值,如果該參數設置小于Oracle SGA設置,
# 那么SGA就會被分配多個共享內存段。這在繁忙的系統中可能成為性能負擔,帶來系統問題。
# 如果沒有修改shmmax參數,Oracle在啟動過程中就可能會報出以下錯誤:
##############################################################################
# Starting ORACLE instance (normal)
# Thu Nov 17 09:27:29 2005
# WARNING: EINVAL creating segment of size 0x0000000033400000
# fix shm parameters in /etc/system or equivalent
##############################################################################
#這里我們設為 2G
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
#單個共享內存段的最小值
echo "kernel.shmmni=4096" >> /etc/sysctl.conf
# kernel.sem中的四個值分別 是指
# 1:SEMMSL(每個用戶擁有信號量最大數量),
# 2:SEMMNS(系統信號量最大數量),
# 3:SEMOPM(每次semop系統調用操作數),
# 4:SEMMNI(系統信號量集最小數量)
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
#系統允許同時打開的最大文件數為65536
echo "fs.file-max = 65536" >> /etc/sysctl.conf
# 本地主機在ipv4下可用端口范圍
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
# 使/etc/sysctl.conf 文件生效
/sbin/sysctl -p
#
#通過編輯 /home/oracle/.bash_profile文件來設置用戶環境變量
echo "############ everoment for oracle################" >> /home/oracle/.bash_profile
echo "export LD_ASSUME_KERNEL=2.4.1" >> /home/oracle/.bash_profile
echo "export THREADS_FLAG=native" >> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/oracle/oracle" >> /home/oracle/.bash_profile
echo "export ORACLE_HOME=/oracle/oracle/product/9.2.0" >> /home/oracle/.bash_profile
echo "export ORACLE_SID=orcl" >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >> /home/oracle/.bash_profile
echo "export ORACLE_OWNER=oracle" >> /home/oracle/.bash_profile
echo "export NLS_LANG=AMERICAN;" >> /home/oracle/.bash_profile
echo 'export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data' >> /home/oracle/.bash_profile
echo 'LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib' >> /home/oracle/.bash_profile
echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >> /home/oracle/.bash_profile
echo "export LD_LIBRARY_PATH" >> /home/oracle/.bash_profile
echo 'export PATH=$PATH:$ORACLE_HOME/bin' >> /home/oracle/.bash_profile
#打安裝前所需的p3006854補丁
USER=`whoami`
if [ $USER != root ]; then
echo "Must be root to run this script, please login as root and re-try"
exit
fi
# see if libcwait.so is already being loaded
if [ -f "/etc/ld.so.preload" ] && [ -n "`grep libcwait /etc/ld.so.preload`" ]; then
echo "Patch has already been applied"
exit
else
echo "Applying patch..."
fi
cat << EOF |
#include <errno.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
pid_t
__libc_wait (int *status)
{
int res;
asm volatile ("pushl %%ebx\n\t"
"movl %2, %%ebx\n\t"
"movl %1, %%eax\n\t"
"int \$0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0), "S" (0));
return res;
}
EOF
gcc -O2 -shared -fpic -xc - -o /etc/libcwait.so
echo "/etc/libcwait.so" >>/etc/ld.so.preload
echo "Patch successfully applied"
echo "####################################################################"
echo "設置結束,你可以切換到oracle用戶,進入oracle的解壓目錄運行 oracle的 runinstaller"
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。