Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology Structured Query Language (SQL) - Cultural View of Technology

culturalview.com
from culturalview.com More from this publisher
23.10.2012 Views

Data Manipulation Language 36 See also • Data Definition Language • Data Control Language References • "The SQL92 standard" [4] . [1] SQL92 [2] SQL92 4.22.2, SQL-statements classified by function [3] "Data Manipulation Language Statements" (http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/sqlplsql.htm#i18503). Oracle. . "Data manipulation language (DML) statements query or manipulate data in existing schema objects." [4] http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt Database Console Commands (Transact-SQL) The Database Console Commands (DBCC) are a series of statements in Transact-SQL programming language to check the physical and logical consistency of a Microsoft SQL Server database. [1] . These commands are also used to fix existing issues [1] . They are also used for administration and file management. [2] DBCC was previously expanded as Database Consistency Checker. [3] Categories of DBCC Commands Based on their uses, DBCC commands are made of three categories of statements. They are: Category Uses Commands Maintenance statements Maintenance tasks DBCC DBREINDEX, DBCC DBREPAIR, DBCC INDEXDEFRAG, DBCC SHRINKDATABASE, DBCC SHRINKFILE, DBCC UPDATEUSAGE, DBCC CLEANTABLE, DBCC DROPCLEANBUFFERS, DBCC FREEPROCCACHE Status statements Status checks DBCC INPUTBUFFER, DBCC OPENTRAN, DBCC OUTPUTBUFFER, DBCC Validation statements Miscellaneous statements PROCCACHE, DBCC SHOWCONTIG, DBCC SHOW_STATISTICS, DBCC SQLPERF, DBCC TRACESTATUS, DBCC USEROPTIONS Validation operations on a database DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKCONSTRAINTS, DBCC CHECKDB, DBCC CHECKFILEGROUP, DBCC and database components such as table, [1] CHECKIDENT, DBCC CHECKTABLE, DBCC NEWALLOC index, file catalog, etc. Miscellaneous tasks DBCC dllname (FREE), DBCC HELP, DBCC PINTABLE, DBCC ROWLOCK, Source: MSDN Transact-SQL Reference (SQL Server 2000) DBCC TRACEOFF, DBCC TRACEON, DBCC UNPINTABLE

Database Console Commands (Transact-SQL) 37 Operation of DBCC statements DBCC DBREINDEX This statement is used to recreate the indexes for a particular table. [4] This statement rebuilds indexes in a single step. [5] It also assigns fresh pages to reduce internal and external fragmentation. [5] DBCC DBREPAIR This statement is used to drop or delete a damaged database [6] . However, this command is no longer available with Microsoft SQL Server 2005 and later versions of Microsoft SQL Server [7] . Instead, it has been replaced by the DROP DATABASE Transact-SQL statement [7] DBCC INDEXDEFRAG This statement is used to defragment the clustered and secondary indexes associated with the particular table. [8] The index defragmentation is carried out using the fill factor specified at the time of creation of indexes. [9] While its operation is strikingly similar to that of DBCC DBREINDEX, unlike DBCC INDEXFRAG it does not allow new fill factor to be specified. [9] DBCC SHRINKDATABASE This statement is used to reduce the size of a database [10] . This statement reduces the physical size of the database log file [11] [12] . An alternate way to shrink a database is to use the commander ALTER DATABASE. [13] DBCC SHRINKFILE This statement is used to reduce the size of a data file or log file of a particular database. [14] [15] The file could also be shrunk by using the SHRINKFILE attribute of the ALTER DATABASE command. [13] DBCC UPDATEUSAGE This statement is used to correct inaccuracies in the page and row statistics in the views. [16] DBCC CLEANTABLE This statement is used to remove spaces occupied by columns when they are removed. [17] . This feature is not available with Micrcosoft SQL Server 2000 and has been newly introduced in Microsoft SQL Server 2005 [17] DBCC DROPCLEANBUFFERS This statement is used to drop clean buffers from the buffer pool. [18] This feature is not available with Micrcosoft SQL Server 2000 and has been newly introduced in Microsoft SQL Server 2005 [18] DBCC FREEPROCCACHE This statement is used to remove all elements from the procedure cache. [19] This feature is not available with Micrcosoft SQL Server 2000 and has been newly introduced in Microsoft SQL Server 2005 [19] DBCC INPUTBUFFER This statement is used to display the last statement stored in the buffer. [20]

Database Console Commands (Transact-<strong>SQL</strong>) 37<br />

Operation <strong>of</strong> DBCC statements<br />

DBCC DBREINDEX<br />

This statement is used to recreate the indexes for a particular table. [4] This statement rebuilds indexes in a single<br />

step. [5] It also assigns fresh pages to reduce internal and external fragmentation. [5]<br />

DBCC DBREPAIR<br />

This statement is used to drop or delete a damaged database [6] . However, this command is no longer available with<br />

Micros<strong>of</strong>t <strong>SQL</strong> Server 2005 and later versions <strong>of</strong> Micros<strong>of</strong>t <strong>SQL</strong> Server [7] . Instead, it has been replaced by the<br />

DROP DATABASE Transact-<strong>SQL</strong> statement [7]<br />

DBCC INDEXDEFRAG<br />

This statement is used to defragment the clustered and secondary indexes associated with the particular table. [8] The<br />

index defragmentation is carried out using the fill factor specified at the time <strong>of</strong> creation <strong>of</strong> indexes. [9] While its<br />

operation is strikingly similar to that <strong>of</strong> DBCC DBREINDEX, unlike DBCC INDEXFRAG it does not allow new fill<br />

factor to be specified. [9]<br />

DBCC SHRINKDATABASE<br />

This statement is used to reduce the size <strong>of</strong> a database [10] . This statement reduces the physical size <strong>of</strong> the database<br />

log file [11] [12] . An alternate way to shrink a database is to use the commander ALTER DATABASE. [13]<br />

DBCC SHRINKFILE<br />

This statement is used to reduce the size <strong>of</strong> a data file or log file <strong>of</strong> a particular database. [14] [15] The file could also<br />

be shrunk by using the SHRINKFILE attribute <strong>of</strong> the ALTER DATABASE command. [13]<br />

DBCC UPDATEUSAGE<br />

This statement is used to correct inaccuracies in the page and row statistics in the views. [16]<br />

DBCC CLEANTABLE<br />

This statement is used to remove spaces occupied by columns when they are removed. [17] . This feature is not<br />

available with Micrcos<strong>of</strong>t <strong>SQL</strong> Server 2000 and has been newly introduced in Micros<strong>of</strong>t <strong>SQL</strong> Server 2005 [17]<br />

DBCC DROPCLEANBUFFERS<br />

This statement is used to drop clean buffers from the buffer pool. [18] This feature is not available with Micrcos<strong>of</strong>t<br />

<strong>SQL</strong> Server 2000 and has been newly introduced in Micros<strong>of</strong>t <strong>SQL</strong> Server 2005 [18]<br />

DBCC FREEPROCCACHE<br />

This statement is used to remove all elements from the procedure cache. [19] This feature is not available with<br />

Micrcos<strong>of</strong>t <strong>SQL</strong> Server 2000 and has been newly introduced in Micros<strong>of</strong>t <strong>SQL</strong> Server 2005 [19]<br />

DBCC INPUTBUFFER<br />

This statement is used to display the last statement stored in the buffer. [20]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!