Linux下安裝Oracle參數自動初始化指令碼

來源:互聯網
上載者:User

在linux下安裝Oracle通常是一件很頭疼的事情,

而如果我們只是為了部署CMS的話,也沒有必要對Oracle的參數去做詳細的瞭解。

那麼有沒有辦法簡化這個安裝過程呢?

下面給出了一個在Linux下執行的sh指令碼,可以自動將Oracle的相關參數及環境變數、使用者都準備好

從而能夠加快CMS的部署、減少出錯。

其實,就我個人的觀點,這些東西實際上應該是Oracle的安裝程式做的工作。

但是沒辦法,誰叫Oracle那麼牛呢?

#!/bin/sh
oracle_passwd=oracle
# oracle使用者密碼
setup_file_path=/oracle/app
# 10g安裝程式目錄
install_to_path=/oracle
# 安裝路徑
#----------------------------------------
grep oracle /etc/passwd &> /dev/null
# 檢查是否已經安裝
if [ $? -eq 0 ]
then
clear
echo "oracle user is already exist!"
exit 1
fi
###################調整核心參數#############################
cat >> /etc/sysctl.conf << !
kernel.sem = 250 32000 100 128
fs.file-max = 65546
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
!
sysctl -p
# 提交配置參數
###################建立安裝使用者及組#########################
#off Selinux
groupadd dba && groupadd oinstall
useradd -g oinstall -G dba -m oracle
echo $oracle_passwd | passwd oracle --stdin
mkdir -p $install_to_path
chown -R oracle.oinstall $install_to_path
##=============================================
cat >> /etc/pam.d/login << !
# Add content for oracle install
session required pam_limits.so
!
# turn on limits for oracle 10g
cat >> /etc/security/limits.conf << !
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65535
!
##=============================================
#echo 'Red Hat Enterprise Linux Server release 4 (Tikanga)' > /etc/RedHat-release
echo '
#--------------------------------------
# Set for Oracle10g Install           ;
#--------------------------------------
trap " " 0 1 2 3 5 9 15
trap clear 0
export TMP=/tmp
export TMPDIR=$TMP
' >> /home/oracle/.bash_profile
#============
echo "export ORACLE_BASE=$install_to_path" >> /home/oracle/.bash_profile
#============
echo '
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=oinstall
export PATH=$ORACLE_HOME/bin:$PATH
export LANG=en_US
' >> /home/oracle/.bash_profile

# 使用者ROOT登入在字元介面下
clear
echo "you can su - oracle in X and run runInstaller to install oracle now!"
#su - oracle
#startx -- :1
#./runInstaller
# 開始安裝ORACLE

這裡給出一個純淨的Linux檔案,大家無需再通過vi編輯器刪除Windows下多餘的亂碼了:

點擊這裡下載:init_oracle.zip

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.