sqllinuxdatabaseunixsqlplus

Running sqlplus in background in Unix


I am trying to run an .sql file from sqlplus in Unix environment as a background process.

I am connecting to Unix using Tectia or Putty, and I want sqlplus to continue running in background even if my terminal closes.

This command works

$ sqlplus USERNAME/password@SCHEMA
SQL>@test.sql
SQL> quit

but when trying to start it in background it fails

$ sqlplus USERNAME/password@SCHEMA&
SQL>@test.sql
SQL> quit

What is the right command/script?


Solution

  • & will put it in the background

    but if you actually want to close your terminal and leave for the day

    you need to use nohup

    nohup sqlplus USERNAME/password@DBNAME @test.sql &