In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to compress the backup database in sql server. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
In SSMS, create a new query window and execute the database backup statement:
-- define variables and assign the QL script of the backup database to the variable declare @ SqlBackupDataBase as nvarchar (1000) set @ SqlBackupDataBase=N'BACKUP DATABASE Northwind TO DISK =''D:\ Northwind-'+CONVERT (varchar (11), GETDATE ()) + REPLACE (varchar (12), GETDATE (),':',') + .bak''--backup file format: Northwind-20170111132424.bakexec sp_executesql @ SqlBackupDataBase-- call the system stored procedure and execute SQL
After a successful backup, the backed up bak file has a size of 1.16G:
Then, excitedly copy the bak file to this machine
Result: always in the process of transmission, the transmission is automatically interrupted.
The reason is that the network is unstable and the network bandwidth is limited.
Think about it, can you back it up to a smaller bak file?
Finally, we use the new feature of sql server 2008 and above: compressed backup database.
In fact, it is to add "with STATS = 1 recording" to the statement of backing up the database.
The full compressed backup database statement is as follows:
-- define variables and assign the QL script of the backup database to the variable declare @ SqlBackupDataBase as nvarchar (1000) set @ SqlBackupDataBase=N'BACKUP DATABASE Northwind TO DISK =''D:\ Northwind-'+CONVERT (varchar (11), GETDATE (), 112) + REPLACE (varchar (12), GETDATE (),':',') + '.bak''+ 'with STATS = 1, Northwind-20170111132424.bakexec sp_executesql @ SqlBackupDataBase-- call the system stored procedure Execute SQL
After the backup is successful, it is found that the backed up bak file is only the size of 160MB:
Finally, the backup file of the database is successfully copied and restored to the local database.
On how to compress the backup database in sql server to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.