SQL Server Backup and Restore

Backup
full backup: backup database <database name> to disk='<path>'
Example: backup database test to disk='c:\backup\full.bak'

Differential backup: backup database <database name> to disk='<path>' with differential
Example: backup database test to disk='c:\backup\diff.bak' with differential

Normal Log backup: backup log <database name> to disk='<path>'
Example: backup log test to disk='c:\backup\log.bak' 

Tail log backup: backup log <database name> to disk='<path>'  with no_truncate
Example: backup log test to disk='c:\backup\taillog.bak' with no_truncate

Restore (normally you need to backup tail log before restore)
full restore: restore database <database name> from disk='<path>' with recovery
Example: restore database test from disk='c:\backup\full.bak' with recovery

full restore + differential restore: 
restore database <database name> from disk='<path>' with norecovery
restore database <database name> from disk='<path>' with recovery
Example:
restore database test from disk='c:\backup\full.bak' with norecovery
restore database test from disk='c:\backup\diff.bak' with recovery

full restore + differential restore + log restore:
restore database <database name> from disk='<path>' with norecovery
restore database <database name> from disk='<path>' with norecovery
restore log <database name> from disk='<path>' with recovery
Example:
restore database test from disk='c:\backup\full.bak' with norecovery
restore database test from disk='c:\backup\diff.bak' with norecovery
restore log test from disk='c:\backup\log.bak' with recovery

Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error