01
—
两个rpm包完成Oracle数据库的安装
在Linux上安装Oracle软件的过程相当复杂,让很多初学者望而却步。但在Oracle 18c以后Oracle推出了使用rpm包安装Oracle数据库软件的安装方式,安装两个(预安装包和数据库安装包)rpm包即可完成整个Oracle数据库软件的安装,以Oracle 21c为例:
预安装包 |
数据库安装包 |
|
Linux 7 | oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm | oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm |
Linux 8 | oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm | oracle-database-ee-21c-1.0-1.ol8.x86_64.rpm |
其中预安装包是从Oracle 11gR2版本开始出现的。这两个安装包可以让整个Oracle软件的安装过程傻瓜化,使用yum安装这两个包即可完成全部的安装工作。
02
—
安装预安装包(oracle-preinstallation-rpm)
预安装包的安装文档:
下面是Linux 7和Linux8的预安装包的下载链接:
wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpmwget https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
使用yum -y localinstall,后面接包名进行安装。
Oracle Database Preinstallation RPM 完成如下工作:
- 自动下载并安装安装Oracle Grid Infrastructure和Oracle Database所需的任何附加RPM软件包,并解决任何依赖关系。
- 创建一个oracle用户,并为该用户创建Oracle inventory(oinstall)和OSDBA (dba)组 。
- 根据建议,设置sysctl.conf的设置、系统启动参数和驱动程序参数。
- 设置硬资源和软资源限制。
- 根据用户的内核版本,设置其他推荐参数。
- 在Linux x86_64机器的内核中设置numa=off。
安装完成后检查安装日志的例子如下:
# cat /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12/orakernel.log Adding group oinstall with gid 54321Adding group dba with gid 54322Adding group oper with gid 54323Adding group backupdba with gid 54324Adding group dgdba with gid 54325Adding group kmdba with gid 54326Adding group racdba with gid 54330Adding user oracle with user id 54321, initial login group oinstall, supplementary groups oinstall,dba,oper,backupdba,dgdba,kmdba,racdba and home directory /home/oracleChanging ownership of /home/oracle to oracle:oinstallPlease set password for user - oracleuid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)User creation passed Saving a copy of the initial sysctl.confVerifying kernel parameters as per Oracle recommendations...Trying to remove instances of - setting for fs.file-max isAdding fs.file-max = 6815744 Trying to remove instances of - setting for kernel.sem isAdding kernel.sem = 250 32000 100 128 Trying to remove instances of - setting for kernel.shmmni isAdding kernel.shmmni = 4096 Trying to remove instances of - setting for kernel.shmall isAdding kernel.shmall = 1073741824 Trying to remove instances of - setting for kernel.shmmax isAdding kernel.shmmax = 4398046511104 Trying to remove instances of - setting for kernel.panic_on_oops isAdding kernel.panic_on_oops = 1 Trying to remove instances of - setting for net.core.rmem_default isAdding net.core.rmem_default = 262144 Trying to remove instances of - setting for net.core.rmem_max isAdding net.core.rmem_max = 4194304 Trying to remove instances of - setting for net.core.wmem_default isAdding net.core.wmem_default = 262144 Trying to remove instances of - setting for net.core.wmem_max isAdding net.core.wmem_max = 1048576 Trying to remove instances of - setting for net.ipv4.conf.all.rp_filter isAdding net.ipv4.conf.all.rp_filter = 2 Trying to remove instances of - setting for net.ipv4.conf.default.rp_filter isAdding net.ipv4.conf.default.rp_filter = 2 Trying to remove instances of - setting for fs.aio-max-nr isAdding fs.aio-max-nr = 1048576 Trying to remove instances of - setting for net.ipv4.ip_local_port_range isAdding net.ipv4.ip_local_port_range = 9000 65500 Setting kernel parameters as per oracle recommendations...Altered file /etc/sysctl.confSaved a copy of the current file in /etc/sysctl.d/99-oracle-database-preinstall-21c-sysctl.confCheck /etc/sysctl.d for backupsVerification & setting of kernel parameters passed Setting user limits using /etc/security/limits.d/oracle-database-preinstall-21c.conf Verifying oracle user OS limits as per Oracle recommendations...Adding oracle soft nofile 1024Adding oracle hard nofile 65536Adding oracle soft nproc 16384Adding oracle hard nproc 16384Adding oracle soft stack 10240Adding oracle hard stack 32768Adding oracle hard memlock 134217728Adding oracle soft memlock 134217728Adding oracle soft data unlimitedAdding oracle hard data unlimitedSetting oracle user OS limits as per Oracle recommendations...Altered file /etc/security/limits.d/oracle-database-preinstall-21c.confOriginal file backed up at /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12Verification & setting of user limits passed Saving a copy of /etc/default/grub file in /etc/default/grub-initial.orabackupSaving a copy of /etc/default/grub in /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12...Verifying kernel boot parameters as per Oracle recommendations...old boot params: "rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet"new boot params: "rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet numa=off" Setting boot params - Checking for blscfgold boot params: "rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet numa=off"new boot params: "rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet numa=off transparent_hugepage=never" Setting boot params - Checking for blscfgSetting kernel boot parameters as per Oracle recommendations...G_DIR=/boot/grub2Default Kernel -> /boot/vmlinuz-3.10.0-123.el7.x86_64Running Kernel -> 3.10.0-123.el7.x86_64Saving a copy of grubenv... in /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12Running grub2-mkconfigGenerating grub configuration file ...File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 6603: /usr/sbin/grub2-probeFile descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 6603: /usr/sbin/grub2-probeFound linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.imgWarning: Please don't use old title `CentOS Linux, with Linux 3.10.0-123.el7.x86_64' for GRUB_DEFAULT, use `Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64' (for versions before 2.00) or `gnulinux-advanced-6f2bbd1f-912e-4f65-8e24-191d20e781b8>gnulinux-3.10.0-123.el7.x86_64-advanced-6f2bbd1f-912e-4f65-8e24-191d20e781b8' (for 2.00 or later)Found linux image: /boot/vmlinuz-0-rescue-0dcd05882fb70447861feb88e3315612Found initrd image: /boot/initramfs-0-rescue-0dcd05882fb70447861feb88e3315612.imgFile descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 6819: /usr/sbin/grub2-probeFile descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 6819: /usr/sbin/grub2-probedoneSetting the default back to /boot/vmlinuz-3.10.0-123.el7.x86_64Boot parameters will be effected on next rebootAltered file /etc/default/grubCopy of the changed file is in - /etc/default/grub-oracle-database-preinstall-21c.orabackupCopy of the original file is in - /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12Verification & setting of boot parameters passed Trying to add NOZEROCONF parameter...Taking a backup of existing file to /etc/sysconfig/network.orabackupSuccessfully added parameter NOZEROCONF to /etc/sysconfig/networkSetting /etc/sysconfig/network parameters passed Disabling Transparent Hugepages. Refer Oracle Note:1557478.1 Disabling defrag. Refer Oracle Note:1557478.1 Taking a backup of old config files under /var/log/oracle-database-preinstall-21c/backup/Dec-28-2021-15-52-12
该视频号动态已删除
mysqlace
03
—
数据库安装包(oracle-database)
数据库安装包的安装文档:
需要注意:
- rpm包不支持使用 rpm -Uvh进行升级
- rpm安装可以在一台机器上用不同的ORACLE_HOME安装多个版本
下载链接:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
在这个网页里面点击“See All”
这里有两个Linux的版本分别对应Linux 8和Linux 7,下面还有预安装包的下载链接。
数据库安装包会自动完成以下操作:
- 执行预安装检查
- 展开数据库软件包
- 将展开的软件的所有权重新分配给预配置的用户和组
- 维护Oracle inventory
- 使用root权限为Oracle数据库的创建进行配置
使用下面的命令进行安装
# yum -y localinstall oracle-database-ee-21c-1.0-1.ol7.x86_64.rpmLoaded plugins: fastestmirrorExamining oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm: oracle-database-ee-21c-1.0-1.x86_64Marking oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm to be installedResolving Dependencies--> Running transaction check---> Package oracle-database-ee-21c.x86_64 0:1.0-1 will be installed--> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================= Package Arch Version Repository Size=============================================================================================================================Installing: oracle-database-ee-21c x86_64 1.0-1 /oracle-database-ee-21c-1.0-1.ol7.x86_64 7.1 G Transaction Summary=============================================================================================================================Install 1 Package Total size: 7.1 GInstalled size: 7.1 GDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : oracle-database-ee-21c-1.0-1.x86_64 1/1[INFO] Executing post installation scripts...[INFO] Oracle home installed successfully and ready to be configured.To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-21c configure Verifying : oracle-database-ee-21c-1.0-1.x86_64 1/1 Installed: oracle-database-ee-21c.x86_64 0:1.0-1 Complete!
可以看到在整个安装过程中没有下载依赖包,因为在之前安装预安装包时依赖包都安装好了。
检查安装日志的例子如下:
# cat /var/log/oracle-database-ee-21c/results/oraInstall.log [INFO] Starting the installation process of the Oracle Database...12/29/2021-10:52:27 AM[INFO] Verifying the final status of the user after all the prechecks execution: uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)[INFO] Registering Oracle home to the Oracle inventory...[INFO] Oracle home registered to the Oracle inventory.[INFO] Executing post installation scripts...[INFO] Setting up inventory as it has not been setup on this machine.[INFO] Configuring ADR directories...[INFO] ADR directories configured.[INFO] Post installation scripts executed successfully.[INFO] Creating configuration directories for Oracle Home...[INFO] Configuration directories created.[INFO] Post installation scripts executed successfully.[INFO] Oracle home installed successfully and ready to be configured.