|
| 1 | +/***************************************************************** |
| 2 | + ------------------------------------- |
| 3 | + tsqltools - RDS Add CDC |
| 4 | + ------------------------------------- |
| 5 | +Description: This stored procedure will help you to enable CDC on |
| 6 | +all the exsiting tables. You have to run this store procedure on the |
| 7 | +database where you need to add the tables. It won't support Cross |
| 8 | +database's tables. |
| 9 | + |
| 10 | +How to Run: If you want to enable CDC on the tables which |
| 11 | +all are in DBAdmin database, |
| 12 | + |
| 13 | +EXEC sp_add_cdc 'DBAdmin' |
| 14 | + |
| 15 | +------------------------------------------------------------------- |
| 16 | + |
| 17 | +Version: v1.0 |
| 18 | +Release Date: 2018年02月09日 |
| 19 | +Author: Bhuvanesh(@SQLadmin) |
| 20 | +Feedback: mailto:r.bhuvanesh@outlook.com |
| 21 | +Updates: https://github.com/SqlAdmin/tsqltools/ |
| 22 | +License: GPL-3.0 |
| 23 | + tsqltools is free to download.It contains Tsql stored procedures |
| 24 | + and scripts to help the DBAs and Developers to make job easier |
| 25 | +(C) 2017 |
| 26 | +*******************************************************************/ |
| 27 | + |
| 28 | +-- READ THE DESCRIPTION BEFORE EXECUTE THIS *** |
1 | 29 | IF OBJECT_ID('dbo.sp_add_cdc') IS NULL
|
2 | 30 | EXEC ('CREATE PROCEDURE dbo.sp_add_cdc AS RETURN 0;');
|
3 | 31 | GO
|
|
42 | 70 | SELECT table_name
|
43 | 71 | FROM INFORMATION_SCHEMA.TABLES Join sys.tables t3 on table_name = t3.name
|
44 | 72 | where TABLE_NAME not in (select table_name
|
45 | | - from INFORMATION_SCHEMA.TABLE_CONSTRAINTS) and table_schema !='cdc' and TABLE_NAME!='systranschemas' and t3.is_tracked_by_cdc=0; |
| 73 | + from INFORMATION_SCHEMA.TABLE_CONSTRAINTS) and table_schema !='cdc' and TABLE_NAME!='systranschemas' and t3.is_tracked_by_cdc=0; |
46 | 74 |
|
47 | 75 | OPEN nonprimary_cursor
|
48 | 76 | FETCH NEXT FROM nonprimary_cursor INTO @name
|
|
0 commit comments