我创建了一个控制台应用程序,我用它来Full
以及Differential Backups
;
下面是功能,现在我正在搜索查询,我可以对Incremental Backup
进行查询。
FullBackup:
Success_backup = Execute_Query_Master_Database("BACKUP DATABASE " + DatabaseName + " TO DISK = '" + Backup_FileName + "' ");
Success_Alter_DB = Execute_Query_Master_Database("ALTER DATABASE " + DatabaseName + " SET MULTI_USER ");
差异BAckup:
Success_backup = Execute_Query_Master_Database("BACKUP DATABASE " + DatabaseName + " TO DISK = '" + Backup_FileName + "' WITH DIFFERENTIAL ");
Success_Alter_DB = Execute_Query_Master_Database("ALTER DATABASE " + DatabaseName + " SET MULTI_USER ");
public static bool Execute_Query_Master_Database(string strQuery)
{
SqlConnection Conn = null;
SqlCommand _command;
{
string connectionstring = @"Data Source=" + servername + ";Initial Catalog='master';User Id='" + UserName + "';Password='" + PassWord + "'";
Conn = new SqlConnection(connectionstring);
Conn.Open();
_command = new SqlCommand();
_command.Connection = Conn;
_command.CommandType = CommandType.Text;
_command.CommandText = strQuery;
_command.CommandTimeout = 0;
_command.ExecuteNonQuery();
return true;
}
catch (Exception ex)
{
Console.WriteLine("Error occured in Function - Execute_Scaler_Master_Database()");
Console.WriteLine("Error Message as below : ");
Console.WriteLine("===========================");
Console.WriteLine(ex.Message);
Console.WriteLine();
return false;
}
finally
{
_command = null;
Conn.Close();
}
}
答案 0 :(得分:0)
Here是描述SQL Server备份选项的MSDN帖子。我没有看到增量备份的选项,至少使用本机SQL命令。
我建议考虑使用Transaction Log Backups,它实际上会在每种可能情况下覆盖你。
希望我帮忙!