re-enabling/resetting Change Tracking

Hi all

I have a problem with Change Tracking in SQL Srver 2008.

One of my databases had change tracking enabled and ws also configured for DB mirroring. After a service restart the DB failed over to the mirror and when the service was up again i failed it back - all this worked ok.

Now, after that incident the change tracking was messed up.
CHANGE_TRACKING_CURRENT_VERSION() retuens a lower value than CHANGE_TRACKING_MIN_VALID_VERSION which is of course wrong.... but the current version grows so change tracking should be enabled.

When i look at the properties for the database however, the change tracking seems to be disabled and if I try to re-enable it i get this error message: "Change tracking is already enabled for database".

The problem with current beeing reset after a failover is a known issue so that is explainable..... but the problem now is how i reset the whole thing.... Any suggestions?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DBAduck - Ben MillerPrincipal ConsultantCommented:
So what do you get when you do:

select * from sys.change_tracking_databases
select * from sys.change_tracking_tables

Daniel_PLDB Expert/ArchitectCommented:
Please consider disabling and re-enabling CDC, to perform use sys.sp_cdc_disable_db and then sys.sp_cdc_enable_db system stored procedures:

If there are many capture instances defined for the database at the time change data capture is disabled, a long running transaction can cause the execution of sys.sp_cdc_disable_db to fail. This problem can be avoided by disabling the individual capture instances by using sys.sp_cdc_disable_table before running sys.sp_cdc_disable_db.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.