Linux下重启Oracle服务及监听器和实例详解
本文分别介绍了Linux下重启Oracle服务、监听器和实例的相关操作步骤,并提供了两个示例说明。
重启Oracle服务
在Linux下重启Oracle服务,需要使用到systemd
服务管理器和oracle-rdbms
组件。操作步骤如下:
- 检查Oracle服务的运行状态:
systemctl status oracle.service
- 停止Oracle服务:
systemctl stop oracle.service
- 启动Oracle服务:
systemctl start oracle.service
- 检查Oracle服务的运行状态,确认是否已成功重启:
systemctl status oracle.service
示例1:
[oracle@linux ~]$ systemctl status oracle.service
● oracle.service - SYSV: Oracle RDBMS server
Loaded: loaded (/etc/rc.d/init.d/oracle; bad; vendor preset: disabled)
Active: active (running) since Tue 2021-09-14 09:57:51 CST; 1 day 2h ago
Process: 52717 ExecStop=/etc/rc.d/init.d/oracle stop (code=exited, status=0/SUCCESS)
Process: 56732 ExecStart=/etc/rc.d/init.d/oracle start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/oracle.service
├─56733 /bin/sh /usr/local/bin/dbstart /u01/app/oracle
└─56739 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
[oracle@linux ~]$ systemctl stop oracle.service
[oracle@linux ~]$ systemctl start oracle.service
[oracle@linux ~]$ systemctl status oracle.service
● oracle.service - SYSV: Oracle RDBMS server
Loaded: loaded (/etc/rc.d/init.d/oracle; bad; vendor preset: disabled)
Active: active (running) since Wed 2021-09-15 13:11:43 CST; 2s ago
Process: 58217 ExecStop=/etc/rc.d/init.d/oracle stop (code=exited, status=0/SUCCESS)
Process: 58356 ExecStart=/etc/rc.d/init.d/oracle start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/oracle.service
├─58357 /bin/sh /usr/local/bin/dbstart /u01/app/oracle
└─58363 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
重启Oracle监听器
在Linux下重启Oracle监听器,需要使用到lsnrctl
监听器控制工具。操作步骤如下:
- 使用
lsnrctl
连接到监听器进程:lsnrctl start
- 输入
start
命令,启动监听器:start
- 重启完毕后可以输入
status
命令确认监听器状态是否正常:status
示例2:
[oracle@linux ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-SEP-2021 13:36:14
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux.example.com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-SEP-2021 13:36:14
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux.example.com)(PORT=1521)))
The listener supports no services
The command completed successfully
重启Oracle实例
在Linux下重启Oracle实例,需要使用到SQL*Plus工具连接到Oracle数据库实例,并使用SQL命令进行操作。操作步骤如下:
- 连接到Oracle数据库实例:
sqlplus / as sysdba
- 使用
shutdown
命令关闭Oracle实例:shutdown immediate
- 启动Oracle实例:
startup
示例3:
[oracle@linux ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 15 13:45:39 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 281018368 bytes
Fixed Size 2230120 bytes
Variable Size 192940136 bytes
Database Buffers 80530688 bytes
Redo Buffers 5898240 bytes
Database mounted.
Database opened.
SQL>
以上就是Linux下重启Oracle服务及监听器和实例的完整攻略以及两个示例说明。
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:Linux下重启oracle服务及监听器和实例详解 - Python技术站