Which Transact-SQL statement should you use?

You are a database administrator for AIOTestKing.com. You administer a SQL Server 2005 database named Contracts. The Contracts database becomes corrupted. You perform a restore by using the following Transact-SQL script.
RESTORE DATABASE Contracts FROM contracts_bu_device WITH CONTINUE_AFTER_ERROR, CHECKSUM, RECOVERY After the restore, the SQL Server logs show errors in some of the page restores. You need to repair the database pages that are corrupt. You need to achieve this goal by using the method that facilitates the fastest possible repair. Which Transact-SQL statement should you use?

You are a database administrator for AIOTestKing.com. You administer a SQL Server 2005 database named Contracts. The Contracts database becomes corrupted. You perform a restore by using the following Transact-SQL script.
RESTORE DATABASE Contracts FROM contracts_bu_device WITH CONTINUE_AFTER_ERROR, CHECKSUM, RECOVERY After the restore, the SQL Server logs show errors in some of the page restores. You need to repair the database pages that are corrupt. You need to achieve this goal by using the method that facilitates the fastest possible repair. Which Transact-SQL statement should you use?

A.
ALTER DATABASE Contracts SET TRUSTWORTHY ON

B.
DBCC CHECKDB (Contracts, REPAIR_ALLOW_DATA_LOSS) WITH TABLOCK

C.
ALTER DATABASE Contracts SET TORN_PAGE_DETECTION ON

D.
DBCC CHECKDB (Contracts, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS

Explanation:
REPAIR_ALLOW_DATA_LOSS specifies that DBCC CHECKTABLE should repair the found errors. To use a repair option the database must be in single-user mode. WITH TABLOCK causes DBCC CHECKTABLE to obtain a shared table lock instead of using an internal database snapshot. TABLOCK will cause DBCC CHECKTABLE to run faster on a table under heavy load, but decreases the concurrency available on the table while DBCC CHECKTABLE is running.



Leave a Reply 0

Your email address will not be published. Required fields are marked *