Linux一鍵部署oracle安裝環(huán)境腳本(推薦)
具體代碼如下所示:
#!/bin/bash
############################################
###功能:Preparation for Oracle Installation
###參數(shù):SID BASE
###其中,sid指的是ORACLE_SID
###BASE指的是ORACLE_BASE的一級(jí)目錄,如ORACLE_BASE=/u01/app/oracle,則BASE為/u01
############################################
#檢查參數(shù)個(gè)數(shù)是否正確
if [ $# -ne 2 ];then
echo "$0 SID BASE"
exit
fi
SID="$1"
BASE="$2"
#主機(jī)名綁定
IP=`ifconfig |awk -F'[: ]+' 'NR==2{print $4'}`
HOST=`hostname`
sed -i '$a'$IP' '$HOST'' /etc/hosts
#Checking the Package Requirements
#將需要安裝的表的列表貼在Package_list文件中
awk -F'-[0-9]' '{print $1}' Package_list |awk '{print $1}' |uniq |xargs yum install -y > output.log 2>&1
#Creating Required Operating System Groups and Users
groupadd -g 800 oinstall
groupadd -g 801 dba
groupadd -g 802 oper
useradd -g oinstall -G dba,oper oracle
echo oracle | passwd --stdin oracle >> output.log 2>&1
#Configure Kernal Parameters
sed -i '$a\fs.aio-max-nr = 1048576' /etc/sysctl.conf
sed -i '$a\fs.file-max = 6815744' /etc/sysctl.conf
sed -i '$a\kernel.shmall = 2097152' /etc/sysctl.conf
sed -i '$a\kernel.shmmax = 536870912' /etc/sysctl.conf
sed -i '$a\kernel.shmmni = 4096' /etc/sysctl.conf
sed -i '$a\kernel.sem = 250 32000 100 128' /etc/sysctl.conf
sed -i '$a\net.ipv4.ip_local_port_range = 9000 65500' /etc/sysctl.conf
sed -i '$a\net.core.rmem_default = 262144' /etc/sysctl.conf
sed -i '$a\net.core.rmem_max = 4194304' /etc/sysctl.conf
sed -i '$a\net.core.wmem_default = 262144' /etc/sysctl.conf
sed -i '$a\net.core.wmem_max = 1048586' /etc/sysctl.conf
sysctl -p >> output.log 2>&1
#Configure Resource Limits
sed -i '$a\oracle soft nproc 2047' /etc/security/limits.conf
sed -i '$a\oracle hard nproc 16384' /etc/security/limits.conf
sed -i '$a\oracle soft nofile 1024' /etc/security/limits.conf
sed -i '$a\oracle hard nofile 65536' /etc/security/limits.conf
#Add the following line to the /etc/pam.d/login file, if it does not already exist:
sed -i '$a\session required pam_limits.so' /etc/pam.d/login
#Add the following line to the /etc/profile
sed -i '$a\if [[ $USER = "oracle" ]]; then' /etc/profile
sed -i '$a\ if [[ $SHELL = "/bin/ksh" ]]; then' /etc/profile
sed -i '$a\ ulimit -p 16384' /etc/profile
sed -i '$a\ ulimit -n 65536' /etc/profile
sed -i '$a\ else' /etc/profile
sed -i '$a\ ulimit -u 16384 -n 65536' /etc/profile
sed -i '$a\ fi' /etc/profile
sed -i '$a\fi' /etc/profile
source /etc/profile
#Configuring the oracle User's Environment
sed -i '$a\export ORACLE_SID='$SID'' /home/oracle/.bash_profile
sed -i '$a\export ORACLE_BASE='$BASE'/app/oracle' /home/oracle/.bash_profile
sed -i '$a\export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1' /home/oracle/.bash_profile
sed -i '$a\export PATH=$ORACLE_HOME/bin:$PATH' /home/oracle/.bash_profile
source /home/oracle/.bash_profile
#Creating Required Directories
mkdir -p $ORACLE_HOME
chown -R oracle.oinstall $BASE/app
chmod -R 775 $BASE/app
echo "Preparation For Oracle Installation Is Over!"
總結(jié)
以上所述是小編給大家介紹的Linux一鍵部署oracle安裝環(huán)境腳本,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
相關(guān)文章
教你使用PLSQLDeveloper14連接Oracle11g的詳細(xì)過(guò)程
今天給大家?guī)?lái)一篇教程關(guān)于用PLSQLDeveloper14連接Oracle11g的詳細(xì)過(guò)程,本文分步驟通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),需要的朋友參考下吧2021-09-09
Oracle之關(guān)于各類連接超時(shí)相關(guān)參數(shù)學(xué)習(xí)
這篇文章主要介紹了Oracle之關(guān)于各類連接超時(shí)相關(guān)參數(shù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04
Oracle?數(shù)據(jù)庫(kù)簡(jiǎn)單查詢從基礎(chǔ)語(yǔ)法到實(shí)戰(zhàn)案例
本文將基于employees(員工表)和departments(部門表),從語(yǔ)法規(guī)則、基礎(chǔ)查詢、條件查詢、排序到函數(shù)應(yīng)用,系統(tǒng)梳理?Oracle?簡(jiǎn)單查詢的全流程,每個(gè)知識(shí)點(diǎn)都搭配實(shí)戰(zhàn)案例,適合新手入門學(xué)習(xí),也可作為日常開(kāi)發(fā)的參考手冊(cè),感興趣的朋友跟隨小編一起看看吧2025-11-11
Oracle數(shù)據(jù)庫(kù)時(shí)間格式轉(zhuǎn)換的常見(jiàn)示例
這篇文章主要給大家介紹了關(guān)于Oracle數(shù)據(jù)庫(kù)時(shí)間格式轉(zhuǎn)換的常見(jiàn)示例,在實(shí)際的工作中會(huì)經(jīng)常會(huì)用到to_char()、to_date()函數(shù)來(lái)對(duì)時(shí)間、日期進(jìn)行處理,文中給出了詳細(xì)的代碼示例,需要的朋友可以參考下2024-02-02
oracle中utl_file包讀寫文件操作實(shí)例學(xué)習(xí)
在oracle中utl_file包提供了一些操作文本文件的函數(shù)和過(guò)程,接下來(lái)和大家一起學(xué)習(xí)他的基本操作,感興趣的你可以參考下哈希望可以幫助到你2013-03-03
oracle中 procedure(存儲(chǔ)過(guò)程)和function(函數(shù))本質(zhì)區(qū)別
這篇文章主要介紹了 oracle中 procedure(存儲(chǔ)過(guò)程)和function(函數(shù))本質(zhì)區(qū)別,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02
Oracle sqlldr導(dǎo)入一個(gè)日期列實(shí)例詳解
這篇文章主要介紹了Oracle sqlldr導(dǎo)入一個(gè)日期列實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下2017-06-06

