Search notes:

SQL Server: dbcc

Clone a database

dbcc clonedatabase creates a new database and then clones the structure of an existing database into the new one.
dbcc clonedatabase( origdb, newdb )
The original and new database need to be on the same instance. In order to clone a database to another instance, SqlPackage.exe.

Check a table's current identity value

dbcc checkident ('TABLE_NAME', reseed, 0);

traceon/traceoff to Enable or disable trace flags

dbcc traceon and dbcc traceoff enable or disable trace flags.
The current value of a given trace flag can be queried with dbcc tracestatus.

Dump content of a page

Do not send output to errorlog:
dbcc traceon (3604);
Dump content of page in database tq84_db whose file id is 1 and hose page id is 312.
dbcc page (
   /* database name: */ 'tq84_db',
   /* file id      : */         1,
   /* page id      : */       312,
   /* option       : */         3
) with tableresults;
File id and page id of a record can be queried with the virtual system column %%physLoc%%.
The value of option is one of
0 Page header only.
1 Page header + hex dump per row + page slot array (if available).
2 Page header + hex dump for entire page.
3 page header + detailed explanation for each record in the page.

Misc

Check current identity value:
dbcc checkident ('TABLE_NAME', reseed, 0);
Collect performance statistics(?):
dbcc sqlperf

stackdump

See also SqlDumper.exe.

Index