当前位置: 首页 > article >正文

在Linux上安装Oracle 数据库 11g (含静默方式安装)

好久没碰11g了,今天(2023年11月16日)因为有个需求又装了一遍。

在OCI上安装了一个Oracle Linux 6实例:

$ uname -a
Linux instance-20231116-1239-db11g 4.1.12-124.80.1.el6uek.x86_64 #2 SMP Mon Oct 9 02:32:10 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux

安装数据库预配置包:

$ sudo yum install oracle-rdbms-server-11gR2-preinstall.x86_64

$ id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)

$ id grid
id: grid: No such user

上传11.2.0.4介质,利用dbca安装数据库软件。以下为部分截图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
如果嫌使用dbca图形界面安装数据库软件慢,可以使用静默方式。在解压目录的response目录中就有样例文件db_install.rsp。

我只修改了下面的条目:

oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
oracle.installer.autoupdates.option=SKIP_UPDATES

完整的响应文件如下:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/home/oracle/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=

静默安装命令如下,响应文件需要指定绝对路径:

./runInstaller -silent -showProgress -responseFile /home/oracle/media/database/response/db_install.rsp

完成后记得执行root的两个脚本。

配置~oracle/.bash_profile,追加以下语句:

export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1/
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl

使用DBCA静默模式创建数据库orcl:

dbca -silent -createDatabase \
 -templateName General_Purpose.dbc \
 -gdbname orcl -sid orcl -responseFile NO_VALUE \
 -characterSet AL32UTF8 \
 -sysPassword Welcome1 \
 -systemPassword Welcome1 \
 -databaseType MULTIPURPOSE \
 -memoryPercentage 20 \
 -storageType FS \
 -datafileDestination "/home/oracle/app/oracle/oradata/" \
 -redoLogFileSize 200 \
 -emConfiguration NONE
 
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/home/oracle/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

11g创建数据库的速度比19c快多了。

现在已经有数据库条目了:

$ tail -1 /etc/oratab
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

可以登录数据库了:

$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base remains unchanged with value /home/oracle/app/oracle

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 16 07:36:36 2023

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

再创建一个数据库orcl2:

dbca -silent -createDatabase \
 -templateName General_Purpose.dbc \
 -gdbname orcl2 -sid orcl2 -responseFile NO_VALUE \
 -characterSet AL32UTF8 \
 -sysPassword Welcome1 \
 -systemPassword Welcome1 \
 -databaseType MULTIPURPOSE \
 -memoryPercentage 20 \
 -storageType FS \
 -datafileDestination "/home/oracle/app/oracle/oradata/" \
 -redoLogFileSize 200 \
 -emConfiguration NONE

安装2个数据库后的空间使用情况:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        38G   20G   17G  55% /
tmpfs           7.5G     0  7.5G   0% /dev/shm
/dev/sda1       200M  276K  200M   1% /boot/efi

数据库条目:

$ tail -2 /etc/oratab
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N
orcl2:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

最后,记得启动监听:

$ lsnrctl start

$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 16-NOV-2023 10:56:01

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                16-NOV-2023 10:52:36
Uptime                    0 days 0 hr. 3 min. 24 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=instance-20231116-1757-oracledb-11204.sub07290808380.training.orP)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl2" has 1 instance(s).
  Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orcl2XDB" has 1 instance(s).
  Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

参考

  • How to Create a 11g Database by DBCA with Silent Mode

http://www.kler.cn/news/134148.html

相关文章:

  • 浅析AcrelEMS-CIA机场智慧能源管平台解决方案-安科瑞 蒋静
  • Kafka 集群实现数据同步
  • Spring 配置
  • 【案例】可视化大屏
  • 度加创作工具 演示
  • 深入理解注意力机制(下)——缩放点积注意力及示例
  • 前端uniapp列表下拉到底部加载下一页列表【下拉加载页面/带源码/实战】
  • 【洛谷 P1182】数列分段 Section II 题解(二分答案+循环)
  • WSL 2 更改默认安装的 Linux 发行版
  • 基于单片机C51全自动洗衣机仿真设计
  • 异常语法详解
  • 飞鼠异地组网工具实战之访问k8s集群内部服务
  • 如何在虚拟机的Ubuntu22.04中设置静态IP地址
  • Vue3+ElementPlus纯前端分页(手撕分页),无需修改后端
  • 全新云开发工具箱:融合多项功能的微信小程序源码解决方案
  • 深眸科技革新升级OCR技术,与AI视觉实现有效融合赋能各行业应用
  • 选择最适合你的框架和语言,打造出色的Windows界面程序
  • Java学习笔记43——函数式接口
  • C++多线程编程(1):线程的创建方式
  • Node.js之TCP(net)
  • python 词云 wordcloud使用paddle模式 庆余年人物分析--不是特别准,可以看着玩一玩
  • 基于深度学习的单帧图像超分辨率重建综述
  • Postman接收列表、数组参数@RequestParam List<String> ids
  • C练习题_13
  • Zabbix实现故障自愈
  • rabbitmq默认交换机锁绑定的routingkey-待研究
  • ICASSP2023年SPGC多语言AD检测的论文总结
  • 算法设计与分析复习--贪心(二)
  • 开源更安全? yum源配置/rpm 什么是SSH?
  • yolov5模型代码怎么修改