有没有快速删除大型工作流程历史堆栈的方法?

时间:2012-02-20 19:14:13

标签: tridion

是否有任何快速方法/技巧可以删除工作流程历史记录中的大约85K条目?从GUI尝试会产生存储问题,要解决此问题需要退回框。

经过很长一段时间后,PowerTool也会崩溃。想要问更广泛的社区。感谢你的想法。

由于 VIN

2 个答案:

答案 0 :(得分:4)

哪个版本的Tridion? 2011?

您可能会使用CoreService客户端应用程序来定期为您执行此操作。通过“PowerTool”我假设你的意思是清除工具?

此外 - 我可能会联系客户支持,了解您看到的错误,似乎不会使用GUI或清除工具失败。

如果您使用的是2011 SP1,则可以使用以下代码:

using System;
using System.ServiceModel;
using System.Xml;
using Tridion.ContentManager.CoreService.Client;

namespace DeleteWorkflowHistory
{
    class Program
    {
        private const string NetTcpEndpoint = 
            "net.tcp://localhost:2660/CoreService/2011/netTcp";
        private static readonly EndpointAddress EndpointAddress =
            new EndpointAddress(NetTcpEndpoint);

        static void Main(string[] args)
        {
            var binding = new NetTcpBinding 
            { 
                MaxReceivedMessageSize = 2147483647 
            };

            var quota = new XmlDictionaryReaderQuotas
            {
                MaxStringContentLength = 2147483647,
                MaxArrayLength = 2147483647
            };
            binding.ReaderQuotas = quota;
            var client = new SessionAwareCoreServiceClient(binding, EndpointAddress);
            Log("Connected to Tridion Content Manager version: " + client.GetApiVersion());
            ProcessesFilterData filter = new ProcessesFilterData
            {
                BaseColumns = ListBaseColumns.IdAndTitle,
                ProcessType = ProcessType.Historical
            };
            foreach (IdentifiableObjectData data in client.GetSystemWideList(filter))
            {
                var processHistory = data as ProcessHistoryData;
                if (processHistory != null)
                {
                    Log("Deleting history: " + processHistory.Id + " / " + processHistory.Title);
                    client.Delete(processHistory.Id);
                }
            }
            client.Close();
        }

        private static void Log(string message)
        {
            Console.WriteLine(string.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss.fff"), message));
        }
    }
}
<磷>氮

答案 1 :(得分:1)

如果您无法使用核心服务,请查看this blog entry,其中介绍了如何使用Powershell强制完成工作流程。通过一些非常小的修改,相同的技术可用于删除工作流程。