Home  >  Article  >  Database  >  Complete steps for SQL Server backup database

Complete steps for SQL Server backup database

WBOY
WBOYforward
2022-07-22 16:46:284776browse

This article brings you relevant knowledge about SQL server, which mainly introduces the complete steps of backing up the database. First, back up the current database into a file, select the corresponding database, and then The database can be restored through this backup file. Let’s take a look at it. I hope it will be helpful to everyone.

Complete steps for SQL Server backup database

Recommended study: "SQL Tutorial"

1. First, back up the current database into a file

1. Follow the operation, select the corresponding database,

Determine the storage location of the backup file

Click OK to generate a backup file.

2.The database can then be restored through the backup file.

Right-click the database and click Restore Files and File Groups

Then set the name of the target database. If the same name already exists in the database, you need to modify or delete it. The original database with the same name, then select the source device and click on the right. . . Click Add in the pop-up box, find the location of the file to be backed up, and click OK.

Then click to check, and then click OK to complete the backup.

Backup and restore completed

2. The second method to copy the database

1. Right-click Database properties

Click on the file and drag to the right to find the location of the database file

.mdf Main data file: Each database has one and only one

.ndf Secondary data files: some databases have them, some don't

.ldf Transaction log files: Each database has at least one

Determine the file location.

2. Right-click the database and click Task, Detach.

Click OK, you will find that there is no more in the database, and then copy the file path found above.

At this time we click on the database to attach.

Click Add to select the corresponding database file.

At this time, the copy is completed. This needs to be done on this machine. Perform the same addition operation as you need to copy above.

Recommended study: "SQL Tutorial"

The above is the detailed content of Complete steps for SQL Server backup database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete