免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3673 | 回复: 8
打印 上一主题 下一主题

请教一个关于JAVA调用linux脚本意外中断的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-02 17:39 |只看该作者 |倒序浏览
5可用积分
我在测试用jsp调用linux脚本来导出数据库,调用倒是成功了,但是导出数据不完整,中途断掉了,请各位帮忙看看是什么问题,谢谢

<%@ page language="java" pageEncoding="GBK" %>
<%@ page import="java.util.*,java.io.*,test.*"%>
<%
        Runtime.getRuntime().exec("/home/weblogic/bankI/bak/manual_exp.sh";
%>
很简单,就一句话。


以下是 manual_exp.sh 的内容:

#/bin/bash

#set Variable
backDir=/home/weblogic/bankI/bak/exp
ora_user=bank
ora_passwd=netsky
service_name=netsky_pms
DATE=`date +"%Y%m%d"`

#set env
ORACLE_BASE=/oradata/ora10g
ORACLE_HOME=/home/ora10g/10.2.0/db_1
ORACLE_SID=pms
NLS_LANG=american_america.ZHS16GBK
PATH=$PATHORACLE_HOME/bin

export ORACLE_HOME ORACLE_BASE ORACLE_SID NLS_LANG PATH

#export the oracle backup
echo "running" > "$backDir"/readme.txt
chown weblogic:weblogic "$backDir"/readme.txt
#exp bank/netsky@NETSKY_PMS  file=bank_2008.dmp owner=bank
exp "$ora_user"/"$ora_passwd"@"$service_name" file="$backDir"/bank_"$DATE".dmp log=/home/weblogic/bankI/log/xxy.log owner="$ora_user"
chown weblogic:weblogic "$backDir"/bank_"$DATE".dmp
echo "success" > "$backDir"/readme.txt
exit 0


以下是导出ORACLE 时的日志文件的内容:


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user BANK
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user BANK
About to export BANK's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export BANK's tables via Conventional Path ...
. . exporting table                      TA01_DEPT          5 rows exported
. . exporting table                      TA02_YHMC         37 rows exported
. . exporting table                  TA03_EMPLOYEE         17 rows exported
. . exporting table                      TA04_ROLE        241 rows exported
. . exporting table                      TA05_CSMC         34 rows exported
. . exporting table                    TA06_MODULE         11 rows exported
. . exporting table                 TA07_FORMFIELD         26 rows exported
. . exporting table                 TA08_YHMC_ZPYW         13 rows exported
. . exporting table                      TA09_SSLB          9 rows exported
. . exporting table                  TA17_EMP_ROLE       1142 rows exported
. . exporting table                    TC01_SELECT         20 rows exported
. . exporting table                        TC02_QZ          5 rows exported
. . exporting table                     TC03_PLBLX         11 rows exported
. . exporting table                      TC04_RZDY         25 rows exported
. . exporting table                   TC05_JSXJPZB         42 rows exported
. . exporting table                 TC06_JSXJPZBMX        176 rows exported
. . exporting table              TC07_MODULE_TABLE         40 rows exported
. . exporting table                      TC08_KHXM          4 rows exported
. . exporting table                      TC09_KHNR         15 rows exported
. . exporting table                   TC10_MESSAGE         14 rows exported
. . exporting table              TC10_MESSAGESLAVE          0 rows exported
. . exporting table                 TC10_MSG_SLAVE          3 rows exported
. . exporting table                    TC11_YJJCPZ         39 rows exported
. . exporting table                 TC12_CISZBZBRZ          5 rows exported
. . exporting table                 TD05_QSZX_WLAQ          0 rows exported
. . exporting table                   TD06_QSZX_YX          8 rows exported
. . exporting table                 TD07_QSZX_YXJH          5 rows exported
. . exporting table                      TD10_ZPYX          1 rows exported
. . exporting table                      TD11_DEZF          6 rows exported
. . exporting table                      TD12_XEZF          6 rows exported
. . exporting table                 TD13_CCPC_XTYX          2 rows exported
. . exporting table                  TD14_ZPYX_YWL          3 rows exported
. . exporting table                  TD15_CCPC_YWL          2 rows exported
. . exporting table                   TD16_WORKDAY         36 rows exported
. . exporting table                 TD17_QUSHIBIAO         22 rows exported
. . exporting table                      TD18_ZFJY         80 rows exported
. . exporting table                    TD19_ZFJYMX        686 rows exported
. . exporting table                      TD20_ZFXX          2 rows exported
. . exporting table                      TD21_ZFMX          7 rows exported
. . exporting table                      TD22_ZPYW          1 rows exported
. . exporting table                    TD23_ZPYWMX         13 rows exported
. . exporting table                    TD26_XEYXRB         49 rows exported

大家可以看到,只导出到了30多张表,其余的30多张没有导出成功。
请大家帮我看看是什么问题,或者告诉我这种问题如何排查也可,反正我是
黩驴技穷了,能想的招都想过了,万分感谢!!!

论坛徽章:
0
2 [报告]
发表于 2009-02-02 17:41 |只看该作者
下一个表是哪个表?

论坛徽章:
0
3 [报告]
发表于 2009-02-02 19:24 |只看该作者

回复

这和下一张表没什么关系,因为原来的时候有TD24_XXXX和TD25_XXXX,
最开始的时候,到TD24_XXXX 就中断了,后来我将TD24_XXX 删除了,
就导出到 TD25_XXX 就中断了,我又将TD25_XXXX 删除了,现在到TD26_XXXX
中断了,
所以和表没什么关系;

单独执行manual_exp.sh 是没有问题的,

论坛徽章:
0
4 [报告]
发表于 2009-02-02 19:26 |只看该作者

回复

这和下一张表没什么关系,因为原来的时候有TD24_XXXX和TD25_XXXX,
最开始的时候,到TD24_XXXX 就中断了,后来我将TD24_XXX 删除了,
就导出到 TD25_XXX 就中断了,我又将TD25_XXXX 删除了,现在到TD26_XXXX
中断了,
所以和表没什么关系;

单独执行manual_exp.sh 是没有问题的,

论坛徽章:
0
5 [报告]
发表于 2009-02-03 08:36 |只看该作者

回复

这个问题没人知道吗

论坛徽章:
0
6 [报告]
发表于 2009-02-03 10:23 |只看该作者
原帖由 netsky_lee 于 2009-2-2 19:24 发表
这和下一张表没什么关系,因为原来的时候有TD24_XXXX和TD25_XXXX,
最开始的时候,到TD24_XXXX 就中断了,后来我将TD24_XXX 删除了,
就导出到 TD25_XXX 就中断了,我又将TD25_XXXX 删除了,现在到TD26_XXX ...

那就是数量达到最大值了?

一次只能导出这么多;

建议是否可以一次执行脚本导出N张表,再一次脚本把剩下的导出。

论坛徽章:
0
7 [报告]
发表于 2009-02-03 10:49 |只看该作者
不在jsp中执行,在类中执行会不会出现这种情况?

论坛徽章:
13
巨蟹座
日期:2013-10-21 16:01:452015亚冠之全北现代
日期:2015-05-14 11:52:492015年亚洲杯之巴勒斯坦
日期:2015-04-27 08:04:252015年亚洲杯之朝鲜
日期:2015-03-11 18:01:112015年迎新春徽章
日期:2015-03-04 09:48:00摩羯座
日期:2014-12-16 12:22:23子鼠
日期:2014-08-08 15:47:44狮子座
日期:2014-07-28 20:37:15寅虎
日期:2014-06-12 12:09:08巨蟹座
日期:2014-03-18 08:41:18戌狗
日期:2013-12-05 10:15:58巨蟹座
日期:2013-11-08 10:24:51
8 [报告]
发表于 2009-02-11 12:52 |只看该作者
是不是备份目录的空间满了

论坛徽章:
0
9 [报告]
发表于 2009-02-20 11:45 |只看该作者
原帖由 netsky_lee 于 2009-2-2 17:39 发表
我在测试用jsp调用linux脚本来导出数据库,调用倒是成功了,但是导出数据不完整,中途断掉了,请各位帮忙看看是什么问题,谢谢




很简单,就一句话。


以下是 manual_exp.sh 的内容:

#/bin/b ...

注意你用jsp脚本调用时的环境变量问题。。。。它跟直接运行linux脚本不同的,检查一下吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP