Forum Stats

  • 3,751,465 Users
  • 2,250,366 Discussions
  • 7,867,433 Comments

Discussions

Sqlcl sql script running in background error(zip file unzipped in unix environment)

295ba3d5-d678-4e89-86cb-906d5f7121c5
edited Sep 13, 2018 9:24AM in SQLcl

i am unable to run sql script(saved in file) in background using sqlcl , but it run fines normally . i tried different solution provided on web but nothing worked .  any help on this would be appreciated.

Solutions which i tried are as below .

nohup ksh xyz.ksh 1>/dev/null 2>2018090123181_xyz.log &

same works fine with sqlplus.

Errors i get :

Stopped (tty output)

when i look for detailed processes it holds of at i get below .

pts/10   00:00:00 sh -c stty -icanon min 1 -icrnl -inlcr -ixon < /dev/tty

pts/10   00:00:00 stty -icanon min 1 -icrnl -inlcr -ixon

any fixable solution for this ?

Answers

  • Glen Conway
    Glen Conway Member Posts: 859 Gold Badge
    edited Sep 4, 2018 1:44AM

    This question has been asked before, and it seems like sqlcl still has an issue with running in the background as opposed to the expected behavior when using sqlplus ( as discussed in How can I run sql script in background? )

    However a more recent discussion proposes a workaround which uses javascript to run the sql in the background of your current sqlcl session: run a script in the background ??

    Hope this helps

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,778 Bronze Crown
    edited Sep 4, 2018 4:41AM
    any fixable solution for this ?

    No.

    Workarounds, yes.

    . screen

    . tmux

    . vncserver / vncclient

    ...etc.

    The issue with sqlcl, I believe, is the way it has been written whereby is incompatible with being put into the background "as is" with nohup, &, bg, so needs a helper process, offered by something like the above.

  • User_LQWCM
    User_LQWCM Member Posts: 2 Employee
    edited Sep 13, 2018 4:48AM

    Hi all,

    The problem is that sqlcl uses the bash commands to detect the terminal width and  height. Since this only works on Linux, this problem won't exist on Windows.

    Inside SQLcl there is a condition that checks whether the program is running on Windows and if so, it does not check the terminal size. It uses system property "os.name" for that so you can do a little hack and provide the value of that property on java command line -Dos.name=win. SQLcl is started from sql command in bin directory so just adding the property as below should work.

    $JAVA  $CUSTOM_JDBC $CYGWIN "${APP_VM_OPTS[@]}" -client $DEBUG -Dos.name=win -cp "$CPLIST" oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli "[email protected]"

    Regards,

    Tomas

  • User_LQWCM
    User_LQWCM Member Posts: 2 Employee
    edited Sep 13, 2018 9:24AM

    I apologise, the fix I was proposing above won't work as there are several other dependencies on "os.name" throughout the call, also os.name should be "Windows 8.1" or alike, "win" is invalid.

    My problem was that when running this in background from python the sqlcl code around terminal was causing the issues. I fixed it by allocating a dedicated TTY for the process.