• 在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
    
    • 1
    • 2

    安装数据库预配置包:

    $ 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    上传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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    完整的响应文件如下:

    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=
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38

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

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

    完成后记得执行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
    
    • 1
    • 2
    • 3
    • 4

    使用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.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36

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

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

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

    可以登录数据库了:

    $ . 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    再创建一个数据库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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    安装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
    
    • 1
    • 2
    • 3
    • 4
    • 5

    数据库条目:

    $ 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
    
    • 1
    • 2
    • 3

    最后,记得启动监听:

    $ 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31

    参考

  • 相关阅读:
    JavaScript 数组
    Spring Boot 集成 EasyExcel 3.x 优雅实现Excel导入导出
    win10 ping localhost 的IP被解析为::1
    基于JavaSwing开发记事本程序(新功能替换查找撤销状态栏) 课程设计 大作业源码
    Android无障碍自动化结合opencv实现支付宝能量自动收集
    【C语言进阶】简易通讯录的实现
    Matlab如何批量读取txt数据?科研效率UpUp第1期
    Avalonia 中的样式和控件主题
    腾讯X5浏览器内核静态集成方案
    Google Archive Patch 基础应用代码记录
  • 原文地址:https://blog.csdn.net/stevensxiao/article/details/134439308