Sometimes you have to run a query that takes FOREVER, 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. Here’s how:
First, create a text file containing your query.
Start with
SET PAGESIZE 50000
SET MARKUP HTML ON TABLE "class=detail cellspacing=0" ENTMAP OFF
SPOOL output.log
Then, place your query under that. Then, end with
; SPOOL OFF quit;
To run the query, ssh into your server,
nohup sqlplus username/password@oracleServer @nameOfTheQuery.sql &
From the OS command prompt, issue:
# nohup sqlplus <username>/<password> @<script name>.sql &
Or as sysdba (if sysdba is needed to run the script):
# nohup sqlplus "/ as sysdba" @<script name>.sql & #nohup sqlplus un/pw @script.sql > file.out 2>&1 &
No comments:
Post a Comment