简体   繁体   English

Jenkins作业在远程ssh服务器上运行.bat文件槽时卡住了(Windows 2008 R2)

[英]Jenkins job stuck running a .bat file trough on a remote ssh server(windows 2008 R2)

I have a jenkins setup running on solaris. 我在solaris上运行了詹金斯设置。 I have configured a job which runs a .bat file, using the jenkins ssh plugin, on a remote Windows 2008 R2 server having an oracle database. 我已经配置了一个作业,该作业使用jenkins ssh插件在具有oracle数据库的远程Windows 2008 R2服务器上运行.bat文件。 The .bat files does an RMAN restore in the oracle Database. .bat文件在oracle数据库中执行RMAN还原。 I have an openssh server running on Windows 2008 R2 server. 我有一个在Windows 2008 R2服务器上运行的openssh服务器。 When I do a restore on smaller database, which takes less than 30 mins to run, everything works fine. 当我在较小的数据库上进行还原(运行少于30分钟)时,一切正常。 But when the databse is large and the restore takes over 3 hours, the jenkins job hangs even though the rman restore srated by the job completes successfully on the server. 但是,当数据库很大且还原需要3个小时以上时,即使由该作业评估的rman还原在服务器上成功完成,jenkins作业也会挂起。

This is the command I run in jenkins ssh plugin command window: 这是我在jenkins ssh插件命令窗口中运行的命令:

/cygdrive/C/OpenSSH/bin/SSH_ImportTEST_DB.bat TEST3

This is what the .bat file does. 这就是.bat文件的作用。

  1. Prepare the DB for RMAN restore(runs few sql commands as system user) 准备用于RMAN还原的数据库(以系统用户身份运行一些sql命令)
  2. Run the RMAN restore 运行RMAN还原
  3. Run few more sql commands to let the Database be available for all users, reset the passwords. 再运行几条sql命令,以使数据库对所有用户可用,并重置密码。

Step 1 and 2 work fine but the jenkins job just shows as running step 2 even though it has completed on remote server. 步骤1和2可以正常工作,但是jenkins作业即使在远程服务器上已完成,也仅显示为正在运行步骤2。 It never executes step 3 if the rman restore runs over 3 hours. 如果rman还原运行超过3个小时,它将永远不会执行步骤3。

X:\oracle\admin\TEST3\scripts>rman auxiliary cmdfile=X:\oracle\admin\TEST3\scripts\restore_db2.sql log=Y:\oracle\NightlyBackup\Prod\restore_MSIPTST3.log 
RMAN> 2> 

This is what the restore_db2.sql contains: 这是restore_db2.sql包含的内容:

DUPLICATE DATABASE TO TEST3 BACKUP LOCATION 'Y:\oracle\NightlyBackup\Prod';
exit;

I have tried the restore_db2.sql without the exit command, but that doeson't help either. 我尝试了不使用exit命令的restore_db2.sql ,但这也无济于事。

I have configured ServerAliveInterval 60 in ssh_config on the server where jenkins is running. 我在运行jenkins的服务器上的ssh_config中配置了ServerAliveInterval 60 I have also configured ClientAliveInterval 60 in sshd_config on the openssh server to rule out timeouts. 我还在openssh服务器上的sshd_config中配置了ClientAliveInterval 60 ,以排除超时。

Can someone assist? 有人可以协助吗?

Set up your windows client as jenkins slave because cygwin openssh is not a proper way for remote jobs. 将Windows客户端设置为jenkins从属设备,因为cygwin openssh不是远程作业的正确方法。 In your case I would recommend the Java Web Start option. 在您的情况下,我建议使用Java Web Start选项。 An configuration example is published on: https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines 一个配置示例发布在: https : //wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM