While I have played a little with screen , my preference is nohup since the output from screen is so ugly.
With that being said, it would be nice for application designs to be resumable, e.g. Shocking opatchauto resume works after auto-logout
There were discussions about running many SQLs where each SQL is run manually, check for error before running the next SQL; hence, screen was used.
Why not trap for error and exit vs manually checking?
[oracle@ol7-121-dg3 ~]$ cat error.sql WHENEVER SQLERROR EXIT SQL.SQLCODE set echo on select sysdate from dual; select * from notable; select database_role from v$database; exit [oracle@ol7-121-dg3 ~]$ sqlplus / as sysdba @ error.sql SQL*Plus: Release 12.1.0.2.0 Production on Sun May 10 17:48:46 2020 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options OL7-121-DG3:(SYS@hawkc:PRIMARY> select sysdate from dual; SYSDATE ------------------- 2020-05-10 17:48:46 OL7-121-DG3:(SYS@hawkc:PRIMARY> select * from notable; select * from notable * ERROR at line 1: ORA-00942: table or view does not exist Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options [oracle@ol7-121-dg3 ~]$
Another reason for using screen is to run stored procedure.
But this can be performed using nohup too as demonstrated.
[oracle@ol7-121-dg3 ~]$ export filename=test [oracle@ol7-121-dg3 ~]$ cat > $filename.sql < set serverout on echo on > exec dbms_output.put_line('test'); > exit > EOF [oracle@ol7-121-dg3 ~]$ ls -l $filename.sql -rw-r--r--. 1 oracle oinstall 65 May 10 17:30 test.sql [oracle@ol7-121-dg3 ~]$ cat $filename.sql set serverout on echo on exec dbms_output.put_line('test'); exit [oracle@ol7-121-dg3 ~]$ nohup sqlplus "/ as sysdba" @ $filename.sql > $filename.log 2>&1 & [1] 8422 [oracle@ol7-121-dg3 ~]$ [1]+ Done nohup sqlplus "/ as sysdba" @ $filename.sql > $filename.log 2>&1 [oracle@ol7-121-dg3 ~]$ ls -l $filename.* -rw-r--r--. 1 oracle oinstall 616 May 10 17:30 test.log -rw-r--r--. 1 oracle oinstall 65 May 10 17:30 test.sql [oracle@ol7-121-dg3 ~]$ cat $filename.log nohup: ignoring input SQL*Plus: Release 12.1.0.2.0 Production on Sun May 10 17:30:53 2020 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options OL7-121-DG3:(SYS@hawkc:PRIMARY> exec dbms_output.put_line('test'); test OL7-121-DG3:(SYS@hawkc:PRIMARY> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options [oracle@ol7-121-dg3 ~]$
It’s possible I will adopt screen at one point; however, my preference is still nohup.