设置 Oracle 监听器密码(LISTENER) .


-- 设置 Oracle 监听器密码(LISTENER)
--==================================

    监听器也有安全?Sure!在缺省的情况下,任意用户不需要使用任何密码即通过lsnrctl 工具对Oracle Listener进行操作或关闭,从
而造成任意新的会话都将无法建立连接。在Oracle 9i 中Oracle监听器允许任何一个人利用lsnrctl从远程发起对监听器的管理。也容易导致数
据库受到损坏。

1. 未设定密码情形下停止监听       
[sql] view plain copy print ?
  1. [oracle@test ~]$ lsnrctl stop listener_demo92   -->停止监听,可以看出不需要任何密码即可停止    
  2.                                                                                               
  3. LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 08:22:26                     
  4.                                                                                               
  5. Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                           
  6.                                                                                               
  7. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                    
  8. The command completed successfully                                                            
[oracle@test ~]$ lsnrctl stop listener_demo92   -->停止监听,可以看出不需要任何密码即可停止 
                                                                                            
LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 08:22:26                   
                                                                                            
Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                         
                                                                                            
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                  
The command completed successfully                                                          
2. 重新启动监听并设置密码
[sql] view plain copy print ?
  1. [oracle@test ~]$ lsnrctl                                                                                                    
  2.                                                                                                                             
  3. LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 08:24:09                                                   
  4. Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                                                         
  5.                                                                                                                             
  6. Welcome to LSNRCTL, type "help" for information.                                                                              
  7. LSNRCTL> set current_listener listener_demo92  -->设置当前监听器                                                             
  8. Current Listener is listener_demo92                                                                                         
  9. LSNRCTL> start             -->启动过程也不需要任何密码,启动的详细信息省略                                                    
  10. LSNRCTL> change_password   -->使用change_password来设置密码                                                                  
  11. Old password:                                                                                                               
  12. New password:                                                                                                               
  13. Reenter new password:                                                                                                       
  14. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                  
  15. Password changed for listener_demo92                                                                                        
  16. The command completed successfully                                                                                          
  17. LSNRCTL> save_config        -->注意此处的save_config失败                                                                     
  18. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                  
  19. TNS-01169: The listener has not recognized the password                                                                     
  20. LSNRCTL> set password       -->输入新设定的密码验证                                                                          
  21. Password:                                                                                                                   
  22. The command completed successfully                                                                                          
  23. LSNRCTL> save_config       -->再次save_config成功                                                                            
  24. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                  
  25. Saved listener_demo92 configuration parameters.                                                                             
  26. Listener Parameter File   /oracle/92/network/admin/listener.ora                                                             
  27. Old Parameter File   /oracle/92/network/admin/listener.bak                                                                  
  28. The command completed successfully                                                                                          
  29.                                                                                                                             
  30. -->增加密码之后可以看到listener.ora文件中有一条新增的记录,即密码选项(注:尽管使用了密码管理方式,仍然可以无需密码启动监听)   
  31. [oracle@test admin]$ more listener.ora                                                                                      
  32.     #----ADDED BY TNSLSNR 26-JUN-2011 05:12:48---                                                                              
  33.     PASSWORDS_listener_demo92 =                                                                                               
  34.     #--------------------------------------------                                                                             
[oracle@test ~]$ lsnrctl                                                                                                  
                                                                                                                          
LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 08:24:09                                                 
Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                                                       
                                                                                                                          
Welcome to LSNRCTL, type "help" for information.	                                                                        
LSNRCTL> set current_listener listener_demo92  -->设置当前监听器                                                          
Current Listener is listener_demo92                                                                                       
LSNRCTL> start             -->启动过程也不需要任何密码,启动的详细信息省略                                                 
LSNRCTL> change_password   -->使用change_password来设置密码                                                               
Old password:                                                                                                             
New password:                                                                                                             
Reenter new password:                                                                                                     
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                
Password changed for listener_demo92                                                                                      
The command completed successfully                                                                                        
LSNRCTL> save_config        -->注意此处的save_config失败                                                                  
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                
TNS-01169: The listener has not recognized the password                                                                   
LSNRCTL> set password       -->输入新设定的密码验证                                                                       
Password:                                                                                                                 
The command completed successfully                                                                                        
LSNRCTL> save_config       -->再次save_config成功                                                                         
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                                                
Saved listener_demo92 configuration parameters.                                                                           
Listener Parameter File   /oracle/92/network/admin/listener.ora                                                           
Old Parameter File   /oracle/92/network/admin/listener.bak                                                                
The command completed successfully                                                                                        
                                                                                                                          
-->增加密码之后可以看到listener.ora文件中有一条新增的记录,即密码选项(注:尽管使用了密码管理方式,仍然可以无需密码启动监听)
[oracle@test admin]$ more listener.ora                                                                                    
	#----ADDED BY TNSLSNR 26-JUN-2011 05:12:48---                                                                           
	PASSWORDS_listener_demo92 =                                                                                             
	#--------------------------------------------                                                                           
3. 尝试未使用密码的情况下停止监听 
[sql] view plain copy print ?
  1. [oracle@test ~]$ lsnrctl stop listener_demo92                                                 
  2. LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 06:09:51                     
  3. Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                           
  4.                                                                                               
  5. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                    
  6. TNS-01169: The listener has not recognized the password    -->收到错误信息,需要使用密码认证  
[oracle@test ~]$ lsnrctl stop listener_demo92                                               
LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 26-JUN-2011 06:09:51                   
Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.                         
                                                                                            
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))                  
TNS-01169: The listener has not recognized the password    -->收到错误信息,需要使用密码认证
4. 使用密码来停止监听  
[sql] view plain copy print ?
  1. [oracle@test ~]$ lsnrctl                                                         
  2. LSNRCTL> set current_listener listener_demo92                                    
  3. Current Listener is listener_demo92                                              
  4. LSNRCTL> stop                                                                    
  5. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))       
  6. TNS-01169: The listener has not recognized the password                          
  7. LSNRCTL> set password                                                            
  8. Password:                                                                        
  9. The command completed successfully                                               
  10. LSNRCTL> stop                                                                    
  11. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))       
  12. The command completed successfully                                               
  13. LSNRCTL> status                                                                  
  14. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))       
  15. TNS-12541: TNS:no listener                                                       
  16.  TNS-12560: TNS:protocol adapter error                                           
  17.   TNS-00511: No listener                                                         
  18.    Linux Error: 111: Connection refused                                          
  19. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))                
  20. TNS-12541: TNS:no listener                                                       
  21.  TNS-12560: TNS:protocol adapter error                                           
  22.   TNS-00511: No listener                                                         
  23.    Linux Error: 2: No such file or directory                                       
[oracle@test ~]$ lsnrctl                                                       
LSNRCTL> set current_listener listener_demo92                                  
Current Listener is listener_demo92                                            
LSNRCTL> stop                                                                  
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(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=test)(PORT=1521)))     
The command completed successfully                                             
LSNRCTL> status                                                                
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))     
TNS-12541: TNS:no listener                                                     
 TNS-12560: TNS:protocol adapter error                                         
  TNS-00511: No listener                                                       
   Linux Error: 111: Connection refused                                        
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))              
TNS-12541: TNS:no listener                                                     
 TNS-12560: TNS:protocol adapter error                                         
  TNS-00511: No listener                                                       
   Linux Error: 2: No such file or directory	                                 
5. save_config失败的问题   
[sql] view plain copy print ?
  1. -->在 Oracle 9i中,使用save_config命令将会失败                                                                            
  2.     LSNRCTL> save_config                                                                                                   
  3.     Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname>)(PORT=<port>)))                                     
  4.     TNS-01169: The listener has not recognized the password                                                                
  5.                                                                                                                          
  6. -->应该先使用set password之后再save_config,则保存配置成功。                                                              
  7.     LSNRCTL> set password                                                                                                  
  8.     Password: <the password you chose>                                                                                     
  9.     The command completed successfully                                                                                     
  10.                                                                                                                            
  11. /*在Oracle 10g 中不会出现类似的问题,因为在10g中可以使用基于操作系统验证方式。listener将检测到如果用户属于dba组的成员,  
  12. 将会被授予改变密码,保存配置以及停止监听等权限。 */                                                                      
-->在 Oracle 9i中,使用save_config命令将会失败                                                                         
	LSNRCTL> save_config                                                                                                 
	Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname>)(PORT=<port>)))                                   
	TNS-01169: The listener has not recognized the password	                                                             
                                                                                                                       
-->应该先使用set password之后再save_config,则保存配置成功。                                                           
	LSNRCTL> set password                                                                                                
	Password: <the password you chose>                                                                                   
	The command completed successfully                                                                                   
	                                                                                                                     
/*在Oracle 10g 中不会出现类似的问题,因为在10g中可以使用基于操作系统验证方式。listener将检测到如果用户属于dba组的成员,
将会被授予改变密码,保存配置以及停止监听等权限。 */                                                                    
6.  配置listener.ora中ADMIN_RESTRICTIONS参数
    参数作用:
        当在listener.ora文件中设置了ADMIN_RESTRICTIONS参数后,在监听器运行时,不允许执行任何管理命令,同时set命令将不可用
        ,不论是在服务器本地还是从远程执行都不行。此时对于监听的设置仅仅通过手工修改listener.ora文件,要使修改生效,只能
        使用lsnrctl reload命令或lsnrctl stop/start命令重新载入一次监听器配置信息。
    修改方法:
        在listener.ora文件中手动加入下面这样一行

            ADMIN_RESTRICTIONS_<监听器名> = ON


7. 更多参考

有关性能优化请参考

    Oracle硬解析与软解析

    共享池的调整与优化(Sharedpool Tuning)

    Buffercache 的调整与优化(一)

    Oracle表缓存(cachingtable)的使用

 

有关ORACLE体系结构请参考

    Oracle表空间与数据文件

    Oracle密码文件

    Oracle参数文件

    Oracle联机重做日志文件(ONLINE LOG FILE)

    Oracle控制文件(CONTROLFILE)

    Oracle归档日志

    Oracle回滚(ROLLBACK)和撤销(UNDO)

    Oracle数据库实例启动关闭过程

    Oracle10g SGA 的自动化管理

    Oracle实例和Oracle数据库(Oracle体系结构)

 

有关闪回特性请参考

    Oracle闪回特性(FLASHBACK DATABASE)

    Oracle闪回特性(FLASHBACK DROP & RECYCLEBIN)

    Oracle闪回特性(Flashback Query、FlashbackTable)

    Oracle闪回特性(Flashback Version、Flashback Transaction)

 

有关基于用户管理的备份和备份恢复的概念请参考

    Oracle冷备份

    Oracle热备份

    Oracle备份恢复概念

    Oracle实例恢复

    Oracle基于用户管理恢复的处理(详细描述了介质恢复及其处理)

    SYSTEM表空间管理及备份恢复

    SYSAUX表空间管理及恢复

 

有关RMAN的备份恢复与管理请参考

    RMAN 概述及其体系结构

    RMAN 配置、监控与管理

    RMAN 备份详解

    RMAN 还原与恢复

    RMANcatalog 的创建和使用

    基于catalog 创建RMAN存储脚本

基于catalog 的RMAN 备份与恢复

使用RMAN迁移文件系统数据库到ASM

    RMAN 备份路径困惑(使用plus archivelog时)

 

有关ORACLE故障请参考

    ORA-32004的错误处理

    ORA-01658错误

    CRS-0215错误处理

    ORA-00119,ORA-00132 错误处理

    又一例SPFILE设置错误导致数据库无法启动

    对参数FAST_START_MTTR_TARGET= 0 的误解及设定

    SPFILE错误导致数据库无法启动(ORA-01565)

 

有关ASM请参考

    创建ASM实例及ASM数据库

    ASM 磁盘、目录的管理

    使用 ASMCMD 工具管理ASM目录及文件

 

有关SQL/PLSQL请参考

    SQLPlus常用命令

    替代变量与SQL*Plus环境设置

    使用Uniread实现SQLplus翻页功能

    SQL 基础-->SELECT 查询

    SQL 基础--> NEW_VALUE的使用

    SQL 基础--> 集合运算(UNION与UNION ALL)

    SQL 基础--> 常用函数

    SQL 基础--> 视图(CREATEVIEW)

    SQL 基础--> 创建和管理表

    SQL 基础--> 多表查询

    SQL 基础--> 过滤和排序

    SQL 基础--> 子查询

    SQL 基础--> 分组与分组函数

    SQL 基础--> 层次化查询(STARTBY ... CONNECT BY PRIOR)

    SQL 基础--> ROLLUP与CUBE运算符实现数据汇总

    PL/SQL--> 游标

    PL/SQL--> 异常处理(Exception)

    PL/SQL--> 语言基础

    PL/SQL--> 流程控制

    PL/SQL--> PL/SQL记录

    PL/SQL--> 包的创建与管理

    PL/SQL--> 隐式游标(SQL%FOUND)

    PL/SQL--> 包重载、初始化

    PL/SQL--> DBMS_DDL包的使用

    PL/SQL--> DML 触发器

    PL/SQL--> INSTEAD OF 触发器

    PL/SQL--> 存储过程

    PL/SQL--> 函数

    PL/SQL--> 动态SQL

    PL/SQL--> 动态SQL的常见错误

 

有关ORACLE其它特性

    Oracle常用目录结构(10g)

    使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例

    日志记录模式(LOGGING、FORCE LOGGING 、NOLOGGING)

    表段、索引段上的LOGGING与NOLOGGING

    OralceOMF 功能详解

    Oracle用户、对象权限、系统权限  

    Oracle角色、配置文件

    Oracle分区表

    Oracle外部表

    使用外部表管理Oracle 告警日志(ALAERT_$SID.LOG)

    簇表及簇表管理(Index clustered tables)

    数据泵 EXPDP 导出工具的使用

    数据泵 IMPDP 导入工具的使用

    导入导出 Oracle 分区表数据

    SQL*Loader使用方法

    启用用户进程跟踪

    配置非默认端口的动态服务注册

    配置ORACLE 客户端连接到数据库

    systemsys,sysoper sysdba 的区别

    ORACLE_SID、DB_NAME、INSTANCE_NAME、DB_DOMIAN、GLOBAL_NAME

    Oracle补丁全集 (Oracle 9i 10g 11g Path)

    Oracle10.2.0.1 升级到10.2.0.4

    Oracle彻底 kill session

 

 

原文地址:http://blog.csdn.net/leshami/article/details/6629249

你可能感兴趣的:(oracle,oracle10g)