Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Replicated Table - has_replication_filter bit does not reset

$
0
0

Running SQL Server 2005 SP2. Transactional replication with no updating subscriber.  Push to subscriber.

What I am trying to do is implement partition switching on a replicated table.  My process looks like:


BEGINTRAN

 

EXECsp_dropsubscription@publication ='PUBLICATION_LogTest',

    @article ='testlog', @subscriber =N'all', @destination_db =N'all'

EXECsp_droparticle@publication ='PUBLICATION_LogTest',

    @article ='testlog', @force_invalidate_snapshot = 1

 

 

ALTERTABLE testlog switch PARTITION 2 TO Testlog_delete PARTITION 2

 

 

EXECsp_addarticle@publication ='PUBLICATION_LogTest',

    @article =  'testlog', @source_owner =N'dbo', @source_object =  'testlog',

    @type =N'logbased', @pre_creation_cmd =N'none', @schema_option = 0,

    @destination_table =  'testlog', @destination_owner =N'dbo'

    @force_invalidate_snapshot = 1

 

   

COMMIT

 

EXECsp_startpublication_snapshot@publication ='PUBLICATION_LogTest'

 

 

(testlog_delete is not replicated)

 

When I try to alter the table, I get an error message:
ALTER TABLE SWITCH statement failed because the table 'sand.dbo.testlog' is marked for replication.

If I look in sys.tables after the DROP subscription/article, I see the the has_replication_filter bit = 1 (the is_published = 0, and is_replicated = 0).

Note that none of the tables are filtered vertically or horizontally.

If I start SQL Server in single user mode and use DAC, I can reset the has_replication_filtered bit = (0) with:
EXEC sp_MSsetfilteredstatus <ObjectId>
Then I can do the partition switch.

 


...but this stored proc is unavailable outside of DAC.

 

So three questions:
(1) Why causes the has_replication_filter bit to get set to 1 (it is happening on some of my tables, but not all of them)
(2) How can reset this bit outside of DAC
(3) Is there a better way (outside of upgrading to SQL Server 2008) to manage partition switching on a replicated table?

 




Viewing all articles
Browse latest Browse all 4054

Trending Articles