Databases Reference
In-Depth Information
The shell script will thus need to have the following lines modified, as shown:
mntlist="/"
for ml in $mntlist
do
echo $ml
usedSpc=$(df -h / | grep % | grep -v Use | awk '{print $4}' | cut -d "%" -f1 -)
login.sql
Use this script to customize aspects of your SQL*Plus environment. When logging in to SQL*Plus in Linux/Unix,
the login.sql script is automatically executed if it exists in a directory contained within the SQLPATH variable. If the
SQLPATH variable hasn't been defined, then SQL*Plus looks for login.sql in the current working directory from which
SQL*Plus was invoked. For instance, here is how the SQLPATH variable is defined in my environment:
$ echo $SQLPATH
/home/oracle/scripts
I created the login.sql script in the /home/oracle/scripts directory. It contains the following lines:
-- set SQL prompt
SET SQLPROMPT '&_USER.@&_CONNECT_IDENTIFIER.> '
Now, when I log in to SQL*Plus, my prompt is automatically set:
$ sqlplus / as sysdba
SYS@o12c>
top.sql
The following script lists the top CPU-consuming SQL processes. It's useful for identifying problem SQL statements.
Place this script in a directory such as HOME/scripts :
select * from(
select
sql_text
,buffer_gets
,disk_reads
,sorts
,cpu_time/1000000 cpu_sec
,executions
,rows_processed
from v$sqlstats
order by cpu_time DESC)
where rownum < 11;
This is how you execute this script:
SQL> @top
 
Search WWH ::




Custom Search