commandline dbaccess
commandline dbaccess
(OP)
hi, i am pretty new to informix and would appreciate an answer to this doubt..I would like to know how can i batch execute multiple .sql files from commandline using dbaccess and then direct the output to a file. Thanks in advance.
RE: commandline dbaccess
dbaccess 'DBNAME' -<<!
'SQL #1';
'SQL #2';
!
If the command file you created is called mysql.sh run it as follows;
nohup mysql.sh &
This will execute SQL #1 followed by SQL #2 (against database DBNAME) and save the output in a file named nohup.out
Make sure the last ! is the first character in the first column.
RE: commandline dbaccess
RE: commandline dbaccess
echo "`date` Selecting rows from table ABC . . ."
dbaccess 'DBNAME' -<<!
unload to abc.unl
select
*
from ABC
;
!
echo "`date` Selected rows from table ABC . . ."
I wrote the echo commands (in this case) to tell me what the sql is doing. Try it with your shell script(s). Happy Halloween!