罗不辣 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 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 有没有帮写代码做实验仿真的
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥30 vmware exsi重置后登不上
    • ¥15 易盾点选的cb参数怎么解啊
    • ¥15 MATLAB运行显示错误,如何解决?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题