共计 2789 个字符,预计需要花费 7 分钟才能阅读完成。
Oracle 官方已放出 18c 企业版的 RPM 安装包,但仅限于单机版。相对于之前的版本,省去了前期规划配置的繁琐步骤。
1、下载 Oracle RPM 安装包
从官网选择 rpm 格式的安装包,下载即可。如下图:
2、使用 yum 安装
我这里使用的为 oracle linux,软件源用的是 oracle 软件源,安装如下:
[root@odb03 ~]# yum -y localinstall /u02/oracle-database-ee-18c-1.0-1.x86_64.rpm
RPM 安装默认的目录为 /opt,安装前确保 /opt 拥有足够的空间。
3、配置 Oracle 18c 数据库
安装完成后,会产生两个文件:一个是管理 oracle 服务的脚本 (/etc/init.d/oracledb_ORCLCDB-18c),另一个是定义数据文件存放路径的文件(/etc/sysconfig/oracledb_ORCLCDB-18c.conf)。
根据实际情况修改以上两个文件,这里修改了数据文件存放的路径为 /u03/oradata 以及默认的实例名为 testdb。如果更改了默认的实例名,则 /etc/sysconfig/oracledb_ORCLCDB-18c.conf 文件也该更改为对应的实例名,这里为 /etc/sysconfig/oracledb_testdb-18c.conf。
[root@odb03 ~]# vi /etc/sysconfig/oracledb_testdb-18c.conf
#This is a configuration file to setup the Oracle Database.
#It is used when running '/etc/init.d/oracledb_ORCLCDB configure'.
#Please use this file to modify the default listener port and the
#Oracle data location.
# LISTENER_PORT: Database listener
LISTENER_PORT=1521
# ORACLE_DATA_LOCATION: Database oradata location
ORACLE_DATA_LOCATION=/u03/oradata
# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500
[root@odb03 ~]# vi /etc/init.d/oracledb_ORCLCDB-18c
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: This script is responsible for taking care of configuring the Oracle Database and its associated services.
#
# processname: oracledb_ORCLCDB-18c
# Red Hat or SUSE config: /etc/sysconfig/oracledb_ORCLCDB-18c
#
# Set path if path not set
case $PATH in
"") PATH=/bin:/usr/bin:/sbin:/etc
export PATH ;;
esac
# Check if the root user is running this script
if [$(id -u) != "0" ]
then
echo "You must be root user to run the configurations script. Login as root user and try again."
exit 1
fi
# Setting the required environment variables
export ORACLE_HOME=/opt/oracle/product/18c/dbhome_1
export ORACLE_VERSION=18c
export ORACLE_SID=testdb
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=kettel
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true
......
修改完成后,执行 /etc/init.d/oracledb_ORCLCDB-18c configure 命令创建数据库实例以及监听,如下:
[root@odb03 ~]# /etc/init.d/oracledb_ORCLCDB-18c configure
Configuring Oracle Database testdb.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/testdb.
Database Information:
Global Database Name:testdb
System Identifier(SID):testdb
Look at the log file "/opt/oracle/cfgtoollogs/dbca/testdb/testdb.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
其实,这个 configure 就是调用 dbca 的静默模式创建数据库实例。创建完成后,根据上面的提示修改系统用户的密码即可。
4、Using 18c OEM
Oracle 18c 默认会开启 Enterprise Manager Database Express,修改完 sys 密码之后,就可以通过如下格式访问:https://ip:5500/em。
: