(1) Find all SQL files that contain “dba” pattern in current directory.
find . -name “*sql” -print | xargs grep -i “dba”
(2) script to kill all Oracle background processes for a database. This is a common Unix script used by Oracle DBAs when a database is
locked up, and Server Manager cannot be used to stop the database in a more “gentle” fashion.
ps -ef|grep “ora_”|grep -v grep|grep $ORACLE_SID|awk ‘{print $2}’|xargs kill -9
Also, you can alias above long command to make it handy as following:
alias nuke_oracle=”ps -ef|grep ‘ora_’|grep -v grep|grep $ORACLE_SID|awk ‘{ print $2 }’|xargs kill -9″
(3)
nohup run_sql.ksh > logfile.lst 2>&1 &
nohup: Submits the task so that it continues to run even after you disconnect your terminal session.
run_sql.ksh : Specifies the Unix shell script that you want to run in the background.
> logfile.lst : Redirects standard output to the specified file.
2 > &1 : Redirects standard error messages to the standard output device. The 2 represents the standard error device, and 1 represents the standard output device.
& : Runs the task in the background. You need to have a space in front of the trailing ampersand (&) character, and it’s that & that causes the task to run as a background task.