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

我们两清 提交于 2019-11-29 18:32:23

问题


To show, for example....

USER@SID > 

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


回答1:


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



来源:https://stackoverflow.com/questions/303940/in-sqlplus-how-do-i-change-the-prompt-to-show-the-connected-user-and-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!