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)
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
Explanation: When this job is executed it runs the system stored procedure sys.sp_MScdc_capture_job.
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
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.
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
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
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.
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
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
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
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
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
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
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.
- Check Information Technology Books
- Practice Programming MCQs
- Check SQL Server Books
- Apply for Programming Internship