Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤

注:如果没有下载数据库安装包,以下提供下载链接

oracle11g数据库下载地址

1.如果是刚安装的系统,需要检查依赖包安装

rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.17 glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

2.安装依赖包

如果yum安装较慢建议切换阿里yum源

yum源切换

先安装wget命令 
yum install wget -y   #wget命令就是在线下载一个url的静态资源

再执行
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

注:切换之前建议先备份 /etc/yum.repos.d 中的文件

yum install compat-libstdc++-33 -y
yum install elfutils-libelf-devel -y
yum install gcc-c++ -y
yum install glibc-* -y
yum install ksh -y
yum install libaio -y
yum install libaio-devel -y
yum install libstdc++-devel -y
yum install unixODBC -y
yum install unixODBC-devel -y

3.创建需要的用户和用户组

groupadd oinstall  
groupadd dba  
groupadd asmadmin  
groupadd asmdba  
useradd -g oinstall -G dba,asmdba oracle -d /home/oracle  
passwd oracle

4.修改linux内核参数并关闭selinux、防火墙

vim /etc/sysctl.conf  增加或者修改

具体参数参考如下:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
关闭selinux
vim /etc/selinux/config
设置SELINUX=disabled

关闭防火墙
systemctl stop firewalld

5.修改/etc/security/limits.conf文件、/etc/pam.d/login文件、/etc/profile文件

vim /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文件

vim /etc/pam.d/login 

添加以下内容

session  required   /lib64/security/pam_limits.so
session  required   pam_limits.so

修改/etc/profile文件

 vim /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

使profile文件生效

source /etc/profile

6.创建数据库相关目录并授权、修改/etc/oraInst.loc文件

mkdir -p /u01/app/
chown -R oracle:oinstall /home/oracle  
chmod -R 775 /home/oracle  
chown -R oracle:oinstall /u01/app/ 
chmod -R 775 /u01/app/

添加/etc/oraInst.loc文件并授权

vim /etc/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc

7.切换的oracle用户,并设置用户环境变量

su - oracle

设置如下:

vim ~/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl

使其生效

source /home/oracle/.bash_profile

8.上传已经下载好的数据库安装包到linux任意目录并解压,我这里解压到的是/home/oracle/目录

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

9.切换到root用户并授权相关文件

su - root
cd /home/oracle/ 
mkdir etc
cp /home/oracle/database/response/* /home/oracle/etc/
chmod 777 /home/oracle/etc/*.rsp

10.切换到oracle用户,配置数据库安装文件

su - oracle
vim /home/oracle/etc/db_install.rsp

配置如下:

oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=主机名
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
#这里必须填ture
DECLINE_SECURITY_UPDATES=true

11.执行安装

./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp -ignorePrereq

此处会卡住,安装完成会出现以下情况则安装成功,若未出现可查看日志文件
Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤_第1张图片

12.安装完成后切换到root用户

su root
执行
sh /u01/app/oracle/product/11.2.0/db_1/root.sh

13.切换成oracle用户配置环境变量

su - oracle
vim ~/.bash_profile

添加配置如下:

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=oracle
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data

使.bash_profile文件生效

source ~/.bash_profile 

14.安装数据库实例,配置dbca.rsp文件

vim /home/oracle/etc/dbca.rsp

配置如下:

GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"

其中TOTALMEMORY = "1638" 为1638MB,物理内存2G*80%。```

15.安装数据库实例

dbca -silent -responseFile /home/oracle/etc/dbca.rsp

出现以下文字则安装成功
Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤_第2张图片
实例进程检查

ps -ef | grep ora_ | grep -v grep

Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤_第3张图片

16.监听配置,切换到oracle用户

su - oracle
配置监听
netca /silent /responsefile /home/oracle/database/response/netca.rsp

监听配置成功后如下:
Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤_第4张图片
查看监听状态

netstat -tnulp | grep 1521

监听状态
如果出现以下情况
监听状态显示异常
切换到root用户执行以下操作即可

chmod +s /bin/netstat

17.安装完成,使用sqlplus连接测试

sqlplus system/****

Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤_第5张图片

注:如果以上11步出现以下错误,可使用命令行方式安装

静默安装报错:

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 7328 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-02-16_10-55-12PM. Please wait ...[oracle@Oracle111 database]$ [FATAL] [INS-10105] The given response file /data1/database/response/myinstall.rsp is not valid.
   CAUSE: Syntactically incorrect response file. Either unexpected variables are specified or expected variables are not specified in the response file.
   ACTION: Refer the latest product specific response file template
   SUMMARY:
       - cvc-complex-type.2.4.b: The content of element 'properties' is not complete. One of '{"":oracle.install.db.CLUSTER_NODES, "":oracle.install.db.isRACOneInstall, "":oracle.install.db.racOneServiceName, "":oracle.install.db.OPER_GROUP, "":oracle.install.db.config.starterdb.type, "":oracle.install.db.config.starterdb.SID, "":oracle.install.db.config.starterdb.globalDBName, "":oracle.install.db.config.starterdb.characterSet, "":oracle.install.db.config.starterdb.memoryLimit, "":oracle.install.db.config.starterdb.enableSecuritySettings, "":oracle.install.db.config.starterdb.installExampleSchemas, "":oracle.install.db.config.starterdb.memoryOption, "":oracle.install.db.config.starterdb.storageType, "":oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation, "":oracle.install.db.config.starterdb.fileSystemStorage.dataLocation, "":oracle.install.db.config.starterdb.password.ALL, "":oracle.install.db.config.starterdb.password.SYS, "":oracle.install.db.config.starterdb.password.DBSNMP, "":oracle.install.db.config.starterdb.password.SYSMAN, "":oracle.install.db.config.starterdb.password.SYSTEM, "":oracle.install.db.config.starterdb.control, "":oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL, "":oracle.install.db.config.starterdb.automatedBackup.enable, "":oracle.install.db.config.starterdb.automatedBackup.osuid, "":oracle.install.db.config.starterdb.automatedBackup.ospwd, "":oracle.install.db.config.asm.diskGroup, "":oracle.install.db.config.asm.ASMSNMPPassword, "":SECURITY_UPDATES_VIA_MYORACLESUPPORT, "":DECLINE_SECURITY_UPDATES, "":MYORACLESUPPORT_USERNAME, "":MYORACLESUPPORT_PASSWORD, "":PROXY_PORT, "":PROXY_HOST, "":PROXY_USER, "":PROXY_PWD, "":COLLECTOR_SUPPORTHUB_URL, "":AUTOUPDATES_MYORACLESUPPORT_USERNAME, "":AUTOUPDATES_MYORACLESUPPORT_PASSWORD, "":oracle.installer.autoupdates.option, "":oracle.installer.autoupdates.downloadUpdatesLoc}' is expected.

A log of this session is currently saved as: /tmp/OraInstall2011-02-16_10-55-12PM/installActions2011-02-16_10-55-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.

命令行安装

./runInstaller -silent -ignorePrereq -debug -force \
FROM_LOCATION=/data/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
NVENTORY_LOCATION=/u01/app/oracle/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 \
ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=oinstall \
oracle.install.db.config.starterdb.characterSet=ZHS16GBK \
oracle.install.db.config.starterdb.memoryLimit=512 \
oracle.install.db.config.starterdb.password.ALL=password \
DECLINE_SECURITY_UPDATES=true

以上就是linux下静默安装oracle11g 11.2.0 的全部过程,欢迎参考!!!

你可能感兴趣的:(Linux,数据库,oracle)