如何使sqlpackage排除索引?
我们正在使用SQLPackage通过脚本操作来生成脚本。有人知道一种使其排除索引的方法吗?似乎找不到方法。
给出了几个 /p:用于排除其他对象类型的属性,我们用来效果良好,而不是索引。索引似乎只能调整,而不是排除。我们正在使用SQL 2017,但是SQL 2019也是如此。
是否有人找到了一种完全排除脚本的索引的方法,因此它们只是在目标数据库上留下的,与所有脚本都一样其他类型的SQL对象?
/p:排除ObjectTypes =(string)在部署过程中应忽略的对象类型的半脱落的列表。
有效的对象类型名称是汇总,应用程序,汇编,非对象,BROKERPRIERITY,证书,columnConcryptionskeys,ColumnMasterKeys,合同,数据库,数据库,默认设备,默认值es,隔离功能,分区,权限,排队,远程服务,roulemership,规则,标量表,搜索范围,搜索范围,安全性,序列,序列,服务,签名,签名,存储,存储,储存量,对称性,对称性,同义词,桌面,桌面,用户,用户,用户,用户列表类型,用户,视图,XMLSchemacollections,审核, Credentials, CryptographicProviders, DatabaseAuditSpecifications, DatabaseScopedCredentials, Endpoints, ErrorMessages, EventNotifications, EventSessions, LinkedServerLogins, LinkedServers, Logins, Routes, ServerAuditSpecifications, ServerRoleMembership, ServerRoles, ServerTriggers.
请注意,我们知道/p:dropindexesnotinsource = true/false
and /p:imageReReIndexOptions = true/false
,但是这些不够。
We're using SqlPackage to generate scripts via the Script action. Does anyone know a way to get it to exclude indexes? Can't seem to find a way.
The SqlPackage reference gives several /p: properties to do with excluding a whole raft of other object types, which we are using to good effect, but not indexes. Indexes we can only tweak, not exclude, it seems. We're using SQL 2017 but the same goes for SQL 2019.
Has anyone found a way to completely exclude indexes from the script, so that they are just left as they are on the target db, the same as can be done for all the other types of SQL object?
/p: ExcludeObjectTypes=(STRING) A semicolon-delimited list of object types that should be ignored during deployment.
Valid object type names are Aggregates, ApplicationRoles, Assemblies, AsymmetricKeys, BrokerPriorities, Certificates, ColumnEncryptionKeys, ColumnMasterKeys, Contracts, DatabaseRoles, DatabaseTriggers, Defaults, ExtendedProperties, ExternalDataSources, ExternalFileFormats, ExternalTables, Filegroups, FileTables, FullTextCatalogs, FullTextStoplists, MessageTypes, PartitionFunctions, PartitionSchemes, Permissions, Queues, RemoteServiceBindings, RoleMembership, Rules, ScalarValuedFunctions, SearchPropertyLists, SecurityPolicies, Sequences, Services, Signatures, StoredProcedures, SymmetricKeys, Synonyms, Tables, TableValuedFunctions, UserDefinedDataTypes, UserDefinedTableTypes, ClrUserDefinedTypes, Users, Views, XmlSchemaCollections, Audits, Credentials, CryptographicProviders, DatabaseAuditSpecifications, DatabaseScopedCredentials, Endpoints, ErrorMessages, EventNotifications, EventSessions, LinkedServerLogins, LinkedServers, Logins, Routes, ServerAuditSpecifications, ServerRoleMembership, ServerRoles, ServerTriggers.
Please note, we know about /p: DropIndexesNotInSource=True/False
and /p: IgnoreIndexOptions=True/False
but these are not sufficient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您需要使用Publish.xml文件。请参阅此答案 大概的想法。它回答的问题具有示例文件。如果您设置为不通过GUI包含索引,则该文件应包含
< dubludeIndexes> true</dubludeIndexes>
之类的内容。I believe you need to use a publish.xml file. See this answer for the rough idea. The question it answers has a sample file. If you set up to not include indexes via the GUI then the file should contain something like
<ExcludeIndexes>True</ExcludeIndexes>
.