尝试PerformPostRestoreFixup,但似乎运行无限循环。 [英] Trying PerformPostRestoreFixup but seems like running endless loop.

查看:112
本文介绍了尝试PerformPostRestoreFixup,但似乎运行无限循环。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

            // Call the API to update synchronization metadata to reflect that the database was
// just restored.
try
{
SqlConnection serverConn = new SqlConnection(connectionString);

SqlSyncStoreRestore databaseRestore = new SqlSyncStoreRestore(serverConn);
databaseRestore.PerformPostRestoreFixup();
serverConn.Close();
serverConn.Dispose();

}
catch (Exception e)
{
Console.WriteLine("Error encouter when trying to perform post restore fixup");
Console.WriteLine("Exception --> {0}" , e.Message);

int exitCode = -1;
Console.WriteLine("it exits with code: 0x{0:X8}.", exitCode);
Environment.Exit(exitCode);


}


我在控制台程序中尝试使用PerformPostRestoreFixup命令。
我所做的步骤是1.将数据库bak文件恢复到SQL 2005服务器。 (不是SQL Server express)
2.运行一个单独的小型控制台程序,最终调用上面的代码。

但是,在我运行控制台程序后,似乎会消耗大量的CPU,这看起来像是在无限循环中运行。

我需要采取哪些特殊措施?

我的数据库大小小于2 MB和我可以在N层或2层环境中同步我的远程和本地计算机。我正在运行SQL Server 2005和SQL Server 2005 express。除了在SqlSyncStoreRestore中提到的PerformPostRestoreFixup命令之外,还有其他任何修复已恢复数据库的方法吗?
例如,通过SQL命令?

PerformPostRestoreFixup是否能够修复恢复的DB时间戳问题? (在此URL中提到 - http://msdn.microsoft.com/en-us/library/bb726016.aspx)
这在同步框架2.0中仍然存在问题吗?因为上面提到的URL中的内容对我来说就像是来自同步框架1.0的结转。 PerformPostRestoreFixup可以解决这个问题吗?

感谢。

I was trying the PerformPostRestoreFixup command in my console program.
The steps I did are
1. Restore the database bak file to SQL 2005 server. (not SQL server express)
2. Run a separate small console program which eventually call the codes above.


However, after I ran the console program, it seems like would consume a lot CPU and this looks to me like it is running in a endless loop.

Any particular steps i need to be precautions?

My database size is less than 2 MB and I can synchronize my remote and local machine in N-Tier or 2 tier environment.  I am running SQL server 2005 and SQL server 2005 express.

Beside the mentioned PerformPostRestoreFixup command in SqlSyncStoreRestore, any other alternative to fix the restored database?
For example, through SQL commands?

Does the PerformPostRestoreFixup be able to fix restored DB timestamp issue? (mentioned in this URL - http://msdn.microsoft.com/en-us/library/bb726016.aspx)
Is this still a problem in sync framework 2.0? Because the content in the mentioned URL looks to me like the carry over from sync framework 1.0.  Can the PerformPostRestoreFixup  fix this problem?


thanks.

推荐答案

其他发现
- ------------

我启动SQL分析器来检查控制台程序调用的T-SQL语句。我发现PerformPostRestoreFixup函数无休止地调用这两个T-SQL语句。


执行sp_executesql N'SELECT [scope_id],[scope_local_id],[scope_sync_knowledge],[scope_tombstone_cleanup_knowledge],[ scope_timestamp],[scope_config_id],[scope_restore_count] FROM [scope_info] WHERE [scope_name] = @ sync_scope_name',N'@ sync_scope_name nvarchar(100)',@ sync_scope_name = N'DependendantRecords'




声明@p9 int
set @ p9 = 0
执行sp_executesql N'UPDATE [scope_info] SET [scope_id] = @sync_scope_id,[scope_sync_knowledge] = @sync_scope_knowledge, [scope_tombstone_cleanup_knowledge] = @sync_scope_cleanup_knowledge,[scope_restore_count] = [scope_restore_count] + 1 WHERE [scope_name] = @sync_scope_name AND(@sync_check_concurrency = 0 OR [scope_timestamp] = @sync_scope_timestamp); SET @sync_row_count = @@ ROWCOUNT',N'@ sync_scope_name nvarchar(100),@ sync_scope_id uniqueidentifier,@ sync_scope_knowledge varbinary(188) ,@ sync_scope_cleanup_knowledge VARBINARY(156),@ sync_check_concurrency INT,@ sync_scope_timestamp BIGINT,@ sync_row_count INT输出",@ sync_scope_name = N'DependendantRecords',@ sync_scope_id = '0348827F-46FD-47BE-8163-7B5956CEE738',@ sync_scope_knowledge = 0x0000000500000000000000040000000000000005000010000000040348827F46FD47BE81637B5956CEE738478BCC932F8F4C97A619E0867E7F462012D57140249C488A9A1C35538​​569A4B374F9020A8C3F423F9D5A5E01A79BEC5A000000180000100128020000010000001500000002000000010000000000000001000000020000000200000000000007D30000000300000000000007D4000000170000000100000016000000010003000000000100000000000000190100000000, @ sync_scope_cleanup_knowledge = 0x0000000500000000000000040000000000000005000010000000040348827F46FD47BE81637B5956CEE738478BCC932F8F4C97A619E0867E7F462012D57140249C488A9A1C35538​​569A4B374F9020A8C3F423F9D5A5E01A79BEC5A0000001800001001280200000100000015000000010000000100000000000000170000000100000016000000010003000000000000000000000000190100000000,@ sync_check_concurr ency = 1,@ sync_scope_timestamp = 2004,@ sync_row_count = @ p9输出
选择@ p9

任何线索有什么问题?




Additional finding
--------------

I fire up the SQL profiler to inspect the T-SQL statement called by the console program. And I found the PerformPostRestoreFixup function is endlessly calling these two T-SQL statement.


exec sp_executesql N'SELECT [scope_id], [scope_local_id], [scope_sync_knowledge], [scope_tombstone_cleanup_knowledge], [scope_timestamp], [scope_config_id], [scope_restore_count] FROM [scope_info] WHERE [scope_name] = @sync_scope_name',N'@sync_scope_name nvarchar(100)',@sync_scope_name=N'DependendantRecords'




declare @p9 int
set @p9=0
exec sp_executesql N'UPDATE [scope_info] SET [scope_id] = @sync_scope_id, [scope_sync_knowledge] = @sync_scope_knowledge, [scope_tombstone_cleanup_knowledge] = @sync_scope_cleanup_knowledge, [scope_restore_count] = [scope_restore_count] + 1 WHERE [scope_name] = @sync_scope_name AND (@sync_check_concurrency = 0 OR [scope_timestamp] = @sync_scope_timestamp);SET @sync_row_count = @@ROWCOUNT',N'@sync_scope_name nvarchar(100),@sync_scope_id uniqueidentifier,@sync_scope_knowledge varbinary(188),@sync_scope_cleanup_knowledge varbinary(156),@sync_check_concurrency int,@sync_scope_timestamp bigint,@sync_row_count int output',@sync_scope_name=N'DependendantRecords',@sync_scope_id='0348827F-46FD-47BE-8163-7B5956CEE738',@sync_scope_knowledge=0x0000000500000000000000040000000000000005000010000000040348827F46FD47BE81637B5956CEE738478BCC932F8F4C97A619E0867E7F462012D57140249C488A9A1C35538569A4B374F9020A8C3F423F9D5A5E01A79BEC5A000000180000100128020000010000001500000002000000010000000000000001000000020000000200000000000007D30000000300000000000007D4000000170000000100000016000000010003000000000100000000000000190100000000,@sync_scope_cleanup_knowledge=0x0000000500000000000000040000000000000005000010000000040348827F46FD47BE81637B5956CEE738478BCC932F8F4C97A619E0867E7F462012D57140249C488A9A1C35538569A4B374F9020A8C3F423F9D5A5E01A79BEC5A0000001800001001280200000100000015000000010000000100000000000000170000000100000016000000010003000000000000000000000000190100000000,@sync_check_concurrency=1,@sync_scope_timestamp=2004,@sync_row_count=@p9 output
select @p9

any clue what is the problem?






这篇关于尝试PerformPostRestoreFixup,但似乎运行无限循环。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆