MS SQL: Difference between revisions
Jump to navigation
Jump to search
(Added "Commands") |
m (Added Applications category) |
||
Line 38: | Line 38: | ||
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' /* Show base tables only (not views etc) */ | SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' /* Show base tables only (not views etc) */ | ||
</source> | </source> | ||
[[Category:Applications]] |
Revision as of 07:34, 25 June 2012
Standard Maintenance Plans
Daily Maintenance Plan
- History Cleanup Task
- Delete all historical data (backup/restore, SQL Server Agent and Maintenance plan histories)
- Older than 2 weeks
- Reorganise Index Task
- All user databases
- Compact large objects
- Update Statistics Task
- All user databases
- Update: All existing statistics
- Scan type: Full scan
- Back Up Database Task
- Backup type: Full
- Databases: All databases
- Backup will expire: Leave unticked
- Create a backup file for every database: Update as appropriate
- Maintenance Cleanup Task
- Delete files of the following type: Backup files
- File extension:
bak
- File age: Select as appropriate
Hourly Transaction Log Backup
- Back Up Database Task
- Backup type: Transaction Log
- Databases: All user databases
- Maintenance Cleanup Task
- Delete files of the following type: Backup files
- File extension:
trn
- File age: Select as appropriate
Commands
Crib sheet of some very basic stuff
SELECT * FROM MASTER..SYSDATABASE /* Show databases */
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%' /* Show tables */
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' /* Show base tables only (not views etc) */