linux系統(tǒng)下oracle11gR2靜默安裝的經(jīng)驗分享
前言:
1、我的linux是64位的redhat6.5,安裝的oracle版本是11.2.0的。
2、我這是自己安裝的linux虛擬機,主機名為ora11g,ip為192.168.100.122
3、這臺機器以前沒有安裝過oracle數(shù)據(jù)庫,這是第一次安裝;系統(tǒng)安裝好了之后,僅僅只配了ip地址;所以新手完全可以按照我的步驟裝一次oracle。
準備工作:
1、確認主機名一致:
[root@ora11g ~]# vi /etc/hosts
在末尾添加 (#其中192.168.100.123為本機ip地址,ora11g為本機主機名,請根據(jù)服務(wù)器不同自行更改)
192.168.100.123 ora11g
2、上傳數(shù)據(jù)庫安裝壓縮包,比如/home/下,并解壓,會得到一個database的文件夾。
打系統(tǒng)補丁包
1、建立光盤源
1)查看光盤位置,可以看出/dev/sr0即為系統(tǒng)光盤文件
[root@ora11g ~]# df -h
提示內(nèi)容為
Filesystem Size Used Avail Use% Mounted on /dev/sda3 26G 2.8G 22G 12% / tmpfs 936M 224K 936M 1% /dev/shm /dev/sda1 194M 34M 151M 19% /boot /dev/sr0 3.6G 3.6G 0 100% /media/RHEL_6.5 x86_64 Disc 1
2)、掛載光盤 (掛載點為mnt目錄)
[root@ora11g ~]# mount /dev/sr0 /mnt/
3)、創(chuàng)建本地yum源并編輯
[root@ora11g ~]# touch /etc/yum.repos.d/redhat.repo [root@ora11g ~]# vi /etc/yum.repos.d/redhat.repo
在redhat.repo中添加內(nèi)容(#后面文字為說明,復(fù)制的時候請自行刪除)
[Sever] name=redhat6.5 #自定義名稱 baseurl=file:///mnt/ #本地光盤掛載路徑 enabled=1 #啟用yum源,0為不啟用,1為啟用 gpgcheck=0 #檢查GPG-key,0為不啟用
4)、把 yum.conf中的gpgcheck改為0
vi /etc/yum.conf
2、打補丁
rqm -qa | grep compat
(補丁包名) 為查看系統(tǒng)是否有這個補丁包
yum install compat
(補丁包名) 為安裝這個補丁包
1)、redhat6.5版本64位系統(tǒng)所需系統(tǒng)補丁截圖
2)、打補丁(根據(jù)我系統(tǒng)安裝的版本檢查完后發(fā)現(xiàn)只需要安裝以下補丁,這里不在贅述)
[root@ora11g ~]#yum install compat-libcap* [root@ora11g ~]#yum install compat-libstdc++-33* [root@ora11g ~]#yum install compat-libstdc++-33*.i686 [root@ora11g ~]#yum install gcc* [root@ora11g ~]#yum install glibc-devel-*.i686 [root@ora11g ~]#yum install libstdc++-devel*.i686 [root@ora11g ~]#yum install libaio*.i686 [root@ora11g ~]#yum install libaio-devel* [root@ora11g ~]#yum install unixODBC* [root@ora11g ~]#yum install unixODBC*.i686 [root@ora11g ~]#yum install ksh
(ps:上述的包為我這個系統(tǒng)中沒有的補丁包,在安裝的時候針對不同系統(tǒng)有不同的情況,請注意。請對照圖片中所列的補丁包一一確認,其中(*86_64)與(.i686)為不同的補丁包,i686的需要的后面加上.i686,可以參照上面的寫法。)
可以使用下面命令檢驗補丁包是否打完
[root@ora11g ~]#rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh [root@ora11g ~]#rpm -q libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC unixODBC-devel
修改系統(tǒng)文件參數(shù)
1、配置linux內(nèi)核參數(shù)
[root@ora11g ~]# vi /etc/sysctl.conf
注釋掉kernel.shmmax與kernel.shmall,并追加以下內(nèi)容
kernel.shmmax = 68719476736 kernel.shmall = 4294967296 fs.file-max = 6815744 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 fs.aio-max-nr = 1048576
2、配置資源使用情況
[root@ora11g ~]# vi /etc/security/limits.conf
追加以下內(nèi)容
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle hard stack 10240
3、登陸設(shè)置
[root@ora11g ~]# vi /etc/pam.d/login
追加以下內(nèi)容
session required /lib64/security/pam_limits.so session required pam_limits.so
[root@ora11g ~]# vi /etc/profile
追加以下內(nèi)容
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
4、關(guān)閉selinux ,確保SELINUX=disabled
[root@ora11g ~]# vi /etc/selinux/config
創(chuàng)建用戶、用戶組和安裝目錄
1、創(chuàng)建oinstall和dba組和oracle用戶
[root@ora11g ~]# groupadd oinstall [root@ora11g ~]# groupadd dba [root@ora11g ~]# useradd -g oinstall -G dba oracle [root@ora11g ~]# passwd oracle ##之后會輸入兩次oracle密碼
2、創(chuàng)建安裝目錄并修改所屬用戶和組
[root@ora11g ~]# mkdir -p /u01/app/oracle [root@ora11g ~]# chown -R oracle:oinstall /u01/app/
修改環(huán)境變量
1、切換到oracle用戶。
[root@ora11g ~]# su - oracle
2、修改環(huán)境變量
[oracle@ora11g ~]$ vi .bash_profile
追加以下內(nèi)容
export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=ora11g export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
移動database文件
移動文件并修改權(quán)限等
[root@ora11g ~]# mv /home/database/ /u01/ [root@ora11g ~]# chown -R oracle:oinstall database/ [root@ora11g ~]# chmod -R 777 database/
下面才是正菜(靜默安裝oracle)
1、靜默安裝oracle軟件
1)、編輯響應(yīng)文件db_install.rsp
[root@ora11g ~]# vi /u01/database/response/db_install.rsp
需要修改的配置有以下內(nèi)容(參考大神說明 http://blog.csdn.net/jameshadoop/article/details/48086933)
oracle.install.option=INSTALL_DB_SWONLY #選擇安裝類型:1.只裝數(shù)據(jù)庫軟件 2.安裝數(shù)據(jù)庫軟件并建庫 3.升級數(shù)據(jù)庫 ORACLE_HOSTNAME=ora11g #指定操作系統(tǒng)主機名,通過hostname命令獲得 UNIX_GROUP_NAME=oinstall #指定oracle inventory目錄的所有者,通常會是oinstall或者dba INVENTORY_LOCATION=/u01/app/oraInventory #指定產(chǎn)品清單oracle inventory目錄的路徑 SELECTED_LANGUAGES=en,zh_CN,zh_TW #指定數(shù)據(jù)庫語言,可以選擇多個,用逗號隔開 ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 #設(shè)置ORALCE_HOME的路徑 ORACLE_BASE=/u01/app/oracle # 設(shè)置ORALCE_BASE的路徑 oracle.install.db.InstallEdition=EE #選擇Oracle安裝數(shù)據(jù)庫軟件的版本 oracle.install.db.isCustomInstall=false oracle.install.db.DBA_GROUP=dba #指定擁有OSDBA、OSOPER權(quán)限的用戶組,通常會是dba組 oracle.install.db.OPER_GROUP=oinstall oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #選擇數(shù)據(jù)庫的用途,一般用途/事物處理,數(shù)據(jù)倉庫 oracle.install.db.config.starterdb.globalDBName=ora11g #指定GlobalName oracle.install.db.config.starterdb.SID=ora11g #指定SID oracle.install.db.config.starterdb.characterSet=ZHS16GBK #選擇字符集。不正確的字符集會給數(shù)據(jù)顯示和存儲帶來麻煩無數(shù)。 #通常中文選擇的有ZHS16GBK簡體中文庫,根據(jù)公司規(guī)定自行選擇 oracle.install.db.config.starterdb.password.ALL=123456 #設(shè)定所有數(shù)據(jù)庫用戶使用同一個密碼,其它數(shù)據(jù)庫用戶就不用單獨設(shè)置了。 DECLINE_SECURITY_UPDATES=true # False表示不需要設(shè)置安全更新,注意,在11.2的靜默安裝中疑似有一個BUG # Response File中必須指定為true,否則會提示錯誤,不管是否正確填寫了郵件地址
2)、切換到oracle用戶進入到/u01/database目錄下執(zhí)行安裝命令
[oracle@ora11g ~]$ cd /u01/database/ [oracle@ora11g database]$ ./runInstaller -silent -ignorePrereq responseFile /u01/database/response/db_install.rsp
使用root用戶使用tail -f 查看實時日志,不贅述。
3)、等到窗口出現(xiàn)以下命令時
出現(xiàn)類似如下提示表示安裝完成:
#------------------------------------------------------------------- ... /u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/db_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software. #-------------------------------------------------------------------
新開窗口使用root用戶登陸并執(zhí)行以下命令
[root@ora11g ~]# /u01/app/oraInventory/orainstRoot.sh [root@ora11g ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh
oracle軟件安裝完成。
2、靜默安裝監(jiān)聽,( $ORACLE_HOME/bin/netca /silent /responsefile u01/database/response/netca.rsp)
[oracle@ora11g ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/netca /silent /responseFile /u01/database/response/netca.rsp
3、靜默建庫
1)、編輯dbca.rsp
[root@ora11g ~]# vi /u01/database/response/dbca.rsp
修改配置如下
#以下內(nèi)容不要修改 RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" #以下內(nèi)容必須設(shè)置 GDBNAME = "ora11g" SID = "ora11g" TEMPLATENAME = "General_Purpose.dbc" #以下內(nèi)容根據(jù)需要修改 CHARACTERSET = "ZHS16GBK"
2)、使用oracle用戶執(zhí)行建庫命令(注意執(zhí)行監(jiān)聽的時候是 /silent /responseFile 而執(zhí)行建庫則是 -silent -responseFile)
[oracle@ora11g ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /u01/database/response/dbca.rsp
之后會提示輸入sys和system的密碼,我的都是123456,所有輸入2次都是一樣的。(我這里命令行會先刪除界面的內(nèi)容才可以輸入,不知道是不是系統(tǒng)的原因還是別的導(dǎo)致的)
界面會提示安裝進度
Copying database files ... 37% complete Creating and starting Oracle instance ... 62% complete Completing Database Creation ... 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ORCL/ORCL.log" for further details.
之后就完成了數(shù)據(jù)庫的安裝。
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流。
相關(guān)文章
PHP程序員玩轉(zhuǎn)Linux系列 Linux和Windows安裝nginx
這篇文章主要為大家詳細介紹了PHP程序員玩轉(zhuǎn)Linux系列文章,Linux和Windows安裝nginx教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-04-04淺析ARM架構(gòu)下的函數(shù)的調(diào)用過程
本文主要介紹了linux程序運行的狀態(tài)以及如何推導(dǎo)調(diào)用棧。2021-05-05cloudstack下libvirtd服務(wù)無響應(yīng)問題
這篇文章主要介紹了cloudstack下libvirtd服務(wù)無響應(yīng)問題的相關(guān)資料,需要的朋友可以參考下2016-10-10在Linux系統(tǒng)中使用Vim讀寫遠程文件的命令詳解
這篇文章主要介紹了在Linux系統(tǒng)中使用Vim讀寫遠程文件的相關(guān)知識,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07