Oracle acquires host server IP

Source: Internet
Author: User

--to obtain the server-side IP -: $: theSYS@XXX> SelectUtl_inaddr.get_host_address fromdual; Get_host_address--------------------------------------------------10.19.2.XX--Resolving domain Names -: $: +SYS@XXX> SELECTUtl_inaddr.get_host_address ('www.anysql.net') fromdual; Utl_inaddr. Get_host_address ('WWW.ANYSQL.NET')--------------------------------------------------173.236.176.151--Reverse host name resolution based on IP address -: -: -SYS@XXX> SelectUtl_inaddr.get_host_name ('173.236.176.151') fromdual; Utl_inaddr. Get_host_name ('173.236.176.151')--------------------------------------------------Apache2-argon.footprint.dreamhost.com--Get client IP -: -: -SYS@XXX> SelectSys_context ('USERENV','IP_Address') ip_address fromdual;ip_address--------------------------------------------------10.19.2. XX--get the client host name -: -: -SYS@XXX>  SelectSys_context ('Userenv','Host') fromdual; Sys_context ('USERENV','HOST')--------------------------------------------------Workgroup\wxx-THINK

UTL_INADDR Packet acquisition of IP information such as the implementation principle:

Refer to the article of the god of cover: http://www.eygle.com/archives/2006/10/how_to_getip_address.html

In Linux you can use the Strace command to track related commands, and in the trace information

Oracle sequentially accesses the following files to complete address positioning:

Open ("/etc/resolv.conf")open ("/etc/host.conf "  A Open ("/etc/hosts"

First get the domain name resolution server, in accordance with the host.conf file to determine the resolution order, because the default Hosts file first, and continue to read the/etc/hosts file.

If the Hosts file has a parsing relationship, the information is returned, if it does not exist, the DNS server continues to be queried, the address is resolved, and if it cannot be resolved, an error occurs:

 -: the: toSYS@XXX> SelectUtl_inaddr.get_host_address ('www.a.com') fromdual;SelectUtl_inaddr.get_host_address ('www.a.com') fromDual*Section1line error: ORA-29257: Unknown host Www.a.comORA-06512: In "SYS. Utl_inaddr ", line +ORA-06512: In "SYS. Utl_inaddr ", line +ORA-06512: On line1

In other words, UTL_INADDR's data acquisition is not dependent on database information, and Sys_context's information acquisition still comes from within the database.

Oracle acquires host server IP

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.