[toc]
前提准备
系统信息
cat /etc/redhat-release
结果:
Red Hat Enterprise Linux Server release 7.4 (Maipo)
网络代理(非必须)
由于Linux网络的限制(无法直接使用ftp访问外网),所以计划用代理的形式从外网的ftp服务器下载文件。
设置代理服务器:
vi /etc/wgetrc
添加http_proxy、https_proxy、ftp_proxy的代理服务,并打开使用代理use_proxy的开关:
# 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
设置完成之后,使之生效:
source /etc/profile
或重启系统生效。
下载Oracle 11g R2 for Linux
百度搜索Oracle 11g R2 for Linux就能检索到。
进入Oracle官网后,下载两个压缩包:
- inux.x64_11gR2_database_1of2.zip
- linux.x64_11gR2_database_2of2.zip
这两个压缩包都得下载!
Linux安装ZModem
有时候受限于网络环境,Linux服务器可能没有搭建好FTP服务或者没有开通FTP端口,故使用ZModem进行传输。个人认为ZModem还是比较方便的。
PS:实际上是在项目实施的过程中,和客户沟通开通FTP太困难,也不给做图形化界面,对于一个不太懂Linux服务的我来说简直头疼。无奈之下,拜了拜度娘,找到了使用ZModem传输。
我用的是MBP,本想用scp直接上传文件,不料没成功,所以用了PD中的Windows后,再安装了Xshell,毕竟Xshell的ZModem功能在Mac系统中调不出打开文件的窗口。
安装lrzsz
yum inistall lrzsz
在Xshell中配置Zmodem
** ZModem使用说明:**
rz #在Linux系统中使用rz命令,将Windows系统的文件上传到Linux系统当前文件夹中
sz #把Linux系统中的文件下载到本地的Windows系统
如:
把Linux服务器的文件下载到Windows,使用sz命令:
sz linux.x64_11gR2_database_1of2.zip
上传并解压Oracle安装包
-
上传安装包
进入/tmp目录后,键入命令rz后,会弹出选择文件的窗口,选择Oracle数据库的两个压缩包就好。
-
解压安装包
将两个压缩包解压到/tmp目录下:unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip
两个zip压缩包都解压出来,自动合并到database目录中了。
配置主机名与IP的映射关系
-
查看主机名
hostname
主机名会在hosts中配置与IP的对应关系,留着备用。
-
查看ip地址
ifconfig
IP会在hosts中配置与主机名的对应关系,留着备用。
-
修改主机名与IP对应
vi /etc/hosts
在最后添加主机名与IP的对应关系:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 IP hostname #添加IP与主机名称的映射关系
关闭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
-
检查已经安装好的依赖包
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"
如果所有的依赖包都安装成功了,执行者条命令的时候会没有输出结果;
如果有输出结果,必然会没有安装好所有的依赖包,可以执行这个命令再安装一下:
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
安装完成后再执行「检查没有安装的依赖包」命令。
关闭防火墙
-
关闭防火墙
systemctl stop firewalld #关闭防火墙
-
检查防火墙状态
systemctl status firewalld
关闭状态位Active: inactive (dead)
â 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)
-
关闭自动启动防火墙服务
systemctl disable firewalld #关闭自动启动防火墙服务
创建并配置组、用户信息
Oracle数据库需要在oracle用户下安装,所以需要创建一个oracle用户,并将其加入到相应的用户组中。
-
创建oinstall组
Unix groupadd oinstall #创建oinstall组
-
创建dba组
groupadd dba #创建dba组
-
创建用户oracle,并将其添加到oinstall组合dba组
useradd - g oinstall -G dba oracle
创建完成后,可使用如下命令查看oracle用户的信息:
id oracle
输出像这样的结果:
uid=1001(oracle) gid=1004(oinstall) groups=1004(oinstall),1005(dba)
创建完成后,我们需要在root用户和oracle用户之间切来切去。
修改内核参数
vi /etc/sysctl.conf
在文件末添加如下参数:
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
执行脚本使内核参数生效:
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
文件中添加如下内容:
\## 以下部分为添加的内容 if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi \## 以上部分为添加的内容
创建安装目录
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
由于在安装过程中发现u01挂载的空间不足,不满足安装条件,所以把安装路径修改到了有1000G的/data下
修改目录所属用户
将 data/u01/app/oracle目录的所有者修改为oinstall组的oracle用户:
chown -R oracle:oinstall /data/u01/app/oracle
修改目录权限
为/data/u01/app/oracle目录设置775权限:
chmod -R 775 /data/u01/app/oracle
延伸:
chmod是Linux系统中设置文件权限的命令,一般是由3个数字组成:
第一个数字表示文件所有者的权限
第二个数字表示与文件所有者同属一个用户组的其他用户的权限
第三个数字表示其它用户组的权限。
权限分为三种:读(r=4),写(w=2),执行(x=1)
综合起来还有可读可执行(rx=5=4+1)、可读可写(rw=6=4+2)、可读可写可执行(rwx=7=4+2+1)。
如果没有设置目录权限,在安装的过程中会提示oracle用户没有权限。到时候再切回到root用户设置权限也行。
静默安装Oracle数据库
设置oracle用户的环境变量
-
切换到oracle用户
su - oracle
-
设置环境变量:
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的实例名称 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
-
进入到/tmp/database/response文件夹:
cd /tmp/database/response/
-
编辑db_install.rsp
db_install.rsp文件安装数据库时读取的配置文件,类似于在使用图形化安装时进行的配置,只不过在静默安装时,需要事先配置好,否则就没法安装了。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 #只安装数据库#-------------------------------------------------------------------------------
# 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= #这里写自己的主机名#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall #指定要安装到的组,前面创建的oinstall组#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/data/Oracle_Inventory #设置INVENTORY目录,不能与oracle的安装目录中u01中,否则安装的时候会抛出报错,所以事先在这里设置好#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.
## Example : SELECTED_LANGUAGES=en,fr,ja
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN,zh_TW #设置支持的语言,这里我设置了英文、简体中文、繁体中文_台湾#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/db_1 #ORACLE_HOME的路径,就是我们前面创建的ORACLE_HOME目录#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#------------------------------------------------------------------------------
ORACLE_BASE=/data/u01/app/oracle #设置Oracle的根目录,就是我们前面创建的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 #设置安装版本,选择企业版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 #设置要授权的组,用dba组#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=oinstall #设置要授权的操作组,用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 #设置数据库类型,用通用
#DATA_WAREHOUSE 数据仓库#------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl #设置全局实例名为:orcl#------------------------------------------------------------------------------
# Specify the Starter Database SID.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl #设置SID,设置为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 #设置数据库字符集为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 #设置内存限制为5120M#------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto the starter
# database or not.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false #设置不安装方案样例#------------------------------------------------------------------------------
# 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 #设置所有的安装密码为oracle,为了方便起见,所有的密码都设置为oracle#-------------------------------------------------------------------------------
# This variable indicates whether to receive email notification for critical
# alerts when using DB control.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false #关闭邮件提醒功能#------------------------------------------------------------------------------
# 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 #关闭自动备份功能#-------------------------------------------------------------------------------
# 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 #设置ASMSNMPP密码为oracle,为了方便起见,所有的密码都设置为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 #设置安全更新为true
``
用oracle用户执行静默安装程序
-
切换到Oracle
su - oracle
-
进入db_install.rsp所在的目录
cd .tmp/database/response
-
执行静默安装脚本
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/database/response/
silent参数就是静默安装
在安装过程中,使用db_install.rsp中的配置。
安装完成后,当前终端会反馈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.``
安装完成后,会告诉我们下一步需要做的事情:
``
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
``
安装过程中会告诉我们安装的日志在哪:
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.
可以新建一个Terminal查看安装日志:
tail -f /tmp/OraInstall2020-02-28_05-04-09PM/installActions2020-02-28_05-04-09PM.log
安装过程中可能会出现各种警告,可以忽略。但是出现[FATAL]时,就是安装失败了。
比如我的这几个FATAL:
1. 因为自动存储问题的:
重新修改了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. 因为磁盘空间不足的:
修改了安装目录,把oracle安装目录放在了存储空间比较大的/data挂载点上。
``
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.
``
执行安装完成后需要执行的脚本
参照安装完成后的提示执行对应的2个脚本:
``
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
-
执行/data/Oracle_Inventory/orainstRoot.sh
sh /data/Oracle_Inventory/orainstRoot.sh
-
执行/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
到这里,数据库就安装好了,但是还没有配置监听程序和数据库实例。
配置监听及数据库实例
配置监听程序
-
切换到oracle用户
su - oracle
-
配置DISPLAY变量,避免出现DISPLAY的问题
export DISPLAY=localhost:0.0
如果配置监听的过程中出现了DISPLAY问题,执行export DISPLAY=localhost:0.0之后,重新配置就能解决。
-
执行监听程序配置文件
netca -silent -responseFile /tmp/database/response/netca.rsp
-
执行完毕后,会在/data/u01/app/oracle/product/11.2.0/db_1/network/admin中生成经常让我们头疼的两个文件listener.ora和sqlnet.ora
ll /data/u01/app/oracle/product/11.2.0/db_1/network/admin
-
切换到root用户,检查监听程序的1521端口是否被占用
su - oracle netstat - tnulp | grep 152
配置数据库实例
-
切换到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用户,静默安装数据库实例orcl
su - oracle dbca -silent -responseFile /tmp/database/response/dbca.rsp
-
检查数据库实例
ps -ef | grep ora_ | grep -v grep
输出结果:
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
查看监听状态
配置完成监听程序和数据库实例后,查看监听状态:
lsnrctl stat
监听状态输出:
``
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
启动日期 28-2月 -2020 19:25:03
正常运行时间 1 天 17 小时 37 分 8 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /data/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
监听程序日志文件 /data/u01/app/oracle/diag/tnslsnr/gsjy-nc-db/listener/alert/log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= # 隐藏掉主机名)(PORT=1521)))
服务摘要..
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
``