文章目录
- 一、Oracle监听
- 1.1. 查看Oracle监听运行状态
- 1.2. 启动Oracle监听
- 1.3. 关闭监听器
- 二、Oracle 服务
- 2.1. 以SYS用户身份登录Oracle
- 2.2. 切换用户至sys
- 2.3. 启动Oracle实例
- 2.4. 停止Oeacle实例运行
一、Oracle监听
操作声明:登录服务器,切换到oracle用户,或者以oracle用户登录
#切换oracle用户
[root@localhost ~]$ su - oracle
密码:
[oracle@localhost ~]$
1.1. 查看Oracle监听运行状态
[oracle@localhost ~]$ lsnrctl status
从图中可以看到oracle监听没有运行
1.2. 启动Oracle监听
[oracle@localhost ~]$ lsnrctl start
再次查看Oracle监听运行状态
[oracle@localhost ~]$ lsnrctl status
从图中可以看到oracle监听已经运行
1.3. 关闭监听器
二、Oracle 服务
2.1. 以SYS用户身份登录Oracle
[oracle@localhost ~]$ sqlplus /nologSQL*Plus: Release 11.2.0.4.0 Production on Sat May 16 15:43:46 2020Copyright (c) 1982, 2013, Oracle. All rights reserved.SQL> conn /as sysdba
Connected to an idle instance.
2.2. 切换用户至sys
切换用户:
CONN 用户名/密码 [AS SYSDBA],如果是sys用户一定要写上AS SYSDBA
sqlplus /nolog
conn /as sysdba
2.3. 启动Oracle实例
SQL> startup
ORACLE instance started.Total System Global Area 8551575552 bytes
Fixed Size 2270360 bytes
Variable Size 4244638568 bytes
Database Buffers 4294967296 bytes
Redo Buffers 9699328 bytes
Database mounted.
Database opened.
2.4. 停止Oeacle实例运行
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
操作日志如下;
Last login: Sat Jun 20 18:03:14 2020 from 192.168.6.188
[root@sonar ~]# su - oracle
ORACLE_BASE=/u01/oracle
ORACLE_HOME=/u01/oracle/product/11.2.0/db_1
ORACLE_SID=sonar
[oracle@sonar ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:19Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
TNS-12541: TNS:no listenerTNS-12560: TNS:protocol adapter errorTNS-00511: No listenerLinux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listenerTNS-12560: TNS:protocol adapter errorTNS-00511: No listenerLinux Error: 111: Connection refused
[oracle@sonar ~]$ lsnrctl startLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:32Copyright (c) 1991, 2013, Oracle. All rights reserved.Starting /u01/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/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/oracle/diag/tnslsnr/sonar/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sonar)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-JUN-2020 18:31:34
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/diag/tnslsnr/sonar/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sonar)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@sonar ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2020 18:31:47Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-JUN-2020 18:31:34
Uptime 0 days 0 hr. 0 min. 13 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/diag/tnslsnr/sonar/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sonar)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@sonar ~]$ sqlplus /nologSQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 20 18:32:56 2020Copyright (c) 1982, 2013, Oracle. All rights reserved.SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.Total System Global Area 8551575552 bytes
Fixed Size 2270360 bytes
Variable Size 4244638568 bytes
Database Buffers 4294967296 bytes
Redo Buffers 9699328 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@sonar ~]$