我正在尝试生成数据库中所有数据的脚本,这样我就可以将数据移动到另一台服务器上的相同数据库中。在 SQL Server 2012 中,我右键单击源数据库
任务 > 生成脚本 > 编写整个数据库和所有数据库对象的脚本 > 高级 > 要编写脚本的数据类型:仅数据
这给了我一个关于循环依赖的错误。如果我将数据类型更改为脚本到模式和数据,它会生成很好。如何解决此问题以仅处理数据?
操作结果从 MyDatabase 获取对象列表失败
详细报告:
Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptPublishException:编写对象脚本时出错。---> Microsoft.SqlServer.Management.Smo.SmoException:找到循环依赖项。在 Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.DependencyGraphTraversal(Int32 num, Dictionary
2 dictionary, List
1 sortedList, HashSet1 visited, HashSet
1 current) 在 Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.DependencyGraphTraversal(Int32 num, Dictionary2 dictionary, List
1 sortedList, HashSet1 visited, HashSet
1 current) .SqlServer.Management.Smo.SmoDependencyOrderer.DependencyGraphTraversal(Int32 num,Dictionary2 dictionary, List
1 sortedList,HashSet1 visited, HashSet
1 current)在 Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.DependencyGraphTraversal(Int32 num,Dictionary2 dictionary, List
1 sortedList, HashSet1 visited, HashSet
1 current) 在 Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.SortDictionary(Dictionary2 dictionary) at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.SortDataSet(DataSet ds) at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.SortDataSet(List
1 objectList, Dictionary2 idDictionary, DataSet ds) at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.ExecuteQueryUsingTempTable(List
1 objectList, List1 list, String query) at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.ResolveTableOnlyDependencies() at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.ResolveDependencies() at Microsoft.SqlServer.Management.Smo.SmoDependencyOrderer.Order(IEnumerable
1 urns) 在 Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable1 urns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker(List
1 urns, ISmoScriptWriter writer) at Microsoft.SqlServer.Management.Smo.ScriptMaker.Script(Urn[] urns, ISmoScriptWriter writer) at Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.DoScript(ScriptOutputOptions outputOptions) --- 内部异常结束堆栈跟踪 --- 在 Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) 在 System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) 在 System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)