一、设置监听的密码
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db02.nowexit)(PORT=1521)))
Password changed for LISTENER
The command completed successfully
LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db02.nowexit)(PORT=1521)))
Saved LISTENER configuration parameters.
Listener Parameter File /u01/app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
Old Parameter File /u01/app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.bak
The command completed successfully
在listener.ora文件中添加LOCAL_OS_AUTHENTICATION_LISTENER = OFF,启用监听密码
二、这下我们再来停止监听
[oracle@db02 ~]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 09-MAR-2014 23:59:53
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db02.nowexit)(PORT=1521)))
TNS-01169: The listener has not recognized the password
可以看出报密码没有指定。
LSNRCTL> set password
Password:
The command completed successfully
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db02.nowexit)(PORT=1521)))
The command completed successfully
执行密码以后则可以正常关闭。
当我们在忘记密码的时候,就算将监听文件删除、替换都没有办法重置密码。这个时候,我们则需要查杀监听进程。
[oracle@db02 admin]$ ps -elf | grep lsnr | grep -v grep
0 S oracle 18572 17481 0 78 0 - 4748 - 00:01 pts/0 00:00:00 lsnrctl
0 S oracle 18574 1 0 78 0 - 10591 stext 00:01 ? 00:00:00 /u01/app/oracle/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER –inherit
[oracle@db02 admin]$ kill -9 18574
同时注释监听文件文件中的以下两项
#PASSWORDS_LISTENER = 7AAA926EC45D3A02
#LOCAL_OS_AUTHENTICATION_LISTENER = OFF
这样既想当于无密码,重启监听即可。