-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdc-rds.sql
38 lines (32 loc) · 1.22 KB
/
cdc-rds.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
Using change data capture
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.SQLServer.CommonDBATasks.CDC.html
*/
-- enable CDC
exec msdb.dbo.rds_cdc_enable_db 'database_name'
GO
--disable CDC
exec msdb.dbo.rds_cdc_disable_db 'database_name'
GO
--Begin tracking a table
exec sys.sp_cdc_enable_table
@source_schema = N'source_schema'
, @source_name = N'source_name'
, @role_name = N'role_name'
--The following parameters are optional:
--, @capture_instance = 'capture_instance'
--, @supports_net_changes = supports_net_changes
--, @index_name = 'index_name'
--, @captured_column_list = 'captured_column_list'
--, @filegroup_name = 'filegroup_name'
--, @allow_partition_switch = 'allow_partition_switch'
;
--View CDC configuration
exec sys.sp_cdc_help_change_data_capture
--The following parameters are optional and must be used together.
-- 'schema_name', 'table_name'
;
-- Show configuration for each parameter on either primary and secondary replicas.
exec rdsadmin.dbo.rds_show_configuration 'cdc_capture_maxtrans';
--To set values on secondary. These are used after failover.
exec rdsadmin.dbo.rds_set_configuration 'cdc_capture_maxtrans', 1000;