Nanny-level tutorial! SQL Server database backup and restore

Backing up and restoring a database using SQL Server Management Studio (SSMS)

1. Database backup

Step 1

Open SSMS and enter the server name, username and password to connect to your SQL Server instance.
insert image description here

Step 2

Expand Database and select the database you want to back up.
insert image description here
insert image description here

Step 3

Right-click the selected database and click Tasks --> Back Up
insert image description here

Step 4
Click Remove to delete the default backup address
insert image description here

Step
5Click Add
insert image description here

Step 6
Click ... to browse the local directory.
insert image description here

Step 7
Select a directory to save the backup file and fill in the backup file name, which should end with .bak, and click OK
insert image description here

Step 8
Keep clicking OK

insert image description here
insert image description here
insert image description here

Step 9

If the following prompt appears, it means that the database backup is successful.
insert image description here

Step 10

The backup database file can be found under the directory selected in Step 7.
insert image description here

2. Database restoration

Step 1

Open SSMS and enter the server name, username and password to connect to your SQL Server instance.
insert image description here

Step 2Right
-click Database and click New Database
insert image description here

Step 3
Enter the database name you want and click OK
insert image description here

Step 4
Select the newly created database in Step 3, right-click and click Tasks --> Restore --> Database
insert image description here

Step 5

Select Device and click ... to select the database backup file.
insert image description here

Step
6Click Add
insert image description here

Step 7
Select the database backup file and click OK
insert image description here

Step 8
Click OK
insert image description here

Step 9
Click Options, check Overwrite the existing database (WITH REPLACE), and click OK
insert image description here

Step 10
If the following prompt appears, the restoration is successful.
insert image description here

Step 11

Select the newly created database and expand Tbles to see the restored table.

insert image description here

Guess you like

Origin blog.csdn.net/qq_45631767/article/details/140777664