java常见问题解决

problem with java code and

deal with string
String [] idsArr = bids.split(",");
            for (int i = 0; i < idsArr.length; i++) {
                 ss = ss + "'"+idsArr[i]+"',";
            }
deal with code
String sql = DataTools.null2EmptyString(URLDecoder.decode(request
        .getParameter("sql"), "utf-8"));
sql query return DataSet
public DataSet executeQuery(String strSQL) throws Exception
     {
             DataSet ds = null;
             try
             {
                     ds = (DataSet) getPM().executeQuery(strSQL);
             }
             catch (DrmException e)
             {
                     System.out.println("" + e);
                     LogFactory.getLog(SystemConfig.logCatagroy).error("", e);
                     throw e;
             }
             finally
             {
                     close();
             }
             return ds;
     }
other thread send email
private class SendMailThread extends Thread{
        ImportToERPR12Dao dao = new ImportToERPR12Dao();// 通用dao
        private List<Object[]> list;
        private String a ;
        public SendMailThread(List<Object[]> l,String s){
            list = l;
            a = s;
          }
          public void run(){
              System.out.println("Reading email properties....");
                String validateName = "";
                String validatePswd = "";
                String fjrMail = "";
                String fjrName = "";
                String constantIp = "";
                String csr = "";
                String sjr = "";
                String shje = "";
            try {
                    HashMap<String, String> paramMap = ReadEmailProperties
                            .getInstance().getPoppertiesMap();
                    validateName = paramMap.get("emailValidateName");
                    validatePswd = paramMap.get("emailValidatePassword");
                    fjrMail = paramMap.get("sendMailPerson");
                    fjrName = MimeUtility.encodeText(paramMap.get("sendMailShowName"),MimeUtility.mimeCharset("gb2312"), null);
                    System.out.println(fjrName);
                    constantIp = paramMap.get("constant_ip");
            } catch (Exception e) {
                    System.out.println("Failed to get mail configuration information. Canceling this operation");

                }
                Iterator itr = list.iterator();
                String[] result = null;
                while(itr.hasNext()){
                    System.out.println("import:"+a);
                    //System.out.println("financial staff email:"+a+"@neusoft.com");
                    Object[] o = (Object[])itr.next();
                    String sql = "select ldap,BILL_AMOUNT from nuip_wsbx.TB_BILL_INF where bill_code=? ";
                    System.out.println("sql:"+sql);
                    String[] param_sql = new String[] { (String) o[0] };
                    try {
                    result = dao.queryListInFixedCol(sql, param_sql, 2).get(0);
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }

                    sjr = result[0]+"@neusoft.com";
                    //sjr = "[email protected]";
                    System.out.println("recipients:"+sjr);
                    shje = result[1];
                    if(!"".equals(sjr)&&null!=sjr&&"null"!=sjr){
                        List<String> csrList = new ArrayList<String>();
                        //csrList.add("[email protected]");
                        //csrList.add(a+"@neusoft.com");
                        List<String> sjrList = new ArrayList<String>();
                        sjrList.add(sjr);
                        //邮件主题
                        String yjzt = "邮件通知";
                        //邮件内容
                        String mailHtml = "";
                        NetManagerEmailVO emailVo = new NetManagerEmailVO();
                        emailVo.setFsr(fjrMail);
                        emailVo.setFsrMc(fjrName);
                        emailVo.setSjrList(sjrList);
                        emailVo.setYjnr(mailHtml);
                        try {
                            emailVo.setYjzt(MimeUtility.encodeText(yjzt,MimeUtility.mimeCharset("gb2312"), null));
                        } catch (UnsupportedEncodingException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        emailVo.setUserName(validateName);
                        emailVo.setPassword(validatePswd);
                        emailVo.setCsrList(csrList);
                        boolean flag = NetManagerEmailSendTool.sendEmailWithSjrName(emailVo, false);// 返回值用于判断邮件是否发送成功,
                        // 第2个参数为true时,发送附件。
                        System.out.println("Send mail status : true is success false is fail    flag=" + flag);
                    }
                }
              }
    }
deal with \
String osname = System.getProperties().getProperty("os.name");
String path = "";
if (osname.equals("Linux")) {
 path = "\\";
}else{
 path = "/";
}
path = 目录1+File.separator+目录2
deal with firefox or chrome for ‘event.fromElement’ and ‘event.toElement’
var event = event || window.event;
deal with IE to firefox
//原代码:
window.showModalDialog("<%=path%>/ExpenseAction.do?method=querySpqk&bill_id="+bill_id,"","dialogWidth:610px;dialogHeight:200px");
//更改代码:
 window.open('<%=path%>/ExpenseAction.do?method=querySpqk&bill_id='+bill_id,'newWin','modal=no,width=610,height=200,resizable=no,scrollbars=no');
idea before saving data delete old (wrong) data
ajax data list
    $.ajax({
        type: 'POST',
             url: path+'/TelephoneAdviserAction.do?method=queryBySale',//数据源
             async: false,
             data: {'where':where},
             success: function (msg) {
                 $("select[name=minority]").children().remove();
                 if 不为0{
                     var json = eval (msg.result);
                     $each(json,function(i,item){
                         $("<option>"+item.minority_name+"</option>").attr("value",item.id).appendTo($("select[name = minority]"));
                     })
                 }else if (...) {
                    $("select[name=minority]").append("<option>加载失败</option>");
                 }
        }
    })
下拉列表
String sql_gw = "select  b.xm as codename,UserAccount as codevalue from neuedu_view_uporguser_ygxx a, neuedu_qx_salesxxb b where  a.user_account = b.useraccount";
        String[] cols_gw = { "CODENAME", "CODEVALUE" };
        String zxgw = ca.queryJsonObjectBySql(sql_gw, cols_gw);
        JSONObject obj = new JSONObject();
        obj.put("zxgw", zxgw); // 咨询顾问
$.ajax({
        type: 'POST',
        url: path+'/TelephoneAdviserAction.do?method=queryBySale',//数据源
        async: false,
        data: {'where':where},
        success: function (v) {
            var obj=eval('('+v+')');
            //是否上门
            var sfsm = document.getElementById('SFSM');
            sfsm.options.length=0;//清除原有选项
            var opn = document.createElement("OPTION");
            opn.value = "";
            opn.innerHTML = "----请选择----";
            sfsm.appendChild(opn);
            for(var i=0;i<obj.sf.length;i++){
                var op = document.createElement("OPTION");
                op.value = obj.sf[i].CODEVALUE;
                op.innerHTML = obj.sf[i].CODENAME;
                sfsm.appendChild(op);
            }  
        }  
        });
export data jxl
public ActionForward doExport(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        String where = request.getParameter("where");
        // 获取交互对象,调用对象方法
        CommonApplogicImpl ca = new CommonApplogicImpl();
        // sql
        String sql = this.queryExportBySql + "and " + where +" order by cjsj desc";
        // 字段
        String sqlcol[] = { "XSXM", "SJHM", "EMAIL", "XM", "ZXGW", "SFSM1", "sfcd1", "YYSMSJ","DHXSFPZXGW"};
        // 标题
        String[] titles = { "学生姓名","电话","邮箱","电话销售","咨询顾问","是否上门","是否承担","预约上门时间","分配人"};
        File tempfile = ca.exportExcel(sql, sqlcol, titles);
        if (tempfile.exists()) {
            // 构造一个读取文件的IO流对象
            InputStream ins = new FileInputStream(tempfile);
            // 放到缓冲流里面
            BufferedInputStream bins = new BufferedInputStream(ins);
            // 获取文件输出IO流
            OutputStream outs = response.getOutputStream();
            BufferedOutputStream bouts = new BufferedOutputStream(outs);
            // 设置response内容的类型
            response.setContentType("application/x-download");
            // 设置头部信息
            response.setHeader("Content-disposition",
                    "attachment;filename=export.xls");
            int bytesRead = 0;
            byte[] buffer = new byte[8192];
            // 开始向网络传输文件流
            while ((bytesRead = bins.read(buffer, 0, 8192)) != -1) {
                bouts.write(buffer, 0, bytesRead);
            }
            // flush()方法关闭流
            bouts.flush();
            ins.close();
            bins.close();
            outs.close();
            bouts.close();
        } else {
            System.out.println("下载的文件不存在");
        }
        return null;
    }
public File exportExcel(String sql, String[] arr, String[] titles)
{
    long time = new Date().getTime();
    File a = new File(time + ".xls");
    DataSet ds = null;
    int count = 0;
    try
    {
        ds = this.DsBySql(sql);
        // ds.last();//游标设置到最后一行;准备取总行数
        count = ds.getRowCount();// 获取最后一行行号
        // ds.beforeFirst();
    } catch (Exception e1)
    {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    try
    {
        // 打开文件
        WritableWorkbook workbook = Workbook.createWorkbook(a);
        // 生成名为“第一页”的工作表,参数0表示这是第一页
        WritableSheet sheet = workbook.createSheet("export", 0);
        // 在Label对象的构造子中指名单元格位置是第一列第一行(0,0)
        // 设置表头行
        // 设置表头格式
        WritableFont wf_title = new WritableFont(WritableFont.ARIAL, 10); // 定义格式
        // 字体
        WritableCellFormat wcf_title = new WritableCellFormat(wf_title); // 单元格定义
        wcf_title.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式(左右居中)
        wcf_title.setBorder(jxl.format.Border.ALL,
                jxl.format.BorderLineStyle.THIN);// 设置边框
        wcf_title.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// (上下居中)
        // 设置单元格格式
        WritableFont wf_cell = new WritableFont(WritableFont.ARIAL, 9); // 定义格式
        // 字体
        WritableCellFormat wcf_cell = new WritableCellFormat(wf_cell); // 单元格定义
        wcf_cell.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式(左右居中)
        wcf_cell.setBorder(jxl.format.Border.ALL,
                jxl.format.BorderLineStyle.THIN);// 设置边框
        wcf_cell.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// (上下居中)
        for (int i = 0; i < titles.length; i++)
        {
            Label label = new Label(i, 0, titles[i], wcf_title);// 设置表头行单元格内容
            // 四个参数是(列号,行号,内容,格式)
            sheet.setColumnView(i, 20);
            sheet.addCell(label);// 将定义好的单元格添加到工作表中
        }
        int t = 0;
        while (ds.next())
        {
            t++;
            for (int p = 0; p < arr.length; p++)
            {
                // System.out.println(arr[p]);
                Label label = new Label(p, t, ds.getString(arr[p]),
                        wcf_cell);// 设置表头行单元格内容 三个参数是(行号,列号,内容)
                sheet.addCell(label);// 将定义好的单元格添加到工作表中
            }
        }

        workbook.write();
        workbook.close();

    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return a;
}
export data with Color jxl
/**
 *  表头带颜色的导出
 *
 * @param sql
 *            查询sql
 * @param arr
 *            对应的字段
 * @param titles
 *            表头字段名
 * @param formats
 *            字段格式
 * @return
 */
public File exportExcelCustom(String sql, String[][] arr, String[] titles)
{
    long time = new Date().getTime();
    File a = new File(time + ".xls");
    DataSet ds = null;
    try
    {
        ds = this.DsBySql(sql);
    } catch (Exception e1)
    {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    try
    {
        // 打开文件
        WritableWorkbook workbook = Workbook.createWorkbook(a);
        // 生成名为“第一页”的工作表,参数0表示这是第一页
        WritableSheet sheet = workbook.createSheet("export", 0);
        // 在Label对象的构造子中指名单元格位置是第一列第一行(0,0)
        // 设置表头行

        // 设置表头样式
        WritableFont title_head = new WritableFont(WritableFont.TIMES, 10,
                WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
                jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
        WritableCellFormat title_format = new WritableCellFormat(title_head); // 单元格定义
        title_format.setBackground(jxl.format.Colour.PALE_BLUE); // 设置单元格的背景颜色
        title_format.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
        title_format.setBorder(jxl.format.Border.ALL,
                jxl.format.BorderLineStyle.THIN);// 设置边框
        title_format
                .setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);

        // 定义格式 字体 下划线 斜体 粗体 颜色
        WritableFont on_head = new WritableFont(WritableFont.TIMES, 10,
                WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
                jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
        WritableCellFormat one_head = new WritableCellFormat(on_head); // 单元格定义
        one_head.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
        one_head.setBorder(jxl.format.Border.ALL,
                jxl.format.BorderLineStyle.THIN);// 设置边框
        one_head.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);

        // 设置列显示为数字格式
        WritableFont num_head = new WritableFont(WritableFont.ARIAL, 10,
                WritableFont.NO_BOLD, false); // 定义格式 字体 下划线 斜体 粗体 颜色
        NumberFormat nf = new NumberFormat("#,##0.00;-#,##0.00");
        WritableCellFormat num_format = new WritableCellFormat(num_head, nf); // 单元格定义
        num_format.setAlignment(jxl.format.Alignment.CENTRE);
        num_format.setBorder(jxl.format.Border.ALL,
                jxl.format.BorderLineStyle.THIN);// 设置边框
        num_format
                .setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);

        for (int i = 0; i < titles.length; i++)
        {
            Label label = new Label(i, 0, titles[i], title_format);// 设置表头行单元格内容
            // 四个参数是(列号,行号,内容,格式)
            sheet.setColumnView(i, 20);
            sheet.addCell(label);// 将定义好的单元格添加到工作表中
        }
        int t = 0;
        while (ds.next())
        {
            t++;
            for (int p = 0; p < arr.length; p++)
            {
                if (arr[p][1].equals("S"))
                {
                    Label label = new Label(p, t, ds.getString(arr[p][0]),
                            one_head);
                    sheet.addCell(label);// 将定义好的单元格添加到工作表中
                } else if (arr[p][1].equals("N"))
                {
                    Double Num = Double.valueOf(ds.getString(arr[p][0]));
                    Number label = new jxl.write.Number(p, t, Num,
                            num_format);
                    sheet.addCell(label);// 将定义好的单元格添加到工作表中
                }

            }
        }
        workbook.write();
        workbook.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return a;
}
Grid
jQuery("#list2").jqGrid({
    url : path + "/studentStatusChangeNewAction.do?method=query",// 数据源
    datatype : "json",// 数据类型
    colNames : ['姓名', '身份证号', '项目名称', '项目编号', '班级名称','报到时间','是否报到','是否住宿','学籍状态','离司时间','离司状态','详情','合同编号','学号','退班时间','退班原因','学生当前状态码','离司原因','转班时间','转班原因','班级编号','休学状态'],// 标题列
    colModel : [{
        name : 'XM',
        width : 80,
        align : "center"
    }, {
        name : 'SFZJH',
        width : 140,
        align : "center"
    }, {
        name : 'XMMC',
        width : 170,
        align : "center"
    }, {
        name : 'XMBH',
        width : 110,
        align : "center"
    }, {
        name : 'BJMC',
        width : 120,
        align : "center"
    }, {
        name : 'BDSJ',
        width : 100,
        align : "center"
    }, {
        name : 'SFBD',
        width : 60,
        align : "center",
        editoptions : {
            value : ':;1:是;0:否'
        },
        formatter : 'select'
    },{
        name : 'SFZS',
        width : 60,
        align : "center",
        editoptions : {
            value : ':;1:是;0:否'
        },
        formatter : 'select',
        hidden:true
    },{
        name : 'XJZT',
        width : 60,
        align : "center"
    },{
        name : 'LSSJ',
        width : 100,
        align : "center"
    },{
        name : 'LSZT',
        width : 80,
        align : "center",
        editoptions : {
            value : ':;0:未申请;1:待确认;2:已确认'
        },
        formatter : 'select',
        hidden : true
    },{
        name : 'RID',
        width : 50,
        align : "center",
        hidden : true
    },{
        name : 'HTBH',
        width : 50,
        align : "center",
        hidden : true
    },{
        name : 'XH',
        width : 50,
        align : "center",
        hidden : true
    },{
        name : 'TBRQ',
        width : 100,
        align : "center"
    },{
        name : 'TBYY',
        width : 180,
        align : "center"
    },{
        name : 'XSDQZTM',
        width : 120,
        align : "center",
        hidden :true
    },{
        name : 'LSYY',
        width : 180,
        align : "center"
    },{
        name : 'ZBRQ',
        width : 100,
        align : "center"
    },{
        name : 'ZBYY',
        width : 180,
        align : "center"
    },{
        name : 'BJBH',
        width : 50,
        align : "center",
        hidden : true
    },{
        name : 'XXZT',
        width : 50,
        align : "center",
        hidden : true
    }
    ],// 每列的参数
    rowNum : 10, // 默认每页行数
    width : 1210,// grid宽度 不设置此属性时按colModel字段宽度计算,否则以此属性优先
    height : 270,// grid高度
    shrinkToFit : false,// 设置初始化时各列宽度的计算方法
    // 当为true时按比例分配,当为false时按colModel中设置宽度分配
    loadtext : '请求数据中.....', // 请求数据时的提示文字
    rownumbers : true,// 是否显示行号
    rownumbersWidth : 15,
    scrollOffset : 0, // 设置预留垂直滚动条宽度,设置为0时不预留滚动条位置,当需要垂直滚动条时会强制显示垂直滚动条,同时出现水平滚动条
    rowList : [10, 20, 30, 50, 100], // 自定义每页数据量
    postData : {
        where : where
    },// 请求数据时发送的参数,参数会被直接加到url上
    pager : '#pager2', // 绑定的翻页工具条
    sortname : '', // 定义排序列 这里填写的是数据库字段
    mtype : "post", // 数据传输方式
    viewrecords : true,
    multiselect : true,// 是否可以多选
    // multiboxonly : true,//此属性有问题 不建议使用//只有点击checkbox时有效
    sortorder : "",// 定义排序规则
    pagerpos : "left",// 分页条位置
    recordpos : "right",// 数据量显示位置
    beforeSelectRow : function(rowid, e, col) {// 控制点击行(非checkbox单元格)时不选中此行
        if (col == "1") {
            return true;
        } else {
            return false;
        }
    }
});
jQuery("#list2").jqGrid('navGrid', '#pager2', {
    position : 'center',
    edit : false,
    add : false,
    del : false,
    search : false,
    refresh : false
});
<!-- 以下内容为jquery grid所需组件 -->
<link rel="stylesheet" type="text/css" href="<%=appPath%>/pages/demo/css/ui.jqgrid.css"></link>
<link rel="stylesheet" type="text/css" href="<%=appPath%>/pages/demo/smoothness/jquery-ui-1.8rc3.custom.css"></link>
<script type="text/javascript" src="<%=appPath%>/pages/demo/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="<%=appPath%>/pages/demo/js/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="<%=appPath%>/pages/demo/src/jquery.jqGrid.js"></script>
<script type="text/javascript" src="<%=appPath%>/Resources/common/layer/layer.js"></script>
<script language="JavaScript" src="<%=appPath%>/pages/demo/jquery/jquery-ui.js"></script>
<script language="JavaScript" src="<%=appPath%>/pages/demo/jquery/jquery.multiselect.js"></script>
<script language="JavaScript" src="<%=appPath%>/pages/demo/jquery/jquery.multiselect.filter.js"></script>
<script language="JavaScript" src="<%=appPath%>/pages/demo/jquery/jquery.multiselect.filter.zh-cn.js"></script>
<link rel="stylesheet" href="<%=appPath%>/pages/demo/jquery/jquery.multiselect.css" type="text/css" />
<div id="pager2"></div> <!-- 这个是分页工具条 -->
layer
layer.open({
         type : 2,
         title : '录入离司日期',
         shadeClose : false,
         shade : 0.8,
         area : ['450px', '250px'],
         content : temppath, // iframe的url
         end : function() {
             obj = new Object();
             query();
         }
     });
oracle unlock
select object_name,
       machine,
       s.sid,
       s.serial# from v$locked_object l,
       dba_objects o,
       v$session s where l.object_id  =  o.object_id and l.session_id = s.sid;
alter system kill session '263,3213';
//解锁存储过程
select * FROM dba_ddl_locks where name =upper('prc_neu_zj_zjxxxg');

select t.sid,t.serial# from v$session t
where t.sid=257;

alter system kill session '257,3318'

//如果上边的办法杀不掉
SELECT p.SPID, s.OSUSER, p.PROGRAM
  FROM v$session s, v$process p
 WHERE s.PADDR = p.ADDR
   AND s.SID = 2193

//取到SPID,然后再linux下执行一下命令
kill -9 6666(取到的SPID)

//替换临时表空间

查询原表空间位置

select name from v$tempfile;

新建一个
create temporary tablespace temp1 tempfile '/oracle/oradata/ORCL/datafile/temp1.dbf' size 20m;


alter database default temporary tablespace temp1;

alter database tempfile '/oracle/oradata/ORCL/datafile/temp1.dbf' autoextend on next 20m;

删除原来的
drop tablespace TEMP2 including contents and datafiles;

下拉框模糊查询

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
    .error {color:red;font-weight:bold;}
</style>
</head>
<body>

    <div>
        <select id="aid">
            <option>上海-浦东</option><option>河南-南阳</option><option>湖北-襄阳</option>
            <option>上海-崇明</option><option>河南-郑州</option><option>湖北-荆州</option>
            <option>上海-黄浦</option><option>河南-安阳</option><option>湖北-十堰</option>
            <option>上海-静安</option><option>河南-濮阳</option><option>湖北-武汉</option>
            <option>上海-长宁</option><option>河南-信阳</option><option>湖南-长沙</option>
        </select>

        <input id="condition">
        <input type="button" id="search" value="Filter">

    </div>
    <script>
    $(function(){
            $("#search").click(function(){
                if($("#condition").val() && $("#condition").val()!=''){
                    var allOptions = $("#aid").children();
                    alert(allOptions);
                    $(allOptions).each(function(i){
                        if($(allOptions[i]).html().indexOf($("#condition").val()) <= -1){
                            $("#aid").append(allOptions[i]);
                            $("#aid option").eq(0).attr('selected', 'true');
                        }
                    });

                }
            });
        });

    </script>
</body>
<script>

</script>
</html>

//日期格式化方法
Date.prototype.format = function(format){
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}

if(/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}

for(var k in o) {
if(new RegExp("("+ k +")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
}
}
return format;
}
//日期格式化方法
拼接函数
select wmsys.wm_concat(htqdr||'('||count(1)||')') into  from neuedu_gg_xxxt where sfjdn = '是' and jd in('沈阳') and drxys is null group by htqdr
恢复oracle数据
根据scn恢复数据
select current_scn from v$database;--查询scn号
select * from NEU_MENU_USER as of scn 1755187500;--查询指定scn号下的数据
flashback table NEU_MENU_USER to scn 1755187500;--将数据恢复到指定scn号下
根据时间恢复数据
select sysdate from dual;--查询当前数据库系统时间
select * from NEU_MENU_USER as of timestamp to_timestamp('2015-10-13 15:20:00','yyyy-mm-dd hh24:mi:ss');--查询指定时间时的数据库数据  
flashback table NEU_MENU_USER to timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');--将数据恢复到指定时间

猜你喜欢

转载自blog.csdn.net/plazyj/article/details/78519273