sqlplus
Using cmd TITLE from sqlplus
Submitted by Niall Litchfield on Thu, 09/13/2007 - 09:37.Rather embarassingly although I described setting the title bar for command line sqlplus as easy, I didn't show how to do it. The script below is a script called session_info that demonstrates the technique. Essentially what you need to do is to select the information you require into session variables (_USER and _CONNECT are predefined for you) and pass those variables through the host command.
define s_sid=unknown
define i_instance=unknown
define s_host=unknown
define i_opid=unknown
col i_sid head SID for a6 new_value s_sid
col instance_name head Instance for a8 new_value i_instance
col opid new_value i_opid
col i_ver head VER for a10
col i_host_name head HOSTNAME format a30 new_value s_host
set termout off
select
i.instance_name,
i.host_name i_host_name,
(select version
from dba_registry
where comp_name like '%Catalog Views' ) i_ver,
to_char(s.sid) i_sid,
ltrim(p.pid) opid
from
v$session s,
v$instance i,
v$process p
where
s.paddr = p.addr
and sid = (select sid from v$mystat where rownum = 1);
host title &i_instance:&s_sid &s_host:&i_opid
set termout on

