Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of backup statements of MSSQL2005 Database

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "summary of backup statements of MSSQL2005 database". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "summary of backup statements of MSSQL2005 database".

-- full backup

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Full_20070908.bak

-- differential backup

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Diff_20070908.bak

With Differential

-- Log backup, which truncates logs by default

Backup Log NorthwindCS

To disk=G:BackupNorthwindCS_Log_20070908.bak

-- Log backup without truncating the log

Backup Log NorthwindCS

To disk=G:BackupNorthwindCS_Log_20070908.bak

With No_Truncate

-truncated logs are not retained

Backup Log NorthwindCS

With No_Log

-- or

Backup Log NorthwindCS

With Truncate_Only

-- the log file will not become smaller after truncation

Contraction can be carried out if necessary

-- File backup

Exec Sp_Helpdb NorthwindCS-View data files

Backup Database NorthwindCS

File=NorthwindCS-logical name of the data file

To disk=G:BackupNorthwindCS_File_20070908.bak

-- filegroup backup

Exec Sp_Helpdb NorthwindCS-View data files

Backup Database NorthwindCS

FileGroup=Primary-logical name of the data file

To disk=G:BackupNorthwindCS_FileGroup_20070908.bak

With init

-split backups to multiple destinations

-- you are not allowed to lose any targets during recovery.

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Full_1.bak

, disk=G:BackupNorthwindCS_Full_2.bak

-- Mirror backup

Every goal is the same.

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Mirror_1.bak

Mirror

To disk=G:BackupNorthwindCS_Mirror_2.bak

With Format-format the target the first time you make a mirror backup

-- Mirror backup to local and remote

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Mirror_1.bak

Mirror

To disk=\ 192.168.1.200BackupNorthwindCS_Mirror_2.bak

With Format

-- generate a backup file every day

Declare @ Path Nvarchar 2000

Set @ Path = Glax BackupNorthwindCSshield full _

+ Convert (Nvarchar,Getdate (), 112) + .bak

Backup Database NorthwindCS

To

-- from NoRecovery or

-- Standby mode is restored to available

Restore Database NorthwindCS_Bak

With Recovery

-- View the backup set in the target backup

Restore HeaderOnly

From Disk = G:BackupNorthwindCS_Full_20070908.bak

-- View the information of the first backup set of the target backup

Restore FileListOnly

From Disk = G:BackupNorthwindCS_Full_20070908_2.bak

With File=1

-- View the volume label of the target backup

Restore LabelOnly

From Disk = G:BackupNorthwindCS_Full_20070908_2.bak

-- backup Settings password protected backup

Backup Database NorthwindCS

To disk=G:BackupNorthwindCS_Full_20070908.bak

With Password = 123 _ init

Restore Database NorthwindCS

From disk=G:BackupNorthwindCS_Full_20070908.bak

With Password = 123

Thank you for your reading, the above is the content of "summary of backup statements of MSSQL2005 database". After the study of this article, I believe you have a deeper understanding of the summary of backup statements of MSSQL2005 database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report