真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

SqlServer備份和恢復的方法

本篇內(nèi)容介紹了“SqlServer備份和恢復的方法”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!

成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比湖北網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式湖北網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋湖北地區(qū)。費用合理售后完善,10多年實體公司更值得信賴。

SqlServer備份和恢復

備份

---創(chuàng)建測試數(shù)據(jù)庫chen20181123

create database chen20181123

on

(name=chen_data,

filename='D:\hrtest\DB\testdata\chen20181123_data.mdf',

size=10MB,

filegrowth=1MB)

log on

(name=chen_log,

filename='D:\hrtest\DB\testdata\chen20181123_log.ldf',

size=1MB,

filegrowth=10MB);

---創(chuàng)建測試數(shù)據(jù)

use chen20181123

create table t1(id int,a varchar(100));

insert into t1 values(1,'a');

insert into t1 values(2,'b');

insert into t1 values(3,'c');

---數(shù)據(jù)庫全備

BACKUP DATABASE chen20181123

TO DISK='D:\hrtest\DB\testdata\backup\chen20181123_full.bak'  WITH COMPRESSION

GO

insert into t1 values(4,'d');

insert into t1 values(5,'e');

---數(shù)據(jù)庫差異備份

BACKUP DATABASE chen20181123

TO DISK='D:\hrtest\DB\testdata\backup\chen20181123_1.bak'  WITH COMPRESSION,DIFFERENTIAL;

GO

insert into t1 values(7,'f');

insert into t1 values(8,'g');

---數(shù)據(jù)庫日志備份

BACKUP LOG chen20181123 TO DISK='D:\hrtest\DB\testdata\backup\chen20181123_2.trn' WITH COMPRESSION;

insert into t1 values(9,'f');

insert into t1 values(10,'g');

---19:51

delete t1;

恢復場景

---恢復全備+差異備份 恢復

restore filelistonly from disk='D:\hrtest\DB\testdata\backup\chen20181123_full.bak';

RESTORE DATABASE chen20181123_1

  FROM DISK = 'D:\hrtest\DB\testdata\backup\chen20181123_full.bak'

  WITH NORECOVERY,

  MOVE 'chen_data' TO 'D:\hrtest\DB\testdata\chen20181123_1_data.mdf',  

  MOVE 'chen_log' TO 'D:\hrtest\DB\testdata\chen20181123_1_log.ldf';

RESTORE DATABASE chen20181123_1 from disk='D:\hrtest\DB\testdata\backup\chen20181123_1.bak'

  WITH RECOVERY;

select * from chen20181123_1.dbo.t1;  ---5

---恢復全備+差異備份+日志備份 恢復

USE MASTER

---drop database chen20181123_2;

RESTORE DATABASE chen20181123_2

  FROM DISK = 'D:\hrtest\DB\testdata\backup\chen20181123_full.bak'

  WITH NORECOVERY,

  MOVE 'chen_data' TO 'D:\hrtest\DB\testdata\chen20181123_2_data.mdf',  

  MOVE 'chen_log' TO 'D:\hrtest\DB\testdata\chen20181123_2_log.ldf';

RESTORE DATABASE chen20181123_2 from disk='D:\hrtest\DB\testdata\backup\chen20181123_1.bak'

  WITH NORECOVERY;

RESTORE LOG chen20181123_2 from disk='D:\hrtest\DB\testdata\backup\chen20181123_2.trn'

  WITH RECOVERY;

select * from chen20181123_2.dbo.t1;  ---7

---20:33

BACKUP LOG chen20181123 TO DISK='D:\hrtest\DB\testdata\backup\chen20181123_3.trn' WITH COMPRESSION;

---恢復全備+差異備份+日志備份+新日志備份 恢復

USE MASTER

RESTORE DATABASE chen20181123_3

  FROM DISK = 'D:\hrtest\DB\testdata\backup\chen20181123_full.bak'

  WITH NORECOVERY,

  MOVE 'chen_data' TO 'D:\hrtest\DB\testdata\chen20181123_3_data.mdf',  

  MOVE 'chen_log' TO 'D:\hrtest\DB\testdata\chen20181123_3_log.ldf';

RESTORE DATABASE chen20181123_3 from disk='D:\hrtest\DB\testdata\backup\chen20181123_1.bak'

  WITH NORECOVERY;

RESTORE LOG chen20181123_3 from disk='D:\hrtest\DB\testdata\backup\chen20181123_2.trn'

  WITH NORECOVERY;

RESTORE LOG chen20181123_3 from disk='D:\hrtest\DB\testdata\backup\chen20181123_3.trn'

  WITH RECOVERY;

select * from chen20181123_3.dbo.t1;  ---0

---恢復全備+差異備份+日志備份+新日志備份+基于時間點不完全恢復

USE MASTER

---drop database chen20181123_5;

RESTORE DATABASE chen20181123_5

  FROM DISK = 'D:\hrtest\DB\testdata\backup\chen20181123_full.bak'

  WITH NORECOVERY,

  MOVE 'chen_data' TO 'D:\hrtest\DB\testdata\chen20181123_5_data.mdf',  

  MOVE 'chen_log' TO 'D:\hrtest\DB\testdata\chen20181123_5_log.ldf';

RESTORE DATABASE chen20181123_5 from disk='D:\hrtest\DB\testdata\backup\chen20181123_1.bak'

  WITH NORECOVERY;

RESTORE LOG chen20181123_5 from disk='D:\hrtest\DB\testdata\backup\chen20181123_2.trn'

  WITH NORECOVERY;

RESTORE LOG chen20181123_5 from disk='D:\hrtest\DB\testdata\backup\chen20181123_3.trn'

  WITH RECOVERY,STOPAT='2018-11-23 19:50:00';

select * from chen20181123_5.dbo.t1;  ---9

“SqlServer備份和恢復的方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識可以關注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!


新聞標題:SqlServer備份和恢復的方法
鏈接URL:http://weahome.cn/article/jjgegi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部