------listener.ora 20090420------
--A DB version: TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 --
--B DB version: 10.2.0.4 for Redhat 5
1、在B 机上设listener.ora指向A的listener
[oracle@OracleTest admin]$ more listener.ora
ID_LIST_listener =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = mydb2)
      (ORACLE_HOME = C:\oracle\ora9i)
      (SID_NAME = mydb2)
    )
  )

listener=
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.49.103)(PORT = 1521))
      )
    )
  )

2、在B机器上下stop命令停listener
[oracle@OracleTest admin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 20-APR-2009 15:09:28

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
Start Date                20-4月 -2009 14:49:15
Uptime                    0 days 0 hr. 20 min. 45 sec
Trace Level               off
Security                  ON
SNMP                      OFF
Listener Log File         C:\oracle\ora9i\network\log\listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sh1itos4117da1.SH.Gracesemi.Local)(PORT=1521)))
The listener supports no services
The command completed successfully

[oracle@OracleTest admin]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 20-APR-2009 14:50:58

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
The command completed successfully
[oracle@OracleTest admin]$

在A上check listener的状态:
C:\Documents and Settings\Administrator>lsnrctl status

LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 20-4月 -2009 14:51
:29

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
TNS-12541: TNS:无监听器
 TNS-12560: TNS: 协议适配器错误
  TNS-00511: 无监听器
   32-bit Windows Error: 61: Unknown error

---在A 上设置listener密码:123
LSNRCTL> start
启动tnslsnr:请稍候...

TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
系统参数文件为C:\oracle\ora9i\network\admin\listener.ora
写入C:\oracle\ora9i\network\log\listener.log的日志信息
监听:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.49.103)(PORT=1521)))

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Produc
tion
启动日期                  20-4月 -2009 16:07:20
正常运行时间              0 天 0 小时 0 分 0 秒
跟踪级别                  off
安全性                    OFF
SNMP                      OFF
监听器参数文件          C:\oracle\ora9i\network\admin\listener.ora
监听器日志文件          C:\oracle\ora9i\network\log\listener.log
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.49.103)(PORT=1521)))
服务摘要..
服务 "mydb2" 包含 1 个例程。
  例程 "mydb2", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
LISTENER的口令已更改
命令执行成功
LSNRCTL> set password
Password:
命令执行成功
LSNRCTL> save_config
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
保存的LISTENER配置参数。
监听器参数文件          C:\oracle\ora9i\network\admin\listener.ora
旧的参数文件C:\oracle\ora9i\network\admin\listener.bak
命令执行成功

--察看listener.ora文件
发现多出以下1行

#----ADDED BY TNSLSNR 20-4月 -2009 16:08:17---
PASSWORDS_LISTENER = F49689E329B4DDE4
#---------------------------------------------

---在B机上尝试stop A机的listener
[oracle@OracleTest admin]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 20-APR-2009 16:09:54

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
TNS-01169: The listener has not recognized the password

---在A 机上stop listener
C:\Documents and Settings\Administrator>lsnrctl

LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 20-4月 -2009 16:17
:47

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

欢迎来到LSNRCTL,请键入"help"以获得信息。

LSNRCTL> stop
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
TNS-01169: 监听器尚未识别口令
LSNRCTL> set password F49689E329B4DDE4
命令执行成功
LSNRCTL> stop
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
命令执行成功
LSNRCTL> status
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.49.103)(PORT=1521)))
TNS-12541: TNS:无监听器
 TNS-12560: TNS: 协议适配器错误
  TNS-00511: 无监听器
   32-bit Windows Error: 61: Unknown error
LSNRCTL>


---如果要取消listener的密码,只需要删除A机上listener.ora文件中的密码设置行即可
#----ADDED BY TNSLSNR 20-4月 -2009 16:08:17---
#PASSWORDS_LISTENER = F49689E329B4DDE4
#---------------------------------------------

总结:1、listener 不配置密码,可在其他机器上stop listener。
2、取消listener密码只需将listener.ora文件中的密码行注销即可

posted on 2009-04-20 16:28  Alex.Zhang  阅读(1797)  评论(0编辑  收藏  举报