Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Ang: RE: Instance Name in Sql Prompt
Thanks it was great
Roland
"IT - Database (Do Not Use)" <dbamail_at_police.edmonton.ab.ca>@fatcity.com den 2001-10-25 07:15 PST Sänd svar till ORACLE-L_at_fatcity.com
Sänt av: root_at_fatcity.com
Till: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Kopia:
I got this from someone on the list. It shows server, instance and username. Put it in your login.sql
set sqlprompt 'SQL> '
column SQLQueryDatabase new_value SQLPromptDatabase noprint column SQLQueryTablespace new_value SQLPromptTablespace noprint column SQLQueryUsername new_value SQLPromptUsername noprint column SQLQueryHost new_value SQLPromptHost noprint /* remove ".WORLD"; append "." just * in case it is absent */ select initcap(substr(g.GLOBAL_NAME, 1, instr(g.GLOBAL_NAME || '.', '.') - 1)) SQLQueryDatabase, u.DEFAULT_TABLESPACE SQLQueryTablespace, u.USERNAME SQLQueryUsername from GLOBAL_NAME g, USER_USERS u
/* this defaults the SQLQueryHost variable * in case we have no privileges on the * v$session view */
from USER_USERS
where rownum = 1
/
select initCap(decode(s.MACHINE,
NULL, '', '', '', s.MACHINE || '/')) SQLQueryHostfrom V$SESSION s
upper(s.PROGRAM) like 'ORACLE%(PMON)%' -- Unix ps style
/
--set sqlprompt '[&SQLPromptHost&SQLPromptDatabase:&SQLPromptTablespace]
&SQLPromptUsername> '
set sqlprompt '[&SQLPromptHost&SQLPromptDatabase] &SQLPromptUsername> '
select '' SQLQueryDatabase, '' SQLQueryHost, '' SQLQueryTablespace, 'SQL' SQLQueryUsername
column SQLQueryDatabase clear
column SQLQueryHost clear
column SQLQueryTablespace clear
column SQLQueryUsername clear
input --
del 1 last
set termout on
set pages 9999
-----Original Message----- From: Ramon Estevez [mailto:com.banilejas_at_codetel.net.do] Sent: Thursday, October 25, 2001 8:35 AM To: Multiple recipients of list ORACLE-L Subject: Instance Name in Sql Prompt Hi Friends, Excuse me for this dumb question, how do I display the instance name in the sql prompt. Have 3 DB and would like to know to which one I am connected. I mean something like that. DBA1 > DBA2 > DB01 > Regards, Ramon E. Estevez com.banilejas_at_codetel.net.do Dominican Republic 809-565-3121
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Roland.Skoldblom_at_ica.se Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Oct 25 2001 - 10:10:53 CDT
![]() |
![]() |