Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How do I get the Oracle 7 Server Name and SID using SQL statement?
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.
-- BillyReceived on Tue Jun 17 2003 - 04:46:29 CDT