首页 新闻 会员 周边 捐助

还原数据库时,如何知道数据库还原好了

0
悬赏园豆:10 [已关闭问题]

还原数据库时,如何知道数据库在某个时间点还原好了,请高手指点一下

幽境仼孓的主页 幽境仼孓 | 初学一级 | 园豆:0
提问于:2010-06-08 12:42
< >
分享
其他回答(1)
0

用sql还是smo,smo有进度可循;sql中用@@RowCount 获取结果。

winzheng | 园豆:8797 (大侠五级) | 2010-06-08 13:28
0

用VS引用Interop.SQLDMO.dll 用里面方法还原就能得到

我以前写过一个备份的代码如下:

        #region 数据库备份
        public bool BackupDB(string url)
        {
            SQLDMO.Backup oBackup = new BackupClass();
            SQLDMO.SQLServer oSQLServer = new SQLServerClass();
            SqlConnection conn = SqlHelperEx.GetConnection();
            try
            {
                oSQLServer.LoginSecure = false;
                oSQLServer.Connect(CommonSystem.StringCut(conn.ConnectionString, "Data Source","Server"), CommonSystem.StringCut(conn.ConnectionString, "User Id", "uid"), CommonSystem.StringCut(conn.ConnectionString, "Password", "pwd"));
                oBackup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database;
                oBackup.Database = CommonSystem.StringCut(conn.ConnectionString, "Initial Catalog");
                oBackup.Files = url;
                oBackup.BackupSetName = CommonSystem.StringCut(conn.ConnectionString, "Initial Catalog"); ;
                oBackup.BackupSetDescription = "数据库备份";
                oBackup.Initialize = true;
                oBackup.SQLBackup(oSQLServer);
                return true;
            }
            catch(Exception err)
            {
                PsLog.WriteLog(err.Message.ToString(), NLog.LogLevel.Error);
                return false;
            }
            finally
            {
                oSQLServer.DisConnect();
            }
        }
        #endregion

觉知的凡夫 | 园豆:468 (菜鸟二级) | 2010-06-08 15:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册