restore database jkxt from jkxt_bak with nonrecovery
关键定写错了呀nonrecovery应该是norecovery另外,你在恢复时还要用到sp_addumpdevice系统存储过程,具体用法请看SQL SERVER的在线帮助。
关键定写错了呀nonrecovery应该是norecovery另外,你在恢复时还要用到sp_addumpdevice系统存储过程,具体用法请看SQL SERVER的在线帮助。
DMO
很方便
请参考SQL SERVER连机帮助
[Microsoft][ODBC SQL Server Driver][SQL Server]在sysdevices 中没有备份设备'jkxt_bak'的条目。请更新sysdevices后重新运行语句这是怎么回事啊???
请大家告诉我一下
谢谢
nonrecovery改为norecovery
Dim rs As ADODB.Recordset
Dim sql As String
Set cnn = New ADODB.Connection
cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"我现在已经将恢复代码改为上面的语句了(备份代码没有改动),但提示的错误是:
[Microsoft][ODBC SQL Server Driver][SQL Server]因为数据库正在使用,所以未能获得对数据库的排他访问权。我该怎么 做能成功呢???请朋友们告诉我一下谢谢啊
cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
^^^^^^^^^你在恢复数据库以前先cnn.close
就是关闭所有连接,你最好重新建立一个连接专门用于恢复/备份数据库
drop database xxx
restore database ....
sleep 10000
cnn.execute "user master"
cnn.execute "restore ..."
private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)Private Sub regain_Click(Index As Integer)
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String
Shell "scm -silent 1 -action 2 -service mssqlserver "'Specfied sqlserver service
sleep 20000
Set cnn = New ADODB.Connection
cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
cnn.Execute "use master"
cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
End Sub
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String
Shell "scm -silent 1 -action 2 -service mssqlserver "'Specfied sqlserver service
sleep 20000
Set cnn = New ADODB.Connection
cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
cnn.Execute "use master"
cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
End Sub
--------------------------------------------------------------------------------
The information in this article applies to:Microsoft SQL Server 2000 (all editions)--------------------------------------------------------------------------------
SYMPTOMS
If the server against which a trace is being run is restarted, while the trace is paused, the profiler returns the following series of error messages in a dialog box: Failed to restart a trace.
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionWrite
(WrapperWrite()). (State 01000) (Code 55)
[Microsoft][ODBC SQL Server Driver][Shared Memory]General network error. Check your network documentation. (State 08S01) (Code 11)
The information window also displays the following:
Error retrieving trace information from the server
as well as:
Connections: 0
However, it may not not be apparent to the user that the network error messages are occurring because of a server restart.Following the reporting of the error messages, the Pause and Stop Execution buttons are dimmed. Only the Start execution button is enabled. Restarting the trace works successfully, with the exception that all previously obtained trace results are cleared from the window and a new trace (and the resulting output) are begun from scratch. CAUSE
This behavior is considered to be by design. Several different ideas were considered in order to make this behavior more intuitive, including having the profiler detect for a dead connection before attempting to restart the trace. Ultimately, it was decided to have the ODBC driver propagate the exact error messages to the user interface (UI). The current behavior enables the user to be made aware of the fact that something has gone wrong with the connection. However, the user needs to take care to save any existing results before restarting the trace. Both saving to a table and saving to a file work properly. Additional query words: Keywords : kbDSupport kbSQLServ2000
Issue type : kbprb
Technology : kbSQLServSearch kbAudDeveloper kbSQLServ2000Search kbSQLServ2000
我们的系统这样做能够正常备份!
cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=127.0.0.1 "
s_restore = "restore database wzgl from disk='" + Trim(Text1.Text) + "'"
cn.Execute s_restore
结果还是用了我的方法,为什么给我的分要少?
你自己怎么要回自己的问题?
Dim cnn As ADODB.Connection
Dim s_restore As String
Shell "scm -silent 1 -action 2 -service mssqlserver " 'Specfied sqlserver service
Sleep 20000
Set cnn = New ADODB.Connection
cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=jkxt"
s_restore = "restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'"
cnn.Execute s_restore
cnn.Close
MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
以上是我目前恢复的代码
“昨天的话可以把所有的连接全部初始化!”这句话是什么意思?
谢谢
----------------------------------------------------------------
原贴内容:
你的数据库连的是哪个?
master还是自己的?
建议一下:一般在恢复完成后,建议用户重新登录一下你们的管理系统!
昨天的话可以把所有的连接全部初始化!