3. 加密listener
有时候处于安全考虑,会需要对listener设置密码。
3.1 设置监听名
如果有多个监听,那么需要先设置当前的监听
LSNRCTL>set current_listener listener_name
3.2 设置密码
使用change_password设置listener口令。
LSNRCTL> change_password
Old password: --如果原来没有设置口令就直接回车,否则输入原来的口令
New password:
Reenter new password:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.4)(PORT=1521)))
Password changed for LISTENER
The command completed successfully
--保存密码:
LSNRCTL> save_config
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.4)(PORT=1521)))
Saved LISTENER configuration parameters.
Listener Parameter File /u01/app/Oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Old Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.bak
The command completed successfully
--加密之前:
[oracle@dave ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 -Production on 22-DEC-2012 22:54:55
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version11.2.0.3.0 - Production
Start Date 22-DEC-2012 21:57:46
Uptime 0 days 0 hr. 57 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dave/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.4)(PORT=1521)))
Services Summary...
Service "dave" has 2 instance(s).
Instance "dave", status UNKNOWN, has 1 handler(s) for thisservice...
Instance "dave", status READY, has 1 handler(s) for thisservice...
Service "daveXDB" has 1instance(s).
Instance "dave", status READY, has 1 handler(s) for thisservice...
--加密之后:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version11.2.0.3.0 - Production
Start Date 22-DEC-2012 22:56:19
Uptime 0 days 0 hr. 11 min. 2 sec
Trace Level off
Security ON: Password or Local OSAuthentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dave/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.4)(PORT=1521)))
Services Summary...
Service "dave" has 2 instance(s).
Instance "dave", status UNKNOWN, has 1 handler(s) for thisservice...
Instance "dave", status READY, has 1 handler(s) for thisservice...
Service "daveXDB" has 1instance(s).
Instance "dave", status READY, has 1 handler(s) for this service...
The command completed successfully
--在listener.ora 文件中也会多一个配置参数:
[oracle@dave ~]$ cat/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
…
#----ADDED BY TNSLSNR 22-DEC-201221:59:58---
LOGGING_LISTENER = ON
#--------------------------------------------
#----ADDED BY TNSLSNR 22-DEC-201223:06:31---
PASSWORDS_LISTENER =1DF5C2FD0FE9CFA2
#--------------------------------------------
[oracle@dave ~]$
3.3 解除密码
listener的密码策略是防止stop,所以在stop时需要确认密码,在start时不需要输入密码。
LSNRCTL> set password
Password:
The command completed successfully
使用set password输入正确的密码后,就可以进行stop操作了。
