Mik*_*Mik 4 sql-server powershell sqlps
由于错误,我无法运行 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
Run Code Online (Sandbox Code Playgroud)
我按照建议运行 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
Run Code Online (Sandbox Code Playgroud)
我最近安装了 SQL Server 2016 和 2012,我不确定这是否导致了这个问题,因为我之前没有使用过任何这些 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/找到一个很好的解释
| 归档时间: |
|
| 查看次数: |
6679 次 |
| 最近记录: |