SQL Server database backup and recovery

Source: Internet
Author: User
Tags password protection
-- Full backup database northwindcsto disk = 'G: \ backup \ northwindcs_full_20070908.bak '-- Differential backup database northwindcsto disk = 'G: \ backup \ northwindcs_diff_20070908.bak' with differential -- log backup, backup log northwindcsto disk = 'G: \ backup \ northwindcs_log_20070908.bak 'is truncated by default. Log backup log northwindcsto disk = 'G: \ backup \ cmd' with no_truncate -- truncate log does not retain backup log northwindcswith no_log -- or backup log northwindcswith truncate_only -- log files will not become smaller after truncation -- it is necessary to compress -- file Backup Exec sp_helpdb -- view the data file backup database northwindcsfile = 'northwindcs '-- Logical name of the data file to disk = 'G: \ backup \ northwindcs_file_20070908.bak '-- File Group Backup Exec sp_helpdb northwindcs -- view the data file backup database northwindcsfilegroup = 'primary' -- Logical name of the data file to disk = 'G: \ backup \ northwindcs_filegroup_20070908.bak 'with init -- split backup to multiple targets -- cannot lose any target backup database northwindcsto disk = 'G: \ backup \ northwindcs_full_1.bak ', disk = 'G: \ backup \ northwindcs_full_2.bak '-- image backup -- each target has the same backup database: northwindcsto disk = 'G: \ backup \ northwindcs_assist_1.bak' attached to disk = 'G: \ backup \ northwindcs_mirror_2.bak 'with format -- format the target during the first image backup -- backup the image to a local or remote backup database northwindcsto disk = 'G: \ backup \ northwindcs_1__1.bak 'failed to disk = '\ 192.168.1.200 \ backup \ northwindcs_1__2.bak' with format -- a backup file is generated every day. Declare @ path nvarchar (2000) set @ Path = 'G: \ backup \ northwindcs_full _ '+ convert (nvarchar, getdate (), 112) + '. bak 'backup database northwindcsto disk = @ path -- recover the database from norecovery or -- standby mode to available Restore database northwindcs_bakwith recovery -- view the backup set restore headeronlyfrom disk = 'G: \ backup \ northwindcs_full_20070908.bak '-- view the information of the first backup set of the target Backup Restore filelistonlyfrom disk = 'G: \ backup \ northwindcs_full_20070908_2.bak 'with file = 1 -- view the restore labelonlyfrom disk = 'G: \ backup \ custom' -- backup Setting Password protection backup database northwindcsto disk = 'G: \ backup \ northwindcs_full_20070908.bak 'with Password = '000000', initrestore database northwindcsfrom disk = 'G: \ backup \ northwindcs_full_20070908.bak 'with Password = '000000'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.