The spool file generated in the shell script has no execution statement
#! /Bin/bash # start on 20151209 # auto_check.sh # liming # aim to do db check automatically # usage: su-oracle-c 'sqlplus-s/as sysdba '<EOF>/u01/app/oracle/script_test_result/auto_check.log 2> 1 set echo onset feedback onspool/home/oracle /script_test_result/auto_check.logselect * from lm. lm_t1; In the spool file auto_check.log generated by spool offexitEOF, there is no statement I executed. How can this problem be solved? [Root @ single1 script_test_result] # more auto_check.log no rows selected
I have been entangled in this issue for a long time because I am not familiar with some commands. Later I checked a lot of information and found that it was not the problem of set echo on, but the problem of connection statements.
Sqlplus-s/as sysdba
In-s, check the command. I understand it ..
-S Sets silent mode which suppresses the display of the SQL * Plus banner, prompts, and echoing of commands.
Remove-s and then restore it.
[Oracle @ single1 script_test_result] $ cat auto_check.log SQL> select * from dual; X1 row selected. SQL> spool off