手把手教你在命令行(静默)部署oracle 11gR2


文章目录

    • 环境介绍
      • linux发行版
      • cpu、内存以及磁盘空间
    • 敲黑板
      • 关闭防火墙以及selinux
    • 操作系统配置
      • 使用阿里的yum源提速
      • 安装依赖软件
      • 设置用户最大进程数以及最大文件打开数
      • 内核参数优化
      • 开启swap分区
      • 创建用户及用户组
      • 赋权及目录创建
      • 设置环境变量
    • 安装oracle
      • 解压安装包
      • 备份配置文件
      • 开始安装
      • 配置oracle监听文件
      • 配置oracle数据库
        • 修改建库配置文件
        • 创建dbca数据库
      • 启动oracle数据库
        • 进入oracle
        • 验证oracle

Oracle 11g 静默安装-db_install.rsp详解

cat <<EOF > database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=bigdata06
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/app/oracle/11gR2
ORACLE_BASE=/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=oracle11g
oracle.install.db.config.starterdb.SID=oracle11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
DECLINE_SECURITY_UPDATES=true
EOF

开始安装

cd database/
./runInstaller -silent -responseFile /app/oracle/database/response/db_install.rsp -ignorePrereq

执行成功后,会有下面的输出(这里给一个免费的建议,新开一个终端去查看日志情况)

You can find the log of this install session at:
 /app/oracle/oraInventory/logs/installActions2021-09-26_02-23-09PM.log

出现如下的回显,表示安装已经完成了

这里需要新开一个终端,以root用户执行下面给出的两个脚本

两个脚本执行完成后,回到oracle用户安装的这个终端敲回车就可以了

The following configuration scripts need to be executed as the "root" user.
 #!/bin/sh
 #Root scripts to run

/app/oracle/oraInventory/orainstRoot.sh
/app/oracle/11gR2/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.

配置oracle监听文件

注意:后面的操作,都是使用oracle用户

cd /app/oracle/database/response
netca /silent /responsefile /app/oracle/database/response/netca.rsp

执行完成后,在/app/oracle/11gR2/network/admin目录下会生成两个文件

listener.ora

sqlnet.ora

ss -nltp | grep 1521

能过滤得到信息,说明监听器已经正常工作了

LISTEN     0      128       [::]:1521                  [::]:*                   users:(("tnslsnr",pid=10836,fd=11))

如果监听器没有启动,则需要手动启动,启动方式如下

/app/oracle/11gR2/bin/lsnrctl start LISTENER

配置oracle数据库

修改建库配置文件

vim /app/oracle/database/response/dbca.rsp
78行(SID+主机域名):
GDBNAME = "oracle11g.myoracle"

149行(SID):# 与环境变量里面的设置的SID要一致
SID = "oracle11g"

190行:
SYSPASSWORD = "oracle"

200行:
SYSTEMPASSWORD = "oracle"

415行:
CHARACTERSET = "AL32UTF8"

425行:
NATIONALCHARACTERSET= "UTF8"

创建dbca数据库

$ORACLE_HOME/bin/dbca -silent -responseFile /app/oracle/database/response/dbca.rsp

启动oracle数据库

进入oracle

sqlplus / as sysdba
start

验证oracle

select * from tab;