罗不辣 2014-05-09 14:38 采纳率: 0%
浏览 2104

怎么在oracle用imp导入数据库前删除数据库里的表 触发器怎么写 或者java代码怎么写

    // 还原
    Button button_1 = new Button(composite_1, SWT.NONE);
    button_1.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TableItem[] tis = table.getSelection();
            if (tis == null || tis.length <= 0) {
                ShowMessageBox
                        .ShowMesBox(shell, "错误提示", "请至少选定一行", SWT.YES);
                return;
            }

            TableItem ti = tis[0];
            if (ShowMessageBox.ShowMesBox(shell, "确定吗?", "确定还原"+ ti.getText(2), SWT.YES | SWT.NO) == SWT.YES) {

                String exp = "imp team/team@orcl file=" + ti.getText(3)+" full=y inctype=incremental";

                File file = new File(ti.getText(3));
                // 判断文件是否存在,存在才进行恢复不存在就不恢复 
                if (file.exists()) {

                    try {
                        // System.out.println(exp.toString());
                        Process p = Runtime.getRuntime().exec(exp.toString());
                        InputStreamReader isr = new InputStreamReader(p.getErrorStream());
                        BufferedReader br = new BufferedReader(isr);
                        String line = null;
                        while ((line = br.readLine()) != null) {
                            if (line.indexOf("错误") != -1) {
                                break;
                            }
                        }
                        p.destroy();
                        p.waitFor();
                        ShowMessageBox.ShowMesBox(shell, "提示", "还原成功", SWT.NONE);
                    } catch (Exception e1) {
                        ShowMessageBox.ShowMesBox(shell, "提示", "还原失败,原因"
                                + e1.getMessage(), SWT.NONE);
                        // System.out.println(e.getMessage());
                    }
                }

            }

        }
    });
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘