Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
61 Cards in this Set
- Front
- Back
3 recovery models |
- Full - Bulk-logged - Simple (truncate log on checkpoint) |
|
Full recovery |
•Pointin time recovery •Failedmedia recovery |
|
Bulk-logged recovery |
•Interimrecovery model used to reduce logging •Pointin time recovery is not available within bulk options |
|
Simple recovery |
(truncate log on checkpoint) •Logbackups are not available, no point in time recovery •Smalldatabases or databases that can be rebuilt from other source data (Basically enough info to restart database if I need it) |
|
2 backup statements |
–BACKUPDATABASE –BACKUPLOG |
|
TSQL that controls whether the backup operation appends to or overwrites the existing backup sets on the media. What is the default? |
INIT/NOINIT default is to append to the most recent backup (NOINIT) |
|
Used only with BACKUP DATABASE to indicate a backup that is only since the last full backup |
WITH DIFFERENTIAL |
|
TSQL that specifies whether the media header should be written on the volumes used for this backup operation, overwriting any existing media header and backup sets |
FORMAT/NOFORMAT |
|
What TSL command backs up the tail of the log and leaves the database in the RESTORING state |
NORECOVERY (useful when failing over to secondary DB or when saving the tail of the log before a RESTORE operation) |
|
4 integrity and fact-finding statements to get information about the backups |
•RESTORE VERIFYONLY FROM device •RESTORE HEADERONLY FROMdevice •RESTORE FILELISTONLY FROM device •RESTORE LABELONLY FROMdevice |
|
Why use system database backups? |
•Certain system database corruptionscause the failure of the SQL Server or SQL Server Agent Services |
|
Specifies that the backup operation will verify each page for checksum and torn page, if enabled and available, and generate a checksum for the entire backup. |
CHECKSUM |
|
Explicitly disables the generation of backup checksums (and the validation of page checksums). This is the default behavior. |
NO_CHECKSUM |
|
TSQL to backup database and log |
BACKUP DATABASE BACKUP LOG |
|
Only says if the backup was ok or not |
RESTORE VERIFYONLY |
|
can return information like subject line of backup |
RESTORE HEADERONLY |
|
Lists files that were in the backup |
RESTORE FILELISTONLY |
|
Returns a result set containing information about the backup media identified by the given backup device. |
RESTORE LABELONLY |
|
Recovery phases (3) |
Find ALL backups uncompleted backups (delete) and completed backups that need to be rolled forward (–Data copy –Redo –Undo) |
|
Recovery process |
–Tail log backup –Restore full-database backup –Restore mostrecent differential backup –Restore alllogs from the most recent differential –Restore thetail of the log and recover the database |
|
List 7 types of recovery |
•Complete database restore in simplerecovery •Complete database restore in full recovery •System database restore •File restore •Online restore •Piecemeal restore •Page restore |
|
2 types of restore database statements |
RESTORE DATABASE RESTORE LOG |
|
Roll back is controlled by the RESTORE statement rolling forward through this statement. Which is default? |
RECOVERY (default) NORECOVERY |
|
What TSQL do you use to indicate position in the media set used for backup |
WITH FILE = [1] |
|
What 2 commands can be used to override the backup of the tail log? |
WITH REPLACE WITH STOPAT (Also RESTORE LOG: WITHSTOPATMARK / STOPBEFOREMARK) |
|
Moves restored DB (T-SQL) |
WITH MOVE [location] |
|
lets you restore your full backup, then run a few queries before you keep restoring transaction logs. |
WITH STANDBY |
|
What DB will you rarely (if ever) recover? |
TEMPDB because that is created everytime the instance is started |
|
•Recovering model when corrupt |
SQL Server will not start. Restore model from backup and also user DB |
|
Recovering MSDB when corrupt |
Agent service won't start, so that needs to be restored |
|
T-SQL command to move, copy, or rename DB |
sp_detach_db then CREATE Database … FOR ATTACH |
|
catalog view to find logical filenames (in order to help with naming other files) |
sys.database_files |
|
What command relocates a DB file within an instance? |
ALTER DATABASE (requires use of logical filenames) |
|
Where can you change location of master DB files and log file? What parameters are needed? |
SQL Server Configuration Manager (from start menu) -d for date file -l for log file Then restart |
|
How to move other system files (not Master)? |
ALTER DATABASE.... then move file(s). Restart SQL Server |
|
Database Console Command for informational statements |
DBCC OPENTRAN (Tasks that gather and display various types of information.) |
|
Database Console Command for validation statements |
DBCC CHECKDB (Validation operations on a database, table, index, catalog, filegroup, or allocation of database pages.) |
|
Database Console Command for Maintenance statements |
DBCC FREEPROCCACHE (Maintenance tasks on a database, index, or filegroup.) |
|
Database Console Command for miscellaneous statements |
DBCC TRACEON/TRACEOFF (Miscellaneous tasks such as enabling trace flags or removing a DLL from memory.) |
|
Info about DBCC CheckDB |
Validate in DB structure and integrity and the data inside |
|
What other commands are spawned by DBCC CheckDB? |
–DBCC CHECKALLOC–DBCC CHECKTABLE–DBCC CHECKCATALOG |
|
Limits the checking to the integrity of the physical structure of the page and record headers and the allocation consistency of the database. This check is designed to provide a small overhead check of the physical consistency of the database, but it can also detect torn pages, checksum failures, and common hardware failures that can compromise a user's data. |
PHYSICAL_ONLY |
|
Displays the estimated amount of tempdb space that is required to run DBCC CHECKDB with all the other specified options. The actual database check is not performed. |
ESTIMATEONLY |
|
Specifies that intensive checks of nonclustered indexes for user tables should not be performed. This decreases the overall execution time. |
NOINDEX |
|
Displays all reported errors per object. All error messages are displayed by default. |
ALL_ERRORMSGS |
|
If the compatibility level is 100 (SQL Server 2008) or higher, performs logical consistency checks on an indexed view, XML indexes, and spatial indexes, where present. |
EXTENDED_LOGICAL_CHECKS |
|
Suppresses all informational messages. |
NO_INFOMSGS |
|
Causes DBCC CHECKDB to obtain locks instead of using an internal database snapshot. will cause DBCC CHECKDB to run faster on a database under heavy load |
TABLOCK |
|
If the compatibility level is 100 (SQL Server 2008) or higher, performs logical consistency checks on an indexed view, XML indexes, and spatial indexes, where present. |
EXTENDED_LOGICAL_CHECKS |
|
REPAIR_REBUILD |
•Causes no loss of data integrity withinthe database •Rebuilds indexes and deallocates corruptpages •Does not involve data loss •Only works in certain circumstances |
|
REPAIR_ALLOW_DATA_LOSS |
•Repair should absolutely be the lastresort•Database damage is likely •If the database is in Emergency Repairmode (ALTER DATABASE) special repairs are attempted with this option |
|
What indexes is a Primary Key Constraint? |
Clustered and Non-Clustered Index, Unique |
|
What indexes is a Unique Key Constraint? |
Clustered and Non-Clustered Index, Unique |
|
What indexes is a Regular Index? |
Clustered and Non-Clustered Index, Non-Unique Clustered and Non-Clustered Index, Unique |
|
What is the difference between a clustered and non-clustered index? |
- Clustered indexes sort and store the data rows in the table or view based on their key values - Nonclustered indexes have a structure separate from the data rows (using pointers ["row locators"]) |
|
What are three reasons statistics can help in determining an optimal execution plan? |
–May aid in index selection and query processing –Join type (nested loop, hash) –Join order (table 1, table 2, or table 2, table 1) |
|
What are two options you can add to the Create Index or Create Table statements? |
FILLFACTOR PAD_INDEX |
|
What T-SQL command checks from fragmentation database-wide, table-wide, for a specific index or specific partition? |
sys.dm_db_index_physical_stats |
|
What is external fragmentation? |
•Pages spread (non-contiguously) within adata file |
|
3 ways to maintain an index |
–ALTER INDEX … REORGANIZE –ALTER INDEX …REBUILD –ALTER INDEX … ALL |
|
3 ways to maintain statistics |
–Auto create and update options –AUTO_UPDATE_STATISTICS_ASYNC –Forceful update with sp_UpdateStats |