|
|
Cooperative Extension Service |
|
|
|
||
|
|
||
|
Agricultural
Experiment Station |
||
|
|
|
|
When working with multiple database instances and logging on with several user ID's, it is very easy to get confused as to who and what is active in each of those SQL*Plus sessions that you have going at the current time. To change the SQL prompt to show the user ID and database (instance) name, just put the following at the end of the $ORACLE_HOME/sqlplus/admin/glogin.sql file (by Dave Hill and Julie Dunnam; note that the prompt is only set at startup, and is not changed if you connect to another user ID during the SQL*Plus session):
set termout off
define new_prompt='nolog'
column new_prompt new_value new_prompt
select username || ': ' || substr(global_name,1,instr(global_name || '.','.')-1)
new_prompt from user_users, global_name;
set sqlprompt "&new_prompt> "
set termout on
On Oracle8, some of our users were getting a buffer overflow on the above code, so, you might want to try the following instead:
set termout off
define new_prompt='nolog'
column new_prompt new_value new_prompt
select username || ': ' || substr(substr(global_name,1,30),1,
instr(substr(global_name || '.',1,30),'.')-1) new_prompt from user_users, global_name;
set sqlprompt "&new_prompt> "
set termout on
Be aware that the prompt is only set at the startup of sqlplus, so, if you connect to another user ID, the prompt will still show the original login user ID.
This Page was Last Updated on 06/04/07
You Are Visitor Number |
|
|
© 2006 |
|
|
University of Arkansas • Division of Agriculture |
Mission
•
Disclaimer
•
EEO
•
|