吳大:天哪!我為了學怎樣做oracle的DBA,己經安裝oracle十幾次了。
吳大:每次裝好丢入資料,只要覺得資料庫好像有問題,我就要重裝,
老是重複key那些環境參數,煩死了!
吳大的同事:啊你不是在學怎麼寫linux的shell script嗎?就拿這個當題目,寫個script吧!
吳大:對哦!我怎麼没想到!唉呀,真是聽君一席話,勝讀十年書哪。
於是,有了以下這個檔案。
有興趣的朋友,試用看看吧!
如果對大夥有幫助的話,也算是功德一件,對吧!阿彌陀佛。
還有,要是有人覺得該怎麼改比較好,有不錯的建議,請mail給我!
mailto:bullock0425@gmail.com
對了!忘了說明一件事,我是用在CentOS4上,我用在RHEL3或RHEL4也行。
只要是用rpm的linux distribution,應該都適用吧!我想。
save as "preinstalloracle.sh"
+--------------------------------------------------------------------------------------------------------------------------------+
#!/bin/bash
# Before your installation for oracle 10g database
# make sure your OS has the packages suport to install oracle 10g database
# This script file is created by Wu KuoHoung. 2007/10/27
datevalue=`date +"%Y/%m/%d %H:%M:%S"`
echo "# oracle 10 database setting ... $datevalue"
echo -e "Check the packages:\n"
rpm -qa binutils compat-* control-center gcc* glibc* gnome-libs libstdc* make pdksh sysstat xscreensaver setarch libaio
echo ""
read -p "Use 'yum install -y packages'?(y/N): " yN
if [ "$yN" == "y" ] || [ "$yN" == "Y" ]; then
echo "OK, Continue ..."
yum install -y binutils compat-* control-center gcc* glibc* gnome-libs libstdc* make pdksh sysstat xscreensaver setarch libaio
elif [ "$yN" == "N" ] || [ "$yN" == "n" ]; then
echo "Oh, interrupt!"
exit 11
else
echo "I don't know what is your choise, byebye."
exit 22
fi
# /etc/sysctl.conf
echo -e 'Setting the sysctl.conf (kernel parameters) ...'
echo '# oracle 10 database setting ... $datevalue' >> /etc/sysctl.conf
echo 'kernel.shmall = 2097152' >> /etc/sysctl.conf
echo 'kernel.shmmax = 2147483648' >> /etc/sysctl.conf
echo 'kernel.shmmni = 4096' >> /etc/sysctl.conf
echo 'kernel.sem = 250 32000 100 128' >> /etc/sysctl.conf
echo 'fs.file-max = 65536' >> /etc/sysctl.conf
echo 'net.ipv4.ip_local_port_range = 1024 65000' >> /etc/sysctl.conf
echo 'net.core.rmem_default = 262144' >> /etc/sysctl.conf
echo 'net.core.rmem_max = 262144' >> /etc/sysctl.conf
echo 'net.core.wmem_default = 262144' >> /etc/sysctl.conf
echo 'net.core.wmem_max = 262144' >> /etc/sysctl.conf
echo '' >> /etc/sysctl.conf
echo -e 'Run the lastestly kernel parameters: \n/sbin/sysctl -p'
read -p 'Do you want to do it right now? (y/N) ' Yn
if [ "$Yn" == "y" ] || [ "$Yn" == "Y" ]; then
echo "OK, Let's do it!!"
/sbin/sysctl -p
read -p "Continue ...(y/N): " yN
if [ "$yN" == "y" ] || [ "$yN" == "Y" ]; then
echo "OK, Continue ..."
elif [ "$yN" == "N" ] || [ "$yN" == "n" ]; then
echo "Oh, interrupt!"
exit 11
else
echo "I don't know what is your choise, byebye."
exit 22
fi
elif [ "$Yn" == "N" ] || [ "$Yn" == "n" ]; then
echo "Oh, interrupt!"
exit 33
else
echo "I don't know what is your choise, byebye."
exit 44
fi
echo ""
# /etc/security/limits.conf
echo -e 'Writting the setting to /etc/security/limits.conf ...'
echo '# oracle 10 database setting ... $datevalue' >> /etc/security/limits.conf
echo '* soft nproc 2047' >> /etc/security/limits.conf
echo '* hard nproc 16384' >> /etc/security/limits.conf
echo '* soft nofile 1024' >> /etc/security/limits.conf
echo '* hard nofile 65536' >> /etc/security/limits.conf
echo '' >> /etc/security/limits.conf
tail -n 6 /etc/security/limits.conf
# /etc/pam.d/login
echo -e 'Writting the setting to /etc/pam.d/login.conf ...'
echo '# oracle 10 database setting ... $datevalue' >> /etc/pam.d/login
echo 'session required /lib/security/pam_limits.so' >> /etc/pam.d/login
echo '' >> /etc/pam.d/login
tail -n 3 /etc/pam.d/login
# /etc/pam.d/su
echo -e 'Writting the setting to /etc/pam.d/su ...'
echo '# oracle 10 database setting ... $datevalue' >> /etc/pam.d/su
echo 'session required /lib/security/pam_limits.so' >> /etc/pam.d/su
echo '' >> /etc/pam.d/su
tail -n 3 /etc/pam.d/su
# /etc/profile
echo -e "Writting the setting to /etc/profile ..."
echo "# oracle 10 database setting ... $datevalue" >> /etc/profile
echo 'if [ $USER = "oracle" ]; then' >> /etc/profile
echo ' if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo ' ulimit -p 16384' >> /etc/profile
echo ' ulimit -n 65536' >> /etc/profile
echo ' else' >> /etc/profile
echo ' ulimit -u 16384 -n 65536' >> /etc/profile
echo ' fi' >> /etc/profile
echo 'fi' >> /etc/profile
echo "" >> /etc/profile
tail -n 10 /etc/profile
echo -e "Create user, groups and directories for oracle 10g database!!"
# echo -e "You can use another termnital to do that with root privilege !"
echo -e "# groupadd oinstall"
groupadd oinstall
echo -e "# groupadd dba"
groupadd dba
echo -e "# useradd -g oinstall -G dba -m oracle"
useradd -g oinstall -G dba -m oracle
echo -e "# mkdir -p /opt/u01/app/oracle/product/10.2.0/db_1"
mkdir -p /opt/u01/app/oracle/product/10.2.0/db_1
echo -e "# chown -R oracle.oinstall /opt/u01"
chown -R oracle.oinstall /opt/u01
echo -e "# chmod -R 755 /opt/u01"
chmod -R 755 /opt/u01
echo -e "# mkdir -p /opt/u02/oradata"
mkdir -p /opt/u02/oradata
echo -e "# chown -R oracle.dba /opt/u02"
chown -R oracle.dba /opt/u02
echo -e "# chmod -R 755 /opt/u02"
chmod -R 755 /opt/u02
echo ""
echo -e "Remember to set the password of oracle!!OK!!\nUse command 'passwd oracle'"
sleep 5
echo -e "Writting the setting to /home/oracle/.bash_profile ..."
echo "# oracle 10 database setting ... $datevalue" >> /home/oracle/.bash_profile
echo 'umask 022' >> /home/oracle/.bash_profile
echo 'TMP=/tmp; export TMP' >> /home/oracle/.bash_profile
echo 'TMPDIR=$TMP; export TMPDIR' >> /home/oracle/.bash_profile
echo 'ORACLE_BASE=/opt/u01/app/oracle; export ORACLE_BASE' >> /home/oracle/.bash_profile
echo 'ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME' >> /home/oracle/.bash_profile
echo 'ORACLE_SID=MISLAB; export ORACLE_SID' >> /home/oracle/.bash_profile
echo 'ORACLE_TERM=xterm; export ORACLE_TERM' >> /home/oracle/.bash_profile
echo 'PATH=/usr/local/bin:/usr/sbin:~/bin:$PATH; export PATH' >> /home/oracle/.bash_profile
echo 'PATH=$ORACLE_HOME/bin:$PATH; export PATH' >> /home/oracle/.bash_profile
echo 'LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH' >> /home/oracle/.bash_profile
echo 'CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH' >> /home/oracle/.bash_profile
echo '' >> /home/oracle/.bash_profile
tail -n 13 /home/oracle/.bash_profile
# echo redhat-4 > /etc/redhat-release
echo -e "Writting the setting to /etc/redhat-release ..."
mv /etc/redhat-release /etc/redhat-release.default
echo redhat-4 > /etc/redhat-release
cat /etc/redhat-release
echo -e "DONE..."
echo -e "**Do not forget to set the password of oracle**\nUse command 'passwd oracle'"
echo -e "Ready to install oracle 10g database!!"
2007年10月27日 星期六
訂閱:
張貼留言 (Atom)
搜尋此網誌
本站大事記
這個部落格(網站)內容以分享LINUX和延伸出的技術文章為主!
特別是為了工作和進修需要,搜集了不少網站連結。
希望對來這裡觀文的朋友們,有提供一些有用的資訊或文章。
但這裡的文章中,也包含個人的心情扎記和隨興言談……
若是當中沒有對上你的口味,請多包涵!
特別是為了工作和進修需要,搜集了不少網站連結。
希望對來這裡觀文的朋友們,有提供一些有用的資訊或文章。
但這裡的文章中,也包含個人的心情扎記和隨興言談……
若是當中沒有對上你的口味,請多包涵!
原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!
原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!
--原序文--
就是當LINUX遇上CISCO啦!他們的結合還能作什麼事…不就是讓這個世界的網路,串…串起來啊…不然你們那能上這網站看部落格!
--原序文--
就是當LINUX遇上CISCO啦!他們的結合還能作什麼事…不就是讓這個世界的網路,串…串起來啊…不然你們那能上這網站看部落格!
我的網誌清單
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
一個多月..14 年前
沒有留言:
張貼留言