重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 818|回复: 0
打印 上一主题 下一主题

SQL2008 发布订阅生成快照时报错:Script failed for Table

[复制链接]
跳转到指定楼层
楼主
发表于 2023-3-15 22:20:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
今天创建SQL2008快照时,快照代理报错:
错误消息:Source: Microsoft.SqlServer.SmoTarget Site: System.Collections.Generic.IEnumerable`1[System.String] ScriptWithList(Microsoft.SqlServer.Management.Smo.DependencyCollection, Microsoft.SqlServer.Management.Smo.SqlSmoObject[])Message: 脚本 对于 表“dbo.patientExemItem_map_his=”失败。 Stack:    在 Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)   在 Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(SqlSmoObject[] objects)   在 Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateLogBasedArticleSchScript(Scripter scripter, BaseArticleWrapper articleWrapper, Table smoTable)   在 Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateLogBasedArticleScripts(ArticleScriptingBundle articleScriptingBundle)   在 Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateArticleScripts(ArticleScriptingBundle articleScriptingBundle)   在 Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateObjectScripts(ArticleScriptingBundle articleScriptingBundle)   在 Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()   在 Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()   在 Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()   在 Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()   在 Microsoft.SqlServer.Replication.AgentCore.Run() (源: Microsoft.SqlServer.Smo,错误号: 0)获取帮助: http://help/0Source: Microsoft.SqlServer.SmoTarget Site: Void CheckSupportedType(Microsoft.SqlServer.Management.Smo.ScriptingOptions)Message: 对象  patientExemItem_map_his 中的列 createdate 包含类型 Date,此类型不受目标服务器版本 SQL Server 2000 支持。Stack:    在 Microsoft.SqlServer.Management.Smo.Column.CheckSupportedType(ScriptingOptions options)   在 Microsoft.SqlServer.Management.Smo.Column.VersionValidate(ScriptingOptions so)   在 Microsoft.SqlServer.Management.Smo.Column.ScriptDdlCreateImpl(StringBuilder sb, ScriptingOptions so)   在 Microsoft.SqlServer.Management.Smo.Column.ScriptDdl(StringCollection queries, ScriptingOptions so)   在 Microsoft.SqlServer.Management.Smo.Table.ScriptTableInternal(ScriptingOptions so, StringBuilder sb, ColumnCollection columns, IndexCollection indexes)   在 Microsoft.SqlServer.Management.Smo.Table.GetTableCreationScript(ScriptingOptions so, StringBuilder sb)   在 Microsoft.SqlServer.Management.Smo.Table.ScriptCreate(StringCollection queries, ScriptingOptions so)   在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(StringCollection query, ScriptingOptions so)   在 Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(DependencyCollection depList, SqlSmoObject[] objects)   在 Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects) (源: Microsoft.SqlServer.Smo,错误号: 0)获取帮助: http://help/0
英文版本的类似报错:
Message: Script failed for Table 'dbo.patientExemItem_map_his'. Source: Microsoft.SqlServer.SmoTarget Site: System.Collections.Generic.IEnumerable`1[System.String] ScriptWithList(Microsoft.SqlServer.Management.Smo.DependencyCollection, Microsoft.SqlServer.Management.Smo.SqlSmoObject[])Message: Script failed for Table 'dbo.patientExemItem_map_his'. Stack: at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects)at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(SqlSmoObject[] objects)at Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateLogBasedArticleSchScript(Scripter scripter, BaseArticleWrapper articleWrapper, Table smoTable)at Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateLogBasedArticleScripts(ArticleScriptingBundle articleScriptingBundle)at Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateArticleScripts(ArticleScriptingBundle articleScriptingBundle)at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateObjectScripts(ArticleScriptingBundle articleScriptingBundle)at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: Microsoft.SqlServer.Smo, Error number: 0)Get help: http://help/0Source: Microsoft.SqlServer.SmoTarget Site: Void CheckSupportedType(Microsoft.SqlServer.Management.Smo.ScriptingOptions)Message: Column definition in object patientExemItem_map_his contains type date, which is not supported in the target server version, SQL Server 2000.Stack: at Microsoft.SqlServer.Management.Smo.Column.CheckSupportedType(ScriptingOptions options)at Microsoft.SqlServer.Management.Smo.Column.VersionValidate(ScriptingOptions so)at Microsoft.SqlServer.Management.Smo.Column.ScriptDdlCreateImpl(StringBuilder sb, ScriptingOptions so)at Microsoft.SqlServer.Management.Smo.Column.ScriptDdl(StringCollection queries, ScriptingOptions so)at Microsoft.SqlServer.Management.Smo.Table.ScriptTableInternal(ScriptingOptions so, StringBuilder sb, ColumnCollection columns, IndexCollection indexes)at Microsoft.SqlServer.Management.Smo.Table.GetTableCreationScript(ScriptingOptions so, StringBuilder sb)at Microsoft.SqlServer.Management.Smo.Table.ScriptCreate(StringCollection queries, ScriptingOptions so)at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(StringCollection query, ScriptingOptions so)at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(DependencyCollection depList, SqlSmoObject[] objects)at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects) (Source: Microsoft.SqlServer.Smo, Error number: 0)Get help: http://help/0
原因是此前数据库的版本是SQL2000,迁移到2008上后没有修改数据库的兼容级别到100。
在发布数据库上执行如下代码,修改数据库的兼容级别到100,修改后问题解决:
ALTER DATABASE [DataBase SET COMPATIBILITY_LEVEL = 100

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-28 16:38 , Processed in 0.088538 second(s), 19 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表