Oracle SQLPLUS提示符设置
把Oracle sqlplus提示符修改为如下,可以提醒你所在的用户模式,减少误操作。
set sqlprompt _user'@'_connect_identifier>
效果对比:
SQL> conn scott/tiger@pdborcl
Connected.
SQL> conn sys/orcl as sysdba
Connected.
SQL> set sqlprompt ">_user'@'_connect_identifier>
---提示符变为SYS@orcl
SYS@orcl> conn scott/tiger@pdborcl
Connected.
SCOTT@pdborcl> conn sys/orcl as sysdba
Connected.
--提示符变为SYS@orcl>
SYS@orcl> conn sys/orcl@pdborcl as sysdba
Connected.
--提示符变为SCOTT@pdborcl
SYS@pdborcl>
以上设置只针对当前SQL*Plus会话有效。
编辑ORACLE_HOME/sqlplus/admin目录下的glogin.sql(C:\app\ORACLE\product\12.1.0\dbhome_1\sqlplus\admin)文件最后加如下一行,就可以为所有SQL*Plus会话自动设置SQL提示符,永久有效.
set sqlprompt _user'@'_connect_identifier>
12c: DISPLAY CDB/PDB NAME IN SQL PROMPT
编辑ORACLE_HOME/sqlplus/admin目录下的glogin.sql(C:\app\ORACLE\product\12.1.0\dbhome_1\sqlplus\admin)添加以下内容
define gname=idle column global_name new_value gname set heading off set termout off col global_name noprint select upper(sys_context ('userenv', 'current_user')||'@'||sys_context ('userenv', 'con_name') || '@' || sys_context('userenv', 'db_name')) global_name from dual; set sqlprompt '&gname> ' set heading on set termout on
效果:
中文提示设置
ALTER SESSION SET NLS_LANGUAGE='SIMPLIFIED CHINESE';