日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一键准备Oracle安装

發布時間:2025/3/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一键准备Oracle安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在Linux下安裝Oracle軟件之前,有相當工作需要準備,包括建立用戶、配置內核參數、配置資源限制參數、配置Oracle用戶環境等,十分繁瑣。即便十分熟悉,也需要花費一定的精力來準備。說白了,做這些事情有點類似于低水平重復建設,雖沒有多大技術含量,卻又不得不做。現在將這些準備工作做成腳本,這樣可以近乎實現一鍵準備Oracle安裝。

說明:

1> 該腳本的執行方式為sh Oracle_Setup_Prepare.sh orcl /u01,兩個參數說明見腳本解釋部分。

2> 該腳本中涉及到一個文本文件Package_list,是Oracle安裝依賴包的列表。具體內容如下文所示。

3> 該腳本主要針對于單實例數據庫安裝。

4> 安裝信息可參考生成的output.log文件

腳本內容如下:

[oracle@node3 ~]$ cat Oracle_Setup_Prepare.sh?

#!/bin/bash ############################################ ###功能:Preparation for Oracle Installation ###參數:SID BASE ###其中,sid指的是ORACLE_SID ###BASE指的是ORACLE_BASE的一級目錄,如ORACLE_BASE=/u01/app/oracle,則BASE為/u01 #############################################檢查參數個數是否正確 if [ $# -ne 2 ];thenecho "$0 SID BASE"exit fiSID="$1" BASE="$2"#主機名綁定 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/appecho "Preparation For Oracle Installation Is Over!"

Package_list內容如下:

[oracle@node3 ~]$ cat Package_list?

binutils-2.17.50.0.6 compat-libstdc++-33-3.2.3 compat-libstdc++-33-3.2.3 (32 bit) elfutils-libelf-0.125 elfutils-libelf-devel-0.125 gcc-4.1.2 gcc-c++-4.1.2 glibc-2.5-24 glibc-2.5-24 (32 bit) glibc-common-2.5 glibc-devel-2.5 glibc-devel-2.5 (32 bit) glibc-headers-2.5 ksh-20060214 libaio-0.3.106 libaio-0.3.106 (32 bit) libaio-devel-0.3.106 libaio-devel-0.3.106 (32 bit) libgcc-4.1.2 libgcc-4.1.2 (32 bit) libstdc++-4.1.2 libstdc++-4.1.2 (32 bit) libstdc++-devel 4.1.2 make-3.81 sysstat-7.0.2 unixODBC-2.2.11 unixODBC-2.2.11 (32 bit) unixODBC-devel-2.2.11 unixODBC-devel-2.2.11 (32 bit)

?PS: 既然sed每次都是在最后一行追加,其實,用echo "***" >> filename即可實現。

總結

以上是生活随笔為你收集整理的一键准备Oracle安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。