We everyone know that with ping command we can get IP Address of another computer.
Suppose from terminal on Solaris machine,use
ping -s hostname to get IP Address of the host.
From Terminal of Linux Machine, use
ping hostname to get IP Address of the host.
But within oracle database how we can convert hostname to IP address?
It can be done by UTL_INADDR package. Within this package GET_HOST_ADDRESS subprograms takes a varchar2 datatype within which we can give the host name for which we want to get IP.
For example, to get IP address of computer saturn, use
SQL> select UTL_INADDR.GET_HOST_ADDRESS('saturn') from dual;
UTL_INADDR.GET_HOST_ADDRESS('SATURN')
--------------------------------------------------------------------------------
192.168.1.11
We can easily use it to see which IP address is now connected to oracle database. Like,
COL machine format a30
COL ip format a20
select sid, machine,
UTL_INADDR.get_host_address (substr(machine,instr(machine,'\')+1)) ip
from v$session where type='USER' and username is not null
order by sid;
or,
select sid,machine,UTL_INADDR.GET_HOST_ADDRESS (machine)
from v$session
where type = 'USER' and username is not null
order by sid;
While issuing this query you may get error ORA-29257, ORA-06512 like
ERROR:
ORA-29257: host appdemo unknown
ORA-06512: at "SYS.UTL_INADDR", line 19
ORA-06512: at "SYS.UTL_INADDR", line 40
ORA-06512: at line 1
For which host you get just exclude that in predicate. Like,
SQL> select sid, machine,
UTL_INADDR.get_host_address (substr(machine,instr(machine,'\')+1)) ip
from v$session where type='USER' and username is not null and machine not in ('quark.arjubd.com', 'nilanjona','sinewave','loris.arjubd.com','appdemo','nilanjona.arjubd.com');
Related Documents
How to find the User who is connected to Oracle
How to find current session ID
How to know which objects are being accessed by a user
Tuesday, April 1, 2008
Subscribe to:
Post Comments (Atom)
Tag Cloud
10.2g
10g
11g
11gR2
Abasa
About Oracle
Administration
Adsense
Alerts
Archival
ASM
ASP.Net
Audit
Audit Vault
Backup
Bangladesh
Block Corruption
Blogger
Browser
Bug
Business
Clone
Clusterware
Comments
Concepts
Connection
Controlfiles
Crime
CSS
Data Block
Data Dictionary
Data Guard
Data Mining
Data Pump
Data Type
Database Administration
Database Vault
DBConsole
Developer
Economics
EM
Excel
Exercise
Explain plan
Export
External Table
Facebook
Firefox
Firmware
Flashback
Forum
Functions
Games
Globalization Support
Grid Control
Hardware
History
HTML
IE
Import
Indexes
initializaion parameter
initialization parameter
Installation
Internals
Internet
Interview
isql*plus
Java
JavaScript
Job
Joins
Joke
Limitation
Linux
Listener
Logminer
Magento
Mail
Materialized View
Medical
Memory
Mobile
Money
Multimedia
MySQL
Net Services
Network
OCP
Operators
Oracle
Oracle Concepts
Oracle Recovery
OS
Others
OUI
Package
Packages
Parameters
Partitioning
Patchset
Performance
Perl
Pfile
Photos
PHP
PL/SQL
Profile
Pseudocolumns
Puzzle
Quiz
Quota
RAC
RAC Installation
Recovery
Recovery Problems
Redo Log
Reports
RMAN
Scripts
Security
SEO
Server Administration
SGA
Shell Script
Smarty
Social Marketing
Solaris
Spfile
SQL
SQL Tuning
SQL*Loader
Sql*Plus
Startup Problem
Streams
SwingBench
System Analysis
Tablespaces
Technology
Temp
TNS Error
Tools
Troubleshooting
Tuning
Undo
UNIX
Upgradation
Utilities
Version
Views
Vmware
Windows
Wordpress
XML
10 comments:
simply genious
Yes, it's a wonderful package provided Java is installed in the database, otherwise anyone trying to use this function will receive the following error:
ERROR at line 1:
ORA-29540: class oracle/plsql/net/InternetAddress does not exist
ORA-06512: at "SYS.UTL_INADDR", line 21
ORA-06512: at "SYS.UTL_INADDR", line 33
ORA-06512: at line 1
Funny how you didn't mention that requirement when you 'discussed' this package.
Salamz Bro,
Same error here, Plz help
ORA-29257: host GIL-DBA unknown
ORA-06512: at "SYS.UTL_INADDR", line 19
ORA-06512: at "SYS.UTL_INADDR", line 40
ORA-06512: at line 1
mirza2k8@gmail.com
Hi how to get Machine name from IP Address in oracle.
is it possible to get Hostname from ip Address in oracle?...
-
Regards
itabul@gmail.com
Machine name is not different from hostname. In the post it is discussed elaborately.
Guys i got it,
SELECT utl_inaddr.get_host_address('google.com')
FROM dual;
&
SELECT utl_inaddr.get_host_name('74.125.45.100')
FROM dual;
Thank you....
Regards.
Abul
Also, you are welcome to post all of your problems inside http://arju-on-it.com
ORA-29257: host 220.227.71.44 unknown
ORA-06512: at "SYS.UTL_INADDR", line 4
ORA-06512: at "SYS.UTL_INADDR", line 35
ORA-06512: at line 1
If you are on windows, just do a simple test,
>ping -a 4.2.2.2
If you can't get hostname you can't expect to get hostname from oracle
Post a Comment