在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
使用C#调用Exp 来执行 Oracle 的备份。前辈们也讲过许多,我也再整理一下我的思路及备份进度提示的处理思路 总体思路
/// <summary> /// 取得表空间已使用大小 /// </summary> /// <param name="tableSpaceName">表空间名称</param> /// <returns>已使用大小</returns> public double GetDBUsedSize(string tableSpaceName) { string sql = string.Format("select " + " (a.bytes-b.bytes)/1024/1024 \"UsedMB\" " + " from " + "(select tablespace_name,sum(bytes) bytes from dba_data_files " + " group by tablespace_name) a, " + " (select tablespace_name,sum(bytes) bytes,max(bytes) largest from " + "dba_free_space group by tablespace_name) b " + " where a.tablespace_name=b.tablespace_name AND A.TABLESPACE_NAME='{0}'", tableSpaceName); object res = dboCenter.ExecuteSingle(sql); if (Convert.IsDBNull(res)) { return 0D; } else { return Convert.ToDouble(res); } } 监视文件大小的线程 exportedSize = (int)(tableSpaceUsedMB * 0.8);//预估压缩率为 80%; if (ActReadToBack != null) { ActReadToBack(exportedSize); if (ActBackProcessing != null) { tmMonitorProcess = new System.Threading.Timer( new System.Threading.TimerCallback (o => { ActBackProcessing(GetFileSize(fileNameForExport)); }), null, 0, 1000 ); } } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论