技术博客
Oracle一键安装
本章目标:掌握本章核心知识点 前置要求:完成前序章节学习 预计时长:60 分钟
Oracle 一键安装脚本,演示 RedHat 9.3 一键安装 Oracle 19C 单机(19.23)过程(全程无需人工干预)。
⭐️ 脚本下载地址:Shell脚本安装Oracle数据库
[root@localhost ~]# cat /etc/os-releaseNAME="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@localhost ~]# ip a2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:0c:29:80:58:e9 brd ff:ff:ff:ff:ff:ff altname enp3s0 inet 192.168.183.90/24 brd 192.168.183.255 scope global noprefixroute ens160 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe80:58e9/64 scope link noprefixroute valid_lft forever preferred_lft forever[root@localhost ~]# ll /soft-rw-r--r-- 1 oracle oinstall 3059705302 May 11 18:28 LINUX.X64_193000_db_home.zip-rwxr-xr-x 1 oracle oinstall 201960 May 11 18:31 OracleShellInstall-rw-r--r-- 1 oracle oinstall 127475677 May 11 18:23 p36199232_190000_Linux-x86-64.zip-rw-r--r-- 1 oracle oinstall 1856311021 May 11 18:25 p36233263_190000_Linux-x86-64.zip-rw-r--r-- 1 oracle oinstall 133535622 May 11 18:23 p6880880_190000_Linux-x86-64.zip-rw-r--r-- 1 oracle oinstall 10528882688 May 11 18:33 rhel-9.3-x86_64-dvd.iso默认使用专业版脚本。脚本下载:ora100.com/shell-install
确保安装环境准备完成后,即可执行一键安装。
使用标准生产环境安装参数(安装过程若失败,脚本支持重复执行安装):
./OracleShellInstall -lf ens160 `# local ip ifname`\-n 19c `# hostname`\-op oracle `# oracle password`\-d /u01 `# software base dir`\-ord /oradata `# data dir`\-o lzhdb `# dbname`\-dp oracle `# sys/system password`\-ds AL32UTF8 `# database character`\-ns AL16UTF16 `# national character`\-redo 200 `# redo size`\-opa 36233263 `# oracle PSU/RU`\-jpa 36199232 `# OJVM PSU/RU`\-opd Y `# optimize db`默认使用专业版脚本。脚本下载:ora100.com/shell-install
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██ ██░░░░░██ ░██ ██░░░░░░ ░██ ░██ ░██░██ ░██ ░██ ░██ ██ ░░██ ██████ ██████ █████ ░██ █████ ░██ ░██ █████ ░██ ░██░██ ███████ ██████ ██████ ██████ ░██ ░██░██ ░██░░██░░█ ░░░░░░██ ██░░░██ ░██ ██░░░██░█████████░██████ ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██░██ ░██ ░██ ░ ███████ ░██ ░░ ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██░░██ ██ ░██ ██░░░░██ ░██ ██ ░██░██░░░░ ░██░██ ░██░██░░░░ ░██ ░██░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██ ░░███████ ░███ ░░████████░░█████ ███░░██████ ████████ ░██ ░██░░██████ ███ ███░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███ ░░░░░░░ ░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░ ░░░░░░░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░注意:本脚本仅用于新服务器上实施部署数据库使用,严禁在已运行数据库的主机上执行,以免发生数据丢失或者损坏,造成不可挽回的损失!!! 请选择安装模式 [单机(si)/单机ASM(sa)/集群(rac)] : si数据库安装模式: single请选择数据库版本 [11/12/19/21] : 19数据库版本: 19OracleShellInstall 开始安装,详细安装过程可查看日志: tail -2000f /soft/print_ora_install_20240511183555.log正在检查操作系统是否符合安装条件......已完成 (耗时: 0 秒)正在去除密码复杂度配置......已完成 (耗时: 0 秒)正在配置 YUM 源......已完成 (耗时: 1 秒)正在获取操作系统信息......已完成 (耗时: 1 秒)正在配置 Swap......已完成 (耗时: 0 秒)正在配置防火墙......已完成 (耗时: 1 秒)正在配置 selinux......已完成 (耗时: 0 秒)正在配置 nsyctl......已完成 (耗时: 1 秒)正在安装依赖包......已完成 (耗时: 26 秒)正在配置主机名和 /etc/hosts......已完成 (耗时: 0 秒)正在创建用户和组......已完成 (耗时: 1 秒)正在创建安装目录......已完成 (耗时: 0 秒)正在配置 Avahi-daemon 服务......已完成 (耗时: 1 秒)正在配置透明大页 && NUMA && 磁盘 IO 调度器......已完成 (耗时: 1 秒)正在配置操作系统参数 sysctl......已完成 (耗时: 1 秒)正在配置 RemoveIPC......已完成 (耗时: 2 秒)正在配置用户限制 limit......已完成 (耗时: 1 秒)正在配置 shm 目录......已完成 (耗时: 1 秒)正在安装 rlwrap 插件......已完成 (耗时: 0 秒)正在配置用户环境变量......已完成 (耗时: 1 秒)正在解压 Oracle 安装包以及补丁......已完成 (耗时: 335 秒)正在安装 Oracle 软件以及补丁......已完成 (耗时: 985 秒)正在创建监听......已完成 (耗时: 2 秒)正在创建数据库......已完成 (耗时: 646 秒)正在优化数据库......已完成 (耗时: 7 秒)恭喜!Oracle 单机安装成功 (耗时: 2014 秒),现在是否重启主机:[Y/N] y正在重启主机......默认使用专业版脚本。脚本下载:ora100.com/shell-install
查看系统版本:
[root@19c 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"查看 Oracle 版本以及补丁:
[oracle@19c:/home/oracle]$ sqlplus -vSQL*Plus: Release 19.0.0.0.0 - ProductionVersion 19.23.0.0.0[oracle@19c:/soft]$ opatch lspatches36199232;OJVM RELEASE UPDATE: 19.23.0.0.240416 (36199232)36233263;Database Release Update : 19.23.0.0.240416 (36233263)29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)OPatch succeeded.查看监听:
[oracle@19c:/soft]$ lsnrctl statusLSNRCTL for Linux: Version 19.0.0.0.0 - Production on 11-MAY-2024 19:17:35Copyright (c) 1991, 2024, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=19c)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 19.0.0.0.0 - ProductionStart Date 11-MAY-2024 19:10:55Uptime 0 days 0 hr. 6 min. 40 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/19.3.0/db/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/19c/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=19c)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Services Summary...Service "lzhdb" has 1 instance(s). Instance "lzhdb", status READY, has 1 handler(s) for this service...Service "lzhdbXDB" has 1 instance(s). Instance "lzhdb", status READY, has 1 handler(s) for this service...The command completed successfully连接数据库:
[oracle@19c:/home/oracle]$ sasSQL*Plus: Release 19.0.0.0.0 - Production on Sat May 11 19:17:01 2024Version 19.23.0.0.0Copyright (c) 1982, 2023, Oracle. All rights reserved.Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.23.0.0.0sys@LZHDB 2024-05-11 19:17:01> show parameter nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------cdb_cluster_name stringcell_offloadgroup_name stringdb_file_name_convert stringdb_name string lzhdbdb_unique_name string lzhdbglobal_names boolean FALSEinstance_name string lzhdblock_name_space stringlog_file_name_convert stringpdb_file_name_convert stringprocessor_group_name stringservice_names string lzhdb数据库连接正常。