SQL Server 中的syncobj是什么

发布于 2024-09-03 03:52:39 字数 408 浏览 4 评论 0原文

当我运行此脚本来搜索 sys.columns 中的特定文本时,我得到很多类似行的“dbo.syncobj_0x3934443438443332”。

SELECT c.name, s.name + '.' + o.name
FROM sys.columns c
INNER JOIN sys.objects  o ON c.object_id=o.object_id
INNER JOIN sys.schemas  s ON o.schema_id=s.schema_id
WHERE c.name LIKE '%text%'

如果我没猜错的话,它们就是复制对象。是这样吗?我可以像 o.name NOT LIKE '%syncobj%' 一样将它们从查询中丢弃吗?或者还有其他方法吗?

谢谢。

When I run this script to search particular text in sys.columns and I get a lot of "dbo.syncobj_0x3934443438443332" like rows.

SELECT c.name, s.name + '.' + o.name
FROM sys.columns c
INNER JOIN sys.objects  o ON c.object_id=o.object_id
INNER JOIN sys.schemas  s ON o.schema_id=s.schema_id
WHERE c.name LIKE '%text%'

If I get it right, they are replication objects. Is it so? Can i just throw them away from my query just like o.name NOT LIKE '%syncobj%' or there's another way?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的黑色迷你裙 2024-09-10 03:52:39

我找到了解决方案。不知道是不是最好的。

SELECT c.name, s.name + '.' + o.name
FROM sys.columns c
   INNER JOIN sys.objects  o ON c.object_id=o.object_id
   INNER JOIN sys.schemas  s ON o.schema_id=s.schema_id
WHERE c.name LIKE '%text%' AND o.type = 'U'

现在的结果已经很好了。正如我所说,syncobj 是复制对象,它们对我们来说没有任何意义。它们仅用于复制目的。

http://www.developmentnow.com/g/114_2007_12_0_0_443938/syncobj-views。 htm

编辑:

忘记添加,syncobj 作为视图存储在数据库中,因此如果您需要视图列表,您可能需要像我在问题中那样忽略它们。

在检查syncobj和我的视图之间的差异时,唯一的区别是is_ms_shipped列。对于syncobj,它是1,对于其他的,它是0。这意味着syncobj视图是由系统创建的。

PS我会等待一段时间,如果没有人给出另一个答案,我会接受我的。

I've found a solution. Doesn't know, if it's the best one or not.

SELECT c.name, s.name + '.' + o.name
FROM sys.columns c
   INNER JOIN sys.objects  o ON c.object_id=o.object_id
   INNER JOIN sys.schemas  s ON o.schema_id=s.schema_id
WHERE c.name LIKE '%text%' AND o.type = 'U'

The result is fine now. As I said syncobj's are replication objects and they don't have a meaning for us. They're used for replication purposes only.

http://www.developmentnow.com/g/114_2007_12_0_0_443938/syncobj-views.htm

EDIT:

Forgot to add, syncobj's are stored in DB as Views, so if you need list of views, you'll probably need to ignore them as I did in my question.

While checking difference between syncobj's and my views, the only difference is is_ms_shipped column. For syncobj it's 1, for others 0. It means that syncobj views are created by system.

P.S. I'll wait for some time and if nobody gives another answer, I'll accept mine.

攀登最高峰 2024-09-10 03:52:39

当您创建不包含原始表中的所有字段或其他元数据更改的复制时。如果您从出版物生成脚本,它将向您显示它是如何创建的(见下文)。该视图提供一个对象来在初始快照期间生成 bcp 提取。

这是一个例子

-- 添加文章同步对象 exec sp_articleview @publication = N'publication_data', @article = N'tablename',
@view_name = N'syncobj_0x4239373642443436',@filter_clause = N'',
@force_invalidate_snapshot = 1,@force_reinit_subscription = 1 GO

@force_invalidate_snapshot = 1,@ force_reinit_subscription 最近,当我删除复制时,我遇到了一个问题,它无法删除这些复制,然后您必须手动删除系统视图才能重用复制脚本。给出错误信息

消息 2714,级别 16,状态 3:已经存在一个名为
数据库中的“syncobj_0x3437324238353830”。

这导致 bcp 在快照期间失败。

When you create a replication that does not include all the fields or other meta data changes from the original table. If you do a generate script from a publication it will show you how it is created (see below). The view provide a object to generate the bcp extracts during the initial snapshots.

Here is an example

-- Adding the article synchronization object exec sp_articleview @publication = N'publication_data', @article = N'tablename',
@view_name = N'syncobj_0x4239373642443436', @filter_clause = N'',
@force_invalidate_snapshot = 1, @force_reinit_subscription = 1 GO

P.S. I recently had a problem when the I dropped replication, it failed to drop these and then you have to manually drop the system views to reuse a replication script. Giving a error message

Msg 2714, Level 16, State 3: There is already an object named
'syncobj_0x3437324238353830' in the database.

Which caused the bcp to fail during the snapshot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文