Search This Blog

Total Pageviews

Tuesday, 28 November 2017

sqlplus command prompt (sqlprompt)

sqlplus command prompt (sqlprompt) ... 


Useful for Standby 

SET TERMOUT OFF 
DEFINE sqlprompt=none
COLUMN sqlprompt NEW_VALUE sqlprompt
SELECT '[-'||sys_context('USERENV', 'DATABASE_ROLE')||'-]'||LOWER(SYS_CONTEXT('USERENV','CURRENT_USER')) || '@' || SYS_CONTEXT('USERENV','DB_UNIQUE_NAME') as sqlprompt FROM DUAL;
SET SQLPROMPT '&sqlprompt> '
UNDEFINE sqlprompt
SET TERMOUT ON
output .. 
[-PRIMARY-]sys@vihcdb1>

 set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
===
Sqlprompt with colour !!!!!!!!!
with colour

SET TERMOUT OFF 
DEFINE sqlprompt=none
COLUMN sqlprompt NEW_VALUE sqlprompt
--select   chr(27)||'[32m'||chr(27)||'[1'||to_char(0)||'m'|| --GREEN  COLOR
select   chr(27)||'[33m'||chr(27)||'[1'||to_char(0)||'m'|| --YELLOW COLOR
--SELECT  chr(27)||'[35m'||chr(27)||'[1'||to_char(0)||'m'|| --PINK   COLOR
 '[-'||sys_context('USERENV', 'DATABASE_ROLE')||'-]'||LOWER(SYS_CONTEXT('USERENV','CURRENT_USER')) || '@' || SYS_CONTEXT('USERENV','DB_UNIQUE_NAME') as sqlprompt FROM DUAL;
SET SQLPROMPT '&sqlprompt> '
UNDEFINE sqlprompt
SET TERMOUT ON

=====



for putty title 

 PROMPT_COMMAND='printf "\033]0;%s@%s - %s\007" "`whoami`" "`hostname`" "`uname -s -r`"'

PROMPT_COMMAND='printf "\033]0;%s@%s - %s\007" "`whoami`" "`hostname`" "`uptime`"'


-- bold yellow color prompt 
export PS1="\e[0;33;1m[\u@\h \W]\$ \e[m"

export PS1="\e[0;33;1m[\u\e[m@\e[0;31;1m\h\e[m \W]\$"


export PS1="\e[0;33;97m[\u\e[m@\e[0;31;1m\h\e[m \W]\$"


                     Red                 Green
$export PS1="\e[0;31;31m[\u\e[m@\e[0;31;92m\h\e[m \W]\$"
  
  Red  @ Green 
[oracle@irac01 ~]$



30 Black | 31 Red | 32 Green | 33 Yellow | 34 Blue| 35 Magenta| 36 Cyan| 37 Light gray |90 Dark gray |91 Light red |92 Light green |93 Light yellow |94 Light blue |95 Light magenta |96 Light cyan |97 White


Changing Color of Linux Terminal Directory and Dir
PS1="\\[\\e]0;\\u@\\h:\\w\\a\\]\\[\\e[1;32m\\]\\u@\\h\\[\\e[1;34m\\] [\\w] \\\$\\[\\e[0m\\] "


export PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[32;47m\]\\$\[\e[m\] "

1 comment:

Anuj Singh said...



PS1='\[\e[41;4;33m\][\u@\h \W]$ \[\e[m\]'

Oracle DBA

anuj blog Archive