Oracle 19c 安装过程

推荐文章:

官方说明书-Database Installation Guide for Linux

Oracle 19c 之 RPM 包安装初体验(一)

Oracle 19c之RPM安装

1. Oracle Database Installation Checklist

2. About the Oracle Database Preinstallation RPM

If your Linux distribution is Oracle Linux, or Red Hat Enterprise Linux, and you are an Oracle Linux support customer, then you can complete most preinstallation configuration tasks by using the Oracle Database Preinstallation RPM for your release.

Oracle Database Preinstallation RPMs are available from the Oracle Linux Network or available on the Oracle Linux DVDs. Using the Oracle Database Preinstallation RPM is not required, but Oracle recommends you use it to save time in setting up your cluster servers.

When installed, the Oracle Database Preinstallation RPM does the following:

oracle-database-preinstall 安装之后会解决安装Oracle DataBase时所用到的依赖;会创建一个 oracle 用户,两个分组oinstall,dba,并授权给 oracle 用户

  • Automatically downloads and installs any additional RPM packages needed for installing Oracle Grid Infrastructure and Oracle Database, and resolves any dependencies

  • Creates an oracle user, and creates the oraInventory (oinstall) and OSDBA (dba) groups for that user

  • As needed, sets sysctl.conf settings, system startup parameters, and driver parameters to values based on recommendations from the Oracle Database Preinstallation RPM program

  • Sets hard and soft resource limits

  • Sets other recommended parameters, depending on your kernel version

  • Sets numa=off in the kernel for Linux x86_64 machines.

Configure Oracle Database Preinstallation RPM only once on your operating system when you install Oracle Database or Oracle Grid Infrastructure for the first time on your system. For subsequent installations on the same system, do not install Oracle Database Preinstallation RPM again.

Do not install Oracle Database Preinstallation RPM on Oracle Engineered Systems, such as Oracle Exadata Database Machine. Oracle Engineered Systems include integrated system software that contain the required version of the operating system kernel and all software packages.

Note:

  • The Oracle Database Preinstallation RPM designated for each Oracle Database release sets kernel parameters and resource limits only for the user account oracle. To use multiple software account owners, you must perform system configuration for other accounts manually.

  • The Oracle Database Preinstallation RPM installs the X11 client libraries, but it does not install the X Window System server packages. To use graphical user interfaces such as OUI, configuration assistants, and Oracle Enterprise Manager, set the display to a system with X Window System server packages.

3. Installing Oracle Database

  1. 安装 oracle-database-preinstall
yum install oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm -y

在这里插入图片描述
2. 安装 Oracle Database 19c

yum install oracle-database-ee-19c-1.0-1.x86_64.rpm

在这里插入图片描述
3. 安装完成后,查看配置文件是否需要更改(安装preinstall时自动创建的配置模板)

  • 监听端口和文件地址相关配置文件在/etc/sysconfig/oracledb_ORCLCDB-19c.conf
  • SID等配置在/etc/init.d/oracledb_ORCLCDB-19c
[root@slmdev package] more /etc/sysconfig/oracledb_ORCLCDB-19c.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=/opt/oracle/oradata

# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500
[root@slmdev package] more /etc/init.d/oracledb_ORCLCDB-19c 
#!/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-19c
# Red Hat or SuSE config: /etc/sysconfig/oracledb_ORCLCDB-19c
#

# 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/19c/dbhome_1 

export ORACLE_VERSION=19c 
export ORACLE_SID=ORCLCDB
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

# General exports and vars
export PATH=$ORACLE_HOME/bin:$PATH
LSNR=$ORACLE_HOME/bin/lsnrctl
SQLPLUS=$ORACLE_HOME/bin/sqlplus
DBCA=$ORACLE_HOME/bin/dbca
NETCA=$ORACLE_HOME/bin/netca
ORACLE_OWNER=oracle
RETVAL=0
CONFIG_NAME="oracledb_$ORACLE_SID-$ORACLE_VERSION.conf"
CONFIGURATION="/etc/sysconfig/$CONFIG_NAME"

# Commands
if [ -z "$SU" ];then SU=/bin/su; fi
if [ -z "$GREP" ]; then GREP=/usr/bin/grep; fi
if [ ! -f "$GREP" ]; then GREP=/bin/grep; fi

# To start the DB
start()
{
    check_for_configuration
    RETVAL=$?
    if [ $RETVAL -eq 1 ]
······

如果不需要更改,执行 /etc/init.d/oracledb_ORCLCDB-19c configure命令创建实例

[root@slmdev package] /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
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/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.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.

创建完成,剩下的就是配置数据库相关参数

4. Configuring Oracle Database

  • 使用oracle用户初始化环境变量
    切换到oracle用户(preinstall时默认创建的)
[oracle@slmdev oracle]$ export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
[oracle@slmdev oracle]$ export ORACLE_SID=ORCLCDB
[oracle@slmdev oracle]$ export ORACLE_BASE=/opt/oracle
[oracle@slmdev oracle]$ export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
[oracle@slmdev ~]$ source .bashrc
  • 修改sys和system用户密码
[oracle@slmdev ~]$ sqlplus sys/ as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 18 17:23:39 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter password: 
[oracle@slmdev ~]$ 
[oracle@slmdev ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 18 17:23:55 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select inst_id,INSTANCE_NAME,status from gv$instance;

   INST_ID INSTANCE_NAME    STATUS
---------- ---------------- ------------
	 1 ORCLCDB	    OPEN

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB1			  READ WRITE NO

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------

/opt/oracle/oradata/ORCLCDB/system01.dbf
/opt/oracle/oradata/ORCLCDB/sysaux01.dbf
/opt/oracle/oradata/ORCLCDB/undotbs01.dbf
/opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf
/opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf
/opt/oracle/oradata/ORCLCDB/users01.dbf
/opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf

11 rows selected.

SQL> alter user system identified by password;

User altered.

SQL> alter user sys identified by password;

User altered.

SQL> exit

到此基本配置完成,可以说相当丝滑,没有任何异常出现

## 启动数据库

# 1. 启动监听
lsnrctl start

# 进入数据库启动CBD
sqlplus / as sysdba

# 查看当前CDB
startup
show con_name

# 切换
alter session set container=ORCLPDB1;

# 启动
startup

设置密码永不过期

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

补充:

glibc降级

安装oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm时报错,检查版本不对应,类似下图

img

注意:尽量不要直接 使用rpm -e --nodeps 命令 。

如果使用这个命令强制卸载rpm包会悲剧的,只能重装centos系统。

正确的方法是:

  1. 将对应的rpm包上传到服务器
  2. rpm -Uvh glib*.rpm --oldpackage
  3. 最后执行 命令 Idconfig
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0x77786e

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值