SQL*Plus 计划任务在连接超时后挂起
SQL*Plus Scheduled Task Hangs After Connect timeout
我有一个执行 sqlplus
命令的计划任务,提供了用户名和密码。
间歇性地发生 ORA-12170: TNS:Connect timeout occurred
。在这些发生之后,SQL*Plus
要求输入用户名,该用户名永远不会超时,无限期地暂停我的任务。
如何防范?是否有任何命令行选项可以防止这种情况?
任务批处理文件
...
sqlplus user/\"password\"@database@script.sql >> "script.log"
script.sql
START TRANSACTION;
call schema.sync_task();
COMMIT;
quit;
成功日志
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 10 22:15:00 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Mon Sep 10 2018 22:10:00 -04:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
SP2-0310: unable to open file "TRANSACTION.sql"
Call completed.
Commit complete.
Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
失败日志
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 10 22:20:00 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12170: TNS:Connect timeout occurred
Enter user-name:
我没有找到一个干净的解决方案,但我确实找到了一个简单的解决方案。
我已将计划任务的设置修改为在 运行 超过一小时时停止。 10 分钟会更好,但这不是任务计划程序中的选项。
我有一个执行 sqlplus
命令的计划任务,提供了用户名和密码。
间歇性地发生 ORA-12170: TNS:Connect timeout occurred
。在这些发生之后,SQL*Plus
要求输入用户名,该用户名永远不会超时,无限期地暂停我的任务。
如何防范?是否有任何命令行选项可以防止这种情况?
任务批处理文件
...
sqlplus user/\"password\"@database@script.sql >> "script.log"
script.sql
START TRANSACTION;
call schema.sync_task();
COMMIT;
quit;
成功日志
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 10 22:15:00 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Mon Sep 10 2018 22:10:00 -04:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
SP2-0310: unable to open file "TRANSACTION.sql"
Call completed.
Commit complete.
Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management option
失败日志
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 10 22:20:00 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12170: TNS:Connect timeout occurred
Enter user-name:
我没有找到一个干净的解决方案,但我确实找到了一个简单的解决方案。
我已将计划任务的设置修改为在 运行 超过一小时时停止。 10 分钟会更好,但这不是任务计划程序中的选项。