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: UNIX like Prompt

Re: UNIX like Prompt

From: Kirti Deshpande <kirtid658_at_gte.net>
Date: 1997/10/10
Message-ID: <61lkeg$5nk$1@gte1.gte.net>#1/1

cmb_at_msic.dia.mil wrote:
>
> I am looking for a way to change the sqlplus/svrmgrl
> prompt from the non-informational one to a UNIX like
> one. That is, it displays the SID,and Oracle user/role
> the application developer session currently displayed
> in the window. What and where are the changes to be made
> for dbas in svrmgrl and appdevs in sqlplus?
>
> Thanks

I don't know about svrmgrl but here is a script that displays SID and Hostname instead of 'SQL>' prompt for sqlplus users. You can change it to have whatever prompt you want.
The glogin.sql works lile /etc/profile, if you may, while user's own login.sql (in their current dir while running sqlplus) is kind of ../profile.

However, if you connect to other DB instances from within current session of SQL*Plus your prompt will remain same and will not change to reflect new SID(& hostname) ;-)

You can put the following script at the appopriate place. Hope this help....

REM sqlprompt.sql
REM The lines below should be included at the end of glogin.sql in the REM $ORACLE_HOME/sqlplus/admin directory. Whenever someone logs into REM sqlplus on the host machine, their sqlprompt will be: REM 'sid_at_host> ' instead of 'SQL> '. REM SYS must grant select on v_$process and v_$parameter to PUBLIC for this
REM to work. If the select below fails, the sqlprompt will default to REM 'SQL> '.
REM
set termout off
col site_name noprint new_value site_name_new select 'SQL> ' site_name from dual;
select

	substr(param.value ||
		substr(proc.program,
			instr(proc.program,'@'),
			instr(proc.program,' ') -
			instr(proc.program,'@')),1,15) || '> ' site_name
	from v$process proc, v$parameter param
	where param.name = 'db_name'
	  and proc.pid = 2;

set sqlprompt '&&site_name_new'
set termout on
-- 
Kirti Deshpande
GTE, DFW Airport      
kirtid658_at_gte.net
=======================================
Please remove all numbers from address 
=======================================
Received on Fri Oct 10 1997 - 00:00:00 CDT

Original text of this message

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