[toc]
前提準(zhǔn)備
系統(tǒng)信息
cat /etc/redhat-release
結(jié)果:
Red Hat Enterprise Linux Server release 7.4 (Maipo)
網(wǎng)絡(luò)代理(非必須)
由于Linux網(wǎng)絡(luò)的限制(無法直接使用ftp訪問外網(wǎng)),所以計(jì)劃用代理的形式從外網(wǎng)的ftp服務(wù)器下載文件。
設(shè)置代理服務(wù)器:
vi /etc/wgetrc
添加http_proxy、https_proxy、ftp_proxy的代理服務(wù),并打開使用代理use_proxy的開關(guān):
# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
http_proxy = http://10.19.129.8:8088
ftp_proxy = http://10.19.129.8:2121# If you do not want to use proxy at all, set this to off.
#use_proxy = on
設(shè)置完成之后,使之生效:
source /etc/profile
或重啟系統(tǒng)生效。
下載Oracle 11g R2 for Linux
百度搜索Oracle 11g R2 for Linux就能檢索到。
進(jìn)入Oracle官網(wǎng)后,下載兩個(gè)壓縮包:
這兩個(gè)壓縮包都得下載!
Linux安裝ZModem
有時(shí)候受限于網(wǎng)絡(luò)環(huán)境,Linux服務(wù)器可能沒有搭建好FTP服務(wù)或者沒有開通FTP端口,故使用ZModem進(jìn)行傳輸。個(gè)人認(rèn)為ZModem還是比較方便的。
PS:實(shí)際上是在項(xiàng)目實(shí)施的過程中,和客戶溝通開通FTP太困難,也不給做圖形化界面,對于一個(gè)不太懂Linux服務(wù)的我來說簡直頭疼。無奈之下,拜了拜度娘,找到了使用ZModem傳輸。
我用的是MBP,本想用scp直接上傳文件,不料沒成功,所以用了PD中的Windows后,再安裝了Xshell,畢竟Xshell的ZModem功能在Mac系統(tǒng)中調(diào)不出打開文件的窗口。
安裝lrzsz
yum inistall lrzsz
在Xshell中配置Zmodem
** ZModem使用說明:**
rz #在Linux系統(tǒng)中使用rz命令,將Windows系統(tǒng)的文件上傳到Linux系統(tǒng)當(dāng)前文件夾中
sz #把Linux系統(tǒng)中的文件下載到本地的Windows系統(tǒng)
如:
把Linux服務(wù)器的文件下載到Windows,使用sz命令:
sz linux.x64_11gR2_database_1of2.zip
上傳并解壓Oracle安裝包
-
上傳安裝包
進(jìn)入/tmp目錄后,鍵入命令rz后,會(huì)彈出選擇文件的窗口,選擇Oracle數(shù)據(jù)庫的兩個(gè)壓縮包就好。
-
解壓安裝包
將兩個(gè)壓縮包解壓到/tmp目錄下:unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip
兩個(gè)zip壓縮包都解壓出來,自動(dòng)合并到database目錄中了。
配置主機(jī)名與IP的映射關(guān)系
-
查看主機(jī)名
hostname
主機(jī)名會(huì)在hosts中配置與IP的對應(yīng)關(guān)系,留著備用。
-
查看ip地址
ifconfig
IP會(huì)在hosts中配置與主機(jī)名的對應(yīng)關(guān)系,留著備用。
-
修改主機(jī)名與IP對應(yīng)
vi /etc/hosts
在最后添加主機(jī)名與IP的對應(yīng)關(guān)系:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 IP hostname #添加IP與主機(jī)名稱的映射關(guān)系
關(guān)閉seLinux
c sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config setenforce 0
安裝依賴包
-
安裝依賴包
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
上面的命令安裝以下依賴包:
binutils-2.27-34.base.el7.x86_64 compat-libcap1-1.10-7.el7.x86_64 package compat-libstdc++-33 is not installed gcc-4.8.5-36.el7_6.2.x86_64 gcc-c++-4.8.5-36.el7_6.2.x86_64 glibc-2.17-260.el7_6.4.x86_64 glibc-2.17-260.el7_6.4.i686 glibc-devel-2.17-260.el7_6.4.x86_64 glibc-devel-2.17-260.el7_6.4.i686 ksh-20120801-139.el7.x86_64 libaio-0.3.109-13.el7.x86_64 libaio-0.3.109-13.el7.i686 libaio-devel-0.3.109-13.el7.x86_64 libaio-devel-0.3.109-13.el7.i686 libgcc-4.8.5-36.el7_6.2.x86_64 libgcc-4.8.5-36.el7_6.2.i686 libstdc++-4.8.5-36.el7_6.2.x86_64 libstdc++-4.8.5-36.el7_6.2.i686 libstdc++-devel-4.8.5-36.el7_6.2.x86_64 libstdc++-devel-4.8.5-36.el7_6.2.i686 libXi-1.7.9-1.el7.x86_64 libXi-1.7.9-1.el7.i686 libXtst-1.2.3-1.el7.x86_64 libXtst-1.2.3-1.el7.i686 make-3.82-23.el7.x86_64 sysstat-10.1.5-17.el7.x86_64 unixODBC-2.3.1-11.el7.x86_64 unixODBC-2.3.1-11.el7.i686 unixODBC-devel-2.3.1-11.el7.x86_64 unixODBC-devel-2.3.1-11.el7.i686
-
檢查已經(jīng)安裝好的依賴包
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
-
檢查沒有安裝的依賴包
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel |grep "not installed"
如果所有的依賴包都安裝成功了,執(zhí)行者條命令的時(shí)候會(huì)沒有輸出結(jié)果;
如果有輸出結(jié)果,必然會(huì)沒有安裝好所有的依賴包,可以執(zhí)行這個(gè)命令再安裝一下:
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
安裝完成后再執(zhí)行「檢查沒有安裝的依賴包」命令。
關(guān)閉防火墻
-
關(guān)閉防火墻
systemctl stop firewalld #關(guān)閉防火墻
-
檢查防火墻狀態(tài)
systemctl status firewalld
關(guān)閉狀態(tài)位Active: inactive (dead)
a firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)
-
關(guān)閉自動(dòng)啟動(dòng)防火墻服務(wù)
systemctl disable firewalld #關(guān)閉自動(dòng)啟動(dòng)防火墻服務(wù)
創(chuàng)建并配置組、用戶信息
Oracle數(shù)據(jù)庫需要在oracle用戶下安裝,所以需要?jiǎng)?chuàng)建一個(gè)oracle用戶,并將其加入到相應(yīng)的用戶組中。
-
創(chuàng)建oinstall組
Unix groupadd oinstall #創(chuàng)建oinstall組
-
創(chuàng)建dba組
groupadd dba #創(chuàng)建dba組
-
創(chuàng)建用戶oracle,并將其添加到oinstall組合dba組
useradd - g oinstall -G dba oracle
創(chuàng)建完成后,可使用如下命令查看oracle用戶的信息:
id oracle
輸出像這樣的結(jié)果:
uid=1001(oracle) gid=1004(oinstall) groups=1004(oinstall),1005(dba)
創(chuàng)建完成后,我們需要在root用戶和oracle用戶之間切來切去。
修改內(nèi)核參數(shù)
vi /etc/sysctl.conf
在文件末添加如下參數(shù):
io-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
執(zhí)行腳本使內(nèi)核參數(shù)生效:
sysctl -p
修改用戶的限制文件
vi /etc/security/limits.conf
在文件末添加如下配置:
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240
修改etc/pam.d/login文件
vi /etc/pam.d/login
在文件末添加如下配置:
session required /lib64/security/pam_limits.so session required pam_limits.so
修改/etc/profile文件
vi /etc/profile
文件中添加如下內(nèi)容:
\## 以下部分為添加的內(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 \## 以上部分為添加的內(nèi)容
創(chuàng)建安裝目錄
mkdir -p /data/u01/app/oracle/product/11.2.0/db_1 mkdir /data/u01/app/oracle/oradata mkdir /data/u01/app/oracle/inventory mkdir /data/u01/app/oracle/fast_recovery_area
由于在安裝過程中發(fā)現(xiàn)u01掛載的空間不足,不滿足安裝條件,所以把安裝路徑修改到了有1000G的/data下
修改目錄所屬用戶
將 data/u01/app/oracle目錄的所有者修改為oinstall組的oracle用戶:
chown -R oracle:oinstall /data/u01/app/oracle
修改目錄權(quán)限
為/data/u01/app/oracle目錄設(shè)置775權(quán)限:
chmod -R 775 /data/u01/app/oracle
延伸:
chmod是Linux系統(tǒng)中設(shè)置文件權(quán)限的命令,一般是由3個(gè)數(shù)字組成:
第一個(gè)數(shù)字表示文件所有者的權(quán)限
第二個(gè)數(shù)字表示與文件所有者同屬一個(gè)用戶組的其他用戶的權(quán)限
第三個(gè)數(shù)字表示其它用戶組的權(quán)限。
權(quán)限分為三種:讀(r=4),寫(w=2),執(zhí)行(x=1)
綜合起來還有可讀可執(zhí)行(rx=5=4+1)、可讀可寫(rw=6=4+2)、可讀可寫可執(zhí)行(rwx=7=4+2+1)。
如果沒有設(shè)置目錄權(quán)限,在安裝的過程中會(huì)提示oracle用戶沒有權(quán)限。到時(shí)候再切回到root用戶設(shè)置權(quán)限也行。
靜默安裝Oracle數(shù)據(jù)庫
設(shè)置oracle用戶的環(huán)境變量
-
切換到oracle用戶
su - oracle
-
設(shè)置環(huán)境變量:
vi .bash_profile
-
在.bash_profile中添加如下配置信息:
\# 以下是添加的配置信息 ORACLE_BASE=/data/u01/app/oracle #oracle的根目錄 ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle的HOME位置 ORACLE_SID=orcl #Oracle的實(shí)例名稱 ORACLE_PID=ora11g LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib PATH=$PATH:$ORACLE_HOME/bin NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8" #字符集,我們使用AL32UTF8 export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_PID LD_LIBRARY PATH NLS_LANG \# 以下是添加的配置信息 \#export PATH
修改靜默安裝文件db_install.rsp
-
切換到root用戶:
su - root
-
進(jìn)入到/tmp/database/response文件夾:
cd /tmp/database/response/
-
編輯db_install.rsp
db_install.rsp文件安裝數(shù)據(jù)庫時(shí)讀取的配置文件,類似于在使用圖形化安裝時(shí)進(jìn)行的配置,只不過在靜默安裝時(shí),需要事先配置好,否則就沒法安裝了。vi db_install.rsp
-
修改db_install.rsp中的以下配置信息:
``
#------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY #只安裝數(shù)據(jù)庫#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME= #這里寫自己的主機(jī)名#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall #指定要安裝到的組,前面創(chuàng)建的oinstall組#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/data/Oracle_Inventory #設(shè)置INVENTORY目錄,不能與oracle的安裝目錄中u01中,否則安裝的時(shí)候會(huì)拋出報(bào)錯(cuò),所以事先在這里設(shè)置好#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.
## Example : SELECTED_LANGUAGES=en,fr,ja
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN,zh_TW #設(shè)置支持的語言,這里我設(shè)置了英文、簡體中文、繁體中文_臺(tái)灣#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/db_1 #ORACLE_HOME的路徑,就是我們前面創(chuàng)建的ORACLE_HOME目錄#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#------------------------------------------------------------------------------
ORACLE_BASE=/data/u01/app/oracle #設(shè)置Oracle的根目錄,就是我們前面創(chuàng)建的oracle目錄#------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# EE : Enterprise Edition
# SE : Standard Edition
# SEONE : Standard Edition One
# PE : Personal Edition (WINDOWS ONLY)
#------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE #設(shè)置安裝版本,選擇企業(yè)版EE#------------------------------------------------------------------------------
# This variable is used to enable or disable custom install.
#
# true : Components mentioned as part of 'customComponents' property
# are considered for install.
# false : Value for 'customComponents' is not considered.
#------------------------------------------------------------------------------
oracle.install.db.isCustomInstall=false#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba #設(shè)置要授權(quán)的組,用dba組#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=oinstall #設(shè)置要授權(quán)的操作組,用oinstall#------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE/TRANSACTION_PROCESSING
# - DATA_WAREHOUSE
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #設(shè)置數(shù)據(jù)庫類型,用通用
#DATA_WAREHOUSE 數(shù)據(jù)倉庫#------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl #設(shè)置全局實(shí)例名為:orcl#------------------------------------------------------------------------------
# Specify the Starter Database SID.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl #設(shè)置SID,設(shè)置為orcl#------------------------------------------------------------------------------
# Specify the Starter Database character set.
#
# It can be one of the following:
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8
#oracle.install.db.config.starterdb.characterSet = ZHS16GBK #設(shè)置數(shù)據(jù)庫字符集為ZHS16GBK#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=true#------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=5120 #設(shè)置內(nèi)存限制為5120M#------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto the starter
# database or not.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false #設(shè)置不安裝方案樣例#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=oracle #設(shè)置所有的安裝密碼為oracle,為了方便起見,所有的密碼都設(shè)置為oracle#-------------------------------------------------------------------------------
# This variable indicates whether to receive email notification for critical
# alerts when using DB control.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false #關(guān)閉郵件提醒功能#------------------------------------------------------------------------------
# This variable is to be set to false if automated backup is not required. Else
# this can be set to true.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.enable=false #關(guān)閉自動(dòng)備份功能#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_SYSTEM
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=oracle #設(shè)置ASMSNMPP密碼為oracle,為了方便起見,所有的密碼都設(shè)置為oracle#------------------------------------------------------------------------------
# Specify whether user wants to give any proxy details for connection.
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true #設(shè)置安全更新為true
``
用oracle用戶執(zhí)行靜默安裝程序
-
切換到Oracle
su - oracle
-
進(jìn)入db_install.rsp所在的目錄
cd .tmp/database/response
-
執(zhí)行靜默安裝腳本
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/database/response/
silent參數(shù)就是靜默安裝
在安裝過程中,使用db_install.rsp中的配置。
安裝完成后,當(dāng)前終端會(huì)反饋Successfully Setup Software:
``
Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 7199 MB Passed
Checking swap space: must be greater than 150 MB. Actual 15999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-02-28_05-18-30PM. Please wait ...[oracle@gsjy-nc-db database]The following configuration scripts need to be executed as the "root" user.
!/bin/sh
Root scripts to run
/data/Oracle_Inventory/orainstRoot.sh
/data/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
- Open a terminal window
- Log in as "root"
- Run the scripts
- Return to this window and hit "Enter" key to continue
Successfully Setup Software.
Connection to 10.17.149.25 closed by remote host.
Connection to 10.17.149.25 closed.``
安裝完成后,會(huì)告訴我們下一步需要做的事情:
``
The following configuration scripts need to be executed as the "root" user.!/bin/sh
Root scripts to run
/data/Oracle_Inventory/orainstRoot.sh
/data/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
- Open a terminal window
- Log in as "root"
- Run the scripts
- Return to this window and hit "Enter" key to continue
``
安裝過程中會(huì)告訴我們安裝的日志在哪:
A log of this session is currently saved as: /tmp/OraInstall2020-02-28_04-32-40PM/installActions2020-02-28_04-32-40PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
可以新建一個(gè)Terminal查看安裝日志:
tail -f /tmp/OraInstall2020-02-28_05-04-09PM/installActions2020-02-28_05-04-09PM.log
安裝過程中可能會(huì)出現(xiàn)各種警告,可以忽略。但是出現(xiàn)[FATAL]時(shí),就是安裝失敗了。
比如我的這幾個(gè)FATAL:
1. 因?yàn)樽詣?dòng)存儲(chǔ)問題的:
重新修改了bd_install.rsp文件后解決。
``
Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 7199 MB Passed
Checking swap space: must be greater than 150 MB. Actual 15999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-02-28_05-15-12PM. Please wait ...[oracle@gsjy-nc-db database]$ [FATAL] [INS-30501] Automatic Storage Management software is not configured on this system.
CAUSE: Prior to configuring a database to use Automatic Storage Management (ASM), you must install and configure Grid Infrastructure, which includes ASM software.
ACTION: Grid Infrastructure can be installed from the separate installation media included in your media pack. Alternatively, it can be downloaded separately from Electronic Product Delivery (EPD) or the Oracle Technology Network (OTN). This is typically installed as a separate operating system user than the Oracle database and may have been installed by your system administrator. See the installation guide for more details.
A log of this session is currently saved as: /tmp/OraInstall2020-02-28_05-15-12PM/installActions2020-02-28_05-15-12PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
``
2. 因?yàn)榇疟P空間不足的:
修改了安裝目錄,把oracle安裝目錄放在了存儲(chǔ)空間比較大的/data掛載點(diǎn)上。
``
Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 7199 MB Passed
Checking swap space: must be greater than 150 MB. Actual 15999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-02-28_04-32-40PM. Please wait ...[oracle@gsjy-nc-db database]$ [FATAL] [INS-32021] Insufficient disk space on this volume for the selected Oracle home.
CAUSE: The selected Oracle home was on a volume without enough disk space.
ACTION: Choose a location for Oracle home that has enough space (minimum of 4,397MB) or free up space on the existing volume.
A log of this session is currently saved as: /tmp/OraInstall2020-02-28_04-32-40PM/installActions2020-02-28_04-32-40PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
``
執(zhí)行安裝完成后需要執(zhí)行的腳本
參照安裝完成后的提示執(zhí)行對應(yīng)的2個(gè)腳本:
``
The following configuration scripts need to be executed as the "root" user.!/bin/sh
Root scripts to run
/data/Oracle_Inventory/orainstRoot.sh
/data/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
- Open a terminal window
- Log in as "root"
- Run the scripts
- Return to this window and hit "Enter" key to continue
``
-
切換到root用戶
su - root
-
執(zhí)行/data/Oracle_Inventory/orainstRoot.sh
sh /data/Oracle_Inventory/orainstRoot.sh
-
執(zhí)行/data/u01/app/oracle/product/11.2.0/db_1/root.sh
sh /data/u01/app/oracle/product/11.2.0/db_1/root.sh
到這里,數(shù)據(jù)庫就安裝好了,但是還沒有配置監(jiān)聽程序和數(shù)據(jù)庫實(shí)例。
配置監(jiān)聽及數(shù)據(jù)庫實(shí)例
配置監(jiān)聽程序
-
切換到oracle用戶
su - oracle
-
配置DISPLAY變量,避免出現(xiàn)DISPLAY的問題
export DISPLAY=localhost:0.0
如果配置監(jiān)聽的過程中出現(xiàn)了DISPLAY問題,執(zhí)行export DISPLAY=localhost:0.0之后,重新配置就能解決。
-
執(zhí)行監(jiān)聽程序配置文件
netca -silent -responseFile /tmp/database/response/netca.rsp
-
執(zhí)行完畢后,會(huì)在/data/u01/app/oracle/product/11.2.0/db_1/network/admin中生成經(jīng)常讓我們頭疼的兩個(gè)文件listener.ora和sqlnet.ora
ll /data/u01/app/oracle/product/11.2.0/db_1/network/admin
-
切換到root用戶,檢查監(jiān)聽程序的1521端口是否被占用
su - oracle netstat - tnulp | grep 152
配置數(shù)據(jù)庫實(shí)例
-
切換到root用戶后,修改dbca.rsp文件
su - root vi /tmp/database/response/dbca.rsp
-
修改dbca.rsp中的如下配置:
GDBNAME = "orcl" SID = "orcl" SYSPASSWORD = "oracle" SYSTEMPASSWORD = "oracle" SYSMANPASSWORD = "oracle" DBSNMPPASSWORD = "oracle" DATAFILEDESTINATION =/data/u01/app/oracle/oradata RECOVERYAREADESTINATION=/data/u01/app/oracle/fast_recovery_area CHARACTERSET = "AL32UTF8" TOTALMEMORY = "1638" SOURCEDB = "orcl"
-
切換到oracle用戶,靜默安裝數(shù)據(jù)庫實(shí)例orcl
su - oracle dbca -silent -responseFile /tmp/database/response/dbca.rsp
-
檢查數(shù)據(jù)庫實(shí)例
ps -ef | grep ora_ | grep -v grep
輸出結(jié)果:
oracle 6468 1 0 14:25 ? 00:00:00 ora_w000_orcl oracle 20318 1 0 Feb28 ? 00:00:14 ora_pmon_orcl oracle 20320 1 0 Feb28 ? 00:01:54 ora_vktm_orcl oracle 20324 1 0 Feb28 ? 00:00:03 ora_gen0_orcl oracle 20326 1 0 Feb28 ? 00:00:05 ora_diag_orcl oracle 20328 1 0 Feb28 ? 00:00:05 ora_dbrm_orcl oracle 20330 1 0 Feb28 ? 00:00:04 ora_psp0_orcl oracle 20332 1 0 Feb28 ? 00:00:58 ora_dia0_orcl oracle 20334 1 0 Feb28 ? 00:00:04 ora_mman_orcl oracle 20336 1 0 Feb28 ? 00:00:10 ora_dbw0_orcl oracle 20338 1 0 Feb28 ? 00:00:11 ora_lgwr_orcl oracle 20340 1 0 Feb28 ? 00:00:24 ora_ckpt_orcl oracle 20342 1 0 Feb28 ? 00:00:06 ora_smon_orcl oracle 20344 1 0 Feb28 ? 00:00:01 ora_reco_orcl oracle 20346 1 0 Feb28 ? 00:00:22 ora_mmon_orcl oracle 20348 1 0 Feb28 ? 00:00:36 ora_mmnl_orcl oracle 20350 1 0 Feb28 ? 00:00:01 ora_d000_orcl oracle 20352 1 0 Feb28 ? 00:00:01 ora_s000_orcl oracle 20386 1 0 Feb28 ? 00:00:01 ora_qmnc_orcl oracle 20400 1 0 Feb28 ? 00:00:24 ora_cjq0_orcl oracle 20404 1 0 Feb28 ? 00:00:01 ora_q001_orcl oracle 20501 1 0 Feb28 ? 00:00:05 ora_smco_orcl oracle 21529 1 0 Feb28 ? 00:00:02 ora_q002_orcl oracle 31956 1 0 05:59 ? 00:00:23 ora_vkrm_orcl
查看監(jiān)聽狀態(tài)
配置完成監(jiān)聽程序和數(shù)據(jù)庫實(shí)例后,查看監(jiān)聽狀態(tài):
lsnrctl stat
監(jiān)聽狀態(tài)輸出:
``
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-3月 -2020 13:02:12Copyright (c) 1991, 2009, Oracle. All rights reserved.
正在連接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
別名 LISTENER
版本 TNSLSNR for Linux: Version 11.2.0.1.0 - Production
啟動(dòng)日期 28-2月 -2020 19:25:03
正常運(yùn)行時(shí)間 1 天 17 小時(shí) 37 分 8 秒
跟蹤級(jí)別 off
安全性 ON: Local OS Authentication
SNMP OFF
監(jiān)聽程序參數(shù)文件 /data/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
監(jiān)聽程序日志文件 /data/u01/app/oracle/diag/tnslsnr/gsjy-nc-db/listener/alert/log.xml
監(jiān)聽端點(diǎn)概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= # 隱藏掉主機(jī)名)(PORT=1521)))
服務(wù)摘要..
服務(wù) "orcl" 包含 1 個(gè)實(shí)例。
實(shí)例 "orcl", 狀態(tài) READY, 包含此服務(wù)的 1 個(gè)處理程序...
服務(wù) "orclXDB" 包含 1 個(gè)實(shí)例。
實(shí)例 "orcl", 狀態(tài) READY, 包含此服務(wù)的 1 個(gè)處理程序...
命令執(zhí)行成功
``