| | |
| | | lastRecodTime = nowTime;
|
| | | DataBaseBackUpThread_SQL.inseartBackupTable(pool,list);
|
| | |
|
| | | ZipUtil zipUtil = new ZipUtil();
|
| | | String zipName = path+".zip";
|
| | | File zipFile = zipUtil.createZip(zipName, new File(path)); //压缩数据库文件
|
| | | |
| | | |
| | | HzipSocket SocketClient = new HzipSocket();
|
| | | SocketClient.init(path); //发送数据库备份文件到远程服务器
|
| | | SocketClient.init(zipName); //发送数据库备份文件到远程服务器
|
| | | System.out.println("远程备份数据库完成" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
| | | if(zipFile.exists() && zipFile.length() > 1*1024 && new File(path).exists()) {
|
| | | deleteDir(new File(path));
|
| | | }
|
| | | }
|
| | |
|
| | | //查询所有需要备份指定数据库的记录
|
| | |
| | | table.setBack_en(DatabaseTable.MYSQL_BACKUP_OVER); //备份完成
|
| | | DataBaseBackUpThread_SQL.UpdateDataBaseState(pool, table);
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | if( count > 0) {
|
| | | ZipUtil zipUtil = new ZipUtil();
|
| | | String zipName = path+".zip";
|
| | | File zipFile = zipUtil.createZip(zipName, new File(path)); //压缩数据库文件
|
| | | if(zipFile.exists() && zipFile.length() > 1*1024 && new File(path).exists()) {
|
| | | deleteDir(new File(path));
|
| | | }
|
| | | System.out.println("开始备份"+count+"个表 at "+Com.getDateTimeFormat(nowTime, Com.DTF_YMD_h_m_s));
|
| | | }
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public static Date createNomalDate(Date time) {
|
| | | String time_str = Com.getDateTimeFormat(time, Com.DTF_YMD) + " 23:59:30";
|
| | | String time_str = Com.getDateTimeFormat(time, Com.DTF_YMD) + " 10:36:30";
|
| | | //System.out.println(time_str);
|
| | | return Com.getDateTimeFromStr(time_str, Com.DTF_YMDhms);
|
| | | }
|