Why This Error Happens
This error occurs because TORN_PAGE_DETECTION and PAGE_CHECKSUM are mutually exclusive page-protection mechanisms in SQL Server, and the engine will reject any command attempting to enable both simultaneously on the same database. Since SQL Server 2005, PAGE_CHECKSUM has been the default and superior method for detecting I/O corruption, rendering the legacy TORN_PAGE_DETECTION option obsolete. This typically happens when a database is restored or migrated from a legacy system where a T-SQL script explicitly sets TORN_PAGE_DETECTION ON without first disabling the newer checksum option, or when an automated deployment script contains conflicting ALTER DATABASE statements.
Step-by-Step Resolution Guide
Step 1: Identify the Conflicting Script or Source
- Open SQL Server Management Studio (SSMS) or Azure Data Studio and locate the specific
ALTER DATABASEscript that triggered Error 5067. - Check if the script contains both
SET TORN_PAGE_DETECTION ONandSET PAGE_CHECKSUM ONin the same batch or in close proximity. - Review deployment pipelines (e.g., DACPAC files or Flyway scripts) for legacy syntax carried over from older SQL Server versions (2000/2005).
Step 2: Verify the Current Page Verify Option
- Run the following query to check the current state of the database in question:
SELECT name, page_verify_option_desc
FROM sys.databases
WHERE name = 'YourDatabaseName';
- Confirm whether the value is currently set to
NONE,TORN_PAGE_DETECTION, orCHECKSUM.
Step 3: Disable Torn Page Detection and Apply Checksum
- Execute the following command to correct the database option, ensuring you remove the torn page setting first:
ALTER DATABASE YourDatabaseName
SET PAGE_VERIFY CHECKSUM;
- Do not attempt to run
SET TORN_PAGE_DETECTION ONin the same transaction or script following this change. - If using a GUI, navigate to Database Properties > Options in SSMS and manually select “CHECKSUM” from the Page Verify dropdown menu, rather than using the deprecated boolean toggle.
Step 4: Update Automation Scripts
- If the error originates from an automated SQL Agent Job or PowerShell deployment script (common in Windows Server 2025 CI/CD pipelines), edit the source files to remove any references to
TORN_PAGE_DETECTION. - Replace legacy logic with the modern
PAGE_VERIFYsyntax to prevent future Error 5067 occurrences during subsequent deployments.
Alternative or Verification Steps
- Verify the Fix: Re-run the
sys.databasesquery from Step 2; thepage_verify_option_desccolumn should now strictly readCHECKSUMwith no errors in the SQL Server Error Log. - Alternative Solution: If legacy compliance software strictly requires
TORN_PAGE_DETECTIONfor older application compatibility, you must choose one or the other—executeALTER DATABASE YourDatabaseName SET PAGE_VERIFY NONE;first, then explicitly setTORN_PAGE_DETECTION ONin a separate, standalone transaction.