Use of Oracle System Event function ORA_CLIENT_IP_ADDRESS

Source: Internet
Author: User

ORA_CLIENT_IP_ADDRESSReturns the IP address used to access the oracle database client. The returned IP address may be blank during windows Local logon.

1. ORA_CLIENT_IP_ADDRESS definition:

 
 
  1. CREATE PUBLIC SYNONYM ORA_CLIENT_IP_ADDRESS FOR SYS.CLIENT_IP_ADDRESS     
  2.  
  3. CREATE OR REPLACE FUNCTION SYS.CLIENT_IP_ADDRESS     
  4.  
  5. return varchar2 is    
  6.  
  7. begin    
  8.  
  9. return dbms_standard.client_ip_address;     
  10.  
  11. end;     
  12.  
  13. CREATE PUBLIC SYNONYM ORA_CLIENT_IP_ADDRESS FOR SYS.CLIENT_IP_ADDRESS  
  14.  
  15. CREATE OR REPLACE FUNCTION SYS.CLIENT_IP_ADDRESS  
  16.  
  17. return varchar2 is  
  18.  
  19. begin  
  20.  
  21. return dbms_standard.client_ip_address;  
  22.  
  23. end; 

2. ORA_CLIENT_IP_ADDRESS example:

 
 
  1. Create or replace trigger sysevent_trig
  2.  
  3. AFTER LOGON
  4.  
  5. ON DATABASE
  6.  
  7. BEGIN
  8.  
  9. Insert into dw. ora_fun_logs (id, value)
  10.  
  11. Values (dw. ora_fun_logs_s.nextval,
  12.  
  13. Ora_sysevent | ': ORA_CLIENT_IP_ADDRESS --' | NVL (ora_client_ip_address, 'n'/'));
  14.  
  15. END;
  16.  
  17. Show errors
  18.  
  19. Truncate table dw. ora_fun_logs;
  20.  
  21. Conn dw/dw @ dw
  22.  
  23. Set line 80
  24.  
  25. Column value format a60
  26.  
  27. Select * from dw. ora_fun_logs;
  28.  
  29. Create or replace trigger sysevent_trig
  30.  
  31. AFTER LOGON
  32.  
  33. ON DATABASE
  34.  
  35. BEGIN
  36.  
  37. Insert into dw. ora_fun_logs (id, value)
  38.  
  39. Values (dw. ora_fun_logs_s.nextval,
  40.  
  41. Ora_sysevent | ': ORA_CLIENT_IP_ADDRESS --' | NVL (ora_client_ip_address, 'n'/'));
  42.  
  43. END;
  44.  
  45. Show errors
  46.  
  47. Truncate table dw. ora_fun_logs;
  48.  
  49. Conn dw/dw @ dw
  50.  
  51. Set line 80
  52.  
  53. Column value format a60
  54.  
  55. Select * from dw. ora_fun_logs;
  56.  
  57. 22:11:08 sys @ dw> create or replace trigger sysevent_trig
  58.  
  59. 22:11:09 2 AFTER LOGON
  60.  
  61. 22:11:09 3 ON DATABASE
  62.  
  63. 22:11:09 4 BEGIN
  64.  
  65. 22:11:09 5 insert into dw. ora_fun_logs (id, value)
  66.  
  67. 22:11:09 values (dw. ora_fun_logs_s.nextval,
  68.  
  69. 22:11:09 7 ora_sysevent | ': ORA_CLIENT_IP_ADDRESS --' | NVL (ora_client_ip_address, 'n'/'));
  70.  
  71. 22:11:09 END;
  72.  
  73. 22:11:09/
  74.  
  75. Trigger created
  76.  
  77. Used time: 00: 00: 00.04
  78.  
  79. At 22:11:10 sys @ dw> truncate table dw. ora_fun_logs;
  80.  
  81. The table is truncated.
  82.  
  83. Used time: 00: 00: 00.03
  84.  
  85. 22:11:18 sys @ dw> conn dw/dw @ dw
  86.  
  87. Connected.
  88.  
  89. At 22:11:24 dw @ dw> set line 80
  90.  
  91. 22:11:24 dw @ dw> column value format a60
  92.  
  93. At 22:11:24 dw @ dw> select * from dw. ora_fun_logs;
  94.  
  95. ID VALUE
  96.  
  97. ----------------------------------------------------------------------
  98.  
  99. 17 LOGON: ORA_CLIENT_IP_ADDRESS--N/
  100.  
  101. 18 LOGON: ORA_CLIENT_IP_ADDRESS--127.0.0.1

Here is an introduction to Oracle System Event function ora_client_ip_address. I hope this will bring you some benefits. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.