暂无图片
暂无图片
8
暂无图片
暂无图片
暂无图片

Oracle 12C静默安装:简化安装流程,提高效率!

2123

目录

一、前言

  在实际部署中,为了提高安装效率和简化操作流程,静默安装技术变得越来越重要。本文详细介绍了在Red Hat Linux 7.6文件系统中使用响应文件静默安装Oracle 12CR2数据库的步骤以及响应文件的概念和作用,通过本文的学习,读者可以轻松掌握在Linux 7.6文件系统中使用响应文件静默安装Oracle 12CR2数据库的技巧和方法。使用响应文件可以减少手动配置的繁琐过程,提高安装的一致性和效率。希望本文能为读者在搭建Oracle数据库环境时提供指导和帮助,使其能够顺利完成安装工作,并为后续的数据库应用开发提供良好的基础。

二、安装前准备工作

1、硬件要求

1.1、内存要求

最低:1 GB 内存 建议:2 GB 或更多内存 [root@hellodba ~]# grep MemTotal /proc/meminfo MemTotal: 2851852 kB

1.2、Swap Space

        RAM       Swap Space
在1GB到2GB之间 RAM大小的1.5倍
2GB到16GB之间 等于RAM的大小
超过16GB 等于16GB
[root@hellodba ~]# grep SwapTotal /proc/meminfo SwapTotal: 3170300 kB

1.3、Automatic Memory Management

  从Oracle Database 11g开始,自动内存管理功能需要更多的共享内存(/dev/shm)和文件描述符。在Linux系统中,’/dev/shm’目录是一个特殊的目录,用于实现共享内存,默认是系统内存的50%。它是一个临时文件系统,通常位于RAM(内存)中,而不是硬盘上,并且在系统重启时会被清空。因此,’/dev/shm’目录只适合用于短期存储和进程间通信,不能用于长期存储数据。’/dev/shm’大小应该大于SGA+PGA的总内存大小,在Linux系统上,如果操作系统’/dev/shm’装载大小对于Oracle系统全局区域(SGA)和程序全局区域(PGA)来说太小,则会导致ORA-00845错误。

1.4、磁盘空间要求

目录/tmp至少有1GB空间,如果小于所需空间,请从目录中删除不必要的文件满足磁盘空间需求。
[root@hellodba ~]# df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 4.3G 53G 8% /

       安装类型   软件文件的磁盘空间要求(GB)
企业版 7.5
标准版 7.5
Grid 8.6
 
[root@hellodba ~]# df -h /u01 Filesystem Size Used Avail Use% Mounted on /dev/sdb1 50G 33M 50G 1% /u01

2、软件要求

2.1、适用于 Linux x86-64 操作系统要求

//需要以下或更高版本的操作系统: Supported Oracle Linux 8 Distributions for x86-64 Supported Oracle Linux 7 Distributions for x86-64 Supported Oracle Linux 6 Distributions for x86-64 Supported Red Hat Enterprise Linux 8 Distributions for x86-64 Supported Red Hat Enterprise Linux 7 Distributions for x86-64 Supported Red Hat Enterprise Linux 6 Distributions for x86-64 Supported SUSE Linux Enterprise Server 15 Distributions for x86-64 Supported SUSE Linux Enterprise Server 12 Distributions for x86-64 Supported NeoKylin Linux Advanced Server 7 Distributions for x86-64
[root@hellodba ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.6 (Maipo)

2.2、适用于 Linux x86-64 内核要求

Oracle Linux 8.2 with the Unbreakable Enterprise Kernel 6: 5.4.17-2011.1.2.el8uek.x86_64 or later Oracle Linux 8.2 with the Red Hat Compatible Kernel: 4.18.0-193.19.1.el8_2.x86_64 or later Oracle Linux 7 with the Unbreakable Enterprise Kernel 3: 3.8.13-35.3.1.el7uek.x86_64 or later Oracle Linux 7.2 with the Unbreakable Enterprise Kernel 4: 4.1.12-32.2.3.el7uek.x86_64 or later Oracle Linux 7 with the Red Hat Compatible kernel: 3.10.0-123.el7.x86_64 or later Oracle Linux 6.4 with the Unbreakable Enterprise Kernel 2: 2.6.39-400.211.1.el6uek.x86_64or later Oracle Linux 6.6 with the Unbreakable Enterprise Kernel 3: 3.8.13-44.1.1.el6uek.x86_64 or later Oracle Linux 6.8 with the Unbreakable Enterprise Kernel 4: 4.1.12-37.6.2.el6uek.x86_64 or later Oracle Linux 6.4 with the Red Hat Compatible kernel: 2.6.32-358.el6.x86_64 or later Red Hat Enterprise Linux 8.2: 4.18.0-193.19.1.el8_2.x86_64 or later Red Hat Enterprise Linux 7: 3.10.0-123.el7.x86_64 or later Red Hat Enterprise Linux 6.4: 2.6.32-358.el6.x86_64 or later SUSE Linux Enterprise Server 15: 4.12.14-25-default or later SUSE Linux Enterprise Server 12 SP1: 3.12.49-11.1 or later NeoKylin Linux Advanced Server 7: 3.10.0-693.el7.x86_64 or later
[root@hellodba ~]# uname -r 3.10.0-957.el7.x86_64

2.3、适用于 Linux x86-64 的 Oracle 数据库包要求

//Packages for Oracle Linux 7 bc binutils-2.23.52.0.1-12.el7 (x86_64) compat-libcap1-1.10-3.el7 (x86_64) compat-libstdc++-33-3.2.3-71.el7 (i686) compat-libstdc++-33-3.2.3-71.el7 (x86_64) glibc-2.17-36.el7 (i686) glibc-2.17-36.el7 (x86_64) glibc-devel-2.17-36.el7 (i686) glibc-devel-2.17-36.el7 (x86_64) ksh libaio-0.3.109-9.el7 (i686) libaio-0.3.109-9.el7 (x86_64) libaio-devel-0.3.109-9.el7 (i686) libaio-devel-0.3.109-9.el7 (x86_64) libX11-1.6.0-2.1.el7 (i686) libX11-1.6.0-2.1.el7 (x86_64) libXau-1.0.8-2.1.el7 (i686) libXau-1.0.8-2.1.el7 (x86_64) libXi-1.7.2-1.el7 (i686) libXi-1.7.2-1.el7 (x86_64) libXtst-1.2.2-1.el7 (i686) libXtst-1.2.2-1.el7 (x86_64) libXrender (i686) libXrender (x86_64) libXrender-devel (i686) libXrender-devel (x86_64) libgcc-4.8.2-3.el7 (i686) libgcc-4.8.2-3.el7 (x86_64) libstdc++-4.8.2-3.el7 (i686) libstdc++-4.8.2-3.el7 (x86_64) libstdc++-devel-4.8.2-3.el7 (i686) libstdc++-devel-4.8.2-3.el7 (x86_64) libxcb-1.9-5.el7 (i686) libxcb-1.9-5.el7 (x86_64) make-3.82-19.el7 (x86_64) nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS) net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC and Oracle Clusterware) smartmontools-6.2-4.el7 (x86_64) sysstat-10.1.5-1.el7 (x86_64)

3、关闭透明页

从Red Hat Enterprise Linux 6、Oracle Linux 6、SUSE 11和Unbreakable Enterprise Kernel 2(UEK2)内核开始,Transparent HugePages在运行时默认启用。然而,透明的HugePages可能会导致内存分配延迟,因为内存是动态分配的。因此,甲骨文建议您在所有甲骨文数据库服务器上禁用透明HugePages,以避免性能问题。

//查看透明页是否启用,显示[always]表示Transparent HugePages是启用的 [root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/defrag [always] madvise never [root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never //禁用透明页 [root@hellodba ~]# vi /etc/rc.d/rc.local echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled [root@hellodba ~]# chmod +x /etc/rc.d/rc.local [root@hellodba ~]# reboot //透明页已关闭 [root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never] [root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/defrag always defer defer+madvise madvise [never]

4、配置主机名解析

[root@hellodba ~]# echo "192.168.0.55 hellodba" >> /etc/hosts [root@hellodba ~]# ping hellodba PING hellodba (192.168.0.55) 56(84) bytes of data. 64 bytes from hellodb (192.168.0.55): icmp_seq=1 ttl=64 time=0.013 ms

5、创建所需的操作系统组和用户

[root@hellodba ~]# /usr/sbin/groupadd -g 54321 oinstall [root@hellodba ~]# /usr/sbin/groupadd -g 54322 dba [root@hellodba ~]# /usr/sbin/groupadd -g 54323 oper [root@hellodba ~]# /usr/sbin/groupadd -g 54324 backupdba [root@hellodba ~]# /usr/sbin/groupadd -g 54325 dgdba [root@hellodba ~]# /usr/sbin/groupadd -g 54326 kmdba [root@hellodba ~]# useradd -u 54321 -g oinstall -G dba,backupdba,dgdba,kmdba,oper oracle [root@hellodba ~]# echo "hellodba" | passwd --stdin oracle [root@hellodba ~]# id oracle uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba)

6、配置Oracle软件安装用户的资源限制

[root@hellodba ~]# vi /etc/security/limits.conf #ORACLE SETTING #打开文件描述符大小 oracle soft nproc 16384 oracle hard nproc 16384 #单个用户可用的进程数 oracle soft nofile 16384 oracle hard nofile 65536 #进程堆栈段的大小 oracle soft stack 10240 oracle hard stack 32768

7、为Linux配置内核参数

在Oracle数据库安装期间,可以生成并运行修复脚本,以检查和设置成功安装数据库所需的内核参数值。建议手动预先修改好。

[root@hellodba ~]# vi /etc/sysctl.conf #ORACLE SETTING #可以拥有的异步IO请求数 fs.aio-max-nr = 1048576 #允许文件句柄的最大数目 fs.file-max = 6815744 #信号参数 kernel.sem = 250 32000 100 128 #IP V4的端口范围 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 = 1048586 #当系统检测到oops时,重新启动系统,以便系统能够重新初始化恢复正常工作 kernel.panic_on_oops = 1 #单个共享内存段最大值,让数据库在一个共享段里面的可以容纳整个SGA #最大值:比物理内存小1字节 #(kernel.shmmax = 物理内存*1024*1024*1024-1) kernel.shmmax = 2684354560 #控制共享内存页数(kernel.shmall = shmmax/4096) kernel.shmall = 655360 #共享内存的最大数量 kernel.shmmni = 4096 #当系统内存使用90%的时候开始使用交换页面 vm.swappiness=10 #默认是100,增大这个参数设置了虚拟内存回收directory和i-node缓冲的倾向,这个值越大。越容易回收。 vm.vfs_cache_pressure=200

8、创建所需的软件目录并授权

[root@hellodba ~]# mkdir -p /u01/app/oraInventory [root@hellodba ~]# mkdir -p /u01/app/oracle [root@hellodba ~]# mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1 [root@hellodba ~]# mkdir -p /soft [root@hellodba ~]# chown -R oracle:oinstall /u01/app/oracle [root@hellodba ~]# chown -R oracle:oinstall /u01/app/oraInventory [root@hellodba ~]# chown -R oracle:oinstall /u01/app/oracle/product/12.2.0/dbhome_1 [root@hellodba ~]# chown -R oracle:oinstall /soft [root@hellodba ~]# chmod -R 775 /u01 [root@hellodba ~]# chmod -R 775 /soft

9、关闭numa功能

//NUMA关闭前 [root@hellodba ~]# dmesg | grep -i numa [ 0.000000] NUMA: Node 0 [mem 0x00000000-0x0009ffff] + [mem 0x00100000-0xbfffffff] -> [mem 0x00000000-0xbfffffff] [ 0.000000] NUMA: Node 0 [mem 0x00000000-0xbfffffff] + [mem 0x100000000-0x1017fffff] -> [mem 0x00000000-0x1017fffff] //关闭NUMA [root@hellodba ~]# vi /etc/default/grub 将 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet" 改 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off" [root@hellodba ~]# grub2-mkconfig -o /etc/grub2.cfg [root@hellodba ~]# reboot //NUMA关闭后 [root@hellodba ~]# dmesg | grep -i numa [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-957.el7.x86_64 root=UUID=0b2b469a-f4ed-42aa-919e-e02405ab8051 ro crashkernel=auto rhgb quiet numa=off [ 0.000000] NUMA turned off [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-957.el7.x86_64 root=UUID=0b2b469a-f4ed-42aa-919e-e02405ab8051 ro crashkernel=auto rhgb quiet numa=off

10、禁用SELINUX

[root@hellodba ~]# getenforce Enforcing [root@hellodba ~]# vi /etc/selinux/config 将 SELINUX=enforcing 改 SELINUX= disabled [root@hellodba ~]# setenforce 0 [root@hellodba ~]# getenforce Permissive

11、关闭防火墙

//关闭防火墙 [root@hellodba ~]# systemctl stop firewalld //查看防火墙状态 [root@hellodba ~]# systemctl status firewalld //禁止防火墙开机自启动 [root@hellodba ~]# systemctl disable firewalld

12、修改 /dev/shm大小

[root@hellodba ~]# echo "none /dev/shm tmpfs defaults,size=3096m 0 0" >> /etc/fstab [root@hellodba ~]# mount -o remount /dev/shm [root@hellodba ~]# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 3.1G 0 3.1G 0% /dev/shm

13、安装Oracle数据库所需软件包

13.1、配置YUM源

[root@hellodba ~]# mount /dev/cdrom /mnt [root@hellodba ~]# cd /etc/yum.repos.d [root@hellodba yum.repos.d]# rm -rf *.repo [root@hellodba yum.repos.d]# echo "[EL]" >> hellodba.repo [root@hellodba yum.repos.d]# echo "name=Linux 7.6 DVD" >> hellodba.repo [root@hellodba yum.repos.d]# echo "baseurl=file:///mnt" >> hellodba.repo [root@hellodba yum.repos.d]# echo "gpgcheck=0" >> hellodba.repo [root@hellodba yum.repos.d]# echo "enabled=1" >> hellodba.repo

13.2、安装必要的软件包

[root@hellodba ~]# yum -y install bc* yum -y install binutils* yum -y install compat-libcap1* yum -y install compat-libstdc* yum -y install glibc* yum -y install ksh* yum -y install libaio* yum -y install libX11* yum -y install libXau* yum -y install libXi* yum -y install libXtst* yum -y install libXrender* yum -y install libgcc* yum -y install libstdc++* yum -y install libxcb* yum -y install make* yum -y install smartmontools* yum -y install sysstat*

14、配置Oracle软件所有者环境

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ vi ~/.bash_profile umask 022 export PS1 export TMP=/tmp export LANG=en_US.UTF8 export TMPDIR=$TMP export TZ=Asia/Shanghai export ORACLE_TERM=xterm; export ORACLE_UNQNAME=hellodb export ORACLE_SID=hellodb; export ORACLE_BASE=/u01/app/oracle; export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_LANG=AMERICAN_AMERICA.UTF8; export PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/12.2.0/dbhome_1/bin:$ORACLE_HOME/bin; export THREADS_FLAG=native;

15、重启操作系统

[root@hellodba ~]# reboot

三、关于响应文件

1、什么是静默安装

静默安装在控制台中运行,不使用GUI。您通常看到的交互式对话框不会在静默安装中显示。
Oracle Universal Installer不会提示您选择一系列安装选项,而是使用存储在响应文件中或在命令行中传递的预定义选项集来安装软件。您可以在控制台中查看静默安装的进度。

2、什么是响应文件

响应文件是一个规范文件,包含在交互式安装会话期间通常通过Oracle Universal Installer用户界面获取的信息。每个参数都存储在响应文件中标识的变量的值。

3、响应文件的工作原理

通过在启动 Oracle Universal Installer 时指定响应文件,可以完全或部分自动执行 Oracle 软件的安装和配置。Oracle Universal Installer 使用响应文件中包含的值来提供部分或全部 Oracle Universal Installer 提示的选项。

4、选择静默安装的原因

在未安装图形界面的操作系统上安装Oracle数据库。
在多台计算机上多次安装Oracle产品,则静默安装非常有用。如果在每台计算机上安装时选择的选项始终相同,则可以节省查看每个安装屏幕和选择各种安装选项的时间。

四、安装Oracle数据库软件

1、上传Oracle数据库安装软件到服务器并解压

//通过oracle用户上传Oracle数据库安装软件到服务器 /soft 目录 [oracle@hellodba ~]$ cd /soft [oracle@hellodba soft]$ unzip -q linuxx64_12201_database.zip

2、准备响应文件

在解压目录/soft/database/response下有三个响应文件模板。
db_install.rsp:数据库软件安装响应文件
netca.rsp:创建监听响应文件
dbca.rsp:创建数据库响应文件

[oracle@hellodba ~]$ ls -l /soft/database/response -rwxrwxr-x 1 oracle oinstall 25502 Jan 5 2017 dbca.rsp -rw-rw-r-- 1 oracle oinstall 22924 Jan 26 2017 db_install.rsp -rwxrwxr-x 1 oracle oinstall 6209 Jun 20 2016 netca.rsp

3、编辑db_install.rsp响应文件

#先将db_install.rsp文件备份一份 [oracle@hellodba ~]$ cd /soft/database/response [oracle@hellodba response]$ cp db_install.rsp db_install.rsp_bak [oracle@hellodba response]$ echo '' > db_install.rsp [oracle@hellodba response]$ vi db_install.rsp #软件版本信息 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0 #安装选项-仅安装数据库软件 oracle.install.option=INSTALL_DB_SWONLY #oracle用户用于安装软件的组名 UNIX_GROUP_NAME=oinstall #oracle产品清单目录 INVENTORY_LOCATION=/u01/app/oraInventory #oracle安装目录 ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 #oracle基础目录 ORACLE_BASE=/u01/app/oracle #安装版本类型:企业版 oracle.install.db.InstallEdition=EE #指定组信息 oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=dba #不配置安全更新 DECLINE_SECURITY_UPDATES=true

4、安装数据库软件

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ cd /soft/database [oracle@hellodba database]$ ./runInstaller -silent -noconfig -ignorePrereq -responseFile /soft/database/response/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 46792 MB Passed Checking swap space: must be greater than 150 MB. Actual 3095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2023-11-01_04-31-24PM. Please wait ...[oracle@hellodba database]$ You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2023-11-01_04-31-24PM.log [oracle@hellodba database]$ The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2023-11-01_04-31-24PM.log' for more details. As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh Successfully Setup Software.

5、执行配置脚本

[root@hellodba ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@hellodba ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh Check /u01/app/oracle/product/12.2.0/dbhome_1/install/root_hellodba_2023-11-01_16-58-04-076098234.log for the output of root script

五、配置监听

1、使用netca.rsp创建监听

netca.rsp不用做修改,默认建一个名为Listener的监听。

[oracle@hellodba database]$ netca -silent -responseFile /soft/database/response/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /soft/database/response/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle/product/12.2.0/dbhome_1/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0

2、监听管理

2.1、查看监听状态

[oracle@hellodba ~]$ lsnrctl status LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-NOV-2023 17:01:43 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodba)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 01-NOV-2023 17:01:16 Uptime 0 days 0 hr. 0 min. 27 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully

2.2、关闭监听

[oracle@hellodba ~]$ lsnrctl stop LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-NOV-2023 17:01:56 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodba)(PORT=1521))) The command completed successfully

2.3、启动监听

[oracle@hellodba ~]$ lsnrctl start LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-NOV-2023 17:02:09 Copyright (c) 1991, 2016, Oracle. All rights reserved. Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 12.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodba)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 01-NOV-2023 17:02:09 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully

六、创建数据库

1、编辑dbca.rsp响应文件

#先将dbca.rsp文件备份一份 [oracle@hellodba ~]$ cd /soft/database/response [oracle@hellodba response]$ cp dbca.rsp dbca.rsp_bak [oracle@hellodba response]$ echo '' > dbca.rsp [oracle@hellodba response]$ vi dbca.rsp #响应文件版本号 responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0 #数据库模板名称 templateName=General_Purpose.dbc #数据库全局名 gdbName=hellodb #SID sid=hellodb #数据库配置-单实例安装 databaseConfigType=SI #设置SYS账户密码 sysPassword=Hell0o@Dba #设置SYSTEM账户密码 systemPassword=Hell0o@Dba #数据库字符集 characterSet=AL32UTF8 #国家字符集 nationalCharacterSet=UTF8 #注册监听 listeners=LISTENER #Oracle所占物理内存百分比 memoryPercentage=40 #Oracle所占物理内存百分比 databaseType=MULTIPURPOSE #关闭自动内存管理 automaticMemoryManagement=false

2、使用响应文件创建数据库

[root@hellodba ~]# su - oracle [oracle@hellodba response]$ dbca -silent -createDatabase -responseFile /soft/database/response/dbca.rsp Creating and starting Oracle instance 1% complete 4% complete Creating database files 8% complete Creating data dictionary views 10% complete 12% complete 13% complete 14% complete 15% complete 16% complete 17% complete 18% complete 21% complete 22% complete 23% complete Adding Oracle JVM 29% complete 36% complete 42% complete 44% complete Adding Oracle Text 45% complete 48% complete 49% complete Adding Oracle Multimedia 50% complete 62% complete Adding Oracle OLAP 63% complete 64% complete 65% complete 66% complete Adding Oracle Spatial 67% complete 75% complete Adding Oracle Application Express 79% complete 83% complete Completing Database Creation 84% complete 85% complete 86% complete 87% complete 88% complete Executing Post Configuration Actions 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/hellodb/hellodb.log" for further details.

七、数据库管理入门

1、启用SQL*Plus从命令行连接到数据库

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ sqlplus / as sysdba

2、查看数据库基础信息

SQL> select name,log_mode,open_mode,platform_name,db_unique_name from v$database; NAME LOG_MODE OPEN_MODE PLATFORM_NAME DB_UNIQUE_NAME -------------------------------------------------------------------------------------- HELLODB NOARCHIVELOG READ WRITE Linux x86 64-bit hellodb

3、查看数据库版本

SQL> select banner from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production PL/SQL Release 12.2.0.1.0 - Production CORE 12.2.0.1.0 Production TNS for Linux: Version 12.2.0.1.0 - Production NLSRTL Version 12.2.0.1.0 - Production

4、查看数据库字符集

SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET%'; PARAMETER VALUE ----------------------------------------------------------------------------- NLS_CHARACTERSET AL32UTF8 NLS_NCHAR_CHARACTERSET UTF8

5、查看数据库块大小

SQL> show parameter db_block_size; NAME TYPE VALUE ----------------------------------------------------------------------------- db_block_size integer 8192

6、实例的启动与关闭

6.1、启动

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ lsnrctl start [oracle@hellodba ~]$ sqlplus / as sysdba SQL> startup

6.2、关闭

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ lsnrctl stop [oracle@hellodba ~]$ sqlplus / as sysdba SQL> shutdown immediate;

7、取消180天密码过期限制

SQL> select profile,resource_name,resource_type,limit from dba_profiles where profile='DEFAULT' and RESOURCE_NAME='PASSWORD_LIFE_TIME'; PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT ------------------------------------ ----------- ------------------------------ DEFAULT PASSWORD_LIFE_TIME PASSWORD 180 SQL> alter profile default limit password_life_time unlimited; SQL> select profile,resource_name,resource_type,limit from dba_profiles where profile='DEFAULT' and RESOURCE_NAME='PASSWORD_LIFE_TIME'; PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT ------------------------------------ ----------- ------------------------------ DEFAULT PASSWORD_LIFE_TIME PASSWORD UNLIMITED

8、关闭审计

SQL> show parameter audit_trail;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_trail                          string      DB

SQL> alter system set audit_trail=none scope=spfile; (重启数据库生效)

9、调整db_files

SQL> show parameter db_files; NAME TYPE VALUE --------------------------------------------------------------------------- db_files integer 200 SQL> alter system set db_files=1024 scope=spfile; (重启数据库生效)

八、总结

  到此通过响应文件静默安装Oracle数据库就完成了,并进行了一些常规的设置。与图形化交互方式安装Oracle数据库相比,使用响应文件安装Oracle数据库更方便、更便捷,更适合批量安装相同配置参数的Oracle数据库。静默安装可以省去手动输入大量信息的繁琐过程,提高了安装效率,同时也减少了出错的可能性。在实际部署中,我们可以根据自己的需要进行调整和优化,如更改安装路径、添加组件等。希望本文能够帮助大家顺利完成使用响应文件静默安装Oracle 12cR2数据库,提高工作效率。

九、写在后面

  由于本人有限的能力和知识储备,可能存在错误或疏漏之处,如有错误敬请批评指正!

 
公众号:Hello DBA
 
扫码_搜索联合传播样式标准色版.png

最后修改时间:2023-11-29 21:05:00
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论