Ms Sql Server 简明教程
MS SQL Server - Creating Backups
Backup 是对数据/数据库等内容的拷贝。备份 MS SQL Server 数据库对于保护数据至关重要。MS SQL Server 备份主要分为三种类型:完全或数据库、差分或增量以及事务日志或日志。
Backup is a copy of data/database, etc. Backing up MS SQL Server database is essential for protecting data. MS SQL Server backups are mainly three types − Full or Database, Differential or Incremental, and Transactional Log or Log.
可以使用以下两种方法之一进行备份数据库。
Backup database can be done using either of the following two methods.
Method 1 – Using T-SQL
Differential Type
Backup database <Your database name> to
disk = '<Backup file location + file name>' with differential
Example
以下命令用于对名为“TestDB”的数据库进行完全备份,将“TestDB_Full.bak”备份文件存入“D:\”位置。
The following command is used for full backup database called 'TestDB' to the location 'D:\' with backup file name 'TestDB_Full.bak'
Backup database TestDB to disk = 'D:\TestDB_Full.bak'
以下命令用于对名为“TestDB”的数据库进行差分备份,将“TestDB_diff.bak”备份文件存入“D:\”位置。
The following command is used for differential backup database called 'TestDB' to the location 'D:\' with backup file name 'TestDB_diff.bak'
Backup database TestDB to disk = 'D:\TestDB_diff.bak' with differential
以下命令用于对名为“TestDB”的数据库进行日志备份,将“TestDB_log.trn”备份文件存入“D:\”位置。
The following command is used for Log backup database called 'TestDB' to the location 'D:\' with backup file name 'TestDB_log.trn'
Backup log TestDB to disk = 'D:\TestDB_log.trn'
Method 2 – Using SSMS (SQL SERVER Management Studio)
Step 1 - 连接到名为“TESTINSTANCE”的数据库实例,然后展开数据库文件夹,如下方的快照所示。
Step 1 − Connect to database instance named 'TESTINSTANCE' and expand databases folder as shown in the following snapshot.
Step 2 - 右键点击“TestDB”数据库,然后选择任务。点击备份,将会看到以下画面。
Step 2 − Right-click on 'TestDB' database and select tasks. Click Backup and the following screen will appear.
Step 3 - 选择备份类型(完全/差分/日志),并务必检查备份文件即将创建的目标路径。选择左上角的选项,以查看以下画面。
Step 3 − Select backup type (Full\diff\log) and make sure to check destination path which is where the backup file will be created. Select options at the top left corner to see the following screen.
Step 4 - 点击确定创建“TestDB”数据库的完全备份,如下方的快照所示。
Step 4 − Click OK to create 'TestDB' database full backup as shown in the following snapshot.