Question

I want to store "change data capture" history rows in another database/table.
How can I implement this?
Should I use own service, which looking for cdc tables and copy rows?
Can I use SSIS cdc package for this? (I never work with SSIS, and after reading this article, i am confused)

Was it helpful?

Solution

I really don't think this is possible out of the box. The best you can do is store the CDC data in a separate filegroup. This is done using the @filegroup_name parameter of sys.sp_cdc_enable_table.

If you are set on doing this, and you wish to keep all the CDC builtin stuff, like the helper view/function generation and change querying system functions, you would need to:

(1) Create an empty database with the same structure as your main database

(2) Configure CDC in the new database like it is in the original one

(3) Put in place some kind of job to copy data (you could use SSIS if the databases are to be on separate servers, or you could use stored procedures if on the same server. SPs could also be used for separate servers if you want to use linked servers) from the CDC tables in the original database, including cdc.lsn_time_mapping (there may be other system ones you need as well, however, this is the main one), into the new database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top