事务 (Master Data Services)Transactions (Master Data Services)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - 仅限 Windows 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - Windows only 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance


Master Data ServicesMaster Data Services中,每次对成员执行操作时,都记录一个事务。In Master Data ServicesMaster Data Services, a transaction is recorded each time action is taken on a member. 事务可供所有用户查看并由管理员撤销。Transactions can be viewed by all users and reversed by administrators. 事务显示执行操作的日期、时间和用户以及其他详细信息。Transactions show the date, time, and user who took the action, along with other details. 用户可以为事务添加批注,以指示事务发生的时间。Users can add an annotation to a transaction, to indicate why a transaction took place.

何时记录事务When Transaction Are Recorded

当成员处于以下状态时将对事务进行记录:Transactions are recorded when members:

  • 已创建、已删除或重新激活。Are created, deleted, or reactivated.

  • 已更改属性值。Have attribute values changed.

  • 在层次结构中移动了位置。Are moved in a hierarchy.

当业务规则更改属性值时,不记录事务。Transactions are not recorded when business rules change attribute values.

查看和管理事务View and Manage Transactions

在“资源管理器”**** 功能区域中,可以查看自行创建的事务并为其添加批注(注释)。In the Explorer functional area, you can view and annotate (add comments to) the transactions that you made yourself.

“版本管理” 功能区域中,管理员可以查看其有权访问的模型的所有用户的所有事务,并撤消这些事务中的任意事务。In the Version Management functional area, administrators can view all transactions for all users for the models they have access to, and reverse any of these transactions.

备注

管理员可以查看所有用户的所有事务,除非他们在“版本权限”**** 功能区域应用了只读权限级别。Administrators can view all transactions for all users as long as they don't have the read-only permission level applied in the Version Management functional area . 例如,如果为管理员设置了只读权限和更新权限级别,管理员将无法查看其他用户事务,因为只读权限将优先于更新权限。For example, if the read-only permission and update permission level is set for the administrator, the administrator will not be able to see other user transactions because the read-only permission will take precedence over the update permission.

可以通过在 数据库的系统设置中设置“日志保留期(以天为单位)”Master Data ServicesMaster Data Services 属性,也可以通过在创建或编辑模型时设置“日志保留期(以天为单位)” **** 来配置事务日志数据的保留期。You can configure how long transaction log data is retained by setting the Log retention in Days property in system settings for the Master Data ServicesMaster Data Services database, and by setting Log Retention Days when you create or edit a model. 有关详细信息,请参阅系统设置 (Master Data Services)创建模型 (Master Data Services)For more information, see System Settings (Master Data Services) and Create a Model (Master Data Services).

SQL Server 代理作业 (MDS_MDM_Sample_Log_Maintenace) 每晚运行,可触发清除事务日志。The SQL Server Agent job, MDS_MDM_Sample_Log_Maintenace, triggers cleanup of the transaction logs and runs every night. 你可以使用 SQL Server 代理修改此作业的时间表。You can use SQL Server Agent to modify the schedule for this job.

你也可以调用以下存储过程来清除事务日志。You can also call the following stored procedures to clean the transaction logs.

存储过程Stored Procedure 说明Description
mdm.udpTransactionsCleanupmdm.udpTransactionsCleanup 清除事务历史记录Cleans transaction history
mdm.udpValidationsCleanupmdm.udpValidationsCleanup 清除验证历史记录Cleans validation History
mdm.udpEntityStagingBatchTableCleanupmdm.udpEntityStagingBatchTableCleanup 清除临时表Cleans staging table

示例Sample

DECLARE @CleanupOlderThanDate date = '2014-11-11',  
@ModelID INT = 7  
--Clean up Transaction Logs  
EXEC mdm.udpTransactionsCleanup @ModelID, @CleanupOlderThanDate;  
  
--Clean up Validation History  
EXEC mdm.udpValidationsCleanup @ModelID, @CleanupOlderThanDate;  
  
--Clean up EBS tables  
EXEC mdm.udpEntityStagingBatchTableCleanup @ModelID, @CleanupOlderThanDate;  
  

系统设置System Settings

Master Data Services 配置管理器Master Data Services Configuration Manager 中有一个设置影响在暂存记录时是否记录事务。There is a setting in Master Data Services 配置管理器Master Data Services Configuration Manager that affects whether or not transactions are recorded when records are staged. 可以在 Master Data Services 配置管理器Master Data Services Configuration Manager 中或直接在 Master Data ServicesMaster Data Services 数据库的“系统设置”表中调整此设置。You can adjust this setting in Master Data Services 配置管理器Master Data Services Configuration Manager or directly in the System Settings table in the Master Data ServicesMaster Data Services database. 有关详细信息,请参阅系统设置 (Master Data Services)For more information, see System Settings (Master Data Services).

在将数据导入此版本的 SQL ServerSQL Server中时,您可以指定是否在启动存储过程时记录事务。When importing data in this version of SQL ServerSQL Server, you can specify whether or not to log transactions when initiating the stored procedure. 有关详细信息,请参阅临时存储过程 (Master Data Services)For more information, see Staging Stored Procedure (Master Data Services).

并发Concurrency

如果某个实体值在多个资源管理器会话中同时显示,则可能对同一个值进行并发编辑。If a particular entity value is shown simultaneously in more than one Explorer session, concurrent edits to the same value are possible. MDS 不会自动检测并发编辑。Concurrent edits will not be detected automatically by MDS. 当多个用户从多个会话(例如从多个计算机、多个浏览器选项卡或窗口,或多个用户帐户)使用 Web 浏览器中的 MDS 资源管理器时,就会出现这种情况。This can occur when multiple users use the MDS Explorer in the Web browser from multiple sessions, for example from multiple computers, multiple browser tabs or windows, or multiple user accounts.

多个用户可以更新相同的实体值而不会出错(即便启用了事务记录也不影响)。More than one user can update the same entity values without error despite transactions being enabled. 一段时间内针对该值的最后一次编辑通常优先级最高。Typically the last edit to the value in a sequence of time will take precedence. 可以在事务历史记录中手工检测到重复编辑冲突,并可由管理员手动解决。The duplicate edit conflict can be manually observed in the transaction history and can be reversed manually by the administrator. 事务历史记录将为每个会话的相关属性的 “旧值”“新值” 显示各个事务,但不会在同一个旧值存在多个 “新值” 时自动解决冲突。The transaction history will show the individual transactions for the Prior value and New value for the attribute in question from each session, but will not automatically resolve the conflict when multiple New Values exist for the same old value.

任务说明Task Description 主题Topic
通过撤消事务来撤消操作(仅限管理员)。Undo an action by reversing a transaction (administrators only). 撤消事务 (Master Data Services)Reverse a Transaction (Master Data Services)

外部资源External Resources

msdn.com 上的博文 Transactions, Validation Issue and Staging table cleanup(事务、验证问题和临时表清除)Blog post, Transactions, Validation Issue and Staging table cleanup, on msdn.com.