zoukankan
html css js c++ java
数据库的备份与还原
数据库备份
恢复数据库:
关键字:Alter Database 被恢复的数据库名 Set Offline with Rollback immediate;
restore database 被恢复的数据库名 from disk
=
'
备份文件路径
'
;
Alter Database 被恢复的数据库名 Set OnLine With rollback Immediate;
/**/
/////////////////////
string
sql
=
"
Alter Database db Set Offline with Rollback immediate;
"
;
//
db 是要备份的数据库名
sql
+=
"
restore database db from disk = '
"
;
sql
+=
Server.MapPath(
""
).ToString()
+
"
\\
"
;
sql
+=
bakname
+
"
'
"
;
//
bakname 是备份文件名
sql
+=
"
Alter Database db Set OnLine With rollback Immediate;
"
;
try
{
连接 master 数据库 ;
执行 sql 语句;
Response.Write(
"
<script language=javascript>alert('数据恢复成功!');</script>
"
);
}
catch
(Exception ex)
{
Response.Write(
"
<script language=javascript>alert('数据恢复失败!');</script>
"
);
this
.Label2.Text
=
ex.ToString();
}
备份数据库:
关键字:backup database 被备份的数据库名 to disk
=
'
备份文件路径
'
;
/**/
/////////////////////
/
string
sql
=
"
backup database db to disk = '
"
+
Server.MapPath(
""
).ToString()
+
"
\\
"
+
bakname
//
备份文件名
+
System.DateTime.Now.DayOfYear.ToString()
+
System.DateTime.Now.Millisecond.ToString()
+
"
.bak'
"
;
SQL 2005中的维护计划:[简要如下]
右击鼠标,可以看到创建向导,根据创建向导,就能很快的创建工作计划。
...略
查看全文
相关阅读:
VS2008 编译出错 fatal error C1859: unexpected precompiled header error, simply rerunning the compiler might fix this problem
解析XML出错,无法创建DOMDocument对象
strncpy, strncpy_s
Mongodb: Sort operation used more than the maximum 33554432 bytes of RAM
node-cache
【Boost】boost::string_algo详解2——find相关函数
Compiler Error: Function call with parameters that may be unsafe
fopen和fopen_s用法的比较
fopen_s遇到的一个问题
Data type conversion in MongoDB
原文地址:https://www.cnblogs.com/yank/p/958343.html
最新文章
TLS握手的OpenSSL实现(深度1)
SSL/TLS工作原理
GPG(GnuPG)入门
Session variables lost after the call of Response.Redirect method
c++中POD类型和non-POD类型
关于c++ template的branching和Recursion的一段很好的描述
How do I remove a particular element from an array in JavaScript?
Get the client's IP address in socket.io
前端 使用 crypto-js 对数据进行对称加密
C++ delegate的几种方法
热门文章
MFC更换窗口图标
boost::make_function_output_iterator报错: C4996
How to copy the contents of std::vector to c-style static array,safely?
std::vector push_back报错Access violation
Structured Exception Handling
Catch a Memory Access Violation in C++
Windows上的字符转换之CP_ACP和CP_OEMCP
Initialize a vector in C++ (5 different ways)
MFC中使用ATL报错:error C4430: missing type specifier
C++ WINDOWS下 wchar_t *和char * 相互转化总结篇
Copyright © 2011-2022 走看看