. #!/bin/bashset-xsu-oracle >>eonlsnrctl Startsqlplus/nolog >>eofconn/as SysdbastartupexitEOFexitEON
We often use the <<eof redirect input in the shell script to input the command string we entered as an execution program, so that we do not need to manually enter the command in that program environment in order to automate the functions we need, such as:
[Plain]View Plaincopy
- Sqlplus EMSSXJK/EMSSXJK <<eof
- Select COUNT (*) from Sncn_yxyj where create_date like sysdate;
- Eof
The SQL statement is equivalent to the input in the Sqlplus program environment, so that the input content is sandwiched between two eof, can be long and short, EOF can also be replaced by any other character, case, as long as the pair appears, for example:
[Plain]View Plaincopy
- SQLPLUS&NBSP;EMSSXJK/EMSSXJK&NBSP;<<STD&NBSP;&NBSP;
- Select COUNT (*) from Sncn_yxyj where create_date like sysdate;
- STD
Of course , this iconic character cannot be reserved, the most commonly used or EOF.
Note that the first EOF must start with the redirect character <<, and the second EOF must be shelf written, otherwise it will be an error.
Let's look at an example of automatic ftp:
[Plain]View Plaincopy
- #ftp data to 10.178.37.244
- rq= ' Date +%y%m%d '
- Cd/data/product/song
- Ftp-i-N <<!
- Open 10.178.37.244
- User Oracle Post
- CD EMS
- Bin
- Put ${rq}.dat
- Bye
- !
Oracle Startup scripts.