SQL Server database backup and recovery measures

Source: Internet
Author: User
Tags microsoft sql server
I. Back up the database
1. Open SQL Enterprise Manager and click Microsoft SQL Server in the root directory of the console.
2. SQL Server Group --> double-click to open your Server --> double-click to open the Database Directory
3. Select your database name (for example, Forum database Forum) --> click the tool in the menu above --> select backup database
4. Select full backup as the backup option. If there is a path or name for the backup in the target project, click delete and then add. If there is no path or name, select Add directly, specify the path and file name, click OK to return to the backup window, and click OK to back up
2. Restore the database
1. Open SQL Enterprise Manager and click Microsoft SQL Server in the root directory of the console.
2. SQL Server Group --> double-click to open your Server --> click the new database icon in the icon bar to retrieve the name of the new database.
3. Click the new database name (such as the Forum database Forum) --> then click the tool in the menu above --> select recover database
4. In the displayed window, select "restore from device"> "select Device"> "add"> "Select your backup file name"> "add" and click "OK" to return, at this time, the device column should display the database backup file name you just Selected. The default backup number is 1. (if you have backed up the same file multiple times, click View next to the backup number, select the latest backup in the check box and click OK) --> then click the option button next to the general button
5. In the displayed window, select force restore on the existing database, and select the option to enable the database to continue running but not to restore other transaction logs in the recovery completion status. To restore the database file in the middle of the window, you need to set it according to your SQL installation (you can also specify your own directory). The logical file name does not need to be changed, the physical file name should be changed based on the recovered machine. If your SQL database is installed in D: Program FilesMicrosoft SQL ServerMSSQLData, you can change the Directory of the recovered machine, and the final file name should be changed to your current database name (for example, if it was originally bbs_data.mdf and the current database is forum, it should be changed to forum_data.mdf ), log and data files must be modified in this way (the log file name is * _ log. ldf ends). You can set the recovery directory as needed, provided that the directory must exist (for example, you can specify d: sqldatabs_data.mdf or d: sqldatabs_log.ldf). Otherwise, an error is returned.
6. After the modification is complete, click "OK" below to restore. A progress bar is displayed, prompting the recovery progress. After the restoration is complete, the system will automatically prompt "success". If an error is reported in the middle, please record the relevant error content and ask people familiar with SQL operations. The common error is nothing more than a directory error, repeated file names, incorrect file names, insufficient space, or database in use errors, you can close all SQL windows and re-open them to restore the database. If an error is prompted, stop the SQL service and restart it, as for the above other errors, you can change the content of the errors to restore them.
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.