SqlPlus run in background with 'nohup'
Sometimes you have to run a query that takes very long time to complete, and you want to go home with your laptop. If you have access to a server with SQL*Plus, you can run the query there in the background.
We can see some example:
1) Create a .sql file containing your query.
e.g. script.sql (for immediate test)
SET PAGESIZE 50000
SET MARKUP HTML ON TABLE "class=detail cellspacing=0" ENTMAP OFF
SPOOL output.log
# query
select sysdate from dual;
spool off;
2) Now call the query with Username and Password or 'as sysdba' from the OS command prompt.
$ nohup sqlplus username/password @script.sql > file.out 2>&1 &
$ nohup sqlplus "/ as sysdba" @script.sql > file.out 2>&1 &
Sometimes you have to run a query that takes very long time to complete, and you want to go home with your laptop. If you have access to a server with SQL*Plus, you can run the query there in the background.
We can see some example:
1) Create a .sql file containing your query.
e.g. script.sql (for immediate test)
SET PAGESIZE 50000
SET MARKUP HTML ON TABLE "class=detail cellspacing=0" ENTMAP OFF
SPOOL output.log
# query
select sysdate from dual;
spool off;
2) Now call the query with Username and Password or 'as sysdba' from the OS command prompt.
$ nohup sqlplus username/password @script.sql > file.out 2>&1 &
$ nohup sqlplus "/ as sysdba" @script.sql > file.out 2>&1 &
No comments:
Post a Comment