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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758201605, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/T-SQL/statements/dbcc/index(96): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78