实战 | CentOS 7 安装 Oracle 19c
[root@node01 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.111 node01.tyun.cn node01
先决条件
[root@node01 ~]# yum -y install binutils \
compat-libcap1 gcc gcc-c++ \
glibc glibc.i686 glibc-devel glibc.i686 \
ksh libaio libaio.i686 libaio-devel libaio-devel.i686 \
libgcc libgcc.i686 libstdc++ \
libstdc++.i686 libstdc++-devel \
libstdc++-devel.i686 compat-libstdc++-33 \
compat-libstdc++-33.i686 libXi libXi.i686 \
libXtst libXtst.i686 make sysstat
[root@node01 ~]# MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')
[root@node01 ~]# echo $MEMTOTAL
8201162752
[root@node01 ~]# SHMMAX=$(expr $MEMTOTAL / 2)
[root@node01 ~]# SHMMNI=4096
[root@node01 ~]# PAGESIZE=$(getconf PAGE_SIZE)
[root@node01 ~]# echo $SHMMAX
4100581376
[root@node01 ~]# echo $PAGESIZE
4096
[root@node01 ~]# cat > /etc/sysctl.d/50-oracle.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = $SHMMAX
kernel.shmall = $(expr \( $SHMMAX / $PAGESIZE \) \* \( $SHMMNI / 16 \))
kernel.shmmni = $SHMMNI
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
[root@node01 ~]# sysctl --system
.....
.....
* Applying /etc/sysctl.d/50-oracle.conf ...
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 9469661184
kernel.shmall = 591853824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
* Applying /usr/lib/sysctl.d/60-libvirtd.conf ...
fs.aio-max-nr = 1048576
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.conf ...
[root@node01 ~]# i=54321; for group in oinstall dba oper backupdba dgdba kmdba asmdba asmoper asmadmin racdba; do
groupadd -g $i $group; i=$(expr $i + 1)
done
[root@node01 ~]# useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,racdba -d /usr/oracle oracle
[root@node01 ~]# passwd oracle
Changing password for user oracle.
New password: # oraclePassword
Retype new password: # oraclePassword
passwd: all authentication tokens updated successfully.
[root@node01 ~]# mkdir -p /u01/app/oracle
[root@node01 ~]# chown -R oracle:oinstall /u01/app
[root@node01 ~]# chmod -R 755 /u01
[root@node01 ~]# vi /etc/pam.d/login
# line 15: add
session required pam_selinux.so open
session required pam_namespace.so
session required pam_limits.so # 增加此行
session optional pam_keyinit.so force revoke
session include system-auth
-session optional pam_ck_connector.so
[root@node01 ~]# vi /etc/security/limits.d/50-oracle.conf
# create new
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
node01 login: oracle
Password:
[oracle@node01 ~]$ vi ~/.bash_profile
# add to the end
umask 022
export ORACLE_BASE=/u01/app/oracle
开始安装
图形界面安装
字符界面安装
# create a directory for installation
[oracle@node01 ~]$ mkdir database
[oracle@node01 ~]$ vi ~/.bash_profile
# add to the end
# ORACLE_BASE : base directory for application
# ORACLE_HOME : Oracle home
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/usr/oracle/database
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@node01 ~]$ source ~/.bash_profile
./runInstaller
,不带参数即可。[oracle@node01 ~]$ cd database
[oracle@node01 database]$ unzip LINUX.X64_193000_db_home.zip
[oracle@node01 database]$ export ORA_INVENTORY=/u01/app/oraInventory
# for example, install Enterprise Edition with software only (not create DB yet)
[oracle@node01 database]$ ./runInstaller -ignorePrereq -waitforcompletion -silent \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOME=$ORACLE_HOME \
ORACLE_BASE=$ORACLE_BASE \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=$ORA_INVENTORY \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba \
oracle.install.db.rootconfig.executeRootScript=true \
oracle.install.db.rootconfig.configMethod=ROOT \
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \
oracle.install.db.ConfigureAsContainerDB=false
Launching Oracle Database Setup Wizard...
[WARNING] [INS-35950] Installer has detected an invalid entry in the central inventory corresponding to Oracle home (/usr/oracle/database).
ACTION: Choose a different location as Oracle home.
# 需要输入 root 密码
Enter password for 'root' user:
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/InstallActions2022-04-24_05-12-06PM/installActions2022-04-24_05-12-06PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/InstallActions2022-04-24_05-12-06PM/installActions2022-04-24_05-12-06PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/usr/oracle/database/install/response/db_2022-04-24_05-12-06PM.rsp
You can find the log of this install session at:
/u01/app/oraInventory/logs/InstallActions2022-04-24_05-12-06PM/installActions2022-04-24_05-12-06PM.log
Successfully Setup Software with warning(s).
创建 Oracle 监听
图形界面设置 Listener
字符界面设置 Listener
netca
命令增加网络监听# create a response file
# all parameters below are default values, change them for your needs
[oracle@node01 ~]$ vi netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="19.0"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
[oracle@node01 ~]$ netca -silent -responsefile $(pwd)/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /usr/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/usr/oracle/database/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
tnslsnr
命令查看监听状态。如下:[oracle@node01 ~]$ ss -napt | grep 1521
LISTEN 0 128 *:1521 *:* users:(("tnslsnr",pid=25768,fd=8))
TIME-WAIT 0 0 127.0.0.1:1521 127.0.0.1:46686
TIME-WAIT 0 0 127.0.0.1:46672 127.0.0.1:1521
## 可选步骤 ##
# 修改监听地址为:0.0.0.0
[oracle@node01 ~]$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /usr/oracle/database/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
# 重启监听
[oracle@node01 ~]$ lsnrctl stop ; lsnrctl start
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 24-APR-2022 17:37:05
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
## 可选步骤 ##
[oracle@node01 ~]$ tnsping localhost
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 24-APR-2022 17:39:39
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
/usr/oracle/database/network/admin/sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
OK (70 msec)
[root@node01 ~]# firewall-cmd --add-port=1521/tcp --permanent
success
[root@node01 ~]# firewall-cmd --reload
success
创建 Database
图形界面创建数据库
[oracle@node01 ~]$ dbca
[oracle@node01 ~]$ vi /etc/oratab
# change like follows
db01:/usr/oracle/database:Y
[oracle@node01 ~]$ vi ~/.bash_profile
# add your SID to the end
export ORACLE_SID=db01
[oracle@node01 ~]$ source ~/.bash_profile
[oracle@node01 ~]$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jan 21 20:07:57 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> select instance_name, host_name, version, startup_time from v$instance;
INSTANCE_NAME
----------------
HOST_NAME
----------------------------------------------------------------
VERSION STARTUP_T
----------------- ---------
db01
node01.tyun.cn
19.0.0.0.0 25-APR-22
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[root@node01 ~]# firewall-cmd --add-port=5500/tcp --permanent
success
[root@node01 ~]# firewall-cmd --reload
success
字符界面创建数据库
dbca
命令创建数据库# set any instance name and create database
[oracle@node01 ~]$ export ORACLE_SID=db01
[oracle@node01 ~]$ export DBEXPRESS_HTTPS_PORT=5500
[oracle@node01 ~]$ dbca -silent -createDatabase \
-databaseConfigType SINGLE \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID}.$(hostname -d) \
-sid ${ORACLE_SID} \
-listeners LISTENER \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword sysPassword \
-systemPassword systemPassword \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName orclpdb \
-pdbAdminPassword pdbAdminPassword \
-databaseType MULTIPURPOSE \
-memoryPercentage 30 \
-storageType FS \
-datafileDestination "${ORACLE_BASE}/oradata/${ORACLE_SID}" \
-emConfiguration DBEXPRESS
=== 一些警告信息,可以忽略 ====
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
=== 一些警告信息,可以忽略 ====
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:
/u01/app/oracle/cfgtoollogs/dbca/db01.
Database Information:
Global Database Name:db01.tyun.cn
System Identifier(SID):db01
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/db01/db01.log" for further details.
[oracle@node01 ~]$ vi /etc/oratab
# last line : change
db01:/usr/oracle/database:Y
[oracle@node01 ~]$ vi ~/.bash_profile
# add SID to the end
export ORACLE_SID=db01
[oracle@node01 ~]$ source ~/.bash_profile
[oracle@node01 ~]$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 1 02:01:36 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> select instance_name, host_name, version, startup_time from v$instance;
INSTANCE_NAME
----------------
HOST_NAME
----------------------------------------------------------------
VERSION STARTUP_T
----------------- ---------
db01
node01.tyun.cn
19.0.0.0.0 24-APR-22
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[root@node01 ~]# firewall-cmd --add-port=5500/tcp --permanent
success
[root@node01 ~]# firewall-cmd --reload
success
sys/sysPassword
进行登录:创建 Systemd 文件
[root@node01 ~]# vi /etc/sysconfig/db01.oracledb
# create new : define environment variables
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/usr/oracle/database
ORACLE_SID=db01
# configure listener service
[root@node01 ~]# vi /usr/lib/systemd/system/[email protected]
# this is an example, modify for free
[Unit]
Description=Oracle Net Listener
After=network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/db01.oracledb
ExecStart=/usr/oracle/database/bin/lsnrctl start
ExecStop=/usr/oracle/database/bin/lsnrctl stop
User=oracle
[Install]
WantedBy=multi-user.target
# configure database service
[root@node01 ~]# vi /usr/lib/systemd/system/[email protected]
# this is an example, modify for free
[Unit]
Description=Oracle Database service
After=network.target lsnrctl.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/db01.oracledb
ExecStart=/usr/oracle/database/bin/dbstart $ORACLE_HOME
ExecStop=/usr/oracle/database/bin/dbshut $ORACLE_HOME
User=oracle
[Install]
WantedBy=multi-user.target
[root@node01 ~]# systemctl daemon-reload
[root@node01 ~]# systemctl enable db01@lsnrctl db01@oracledb
[root@node01 ~]# systemctl status [email protected]
● [email protected] - Oracle Net Listener
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-04-25 09:15:58 CST; 6s ago
Process: 5565 ExecStop=/usr/oracle/database/bin/lsnrctl stop (code=exited, status=0/SUCCESS)
Process: 5568 ExecStart=/usr/oracle/database/bin/lsnrctl start (code=exited, status=0/SUCCESS)
Main PID: 5570 (tnslsnr)
CGroup: /system.slice/system-db01.slice/[email protected]
└─5570 /usr/oracle/database/bin/tnslsnr LISTENER -inherit
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Log messages written to /u01/app/ora...l
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Listening on: (DESCRIPTION=(ADDRESS=...)
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Listening on: (DESCRIPTION=(ADDRESS=...)
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Connecting to (DESCRIPTION=(ADDRESS=...)
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: STATUS of the LISTENER
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: ------------------------
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Alias LISTENER
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Version TNSLSNR fo...n
Apr 25 09:15:58 node01.tyun.cn lsnrctl[5568]: Start Date 25-APR-202...8
Apr 25 09:15:58 node01.tyun.cn systemd[1]: Started Oracle Net Listener.
Hint: Some lines were ellipsized, use -l to show in full.
[root@node01 ~]# systemctl status [email protected]
● [email protected] - Oracle Database service
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
Active: inactive (dead)
[root@node01 ~]# systemctl restart [email protected]
[root@node01 ~]# systemctl status [email protected]
● [email protected] - Oracle Database service
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-04-25 09:16:49 CST; 11s ago
Process: 5638 ExecStart=/usr/oracle/database/bin/dbstart $ORACLE_HOME (code=exited, status=0/SUCCESS)
CGroup: /system.slice/system-db01.slice/[email protected]
├─5753 ora_pmon_db01
├─5755 ora_clmn_db01
├─5757 ora_psp0_db01
├─5760 ora_vktm_db01
......
├─6146 ora_s001_db01
└─6151 ora_w004_db01
Apr 25 09:16:33 node01.tyun.cn systemd[1]: Starting Oracle Database service...
Apr 25 09:16:33 node01.tyun.cn dbstart[5638]: Processing Database instance "db01":...g
Apr 25 09:16:49 node01.tyun.cn systemd[1]: Started Oracle Database service.
Hint: Some lines were ellipsized, use -l to show in full.
从 RPM 包安装数据库
[root@node01 ~]# curl http://public-yum.oracle.com/public-yum-ol7.repo -o /etc/yum.repos.d/public-yum-ol7.repo
[root@node01 ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/public-yum-ol7.repo
[root@node01 ~]# rpm --import http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7
[root@node01 ~]# yum --enablerepo=ol7_latest -y install oracle-database-preinstall-19c
[root@node01 ~]# rpm -Uvh oracle-database-ee-19c-1.0-1.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:oracle-database-ee-19c-1.0-1 ################################# [100%]
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure
[root@node01 ~]# vi /etc/sysconfig/oracledb_ORCLCDB-19c.conf
# change default settings if you need
# listening port for Listener
LISTENER_PORT=1521
# data location
ORACLE_DATA_LOCATION=/opt/oracle/oradata
# EM_EXPRESS_PORT: Oracle EM Express listener
# listening port for Enterprise Manager
EM_EXPRESS_PORT=5500
# create sample Database [ORCLCDB]
[root@node01 ~]# /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.
[oracle@node01 ~]$ vi ~/.bash_profile
# add to the end
umask 022
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle/oradata
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@node01 ~]$ source ~/.bash_profile
# verify connection
[oracle@node01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 21 21:22:53 2020
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 name from v$database;
NAME
---------
DB01
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
db01 OPEN
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[root@node01 ~]# vi /etc/oratab
# last line : change
ORCLCDB:/opt/oracle/product/19c/dbhome_1:Y
[root@node01 ~]# vi /etc/sysconfig/ORCLCDB.oracledb
# create new : define environment variables
ORACLE_BASE=/opt/oracle/oradata
ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ORACLE_SID=ORCLCDB
# configure listener service
[root@node01 ~]# vi /usr/lib/systemd/system/[email protected]
# this is an example, modify for free
[Unit]
Description=Oracle Net Listener
After=network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/ORCLCDB.oracledb
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/lsnrctl stop
User=oracle
[Install]
WantedBy=multi-user.target
# configure database service
[root@node01 ~]# vi /usr/lib/systemd/system/[email protected]
# this is an example, modify for free
[Unit]
Description=Oracle Database service
After=network.target lsnrctl.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/ORCLCDB.oracledb
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/dbstart $ORACLE_HOME
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/dbshut $ORACLE_HOME
User=oracle
[Install]
WantedBy=multi-user.target
[root@node01 ~]# systemctl daemon-reload
[root@node01 ~]# systemctl enable ORCLCDB@lsnrctl ORCLCDB@oracledb
遇到的问题
安装失败
推荐阅读
推荐视频
微信扫码关注该文公众号作者
戳这里提交新闻线索和高质量文章给我们。
来源: qq
点击查看作者最近其他文章