Home Database Mysql Tutorial SQL Server 数据库备份方法介绍

SQL Server 数据库备份方法介绍

Jun 07, 2016 pm 05:49 PM
database backup

我们知道在SQL Server 数据库备份方法有几种,如:完全备份,事务日志备份,差异备份,文件和文件组备份 下面我来给大家介绍介绍有需要了解的朋友可参考。

备份是指对或事务日志进行复制,当系统、磁盘或数据库文件损坏时,可以使用备份文件进行恢复,防止数据丢失。

  SQL Server数据库备份支持4种类型,分别应用于不同的场合,下面简要介绍。

  (1)完全备份

  完全备份,即完整数据库备份,可以备份整个数据库,包含用户表、系统表、索引、视图和存储过程等所有数据库对象。这是大多数人常用的方式,但需要花费更多的时间和空间,所以一般推荐一周做一次完全备份。 

  (2)事务日志备份

  事务日志备份时一个单独的文件,记录数据库的改变,备份时只需要复制上次备份以来对数据库所做的改变,可支持从数据库、差异或文件备份中快速恢复,时间少,速度快,推荐每小时甚至更频繁地备份事务日志。

  (3)差异备份

  在完整数据库备份之间执行差异数据备份,比完全备份小,因为只包含自完全备份以来所改变的数据库,优点是存储和恢复速度快。推荐每天做一次差异备份。

  (4)文件和文件组备份

  数据库一般由硬盘上的许多文件构成。如果这个数据库非常大,并且一个晚上也不能备份完,那么可以使用文件和文件组备份,每晚备份数据库的一部分。由于一般情况下数据库不会大到必须使用多个文件存储,所以此种备份并不常用。

  本实例运用SQLDMO.backup对象完成整个系统数据库的备份。这使得在系统或数据库发生故障(如硬盘发生故障)时可以重建系统。

  备份整个数据库的语法如下:


BACKUP DATABASE {database_name|@database_name_var}
TO[,...n]
[WITH
        [BLOCKSIZE={blocksize|@blocksize_variable}]
        [[,]DESCRIPTION={'text'|@text_variable}]
        [[,]DIFFERENTIAL]
        [[,]EXPIREDATE={date|@date_var}
            |RETAINDAYS={days|@days_var}]
        [[,]PASSWORD={pass|@password_variable}]
        [[,]FORMAT|NOFORMAT]
        [[,]{INIT|NOINIT}]
        [[,]MEDIADESCRIPTION={'text'|@text_variable}]
        [[,]MEDIANAME={media_name|@media_name_variable}]
        [[,]MEDIAPASSWORD={mediapassword|@mediapassword_variable}]
        [[,]NAME={backup_set_name|@backup_set_name_var}]
        [[,]{NOSKIP|SKIP}]
        [[,]{NOREWIND|REWIND}]
        [[,]{NOUNLOAD|UNLOAD}]
        [[,]RESTART]
        [[,]STATS[=percentage]]
]  

备份数据库参数及说明如下:
首先,在“企业管理器”中右键点击动易的数据库,弹出菜单中选择“所有任务/备份数据库”



然后,保持其他选项不变,在“目的”一项中点击“添加”:



弹出的菜单中,选择按文件保存备份,在“文件名”后输入你要保存到的路径和文件名:



点击“确定”返回最初弹出的界面,点“确定”完成备份。



备份文件可以随便迁移到任何地方,包括另外的服务器都可以。在新的服务器上,首先新建一个数据库,只需输入和原来一样的数据库名字即可,其他任何设置都不要改动,建立以后,不必运行sql脚本生成数据库,也不要从mdb数据库中导入数据:

 



数据库建立之后,在新建立的数据库上点右键,选择“所有任务/还原数据库”



弹出的窗口中,还原的类型选择“从设备”,然后点“选择设备”:



系统默认是“还原自磁盘”,点击“添加”:



弹出选择还原目的的窗口,在“文件名”后面输入(或者选取)你的备份文件:



点两次确定回到还原数据库的最初窗口,在这里选择“选项”,钩选“在现有数据库上强制还原”,然后点确定。



OK,至此大功告成:



通过这个方法,可以实现备份、还原数据库,也可以用于将SQL数据库迁移到其它服务器上。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and PDO: How to perform database backup and restore operations PHP and PDO: How to perform database backup and restore operations Jul 29, 2023 pm 06:54 PM

PHP and PDO: How to perform database backup and restore operations When developing web applications, database backup and restore are very important tasks. As a popular server-side scripting language, PHP provides a wealth of libraries and extensions, among which PDO (PHP Data Objects) is a powerful database access abstraction layer. This article will introduce how to use PHP and PDO to perform database backup and restore operations. Step 1: Connect to the database Before actual operation, we need to establish a connection to the database. Use PDO pair

Analysis of project experience on MySQL database backup and recovery performance optimization Analysis of project experience on MySQL database backup and recovery performance optimization Nov 02, 2023 am 08:53 AM

In the current Internet era, the importance of data is self-evident. As one of the core components of Internet applications, database backup and recovery work is particularly important. However, as the amount of data continues to increase and business requirements become increasingly complex, traditional database backup and recovery solutions can no longer meet the high availability and high performance requirements of modern applications. Therefore, optimizing the backup and recovery performance of MySQL database has become an urgent problem that needs to be solved. In practice, we have adopted a series of project experiences to effectively improve MySQL data

How to use ThinkPHP6 to implement database backup and recovery How to use ThinkPHP6 to implement database backup and recovery Jun 20, 2023 pm 07:25 PM

In the process of developing business systems, the database is a very important part. Therefore, backing up and restoring the database is a very necessary operation. This article will combine examples of the ThinkPHP6 framework to introduce how to use ThinkPHP6 to implement database backup and recovery. 1. Database backup 1.1 Environment preparation Before performing database backup, you need to confirm the following points: 1. You need to set the bin directory address of the mysql database and add its path to the system Path variable; 2. Mysqld needs to be installed

Database backup, optimization and recovery of Pagoda Panel Database backup, optimization and recovery of Pagoda Panel Jun 21, 2023 am 09:45 AM

In today's online world, websites have become an important carrier for every enterprise, organization or individual to display their brands, services, products, etc. In order to ensure the normal operation and security of the website, we need to continuously back up and optimize the database. and recovery. As a server management software with simple operation, rich functions and beautiful interface, Pagoda Panel is also quite excellent in database management and has important functions such as backup, optimization and recovery. This article will focus on the database backup, optimization and recovery functions of Pagoda Panel and related concerns.

PHP and Memcached database backup and recovery PHP and Memcached database backup and recovery May 15, 2023 pm 09:12 PM

With the rapid development of the Internet, large-scale MySQL database backup and recovery has become one of the essential skills for major enterprises and websites. With the widespread application of Memcached, how to back up and restore Memcached has also become an important issue. As one of the main languages ​​for web development, PHP has unique advantages and skills in handling backup and recovery of MySQL and Memcached. This article will introduce in detail the implementation method of PHP processing MySQL and Memcached backup and recovery.

How to backup database in Golang? How to backup database in Golang? Jun 01, 2024 am 11:56 AM

Backing up your database in Golang is crucial to protecting your data. You can use the database/sql package in the standard library, or a third-party package such as github.com/go-sql-driver/mysql. Specific steps include: Connect to the database. Create a file to store the backup data. Use the Dump function or Exporter to back up the database to a file.

How to use thinkorm to implement database backup and restore How to use thinkorm to implement database backup and restore Jul 28, 2023 pm 02:05 PM

Title: Using ThinkORM to realize database backup and restoration Introduction: In the development process, database backup and restoration is a very important task. This article will introduce how to use the ThinkORM framework to implement database backup and restoration, and provide corresponding code examples. 1. Background introduction During the development process, we usually use databases to store and manage data. The principle of database backup and restore is to perform regular backups of the database so that the data can be quickly restored in the event of database problems or data loss. With the help of

Project experience analysis of MySQL database backup and recovery strategy Project experience analysis of MySQL database backup and recovery strategy Nov 02, 2023 pm 06:23 PM

Project experience analysis of MySQL database backup and recovery strategy Summary: MySQL database, as an open source and stable and reliable relational database management system, is widely used in various enterprise projects. Database backup and recovery is an important task to ensure data security and availability. This article will share some practical experience in MySQL database backup and recovery strategies accumulated in the project. Introduction: For any enterprise, data is one of the most important assets, and the database is the core system for saving, managing and processing this data.

See all articles