_____________________________________________________________________________________________________________________
OS Commands Execution
You can use
either ! or host keyword to execute OS commands
or to run shell script from the sqlplus / sql prompt.
Here are
some examples for OS command execution
SQL> !pwd
/home/oracle
SQL> host
pwd
/home/oracle
SQL> host
date
Wed Mar 1 00:33:47 EST
2017
SQL> !date
Shell Script Execution
I have a
sample shell script file here called New_Shell.sh
$ cat New_Shell.sh
ls -ltr
sleep 10
Wed Mar 1 00:33:50 EST
2017
$ vi New_Shell.sh
Change the
permissions to executable mode.
$ chmod 744 New_Shell.sh
Now you can
run the shell script using either ! or host command.
SQL> !./New_Shell.sh
total 4
-rwxr--r-- 1 oracle oinstall 18 Mar 1 00:29 New_Shell.sh
SQL> host ./New_Shell.sh
total 4
-rwxr--r-- 1 oracle oinstall 18 Mar
1 00:29 New_Shell.sh
_____________________________________________________________________________________________________________________
0 comments:
Post a comment