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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL*Plus Client on Windows

RE: SQL*Plus Client on Windows

From: Tanel Poder <tanel.poder.003_at_mail.ee>
Date: Sun, 09 Sep 2007 12:19:54 +0800
Message-id: <045801c7f298$ac9f72b0$6701a8c0@windows01>


If you are using the command prompt version of Sqlplus, then you can use the cmd.exe's TITLE command for that.

Here's my i.sql which I use both for identifying where I'm logged on before doing any changes to database, plus it is called through login.sql. The window title change happens on the last line:

define mysid=unknown

col username for a12
col i_sid head SID for a6 new_value mysid col serial# for 999999
col opid for 999999
col spid for 999999
col host_name for a25
col i_ver head VER for a10
col i_startup_day head STARTED for a8

select

	s.username, 
	i.instance_name, 
	i.host_name, 
	(select substr(banner, instr(banner, 'ease ')+5,10) from v$version
where rownum =1) i_ver,
	to_char(startup_time, 'YYYYMMDD') i_startup_day, 
	to_char(s.sid)		i_sid, 
	s.serial#, 
	p.spid, 
	p.pid			opid, 
	s.saddr, 
	p.addr			PADDR
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 &_user@&_connect_identifier [&mysid]

And the output is:

SQL*Plus: Release 10.2.0.3.0 - Production on Sun Sep 9 12:16:15 2007

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options

USERNAME     INSTANCE_NAME    HOST_NAME                 VER        STARTED
SID    SERIAL# SPID            OPID SADDR    PADDR
------------ ---------------- ------------------------- ---------- --------
------ ------- ------------ ------- -------- --------
SYS          prod01           WINDOWS01                 10.2.0.3.0 20070907
148       2003 3480              19 343371B4 3425173C

SQL>

--
Regards,
Tanel Poder
http://blog.tanelpoder.com
 


> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org
> [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of
> Michael.Coll-Barth_at_VerizonWireless.com
> Sent: Sunday, September 09, 2007 09:09
> To: oracle-l
> Subject: SQL*Plus Client on Windows
>
> Hi all!
>
> This is in reference to the 10g ( 10.2.0.1.0 ) SQL*Plus
> client for Windows ( XP for me ).
>
> Does anyone know if there is a way to change the bar at the
> top of the SQL*Plus client window so it will display the
> _CONNECT_IDENTIFIER and _USER variables. This is the same
> bar at the top of the client's window that has the Minimize,
> Maximize and Close boxes in the upper right of the window.
> If its a hack, so be it...
>
> I am constantly connecting to different instances and
> sometimes have to type 'DEFINE' to remember where I am.
>
> TIA,
> Michael
>
>
>
>
>
>
>
> The information contained in this message and any attachment
> may be proprietary, confidential, and privileged or subject
> to the work product doctrine and thus protected from
> disclosure. If the reader of this message is not the
> intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.
> If you have received this communication in error, please
> notify me immediately by replying to this message and
> deleting it and all copies and backups thereof. Thank you.
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
-- http://www.freelists.org/webpage/oracle-l
Received on Sat Sep 08 2007 - 23:19:54 CDT

Original text of this message

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