您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux下怎么安裝Oracle 11g”的相關(guān)知識(shí),小編通過實(shí)際案例向大家展示操作過程,操作方法簡(jiǎn)單快捷,實(shí)用性強(qiáng),希望這篇“Linux下怎么安裝Oracle 11g”文章能幫助大家解決問題。
oracle 11g客戶端是一款出自甲骨文公司之手的專業(yè)化關(guān)系數(shù)據(jù)庫(kù)管理系統(tǒng),oracle 11g客戶端功能強(qiáng)勁,具有高效性、安全性、穩(wěn)定性和延展性等特點(diǎn),世界上的幾乎所有大型信息化系統(tǒng)都在應(yīng)用Oracle數(shù)據(jù)庫(kù)技術(shù)。
1.1.配置本地yum源
#因公司內(nèi)網(wǎng)環(huán)境,沒有互聯(lián)網(wǎng),所以需要配置本地yum源,安裝所需依賴包等。#掛載ios鏡像centos7.5-1804[root@oracle ~]#mount /dev/cdrom /mnt#備份原配置文件[root@oracle ~]#cd /etc/yum.repos.d/[root@oracle ~]#mkdir bak[root@oracle ~]#mv * bak#創(chuàng)建yum配置文件[root@oracle ~]#vi /etc/yum.repos.d/local.repo#添加以下內(nèi)容[local] name=localbaseurl=file:///mnt gpgcheck=0 enabled=1#清空yum所有源信息[root@oracle ~]#yum clean all#查看本地源的所有軟件[root@oracle ~]#yum list
1.2上傳解壓oracle 11g安裝包
#將下載的linux.x64_11gR2_database_1of2.zip和linux.x64_11gR2_database_2of2.zip解壓到/usr/local/apps/oracle目錄[root@oracle ~]# mkdir -p /usr/local/apps/oracle[root@oracle ~]# cd /usr/local/apps/oracle[root@oracle oracle]# unzip p13390677_112040_Linux-x86-64_1of7.zip && unzip p13390677_112040_Linux-x86-64_2of7.zip#沒有安裝unzip命令工具的安裝一下[root@oracle ~]# yum install unzip –y#解壓后會(huì)產(chǎn)生一個(gè)database目錄,即/usr/local/apps/oracle/database,目錄里面是oracle11g企業(yè)版的安裝文件
1.3.給本機(jī)服務(wù)IP地址作個(gè)映射
#添加本機(jī)IP地址和主機(jī)名[root@oracle oracle]# vim /etc/hosts10.0.0.10 oracle
1.4.關(guān)閉selinux
#修改SELINUX=disabled[root@oracle ~]#vi /etc/selinux/configSELINUX=disabled [root@oracle ~]#setenforce 0setenforce: SELinux is disabled
1.5.關(guān)閉防火墻
[root@oracle ~]#service iptables stop[root@oracle ~]#systemctl stop firewalld[root@oracle ~]#systemctl disable firewalld
1.6.安裝Oracle 11g依賴包
[root@oracle ~]#yum install gcc make ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel –y
1.7.添加安裝用戶和用戶組
#創(chuàng)建用戶組[root@oracle ~]#groupadd oinstall[root@oracle ~]#groupadd dba#創(chuàng)建oracle用戶并指定用戶組[root@oracle ~]#useradd -g oinstall -G dba oracle#為oracle用戶設(shè)置密碼[root@oracle ~]#passwd oracle#查看用戶信息[root@oracle ~]#id oracle uid=1001(oracle) gid=1001(oinstall) 組=1001(oinstall),1002(dba)#如顯示以上類似信息則表示添加用戶和用戶組成功
1.8.修改內(nèi)核參數(shù)
[root@oracle ~]#vi /etc/sysctl.conf#添加以下內(nèi)容fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 1073741824 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 = 1048576#其中shmmax是單個(gè)共享內(nèi)存段的最大值,一般設(shè)置為本機(jī)物理內(nèi)存的一半,單位為byte,可根據(jù)自己的實(shí)際情況做相應(yīng)調(diào)整#使新內(nèi)核參數(shù)生效[root@oracle ~]#sysctl –p
1.9.修改用戶的限制文件
[root@oracle ~]#vi /etc/security/limits.conf#添加以下內(nèi)容oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240
1.10.修改/etc/pam.d/login文件
[root@oracle ~]#vi /etc/pam.d/login#添加以下內(nèi)容session required /lib64/security/pam_limits.sosession required pam_limits.so
1.11.修改/etc/profile文件
[root@oracle ~]#vi /etc/profile#添加以下內(nèi)容if [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fifi#使之生效[root@oracle ~]#source /etc/profile
1.12.創(chuàng)建安裝目錄和設(shè)置文件權(quán)限
[root@oracle ~]#mkdir -p /usr/local/apps/oracle/product/11.2.0[root@oracle ~]#mkdir /usr/local/apps/oracle/oradata[root@oracle ~]#mkdir /usr/local/apps/oracle/inventory[root@oracle ~]#mkdir /usr/local/apps/oracle/fast_recovery_area[root@oracle ~]#chown -R oracle:oinstall /usr/local/apps/oracle[root@oracle ~]#chmod -R 775 /usr/local/apps/oracle
1.13.設(shè)置oracle用戶環(huán)境變量
[root@oracle ~]#su - oracle#此處注意,切換用戶時(shí)切記要加"-",加-會(huì)擁有目標(biāo)用戶的環(huán)境變量,不加"-"則沒有,詳細(xì)的可自行網(wǎng)上搜索找解答[oracle@oracle ~]$vi .bash_profile#添加如下內(nèi)容ORACLE_BASE=/usr/local/apps/oracleORACLE_HOME=$ORACLE_BASE/product/11.2.0ORACLE_SID=orclPATH=$PATH:$ORACLE_HOME/binexport ORACLE_BASEexport ORACLE_HOMEexport ORACLE_SIDexport PATH#使配置生效[oracle@oracle ~]$source .bash_profile
1.14.編輯靜默安裝響應(yīng)文件
[oracle@oracle ~]$cp -R /usr/local/apps/oracle/database/response/ /home/oracle[oracle@oracle ~]$cd /home/oracle/response[oracle@oracle ~]$vi db_install.rsp#需要設(shè)置的選項(xiàng)如下,注意只修改以下設(shè)置,其他設(shè)置不變,否則會(huì)報(bào)錯(cuò)。oracle.install.option=INSTALL_DB_SWONLYORACLE_HOSTNAME=oracleUNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/usr/local/apps/oracle/inventorySELECTED_LANGUAGES=en,zh_CNORACLE_HOME=/usr/local/apps/oracle/product/11.2.0ORACLE_BASE=/usr/local/apps/oracleoracle.install.db.InstallEdition=EEoracle.install.db.DBA_GROUP=dbaoracle.install.db.OPER_GROUP=dbaDECLINE_SECURITY_UPDATES=true
[oracle@oracle ~]$cd /usr/local/apps/oracle/database[oracle@oracle ~]$./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq#Oracle開始在后臺(tái)靜默安裝,如果提示Successfully則表示安裝成功#按照要求執(zhí)行腳本,打開終端,以root用戶登錄,執(zhí)行腳本[root@oracle ~]#/usr/local/apps/oracle/inventory/orainstRoot.sh[root@oracle ~]#/usr/local/apps/oracle/product/11.2.0/root.sh
#以oracle用戶登錄,執(zhí)行[oracle@oracle ~]$netca /silent /responsefile /home/oracle/response/netca.rsp#通過netstat命令查看1521端口是否在監(jiān)聽中[oracle@oracle ~]$ss -tnulp | grep 1521
4.1.修改dbca.rsp配置文件
[oracle@oracle ~]$vim /home/oracle/response/dbca.rsp#設(shè)置以下參數(shù)[CREATEDATABASE]GDBNAME = "orcl"SID = "orcl"SYSPASSWORD = "123456"SYSTEMPASSWORD = "123456"SYSMANPASSWORD = "123456"DBSNMPPASSWORD = "123456"DATAFILEDESTINATION =/usr/local/apps/oracle/oradataRECOVERYAREADESTINATION=/usr/local/apps/oracle/fast_recovery_areaCHARACTERSET = "AL32UTF8"TOTALMEMORY = "800"#其中TOTALMEMORY = "800"為800MB,一般設(shè)置為物理內(nèi)存的80%
4.2.進(jìn)行靜默配置創(chuàng)建實(shí)例
[oracle@oracle ~]$dbca -silent -responseFile /home/oracle/response/dbca.rsp#建庫(kù)后進(jìn)行實(shí)例進(jìn)程檢查[oracle@oracle ~]$ps -ef | grep ora_ | grep -v grep#查看監(jiān)聽狀態(tài)[oracle@oracle ~]$lsnrctl status#登錄查看實(shí)例狀態(tài)[oracle@oracle ~]$sqlplus / as sysdbaSQL> select status from v$instance;#如顯示STATUS------------OPEN#則表示實(shí)例是啟動(dòng)狀態(tài)#查看數(shù)據(jù)庫(kù)編碼SQL> select userenv('language') from dual;#查看數(shù)據(jù)庫(kù)版本SQL> select * from v$version;
5.1.修改啟動(dòng)腳本文件
#修改/usr/local/apps/oracle/product/11.2.0/bin/dbstart[oracle@oracle ~]$vi /usr/local/apps/oracle/product/11.2.0/bin/dbstart#將ORACLE_HOME_LISTNER=$1修改為ORACLE_HOME_LISTNER=$ORACLE_HOME#修改/usr/local/apps/oracle/product/11.2.0/bin/dbshut[oracle@oracle ~]$vi /usr/local/apps/oracle/product/11.2.0/bin/dbshut#將ORACLE_HOME_LISTNER=$1修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
5.2.修改/etc/oratab文件
[oracle@oracle ~]$vi /etc/oratab#將orcl:/usr/local/apps/oracle/product/11.2.0:N中最后的N改為Y,成為orcl:/usr/local/apps/oracle/product/11.2.0:Y#輸入dbshut和dbstart測(cè)試[oracle@oracle ~]$dbshut#Oracle監(jiān)聽停止,進(jìn)程消失[oracle@oracle ~]$dbstart#Oracle監(jiān)聽啟動(dòng),進(jìn)程啟動(dòng)5.3.切換到root賬戶建立自啟動(dòng)腳本 [oracle@oracle ~]$su - [root@oracle ~]#vim /etc/rc.d/init.d/oracle#添加以下內(nèi)容(有些值如ORA_HOME和ORA_USER等根據(jù)實(shí)際情況可以修改):#!/bin/sh# chkconfig: 35 80 10# description: Oracle auto start-stop script.## Set ORA_HOME to be equivalent to the $ORACLE_HOME# from which you wish to execute dbstart and dbshut;## Set ORA_OWNER to the user id of the owner of the# Oracle database in ORA_HOME.ORA_HOME=/usr/local/apps/oracle/product/11.2.0 ORA_OWNER=oracleif [ ! -f $ORA_HOME/bin/dbstart ]then echo "Oracle startup: cannot start" exitficase "$1" in'start')# Start the Oracle databases:echo "Starting Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" >>/var/log/oracleecho "Done"# Start the Listener:echo "Starting Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracleecho "Done."echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle touch /var/lock/subsys/oracle ;;'stop')# Stop the Oracle Listener:echo "Stoping Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracleecho "Done."rm -f /var/lock/subsys/oracle# Stop the Oracle Database:echo "Stoping Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" >>/var/log/oracleecho "Done."echo ""echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle ;;'restart')$0 stop$0 start ;;esac
5.4.修改/etc/init.d/oracle服務(wù)文件權(quán)限
[root@oracle ~]#chmod 755 /etc/init.d/oracle
5.5.添加開機(jī)自啟服務(wù)
[root@oracle ~]#chkconfig oracle on
5.6.需要在關(guān)機(jī)或重啟機(jī)器之前停止數(shù)據(jù)庫(kù),做一下操作
#關(guān)機(jī)[root@oracle ~]ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle#重啟[root@oracle ~]ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle #進(jìn)行測(cè)試[root@oracle ~]# service oracle start #啟動(dòng)oracle[root@oracle ~]# service oracle stop #關(guān)閉oracle
5.7.重啟查看Oracle監(jiān)聽和實(shí)例進(jìn)程是否均能自動(dòng)啟動(dòng)
[root@oracle ~]#reboot
關(guān)于“Linux下怎么安裝Oracle 11g”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí),可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會(huì)為大家更新不同的知識(shí)點(diǎn)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。