ych

2007年7月6日

通过exp导出与imp导入进行数据的备份转移:
exp命令:
1 exp username/psw@TEST file=d:test.dmp full=y
2 exp username/psw@TEST file=d:test.dmp owner=(ly)
3 exp username/psw@TEST file= d:test.dmp tables=(grid1,grid2)
1其中一是将Test(与某一数据库对应的oracle服务名)数据库进行整体导出
2将属于用户ly的所有表导出
3将表grid1,与grid2导出
d:test.dmp是导出的文件地址

imp命令:
1 imp system/psw@TEST  file=d:test.dmp
2 imp system/psw@TEST  full=y  file=d:test.dmp ignore=y
3 imp system/psw@TEST  file=d:test.dmp  tables=(grid1)
ignore=y表示如果被导入的数据库中某个表已经存在就忽略不导入那个表
3表示只导入grid1这个表

在导入导出前要先测试下对应的数据库是否是通的:tnsping test来测试,同样test是服务名
所有命令可在cmd下执行
posted @ 2008-09-03 11:57 changhong 阅读(91) | 评论 (0)编辑 收藏

http://blog.csdn.net/techyang/archive/2005/08/09/448677.aspx(luanfengxia/arc/2006/05/20/746951.aspx)

 public ActionForward add(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) throws Exception {
        String encoding = request.getCharacterEncoding();
        if ((encoding != null) && (encoding.equalsIgnoreCase("utf-8")))
        {
            response.setContentType("text/html; charset=gb2312");//如果没有指定编码,编码格式为gb2312
        }
        NodeForm theForm = (NodeForm) form;
        String nodename=theForm.getNodename();
        String note=theForm.getNote();
        FormFile file = theForm.getTheFile1();//取得上传的文件
        FormFile file2=theForm.getTheFile2();
        FormFile file3=theForm.getTheFile3();
        Session session=null;
        String forward="";
        try
        {
            /*
             * 取当前系统路径
             */
            String filePath = this.getServlet().getServletContext()
            .getRealPath("/");
            System.out.println("---------------------------------------"+filePath);
            if(file.getFileSize()!=0){
            ByteArrayInputStream stream = (ByteArrayInputStream) file.getInputStream();//把文件读入
          
            //ByteArrayOutputStream baos = new ByteArrayOutputStream();
          
            /*
             * 建立一个上传文件的输出流
             */
            OutputStream bos = new FileOutputStream(filePath +
                    "UploadFiles\\"+file.getFileName());
            request.setAttribute("fileName",filePath + "/"
                    + file.getFileName());
            int bytesRead = 0;
            byte[] buffer = new byte[8192];
            while ((bytesRead = stream.read(buffer, 0, 8192)) != -1)
            {
                bos.write(buffer, 0, bytesRead);//将文件写入服务器
            }          
            bos.close();
            stream.close();
            }if(file2.getFileSize()!=0){
            ByteArrayInputStream stream2 = (ByteArrayInputStream) file2.getInputStream();
            OutputStream bos2 =  new FileOutputStream(filePath +
                    "UploadFiles\\"+file2.getFileName());//建立一个上传文件的输出流
            int bytesRead2 = 0;
            byte[] buffer2 = new byte[8192];
            while ((bytesRead2 = stream2.read(buffer2, 0, 8192)) != -1)
            {
                bos2.write(buffer2, 0, bytesRead2);//将文件写入服务器
            }          
            bos2.close();
            stream2.close();
            }if(file3.getFileSize()!=0){
            ByteArrayInputStream stream3 = (ByteArrayInputStream) file3.getInputStream();//把文件读入
        OutputStream bos3 =  new FileOutputStream(filePath +
                "UploadFiles\\"+file3.getFileName());//建立一个上传文件的输出流
        int bytesRead3 = 0;
        byte[] buffer3 = new byte[8192];

        while ((bytesRead3 = stream3.read(buffer3, 0, 8192)) != -1)
        {
            bos3.write(buffer3, 0, bytesRead3);//将文件写入服务器
        }          
        bos3.close();
        stream3.close();
        }
  Configuration config = new Configuration().configure();
  SessionFactory factory = config.buildSessionFactory();
     session = factory.openSession();
        Transaction transaction = session.beginTransaction();
        Node node=new Node();
        node.setNodeName(nodename);
        node.setXsdName(file.getFileName());
        node.setXslName(file2.getFileName());
        node.setXhtmlName(file3.getFileName());
        node.setNote(note);
        session.save(node);
  session.flush();
  session.clear();
  forward="display";
        transaction.commit();
        }
        catch (Exception e)
        {
         forward="error";
            System.err.print(e);
            e.printStackTrace();
        }
   
  finally{
   session.close();
   }
        return mapping.findForward(forward);
 }

posted @ 2007-08-29 13:35 changhong 阅读(183) | 评论 (0)编辑 收藏
"^\\d+$"  //非负整数(正整数 + 0)
"^[0-9]*[1-9][0-9]*$"  //正整数
"^((-\\d+)|(0+))$"  //非正整数(负整数 + 0)
"^-[0-9]*[1-9][0-9]*$"  //负整数
"^-?\\d+$"    //整数
"^\\d+(\\.\\d+)?$"  //非负浮点数(正浮点数 + 0)
"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮点数
"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"  //非正浮点数(负浮点数 + 0)
"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //负浮点数
"^(-?\\d+)(\\.\\d+)?$"  //浮点数
"^[A-Za-z]+$"  //由26个英文字母组成的字符串
"^[A-Z]+$"  //由26个英文字母的大写组成的字符串
"^[a-z]+$"  //由26个英文字母的小写组成的字符串
"^[A-Za-z0-9]+$"  //由数字和26个英文字母组成的字符串
"^\\w+$"  //由数字、26个英文字母或者下划线组成的字符串
"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"    //email地址
"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$"  //url
posted @ 2007-07-06 19:14 changhong 阅读(129) | 评论 (0)编辑 收藏

导航

<2007年7月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

统计

常用链接

留言簿(1)

随笔档案

文章档案

相册

搜索

最新评论

阅读排行榜

评论排行榜