|
|
 |
|
Process command execution
Oracle Tips by Burleson Consulting
|
Process command execution
To illustrate the communications between UNIX and Oracle, let’s use
the example of a UNIX script that accesses Oracle to display
rollback segment information. Because of the complex details and
differences in UNIX dialects, this example has been deliberately
over-simplified for illustration purposes.
rollstat.ksh
#!/bin/ksh
# First, we must set the environment . . . .
export ORACLE_HOME=$1
ORACLE_HOME=`cat /etc/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
$ORACLE_HOME/bin/sqlplus system/manager<<!
select * from v\$rollstat;
exit
!
echo All Done!
Note the reference to the v$rollstat view in the UNIX script as v\$rollstat.
In UNIX, you must place a back-slash character in from of every
dollar sign in all SQL commands to tell UNIX that the dollar sign is
a literal value and not a UNIX shell command.
When we execute this script in UNIX, the script performs the
following UNIX system calls:
1 - fork(get_rollstat.ksh)
2 - read(/etc/oratab)
3 - fork(sqlplus)
4 - read(file#,block#)
5 - write(v$rollstat contents)
6 – write(“All Done”)
 |
Expert Remote DBA
BC is America's oldest and largest Remote DBA Oracle support
provider. Get real Remote DBA experts, call
BC Remote DBA today. |
 |
|
|
|
|