- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 SMO 从数据库中获取存储过程列表。我对存储过程进行了 foreach 循环,以对它们进行预期的操作。但是我只需要使用用户创建的存储过程。我使用存储过程的 IsSystemObject 属性。但是它太慢了:
大约 10 秒:
foreach (StoredProcedure mystr in mydb.StoredProcedures)
{
if (!mystr.IsSystemObject)
{
classGenerated += mystr.Name + Environment.NewLine;
}
}
不到 1 秒:
foreach (StoredProcedure mystr in mydb.StoredProcedures)
{
classGenerated += mystr.Name + Environment.NewLine;
}
这种差异对于一个 if 条件是否正常?如果不是,造成这种性能差异的原因是什么?如果有其他方法,我可以使用另一种方法来区分系统对象和非系统对象。
最佳答案
是的。这就是为什么。默认情况下,SMO 预取某些属性并及时保留其他属性。因此,您基本上会为每个过程调用一次,以确定它是否是系统过程。幸运的是,有一个修复。查看this BOL article
SMO optimization allows only the minimum properties to be loaded when an object is created. When uninitialized properties are accessed, SMO makes individual requests to load the information from the instance of SQL Server. You can use this method to adjust which properties are initialized for an object when it is first created to further optimize performance
关于c# - smo 的 IsSystemObject 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20740561/
我正在尝试使用 SMO 通过 Powershell 恢复数据库,但是当我尝试定义和使用服务器对象时,出现以下错误: Cannot convert argument "srv", with value:
我已经阅读了十几个不同的博客,并通读了 msdn 示例,但它们对我不起作用。 最终我想做的是自动将数据库从我们的生产实例移动到我们的开发实例,或其他方向。 我采取的方法是: 备份/恢复到临时数据库 分
我使用这个 SMO 来恢复备份: Server myServer = new Server(@"PC-1\Instance1"); Restore restoreDB
我已经编写了一个 C# 代码来使用 SMO 在两个远程服务器之间传输表,我想知道的是无论如何都可以检查目标服务器中是否已经存在具有确切模式、列名、数据类型的表,约束和一切。这样我就不必每次都删除现有表
我正在考虑使用 C# SMO 库以编程方式创建当前数据库结构(不含数据)的副本。我已经成功地移动了模式、表、存储过程和外部资源,但是我很难这样做。我正在考虑使用这样提供的表对象: TableColle
我在 C# 中使用 SMO 从数据库生成整个模式的脚本。 这是我使用的代码: // Instanciando Server srv = new Server(con); // Refere
我正在做一个使用 smo 对象(服务器、数据库)的 C# 项目。 我包括了 using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlS
我有一个集成测试,它创建了一个 Microsoft.SqlServer.Management.Smo.Database 类型的数据库: var defaultConnectionConnectionS
我使用 SQL Server SMO 将 .bak 恢复到新数据库,但没有成功。 sql server是2012,smo object版本来自最新的sdk version 11.0 文件 .bak 是
我正在向数据库中插入大量行并尝试在其上建立主键。如果我创建表并立即建立一个键,即使使用 SQLBulkCopy 命令,插入数据也需要 10 倍的时间。所以这不是一个可行的选择。我现在要做的是插入数据,
WEKA 的 SMO 与 LIBSVM 不同吗? 我问是因为它在 LIBSVM 的 site 上说那:it implements an SMO-type algorithm proposed in t
我使用 vb.net 备份 sql '05 - '08 数据库。它在较小的数据库上效果很好。但当涉及大型数据库时,它会在 30% 或 40% 时失败并出现错误:备份或恢复已中止。 Di
我在尝试恢复 SQL Server 2008 R2 数据库时遇到错误: Restore failed for Server 'KIMO-PC'. 使用的代码: Server myServer
我使用 SQL Server 已经有几年了。我听说过SMO,但我对此一无所知。使用它有什么好处?我应该在我的 SQL Server 项目(主要是数据仓库开发)中学习并开始使用 SMO 吗?为什么? 最
如何与 SMO 服务器连接共享交易?共享连接就这么简单 var connection = new SqlConnection(); var serverConnection = new ServerC
如何使用 SMO 重命名物理 .mdf .ndf .ldf 文件。 This这篇文章很有帮助,但我需要使用 C# SMO 对象。 使用 SMO 服务器对象,我可以检索数据库,然后获取对数据文件对象的访
我有一个系统可以在两个具有相同模式的数据库之间传输数据(用于开发目的)。 SMO dependency walker 除了触发器外工作得很好。如果我得到一个依赖项列表,我不关心触发器是否引入了对另一个
我能够使用 SMO 构建类似于 SSMS 中的“查找备份文件”对话框的 TreeView 。我可以列出服务器上的文件夹,如果有备份设备,它们也会被列出。我似乎无法复制的一件事是如何浏览备份文件以恢复最
我已将 Microsoft.SqlServer.Management.Smo.dll 引用添加到我的项目中,但它仍然给我以下错误。引用的dll在C:\Program Files\Microsoft S
我是 Weka 的新手。我想在 WEKA 中使用顺序最小优化。谁能告诉我如何继续?这是我的 Java 代码,但它不起作用: public class SVMTest { public void tes
我是一名优秀的程序员,十分优秀!