How can I get the server name, IP address of Oracle server, machine name, Oracle version, Windows version or other...
such things using a SQL statment?
You won't be able to get all of the information you are seeking with a simple SQL statement. But you can get some of it. For instance:
SELECT instance_name,host_name,version FROM v$instance;
This will give you the instance name, the host name of the database server and the Oracle version you are running.
To get the IP address of the database server, you will need to code an Java routine which will run an external 'nslookup' command on the database server. You'll pass the host_name you gathered from above. If you want to find the OS version you are running, you can use the same Java routine, but instead of running the 'nslookup' command, you'll need to run 'winver' for Windows or 'uname -a' for most Unix flavors.
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.