2017-03-13 152 views
1

由於錯誤,我無法運行Backup-SqlDatabase。我得到如下:在Powershell中使用Backup-SqlDatabase時出現「TypeData錯誤」錯誤

PS C:\Users\Mik> Backup-SqlDatabase 
Backup-SqlDatabase : The 'Backup-SqlDatabase' command was found in the module 'SqlServer', but the module could not be 
loaded. For more information, run 'Import-Module SqlServer'. 
At line:1 char:1 
+ Backup-SqlDatabase 
+ ~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : ObjectNotFound: (Backup-SqlDatabase:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule 

我運行導入模塊的建議,並得到這個:

PS C:\Users\Mik> Import-Module SqlServer 
Import-Module : The following error occurred while loading the extended type data file: Error in TypeData 
"Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultKeyPropertySet is already present. 
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayPropertySet is already 
present. 
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayProperty is already 
present. 
At line:1 char:1 
+ Import-Module SqlServer 
+ ~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidOperation: (:) [Import-Module], RuntimeException 
    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand 

我最近安裝了SQL Server 2016一起2012,我不知道這是否已經到了問題的貢獻我之前沒有使用任何Powershell命令。

+0

找到一個很好的解釋你有沒有嘗試在一個新鮮的PoSH會話(即沒有其他模塊加載是否直接或一些配置文件)?您正在加載哪個版本的SqlServer模塊(檢查多個並行模塊版本,並嘗試通過顯式加載預期版本來導入模塊)?那麼錯誤仍然會發生? –

回答

相關問題