本文介绍了Microsoft.SqlServer.Management.Smo.FailedOperationException:服务器'\\.\pipe\3F103E6E-3FD4-47\tsql\query'的备份失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
void BackupDatabase(string sConnect,string dbName,string backUpPath)
pre>
{
using(SqlConnection cnn = new SqlConnection(sConnect))
{
cnn.Open();
dbName = cnn.Database.ToString();
ServerConnection sc = new ServerConnection(cnn);
服务器sv =新服务器(sc);
//为备份创建备份设备项
BackupDeviceItem bdi = new BackupDeviceItem(backUpPath,DeviceType.File);
//创建备份信息
Microsoft.SqlServer.Management.Smo.Backup bk = new Backup();
bk.PercentComplete + = new PercentCompleteEventHandler(percentComplete);
bk.Devices.Add(bdi);
bk.Action = BackupActionType.Database;
bk.PercentCompleteNotification = 1;
bk.BackupSetDescription = dbName;
bk.BackupSetName = dbName;
bk.Database = dbName;
//bk.ExpirationDate = DateTime.Now.AddDays(30);
bk.LogTruncation = BackupTruncateLogType.Truncate;
bk.FormatMedia = false;
bk.Initialize = true;
bk.Checksum = true;
bk.ContinueAfterError = true;
bk.Incremental = false;
//运行备份
bk.SqlBackup(sv); //异常
}
}
但发生例外:
Microsoft.SqlServer.Management.Smo.FailedOperationException:服务器'\\.\pipe\3F103E6E-3FD4-47\tsql\query'
有关异常的其他信息:
{Microsoft.SqlServer .Management.Smo.FailedOperationException:服务器'\\.\pipe\3F103E6E-3FD4-47\tsql\query'的备份失败。 ---> System.IO.FileNotFoundException:无法加载文件或程序集Microsoft.SqlServer.BatchParser,Version = 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91或其依赖关系之一。该系统找不到指定的文件。
文件名:'Microsoft.SqlServer.BatchParser,Version = 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91'
在Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query,ExecutionTypes executionType ,Int32& StatementToReverse)
在Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand,ExecutionTypes executionType)
在Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands,ExecutionTypes executionType )
在Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
在Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries,ServerMessageEventHandler dbccMessageHandler,Boolean errorsAsMessages)
在Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(服务器服务器,StringCollection查询)
在Microsoft.SqlServer.Management.Smo.Backup.SqlBack up(Server srv)
===预绑定状态信息===
日志:用户= MDS-PC\MDS
日志:DisplayName = Microsoft.SqlServer。 BatchParser,Version = 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91
(完全指定)
日志:Appbase = file:/// D:/我的作品/ C#/ Win Form / Reza餐厅/ RezaRestaurant / bin / Release /
日志:初始PrivatePath = NULL
调用程序集:Microsoft.SqlServer.ConnectionInfo,版本= 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91。
===
日志:此绑定在默认加载上下文中启动。
日志:使用应用程序配置文件:D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\bin\Release\RezaRestaurant.vshost.exe.Config
日志:从C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config使用机器配置文件。
LOG:Post-policy reference:Microsoft.SqlServer.BatchParser,Version = 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91
日志:尝试下载新的URL文件:/// D:/ My Works / C#/ Win Form / Reza Restaurant / RezaRestaurant / bin / Release / Microsoft.SqlServer.BatchParser.DLL。
日志:尝试下载新的URL文件:/// D:/ My Works / C#/ Win Form / Reza Restaurant / RezaRestaurant / bin / Release / Microsoft.SqlServer.BatchParser / Microsoft.SqlServer.BatchParser.DLL。
日志:尝试下载新的URL文件:/// D:/ My Works / C#/ Win Form / Reza Restaurant / RezaRestaurant / bin / Release / Microsoft.SqlServer.BatchParser.EXE。
日志:尝试下载新的URL文件:/// D:/ My Works / C#/ Win Form / Reza Restaurant / RezaRestaurant / bin / Release / Microsoft.SqlServer.BatchParser / Microsoft.SqlServer.BatchParser.EXE。
---内部异常堆栈跟踪结束---
在Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(服务器srv)
在RezaRestaurant.Form_تنظیمات_نرم_افزار。BackupDatabase (String sConnect,String dbName,String backUpPath)在D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزارcs:line 260
在RezaRestaurant.Form_تنظیمات_نرم_افزار .button_تهیه_نسخه_پشتیبان_在D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزار中单击(Object sender,EventArgs e)cs:line 177}
你能引导我吗?
谢谢。解决方案错误信息是非常确定的:
SMO是否正确安装?
您是否在64位系统上运行?
您是否安装了2008版SMO组件?
您可以从这里下载64位版本的SMO:
I'm gonna get a backup with below method :
void BackupDatabase(string sConnect, string dbName, string backUpPath) { using (SqlConnection cnn = new SqlConnection(sConnect)) { cnn.Open(); dbName = cnn.Database.ToString(); ServerConnection sc = new ServerConnection(cnn); Server sv = new Server(sc); // Create backup device item for the backup BackupDeviceItem bdi = new BackupDeviceItem(backUpPath, DeviceType.File); // Create the backup informaton Microsoft.SqlServer.Management.Smo.Backup bk = new Backup(); bk.PercentComplete += new PercentCompleteEventHandler(percentComplete); bk.Devices.Add(bdi); bk.Action = BackupActionType.Database; bk.PercentCompleteNotification = 1; bk.BackupSetDescription = dbName; bk.BackupSetName = dbName; bk.Database = dbName; //bk.ExpirationDate = DateTime.Now.AddDays(30); bk.LogTruncation = BackupTruncateLogType.Truncate; bk.FormatMedia = false; bk.Initialize = true; bk.Checksum = true; bk.ContinueAfterError = true; bk.Incremental = false; // Run the backup bk.SqlBackup(sv);//Exception } }
But an exception has occurred :
Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server '\\.\pipe\3F103E6E-3FD4-47\tsql\query'
additional info about the Exception:
{Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server '\\.\pipe\3F103E6E-3FD4-47\tsql\query'. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' at Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries, ServerMessageEventHandler dbccMessageHandler, Boolean errorsAsMessages) at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries) at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv) === Pre-bind state information === LOG: User = MDS-PC\MDS LOG: DisplayName = Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 (Fully-specified) LOG: Appbase = file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.SqlServer.ConnectionInfo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\bin\Release\RezaRestaurant.vshost.exe.Config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. LOG: Post-policy reference: Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser.DLL. LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser/Microsoft.SqlServer.BatchParser.DLL. LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser.EXE. LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser/Microsoft.SqlServer.BatchParser.EXE. --- End of inner exception stack trace --- at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv) at RezaRestaurant.Form_تنظیمات_نرم_افزار.BackupDatabase(String sConnect, String dbName, String backUpPath) in D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزار.cs:line 260 at RezaRestaurant.Form_تنظیمات_نرم_افزار.button_تهیه_نسخه_پشتیبان_Click(Object sender, EventArgs e) in D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزار.cs:line 177}
Would you please guide me ?Thanks.
解决方案The error message is pretty much conclusive:
Is SMO installed correctly?
Are you running on a 64 bit system?
Have you installed the 2008 version of the SMO Components?
You can down the 64 bit version of SMO from here: Microsoft SQL Server 2008 Feature Pack, October 2008
这篇关于Microsoft.SqlServer.Management.Smo.FailedOperationException:服务器'\\.\pipe\3F103E6E-3FD4-47\tsql\query'的备份失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!