oracle 9i、10g、11g資料庫設定listener密碼的方法

ysjxjf發表於2014-08-12

FROM : http://blog.csdn.net/gyanp/article/details/8260446

Oracle 9i、10g在預設的情況下,允許任何一個人利用lsnrctl從遠端發起對監聽器的管理。

      Oracle11g在listener加密的情況下,在本伺服器上執行lsnrctl status listener_name仍然可以,除非listener.ora里加如下內容:

                                  LOCAL_OS_AUTHENTICATION_LISTENER = OFF


1. 未設定密碼情形下停止監聽       

 

[oracle@test ~]$ lsnrctl stop listener_name   --&gt停止監聽,可以看出不需要任何密碼即可停止                                                   

2. 重新啟動監聽並設定密碼
  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  --&gt設定當前監聽器                                                            
  8. Current Listener is listener_demo92                                                                                         
  9. LSNRCTL> start             --&gt啟動過程也不需要任何密碼,啟動的詳細資訊省略                                                   
  10. LSNRCTL> change_password   --&gt使用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        --&gt注意此處的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       --&gt輸入新設定的密碼驗證                                                                         
  21. Password:                                                                                                                   
  22. The command completed successfully                                                                                          
  23. LSNRCTL> save_config       --&gt再次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. --&gt增加密碼之後可以看到listener.ora檔案中有一條新增的記錄,即密碼選項(注:儘管使用了密碼管理方式,仍然可以無需密碼啟動監聽)  
  31. [oracle@test admin]$ more listener.ora                                                                                      
  32.     #----ADDED BY TNSLSNR 26-JUN-2011 05:12:48---                                                                             
  33.     PASSWORDS_listener_demo92 = 678679679hjfh                                                                                              
  34.     #--------------------------------------------                                                                             
3. 嘗試未使用密碼的情況下停止監聽 
  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    --&gt收到錯誤資訊,需要使用密碼認證

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/66634/viewspace-1250075/,如需轉載,請註明出處,否則將追究法律責任。

相關文章