查看Oracle某時刻的客戶端IP連接情況


1、查看每個oracle帳戶的連接總數

Sql代碼   收藏代碼
  1. select username,count(username) from v$session where username is not null group by username  

 

2、缺省從 v$session 中不能直接獲得客戶端 IP,可以在數據庫中創建一個追蹤客戶端IP地址的觸發器:

Sql代碼   收藏代碼
  1. create or replace trigger on_logon_trigger after logon on database  
  2. begin  
  3.     dbms_application_info.set_client_info(sys_context('userenv', 'ip_address'));  
  4. end;   
  5. /  

 

3、比較常用的顯示客戶端信息的sql:

Sql代碼   收藏代碼
  1. select sid,serial#,username,program,machine,client_info  
  2. from v$session  
  3. where username is not null  -- and status = 'ACTIVE'
  4. order by username,program,machine;   

  顯示結果:

Java代碼   收藏代碼
  1. 1   102 2986    AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  2. 2   375 10078   AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  3. 3   858 1751    AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  4. 4   761 5406    AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  5. 5   803 3590    AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  6. 6   448 2525    AMS_TEST    JDBC Thin Client    MICROSO-V22G1JA 192.168.0.92  
  7. 7   654 10009   HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  
  8. 8   659 9547    HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  
  9. 9   664 7554    HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  
  10. 10  693 6960    HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  
  11. 11  714 3672    HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  
  12. 12  724 13457   HDCZOA  JDBC Thin Client    WWW-18843A7DA64 192.168.0.115  

 

 

4、查看當前Oracle的連接數

Sql代碼   收藏代碼
  1. select count(*) from v$process;  

 5、查看數據庫允許的最大連接數

Sql代碼   收藏代碼
  1. select value from v$parameter where name='processes';   

 6、修改最大連接數

Sql代碼   收藏代碼
  1. alter system set processes=3000 scope=spfile;  

7、業務IP連接數查詢

set pagesize 1000 line 1000 

select count(1), client_info from v$session where username is not null group by client_info order by 1 desc;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM