1、查看监听
C:\>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:13:14
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 2: No such file or directory
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 61: Unknown error
2、启动监听
C:\>lsnrctl start
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:14:50
Copyright (c) 1991, 2010, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
写入d:\app\administrator\diag\tnslsnr\PC-20150324PGVY\listener\alert\log.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
启动日期 29-3月 -2015 21:14:51
正常运行时间 0 天 0 小时 0 分 1 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\administrator\diag\tnslsnr\PC-20150324PGVY\listener\alert\log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
3、关闭监听
C:\>lsnrctl stop
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:17:01
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
命令执行成功
4、访问本地数据库不需要启动监听
SQL> connect system/manager
已连接。
5、访问网络数据库需要启动监听
SQL> connect system/manager@cs
ERROR:
ORA-12541: TNS: 无监听程序
警告: 您不再连接到 ORACLE。
6、sqlplus / as sysdba 是否允许
位于sqlnet.ora文件
|-SQLNET.AUTHENTICATION_SERVICES= (NTS) 允许
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:28:26 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
|-SQLNET.AUTHENTICATION_SERVICES= (NONE) 不允许
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:28:36 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
7、是否允许轻松连接(ezconnect)
位于sqlnet.ora文件
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
|-TNSNAMES 使用tnsnames.ora文件
|-EZCONNECT 轻松连接 sqlplus 用户名/密码@服务器地址:端口号/SID
C:\>sqlplus system/manager@localhost:1521/cs
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:41:44 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
图形配置工具:命名方法配置-->轻松连接命名
8、可以配置多个监听,以监听多个端口
local_listener='(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = PC-20150324PGVY)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = PC-20150324PGVY)(PORT = 1522))
)'
9、tnsping host_string
C:\>tnsping cs
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 22:47:13
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = cs)))
OK (20 毫秒)
C:\>tnsping cs1
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 22:47:21
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
TNS-03505: 无法解析名称
10、监听程序的静态注册(UnKnown)和动态注册(Readly PMON进程)
C:\>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:13:14
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 2: No such file or directory
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 61: Unknown error
2、启动监听
C:\>lsnrctl start
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:14:50
Copyright (c) 1991, 2010, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
系统参数文件为d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
写入d:\app\administrator\diag\tnslsnr\PC-20150324PGVY\listener\alert\log.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
启动日期 29-3月 -2015 21:14:51
正常运行时间 0 天 0 小时 0 分 1 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\administrator\diag\tnslsnr\PC-20150324PGVY\listener\alert\log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
3、关闭监听
C:\>lsnrctl stop
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 21:17:01
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
命令执行成功
4、访问本地数据库不需要启动监听
SQL> connect system/manager
已连接。
5、访问网络数据库需要启动监听
SQL> connect system/manager@cs
ERROR:
ORA-12541: TNS: 无监听程序
警告: 您不再连接到 ORACLE。
6、sqlplus / as sysdba 是否允许
位于sqlnet.ora文件
|-SQLNET.AUTHENTICATION_SERVICES= (NTS) 允许
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:28:26 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
|-SQLNET.AUTHENTICATION_SERVICES= (NONE) 不允许
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:28:36 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
7、是否允许轻松连接(ezconnect)
位于sqlnet.ora文件
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
|-TNSNAMES 使用tnsnames.ora文件
|-EZCONNECT 轻松连接 sqlplus 用户名/密码@服务器地址:端口号/SID
C:\>sqlplus system/manager@localhost:1521/cs
SQL*Plus: Release 11.2.0.1.0 Production on 星期日 3月 29 21:41:44 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
图形配置工具:命名方法配置-->轻松连接命名
8、可以配置多个监听,以监听多个端口
local_listener='(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = PC-20150324PGVY)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = PC-20150324PGVY)(PORT = 1522))
)'
9、tnsping host_string
C:\>tnsping cs
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 22:47:13
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = cs)))
OK (20 毫秒)
C:\>tnsping cs1
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 29-3月 -2015 22:47:21
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
TNS-03505: 无法解析名称
10、监听程序的静态注册(UnKnown)和动态注册(Readly PMON进程)