您好,登錄后才能下訂單哦!
#! /bin/bash
echo "#########oracle9R204 的一個(gè)簡(jiǎn)單的安裝腳本 ##############################"
#
# 為系統(tǒng)添加oracle的用戶和用戶組
#
groupadd dba
groupadd oinstall
useradd -c "Oracle software owner" -g oinstall -G dba oracle
passwd oracle
# 創(chuàng)建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++
#設(shè)置Oracle配置文件
echo "oracle soft nofile 65536" >> /etc/security/limits.conf
echo "oracle hard nofile 65536" >> /etc/security/limits.conf
#最大的進(jìn)程數(shù)量
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內(nèi)核參數(shù)定義單個(gè)共享內(nèi)存段的最大值,如果該參數(shù)設(shè)置小于Oracle SGA設(shè)置,
# 那么SGA就會(huì)被分配多個(gè)共享內(nèi)存段。這在繁忙的系統(tǒng)中可能成為性能負(fù)擔(dān),帶來(lái)系統(tǒng)問(wèn)題。
# 如果沒(méi)有修改shmmax參數(shù),Oracle在啟動(dòng)過(guò)程中就可能會(huì)報(bào)出以下錯(cuò)誤:
##############################################################################
# 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
##############################################################################
#這里我們?cè)O(shè)為 2G
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
#單個(gè)共享內(nèi)存段的最小值
echo "kernel.shmmni=4096" >> /etc/sysctl.conf
# kernel.sem中的四個(gè)值分別 是指
# 1:SEMMSL(每個(gè)用戶擁有信號(hào)量最大數(shù)量),
# 2:SEMMNS(系統(tǒng)信號(hào)量最大數(shù)量),
# 3:SEMOPM(每次semop系統(tǒng)調(diào)用操作數(shù)),
# 4:SEMMNI(系統(tǒng)信號(hào)量集最小數(shù)量)
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
#系統(tǒng)允許同時(shí)打開(kāi)的最大文件數(shù)為65536
echo "fs.file-max = 65536" >> /etc/sysctl.conf
# 本地主機(jī)在ipv4下可用端口范圍
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
# 使/etc/sysctl.conf 文件生效
/sbin/sysctl -p
#
#通過(guò)編輯 /home/oracle/.bash_profile文件來(lái)設(shè)置用戶環(huán)境變量
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補(bǔ)丁
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 "設(shè)置結(jié)束,你可以切換到oracle用戶,進(jìn)入oracle的解壓目錄運(yùn)行 oracle的 runinstaller"
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。