Today I was doing some tricky remote troubleshooting of an ORDS deployment. It turned out that it was the networking team doing fun stuff with the removal of cookies from only one of the multiple load-balanced devices between the users and the ORDS server (99% sure of this, we’ll see later if I was right). Since this stuff can be almost impossible to figure out without sniffing packets and/or visibility into the whole network configuration, a good trick to remember is to just deploy ORDS standalone on the desktop of the user attempting to troubleshoot things. If it works on their desktop, then it’s almost certainly the networking team doing something funny between the users and the application servers.
During the whole troubleshooting session, where the DBA was typing in all the commands as I dictated them (so much fun!), the DBA was constantly typing pwd. This post is for that DBA.
I’ve added the following line to my .bash_profile on all my Oracle database servers:
export PS1='\n[\u@\h DB:$( echo $ORACLE_SID ) \t \w]\n\$ '
PS1 is the environment variable that controls what your prompt looks like.
Mine has the following:
\n = a new line. This means that all of my commands have some nice whitespace (although I use green on black, so is that blackspace?) between them.
[ = the starting bracket for my prompt.
\u@\h = username@hostname
DB:$( echo $ORACLE_SID ) = Each time a new prompt is generated, find the value of the $ORACLE_HOME environment variable and display it with a DB: in front of it. It took me a bit to figure out how to get this to evaluate every time a new prompt was drawn. For my middleware servers, I leave this portion off. I suppose if your middleware server talks to only a single database, you could just hardcode it into the prompt.
\t = the current time
\w = the current working directory. No more typing pwd every other command!
] = the ending bracket for my prompt.
\n = another new line. This allows your actual command prompt to always start on the left side of the screen instead of constantly moving across the screen as you navigate down directory paths.
\$ = print the normal prompt. Notice that there is a space before the closing ‘ so that commands are not jammed up against the prompt.
Hopefully, an Oracle DBA or two out there finds this useful!