本文涉及的安装包下载:
链接:https://pan.baidu.com/s/1cXxAUTvWE64RTuRQTfxiVg
提取码:z5jn
操作系统 | 内存 | 磁盘空间 | 域名 | IP地址 |
---|---|---|---|---|
Oracle Linux 7.4 | 16G | 100G | test19c.mylinux.com | 192.168.15.50 |
对于操作系统官网说明如下图所示:
Oracle Linux 7.4 的版本要求是 Oracle Linux 7.4 with the Unbreakable Enterprise Kernel 4: 4.1.12-124.19.2.el7uek.x86_64 or later
检查 kernel 版本
[root@test19c ~]# uname -a
Linux test19c.mylinux.com 4.1.12-94.3.9.el7uek.x86_64 #2 SMP Fri Jul 14 20:09:40 PDT 2017 x86_64 x86_64 x86_64 GNU/Linux
小于要求最小版本要求 ·4.1.12-94·,用 yum
将 kernel-uek
更新到最新,
yum update -y kernel-uek
并重启后再次检查版本,符合要求
[root@test19c ~]# uname -a
Linux test19c.mylinux.com 4.1.12-124.64.1.el7uek.x86_64 #2 SMP Tue Jun 21 04:48:10 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux
oracle-database-preinstall-19c
,或者根据rpm要求的清单手动安装。public-yum-ol7.repo
[root@test19c yum.repos.d]# cat public-yum-ol7.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[ol7_u0_base]
name=Oracle Linux $releasever GA installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/0/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u1_base]
name=Oracle Linux $releasever Update 1 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/1/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u2_base]
name=Oracle Linux $releasever Update 2 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/2/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u3_base]
name=Oracle Linux $releasever Update 3 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/3/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u4_base]
name=Oracle Linux $releasever Update 4 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/4/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[ol7_UEKR3]
name=Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_UEKR3_OFED20]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel on Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3_OFED20/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20
[ol7_UEKR4_OFED]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel Release 4 on Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/OFED/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20
[ol7_MySQL57]
name=MySQL 5.7 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL57_community/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MySQL56]
name=MySQL 5.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL56/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MySQL55]
name=MySQL 5.5 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL55/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack30]
name=OpenStack 3.0 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack30/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack_extras]
name=OpenStack 3.0 Extra packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack_extras/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack21]
name=OpenStack 2.1 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack21/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
[ol7_openstack20]
name=OpenStack 2.0 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack20/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
[ol7_ceph]
name=Ceph Storage for Oracle Linux Release 2.0 - Oracle Linux 7.2 or later ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/ceph/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_ceph10]
name=Ceph Storage for Oracle Linux Release 1.0 - Oracle Linux 7.1 or later ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/ceph10/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_software_collections]
name=Software Collection Library release 2.3 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/SoftwareCollections/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk24_server]
name=Spacewalk Server 2.4 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk24/server/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk24_client]
name=Spacewalk Client 2.4 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk24/client/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk26_server]
name=Spacewalk Server 2.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk26/server/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk26_client]
name=Spacewalk Client 2.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk26/client/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MODRHCK]
name=Latest RHCK with fixes from Oracle for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MODRHCK/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
执行以下语句
[root@test19c ~]# yum install -y oracle-database-preinstall-19c
PS:如果安装时出现以下错误,一般是服务器不是 Oracle Linux 时会出现
GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
解决方法:
wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
执行完后,检查是否有遗漏的包未安装,实际装完发现还漏几个
rpm --query --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat
后面加上 | grep "not installed"
或者 | grep "未安装"
,若有遗漏的可用 yum 继续安装,安装多个用空格隔开
yum install -y XX1 XX2 XX3
我这里遗漏重新安装了一下内容:
yum install -y compat-libstdc++-33 elfutils-libelf-devel fontconfig-devel fontconfig-devel libXrender-devel
方式二:手动安装
yum install -y bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat kmod kmod-libs
oracle-database-preinstall-19c
,以下这些组和用户oracle都以自动建好,执行时会提示重复,已创建groupadd oinstall
groupadd dba
groupadd asmdba
groupadd backupdba
groupadd dgdba
groupadd kmdba
groupadd racdba
groupadd oper
useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle
修改 oracle 用户密码,后面需要登录该用户进行安装
[root@test19c ~]# echo "oracle" | passwd oracle --stdin
oracle-database-preinstall-19c
,则会自动设置vi /etc/sysctl.conf
[root@test19c ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# oracle-database-preinstall-19c setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-preinstall-19c setting for kernel.sem is '250 32000 100 128'
kernel.sem = 250 32000 100 128
# oracle-database-preinstall-19c setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-preinstall-19c setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-preinstall-19c setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-preinstall-19c setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-preinstall-19c setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-preinstall-19c setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-preinstall-19c setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-preinstall-19c setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
手工修改时,执行/sbin/sysctl -p
使设置生效,如果是 oracle-database-preinstall-19c
自动设置的,就不需要执行这个了
[root@test19c ~]# systemctl stop firewalld
[root@test19c ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
修改 /etc/selinux/config 文件,将 SELINUX=enforcing
改为 SELINUX=disabled
,重启操作系统或者 setenforce 0
当时生效
[root@test19c ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@test19c ~]# setenforce 0
[root@test19c ~]# getenforce
Permissive
/etc/security/limits.conf
后添加内容:cat <>/etc/security/limits.conf
# Set Oracle Database Server
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
EOF
/etc/hosts
,添加以下内容192.168.15.50 test19c
[root@test19c ~]# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
[root@test19c ~]# unzip -q -o /soft/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db
[root@test19c ~]# chown -R oracle:oinstall /u01/app
在 oracle 用户,.bash_profile文件中添加以下内容
cat <<EOF>>/home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=test19c.mylinux.com
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=test19c
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
################OracleEnd#########################
EOF
退出重新登录,或者 source .bash_profile
,加载环境变量
登录 oracle 用户,执行以下命令,开始安装
[oracle@test19c ~]$ cd $ORACLE_HOME
[oracle@test19c db]$ ./runInstaller
PS1:安装程序据说默认没有安装中文字体,所以为了避免安装过程中出现乱码,有以下两种方式:
(1) 语言设置为英文
[oracle@ora19c db]$ cd $ORACLE_HOME
[oracle@ora19c db]$ LANG=en_US ./runInstaller
(2)既然没有安装中文字体,那就安装就可以了
C:\Windows\Fonts
下,将相关字体文件复制出来就行,这里我使用新宋体 simsun.ttc
,你用别的中文字体也行$ORACLE_HOMEjdk/jre/lib/fonts
,新建文件夹 fallback
,可以将需要安装的字体文件复制到该目录下,复制后目录结构如下-fonts
-fallback
-simsun.ttc
安装好字体后,再次运行安装程序即可
PS2:数据库默认是基础版 19.0 如果 如果想升级,也可以在安装的时候通过如下方式直接打补丁
(1)将压缩包上传至 /soft,root下执行
[root@test19c ~]# chown -R oracle:oinstall /soft
[root@test19c ~]# su - oracle -c "unzip -q -o /soft/p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.3.0/db"
[root@test19c ~]# su - oracle -c "unzip -q -o /soft/p33515361_190000_Linux-x86-64.zip -d /soft"
[root@test19c soft]# ll
总用量 4449468
drwxr-xr-x. 5 oracle oinstall 81 1月 13 2022 33515361
-rw-r--r--. 1 oracle oinstall 3059705302 7月 24 13:35 LINUX.X64_193000_db_home.zip
-rw-r--r--. 1 oracle oinstall 1373118192 7月 24 13:44 p33515361_190000_Linux-x86-64.zip
-rw-r--r--. 1 oracle oinstall 122247289 7月 24 13:44 p6880880_190000_Linux-x86-64.zip
-rw-rw-r--. 1 oracle oinstall 1178757 1月 18 2022 PatchSearch.xml
[root@test19c soft]#
(2)登录 oracle 用户,执行以下命令,会出现提示 正在准备要打补丁的主目录...
(补丁会将上面的上传的字体文件给删了重新生成,所以为了避免乱码,建议英文,或者补丁打好后,再设置字体,然后再单独运行 ./runInstaller
)
[oracle@test19c soft]$ cd $ORACLE_HOME
[oracle@test19c db]$ ./runInstaller -applyRU /soft/33515361/
正在准备要打补丁的主目录...
Oracle 基目录设置为 /u01/app/oracle
,点击下一步
产品清单目录设置为u01/app/oraInventory
,点击下一步
后面安装产品的时候,会提示需要用 root
来执行两个脚本 /u01/app/oraInventory/orainstRoot.sh
和 /u01/app/oracle/product/19.3.0/dbhome_1/root.sh
,不选择自动运行的话,也可以后面根据提示手动运行,点击下一步
这里总体展示了前面的设置,点击安装
等待安装完成,另外如果前面没有设置root自动执行脚本,也会提示需要执行,按提示来就行。
执行命令
[oracle@test19c ~]$ cd $ORACLE_HOME
[oracle@test19c db]$ netca
设置监听名称,默认为 LISTENER
就行,点击下一步
默认,点击下一步
使用默认端口 1521 即可,点击下一步
选择否,点击下一步
点击下一步
此时切换到终端也可以看到提示:
[oracle@test19c db]$ netca
Oracle Net Services 配置:
配置监听程序:LISTENER
监听程序配置完成。
Oracle Net 监听程序启动:
正在运行监听程序控制:
/u01/app/oracle/product/19.3.0/dbhome_1/bin/lsnrctl start LISTENER
监听程序控制完成。
监听程序已成功启动。
成功完成 Oracle Net Services 配置。退出代码是0
[oracle@test19c ~]$ cd $ORACLE_HOME
[oracle@test19c db]$ dbca
选择 高级配置
,点击下一步
数据库类型选择 Oracle 单实例数据库
,数据库模板选择 一般用途或事务处理
,点击下一步
选择为数据库存储属性使用模板文件
,点击下一步
都启用,测试环境可以不用,后面有需要可以再开启,点击下一步
选择监听程序,点击下一步
都不勾选,点击下一步
内存标签页中,选择使用自动共享内存管理
,调整到 90%,
调整大小标签页中,进程修改为1500
字符集标签页中设置如下所示,点击下一步
不配置,点击下一步
设置sys 和 system 密码,测试环境就都默认为 manager,点击下一步
选择创建数据库,点击下一步
点击下一步
大概等个10-20分钟吧,看电脑性能,等装完后,此时数据库和监听都已经自动打开了,点击关闭
[oracle@test19c ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 24-7月 -2022 15:49:57
Copyright (c) 1991, 2021, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test19c)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for Linux: Version 19.0.0.0.0 - Production
启动日期 24-7月 -2022 15:16:32
正常运行时间 0 天 0 小时 33 分 25 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /u01/app/oracle/product/19.3.0/db/network/admin/listener.ora
监听程序日志文件 /u01/app/oracle/diag/tnslsnr/test19c/listener/alert/log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test19c.mylinux.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
服务摘要..
服务 "test19c" 包含 1 个实例。
实例 "test19c", 状态 READY, 包含此服务的 1 个处理程序...
服务 "test19cXDB" 包含 1 个实例。
实例 "test19c", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
登录数据库
[oracle@test19c ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on 星期日 7月 24 15:53:39 2022
Version 19.14.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
连接到:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0
SQL> SELECT NAME FROM v$database;
NAME
---------
TEST19C
SQL> quit
从 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0 断开
[oracle@test19c ~]$
为了后续启停方便,可以设置启停脚本
[oracle@test19c ~]$ vi ~/startdb.sh
export LISTENER_NAME=LISTENER
lsnrctl start $LISTENER_NAME
sqlplus /nolog <<EOF
conn /as sysdba
startup
exit
EOF
[oracle@test19c ~]$ vi ~/stopdb.sh
export LISTENER_NAME=LISTENER
lsnrctl stop $LISTENER_NAME
sqlplus /nolog <<EOF
conn /as sysdba
shutdown immediate
exit
EOF
修改权限,允许执行
[oracle@test19c ~]$ chmod +x startdb.sh stopdb.sh
后续可直接通过脚本启停
[oracle@test19c ~]$ ./startdb.sh
[oracle@test19c ~]$ ./stopdb.sh
本地安装了Oracle客户端,以及plsql developer 后,可以在配置 TNS 后连接数据库,TNS的连接信息,可通过以下方式获得:
[oracle@test19c ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TEST19C =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test19c.mylinux.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TEST19C.mylinux.com)
)
)
LISTENER_TEST19C =
(ADDRESS = (PROTOCOL = TCP)(HOST = test19c.mylinux.com)(PORT = 1521))
另外为了避免本地安装的客户端版本过低,比如安装客户端的是 Oracle 10G
,导致连接数据库时出现错误 ORA-28040: No matching authentication protocol
,可以在 $ORACLE_HOME/network/admin
下新增 sqlnet.ora
,并添加内容 SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
,允许低版本的客户端登录
[oracle@test19c ~]$ vi $ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
无需重启服务器,但是如果再次尝试连接,会提示密码错误,需要修改用户密码,可以用原密码,修改后再次登录就正常了
[oracle@test19c ~]$ sqlplus / as sysdba
SQL> alter user system identified by manager;
到此,ORACLE 19C 的单实例安装就完成了。
参考资料:
https://blog.csdn.net/bjywxc/article/details/104696121
https://sys-blog.net/oracle-database-19c-for-redhat/
https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/index.html