SQL Server Questions and Answers – Change Data Capture

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Change Data Capture”.

1. Which of the following script will enable CDC on HumanResources.Shift table?
a)

USE AdventureWorks
GO
EXEC sys.sp_cdc_enable
@source_schema = N'HumanResources',
@source_name   = N'Shift',
@role_name     = NULL
GO

b)

USE AdventureWorks
GO
EXEC sys.sp_cdc_disable_table
@source_schema = N'HumanResources',
@source_name   = N'Shift',
@role_name     = NULL
GO

c)

advertisement
advertisement
USE AdventureWorks
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'HumanResources',
@source_name   = N'Shift',
@role_name     = NULL
GO

d) All of the mentioned
View Answer

Answer: c
Explanation: When this job is executed it runs the system stored procedure sys.sp_MScdc_capture_job.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

2. Point out the correct statement.
a) To determine if a database is already enabled, query the is_cdc_enabled column in the sys.database catalog view
b) Change data capture requires exclusive use of the cdc schema and cdc user
c) If a change data capture enabled database is dropped, change data capture jobs are not removed
d) All of the mentioned
View Answer

Answer: b
Explanation: If either a schema or a database user named cdc currently exists in a database, the database cannot be enabled for change data capture until the schema and or user are dropped or renamed.

advertisement

3. Which of the following disable database for Change Data Capture?
a) EXEC sys.sp_cdc_ensable_db
b) EXEC sys.sp_disable_db
c) EXEC sys.sp_cdc_disable_db
d) All of the mentioned
View Answer

Answer: c
Explanation: A member of the sysadmin fixed server role can run the stored procedure sys.sp_cdc_disable_db in the database context to disable change data capture for a database.

4. If you do not want to use a gating role, explicitly set the @role_name parameter to ______________
a) 0
b) NULL
c) 1
d) None of the mentioned
View Answer

Answer: b
Explanation: When a role is specified, users who are not members of either the sysadmin or db_owner role must also be members of the specified role.

advertisement

5. Point out the wrong statement.
a) By default, all of the columns in the source table are not identified as captured columns
b) By default, the change table is located in the default filegroup of the database
c) The purpose of the named role is to control access to the change data
d) None of the mentioned
View Answer

Answer: a
Explanation: If only a subset of columns need to be tracked, such as for privacy or performance reasons, use the @captured_column_list parameter to specify the subset of columns.

6. Which of the following query determine sessions that had an empty scan?
a) SELECT * from sys.dm_cdc_log_scan_sessions where empty_scan_count <> 0
b) SELECT * from sys.dm_cdc_log_scan_sessions where empty_scan_count = 0
c) SELECT * from sys.dm_cdc_log_scan_sessions where empty_scan_count < 0
d) SELECT * from sys.dm_cdc_log_scan_sessions where empty_scan_count > 0
View Answer

Answer: a
Explanation: Every row in sys.dm_cdc_log_scan_sessions represents a log scan session (except the row with an ID of 0).

7. Which of the following script enable a table Without Using a Gating Role?
a)

USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = 1,
@supports_net_changes = 1
GO

b)

USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = 0,
@supports_net_changes = 1
GO

c)

USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = NULL,
@supports_net_changes = 1
GO

d) None of the mentioned
View Answer

Answer: c
Explanation: Role name is set to NULL for not using a gating role.

8. Which of the following script enable a Table for all and Net Changes Queries?
a)

\USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = N'MyRole',
@supports_net_changes = 1
GO

b)

\USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = N'MyRole',
@supports_net_changes = 0
GO

c)

\USE MyDB
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name   = N'MyTable',
@role_name     = N'MyRole',
@supports_net_changes = NULL
GO

d) All of the mentioned
View Answer

Answer: a
Explanation: To support net changes queries, the source table must have a primary key or unique index to uniquely identify rows.

9. Upper bound on expected throughput of the capture job is calculated using which of the following computation?
a) (maxtrans * maxscans) / number of seconds between scans
b) (maxtrans * maxscans) * number of seconds between scans
c) (maxtrans * maxscans) – number of seconds between scans
d) None of the mentioned
View Answer

Answer: a
Explanation: When running in one shot mode, you can compute an upper bound on expected throughput of the capture job

10. The cleanup job is initiated by running the parameterless stored procedure is ___________
a) sp_MScdc_cleanup_job
b) sp_cdc_cleanup_change_job
c) sp_cdc_cleanup_change_tables
d) none of the mentioned
View Answer

Answer: a
Explanation: sp_MScdc_cleanup_job starts by extracting the configured retention and threshold values for the cleanup job from msdb.dbo.cdc_jobs.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.