Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How do I get the Oracle 7 Server Name and SID using SQL statement?

Re: How do I get the Oracle 7 Server Name and SID using SQL statement?

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Tue, 17 Jun 2003 09:46:29 +0000
Message-ID: <bcmh4o$3vp$1@ctb-nnrp2.saix.net>


Afulajo wrote:

> Thank you all for trying to help,
> But on 7 I can not get the server name <snipped>

(digging thru my old v7.x code)... try the following functions...

CREATE OR REPLACE FUNCTION get_dbname RETURN VARCHAR2 IS   dbname VARCHAR2(20);
BEGIN
  SELECT name INTO dbname FROM v$database;   RETURN dbname;
END;
/

CREATE OR REPLACE FUNCTION get_nodename RETURN VARCHAR2 IS   nodename VARCHAR2(20);
BEGIN
  SELECT machine INTO nodename FROM v$session WHERE sid = 1;   RETURN nodename;
END;
/

The first function returns the DB SID. The second function returns the machine (hostname) of the platform it is running on. I used it on an old OPS 7.3.4 cluster and it worked okay back then.

--
Billy
Received on Tue Jun 17 2003 - 04:46:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US