亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

SqlServer備份和恢復的方法

發布時間:2021-08-30 21:49:36 來源:億速云 閱讀:122 作者:chen 欄目:關系型數據庫

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

SqlServer備份和恢復

備份

---創建測試數據庫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);

---創建測試數據

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');

---數據庫全備

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');

---數據庫差異備份

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');

---數據庫日志備份

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備份和恢復的方法”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

白水县| 方山县| 青阳县| 海城市| 彭山县| 诸城市| 大埔县| 嘉义县| 龙口市| 修武县| 灵川县| 宜君县| 上虞市| 句容市| 子洲县| 阿鲁科尔沁旗| 永顺县| 舞阳县| 胶州市| 丰县| 枞阳县| 邢台市| 安达市| 建湖县| 高安市| 卫辉市| 息烽县| 安阳市| 师宗县| 通化市| 正安县| 德格县| 涟水县| 贵南县| 惠来县| 和龙市| 凤翔县| 东莞市| 科技| 台中市| 宁乡县|