In SQL*Plus, how do I change the prompt to show the connected user and database?

To show, for example....

USER@SID >

I thought this was potentially helpful to a few people so I'm going to answer it too!

Answers


Amend your $ORACLE_HOME\sqlplus\admin\glogin.sql script - add:

set sqlprompt "_user '@' _connect_identifier > "

to the end of the file.

In Oracle 10g this will change correctly each time you issue a "conn". For clients before 10g it won't change when you do a "conn" but will remain as the username/db you first connected to.

You can also use _date for the current date and _privilege for the privilege (eg SYSDBA) of the connected user.

Reference:

http://www.acs.ilstu.edu/docs/Oracle/server.101/b12170/whatsnew.htm


Need Your Help

Using pointers for QObject attributes

c++ qt pointers qobject

Since I learned Qt, I've been confused by the fact that in the documentations, and books I've read, they use pointers for attributes that are instances of QObject subclasses, such as widgets.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.