Training Day 3 - Restore
Should be backing up:
* model (if it's not default)
as well as user databases.
RESTORE DATABASE command - NORECOVERY if you're going to do more restores (e.g., full then diff then log)
* RESTORE VERIFYONLY FROM DISK =[filename] - Check backup is valid
* RESTORE HEADERONLY FROM DISK = [filename] - Display contents of backup file (to get the file numbers for below)
* RESTORE DATABASE [database] FROM DISK = [filename] WITH FILE = n, NORECOVERY - Restore full backup
* RESTORE DATABASE [database] FROM DISK = [filename] WITH FILE = n, NORECOVERY - Restore partial backup
* RESTORE LOG [database] FROM DISK = [filename] WITH FILE = n, RECOVERY- restore log and restart DB
where FILE = n is the index of a specific backup in a file. (Which gets complicated quick if you're doing a weekly full, daily diff, and hourly log backups).
(But do restores with SSMS since they're not done very often?)
Probably do full backup after any restore.
Point in time: Add STOPAT [date] or STOPATMARK [transaction name] (but EF doesn't support adding marks to transactions)