Command | Purpose | Sample Usage |
sp_helpdb | This gives you information about all databases in the instance or specific information about one database. |
|
fn_virtualfilestats | This command will show you the number of read and writes to a data file. Use sp_helpdb with the database name to see the logical file numbers for the data files and the database id. |
|
fn_get_sql() | Returns the text of the SQL statement for the specified SQL handle. This is similar to using DBCC INPUTBUFFER, but this command will show you additional information. This can also be embedded in a process easier then using the DBCC commandMSSQLTips additional info |
|
sp_lock | This command shows you all of the locks that the system is currently tracking This is similar to information you can see in Enterprise Manager. |
|
sp_help | This command gives you information about the objects within a database. The command without an objectname will give you a list of all objects within the database. |
|
sp_who2 | Gives you process information similar to what you see when using Enterprise Manager. |
|
sp_helpindex | Gives you information about the indexes on a table as well as the columns used for the index.MSSQLTips additional info |
|
sp_spaceused | This command shows you how much space has been allocated for the database (or if specified an object) and how much space is being used. |
|
DBCC CACHESTATS | Displays information about the objects currently in the buffer cache. |
|
DBCC CHECKDB | This will check the allocation of all pages in the database as well as check for any integrity issues. |
|
DBCC CHECKTABLE | This will check the allocation of all pages for a specific table or index as well as check for any integrity issues. |
|
DBCC DBREINDEX | This command will reindex your table. If the indexname is left out then all indexes are rebuilt. If the fillfactor is set to 0 then this will use the original fillfactor when the table was created.MSSQLTips additional info |
|
DBCC PROCCACHE | This command will show you information about the procedure cache and how much is being used. Spotlight will also show you this same information. |
|
DBCC MEMORYSTATUS | Displays how the SQL Server buffer cache is divided up, including buffer activity. |
|
DBCC SHOWCONTIG | This command gives you information about how much space is used for a table and indexes. Information provided includes number of pages used as well as how fragmented the data is in the database. |
|
DBCC SHOW_STATISTICS | This will show how statistics are laid out for an index. You can see how distributed the data is and whether the index is really a good candidate or not. |
|
DBCC SHRINKFILE | This will allow you to shrink one of the database files. This is equivalent to doing a database shrink, but you can specify what file and the size to shrink it to. Use the sp_helpdb command along with the database name to see the actual file names used.MSSQLTips additional info |
|
DBCC SQLPERF | This command will show you much of the transaction logs are being used. |
|
DBCC TRACEON | This command will turn on a trace flag to capture events in the error log. Trace Flag 1204 captures Deadlock information. |
|
DBCC TRACEOFF | This command turns off a trace flag. |
Some stories mostly on Oracle related things I like to share
High Availbility
- dataguard (5)
- migration (9)
- performance tuning (11)
- problem (4)
- rac (8)
- recovery (8)
- security (4)
- troubleshooting (2)
OS & Virtualization
- adrci (1)
- big data (2)
- exadata (5)
- gridcontrol (6)
- linux (9)
- mysql (4)
- solaris (2)
- SQLserver (5)
- virtualization (6)
- windows (2)
Thursday, March 01, 2012
SQLServer commands
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment