DBCC CHECKDB
DBCC CHECKDB is a SQL statement in the Administration category. SQL Server: checks the logical and physical integrity of all objects in a database. The syntax is DBCC CHECKDB ('database_name');. It returns integrity report. A typical example: DBCC CHECKDB ('my_company') WITH NO_INFOMSGS; -- Checks: allocations, catalog consistency, system table integrity -- Returns errors if corruption found -- Repair options: -- DBCC CHECKDB ('db', REPAIR_ALLOW_DATA_LOSS); -- Last resort, may lose data -- PostgreSQL equivalent: -- pg_checksums / pg_repack A close relative is CREATE USER, which creates a new database user account. A close relative is GRANT, which grants specific privileges (SELECT, INSERT, UPDATE, DELETE, ALL) to a user on a database/table. A close relative is REVOKE, which removes previously granted privileges from a user. More about this category: Database administration — CREATE DATABASE, GRANT, REVOKE, SHOW, DESCRIBE. Related Administration entries: CREATE USER, GRANT, REVOKE, SHOW TABLES, DESCRIBE / DESC, SHOW INDEX, SHOW CREATE TABLE, SHOW DATABASES.