ApsaraDB RDS for SQL Server 2012 and later versions support some Database consistency checker (DBCC) statements. You can use the sp_rds_dbcc_trace stored procedure to specify the trace flags to be enabled. You can also execute the DBCC tracestatus(-1) statement to view whether the trace flags are enabled.

Supported trace flags

  • 1222
  • 1204
  • 1117
  • 1118
  • 1211
  • 1224
  • 3604

How to use

You can execute the following statements to use the DBCC feature:




USE master
GO
--database engine edition
SELECT SERVERPROPERTY('edition')
GO
--create database
CREATE DATABASE testdb
GO
DBCC tracestatus(-1)
exec sp_rds_dbcc_trace 1222,1
WAITFOR DELAY '00:00:10'
DBCC tracestatus(-1)
GO