[英]“Error in TypeData” errors when using Backup-SqlDatabase in Powershell
由於錯誤,我無法運行Backup-SqlDatabase。 我得到以下內容:
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
我按照建議運行Import-Module並得到:
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
我最近在2012年安裝了SQL Server 2016,我不確定這是否導致了這個問題,因為我以前沒有使用過任何這些Powershell命令。
確保您沒有導入SQLPS ,它是2016年之前安裝SQL Server的模塊.SqlServer是與SQL Server 2016關聯的模塊,可用於以前的SQL版本。 您可以在http://www.mikefal.net/2016/07/12/out-with-the-sqlps-in-with-the-sqlserver/找到一個很好的解釋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.