技术博客
Oracle一键安装
本章目标:掌握本章核心知识点 前置要求:完成前序章节学习 预计时长:60 分钟
Oracle 一键安装脚本,演示 RedHat 9.3 一键安装 Oracle 11GR2 单机过程(全程无需人工干预)。
⭐️ 脚本下载地址:Shell脚本安装Oracle数据库
# 主机版本[root@rhel9 soft]# cat /etc/os-release NAME="Red Hat Enterprise Linux"VERSION="9.3 (Plow)"ID="rhel"ID_LIKE="fedora"VERSION_ID="9.3"PLATFORM_ID="platform:el9"PRETTY_NAME="Red Hat Enterprise Linux 9.3 (Plow)"ANSI_COLOR="0;31"LOGO="fedora-logo-icon"CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"HOME_URL="https://www.redhat.com/"DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"BUG_REPORT_URL="https://bugzilla.redhat.com/"REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"REDHAT_BUGZILLA_PRODUCT_VERSION=9.3REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"REDHAT_SUPPORT_PRODUCT_VERSION="9.3"# 网络信息[root@rhel9 soft]# ip a2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:ca:1f:5b brd ff:ff:ff:ff:ff:ff altname enp2s1 inet 192.168.6.133/24 brd 192.168.6.255 scope global noprefixroute ens33 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:feca:1f5b/64 scope link noprefixroute valid_lft forever preferred_lft forever# 挂载本地 ISO 镜像[root@rhel9 soft]# mount | grep iso9660 | grep -v "/run/media"/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)[root@rhel9 soft]# df -h|grep /mnt/dev/sr0 9.9G 9.9G 0 100% /mnt# 安装包存放在 /soft 目录下[root@rhel9 soft]# ll-rwxr-xr-x. 1 root root 214424 Jun 13 15:48 OracleShellInstall-rwx------. 1 root root 1395582860 Jun 13 14:38 p13390677_112040_Linux-x86-64_1of7.zip-rwx------. 1 root root 1151304589 Jun 13 14:38 p13390677_112040_Linux-x86-64_2of7.zip默认使用专业版脚本。脚本下载:ora100.com/shell-install
确保安装环境准备完成后,即可执行一键安装。
使用标准生产环境安装参数:
# 根据脚本 README 或者 -h 命令提示,编辑好一键安装命令,进入 /soft 目录执行安装:./OracleShellInstall -lf ens33 `# local ip ifname`\-n rhel9 `# hostname`\-op oracle `# oracle password`\-d /u01 `# software base dir`\-ord /oradata `# data dir`\-o lucifer `# dbname`\-dp oracle `# sys/system password`\-ds AL32UTF8 `# database character`\-ns AL16UTF16 `# national character`\-redo 10 `# redo size`\-opd Y `# optimize db`默认使用专业版脚本。脚本下载:ora100.com/shell-install
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██ ██░░░░░██ ░██ ██░░░░░░ ░██ ░██ ░██░██ ░██ ░██ ░██ ██ ░░██ ██████ ██████ █████ ░██ █████ ░██ ░██ █████ ░██ ░██░██ ███████ ██████ ██████ ██████ ░██ ░██░██ ░██░░██░░█ ░░░░░░██ ██░░░██ ░██ ██░░░██░█████████░██████ ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██░██ ░██ ░██ ░ ███████ ░██ ░░ ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██░░██ ██ ░██ ██░░░░██ ░██ ██ ░██░██░░░░ ░██░██ ░██░██░░░░ ░██ ░██░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██ ░░███████ ░███ ░░████████░░█████ ███░░██████ ████████ ░██ ░██░░██████ ███ ███░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███ ░░░░░░░ ░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░ ░░░░░░░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░ 注意:本脚本仅用于新服务器上实施部署数据库使用,严禁在已运行数据库的主机上执行,以免发生数据丢失或者损坏,造成不可挽回的损失!!! 请选择安装模式 [单机(si)/单机ASM(sa)/集群(rac)] : si数据库安装模式: single 请选择数据库版本 [11/12/19/21] : 11数据库版本: 11 正在进行安装前检查,请稍等...... !!! 免责声明:当前操作系统版本是 [ Red Hat Enterprise Linux 9.3 (Plow) ] 不在 Oracle 官方支持列表,本脚本只负责安装,请确认是否继续安装 (Y/N): [Y] OracleShellInstall 开始安装,详细安装过程可查看日志: tail -2000f /soft/print_shell_install_20240613163821.log 正在获取操作系统信息......已完成 (耗时: 1 秒)正在配置本地软件源......已完成 (耗时: 1 秒)正在安装依赖包......已完成 (耗时: 276 秒)正在禁用防火墙......已完成 (耗时: 1 秒)正在禁用 selinux......已完成 (耗时: 1 秒)正在配置 nsyctl......已完成 (耗时: 1 秒)正在配置主机名和 /etc/hosts......已完成 (耗时: 0 秒)正在创建用户和组......已完成 (耗时: 2 秒)正在创建安装目录......已完成 (耗时: 0 秒)正在配置透明大页 && NUMA && 磁盘 IO 调度器......已完成 (耗时: 2 秒)正在配置操作系统参数 sysctl......已完成 (耗时: 1 秒)正在配置 RemoveIPC......已完成 (耗时: 1 秒)正在配置用户限制 limit......已完成 (耗时: 1 秒)正在配置 shm 目录......已完成 (耗时: 1 秒)正在配置用户环境变量......已完成 (耗时: 1 秒)正在解压 Oracle 安装包以及补丁......已完成 (耗时: 40 秒)正在安装 Oracle 软件以及补丁......已完成 (耗时: 385 秒)正在创建监听......已完成 (耗时: 14 秒)正在创建数据库......已完成 (耗时: 260 秒)正在优化数据库......已完成 (耗时: 39 秒)恭喜!Oracle 一键安装执行完成 (耗时: 1029 秒),现在是否重启主机:[Y/N] Y正在重启当前节点主机...... 默认使用专业版脚本。脚本下载:ora100.com/shell-install
查看系统版本:
[root@rhel9:/root]# cat /etc/os-release NAME="Red Hat Enterprise Linux"VERSION="9.3 (Plow)"ID="rhel"ID_LIKE="fedora"VERSION_ID="9.3"PLATFORM_ID="platform:el9"PRETTY_NAME="Red Hat Enterprise Linux 9.3 (Plow)"ANSI_COLOR="0;31"LOGO="fedora-logo-icon"CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"HOME_URL="https://www.redhat.com/"DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"BUG_REPORT_URL="https://bugzilla.redhat.com/"REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"REDHAT_BUGZILLA_PRODUCT_VERSION=9.3REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"REDHAT_SUPPORT_PRODUCT_VERSION="9.3"查看 Oracle 版本以及补丁:
[oracle@rhel9:/home/oracle]$ sqlplus -vSQL*Plus: Release 11.2.0.4.0 Production[oracle@rhel9:/home/oracle]$ opatch lspatchesThere are no Interim patches installed in this Oracle Home.检查监听:
[oracle@rhel9:/home/oracle]$ lsnrctl statLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-JUN-2024 17:02:45Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionStart Date 13-JUN-2024 16:57:51Uptime 0 days 0 hr. 4 min. 54 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/db/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/rhel9/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel9)(PORT=1521)))Services Summary...Service "lucifer" has 1 instance(s). Instance "lucifer", status READY, has 1 handler(s) for this service...Service "luciferXDB" has 1 instance(s). Instance "lucifer", status READY, has 1 handler(s) for this service...The command completed successfully连接数据库:
[oracle@rhel9:/home/oracle]$ sasSQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 13 17:02:46 2024Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionssys@LUCIFER 2024-06-13 17:02:46> show parameter nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------cell_offloadgroup_name stringdb_file_name_convert stringdb_name string luciferdb_unique_name string luciferglobal_names boolean FALSEinstance_name string luciferlock_name_space stringlog_file_name_convert stringprocessor_group_name stringservice_names string lucifer数据库连接正常。