问题描述
- 怎么在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()); } } } } });
时间: 2024-11-02 07:55:33