我有两个数据库:DB_1Large和DB_2Medium
它看起来很荒谬,但这个数据库的备份有下一个尺寸:
在使用win rar或studio进行压缩之后,这会有下一个尺寸:
为什么以及如何缩小它?
两个数据库的exec sp_spaceused:
database_name database_size unallocated space
DB_1Large 52349.38 MB 20197.74 MB
reserved data index_size unused
30546184 KB 16273760 KB 13500336 KB 772088 KB
database_name database_size unallocated space
DB_2Medium 17144.19 MB 4672.13 MB
reserved data index_size unused
12457024 KB 10608232 KB 1809120 KB 39672 KB
答案 0 :(得分:0)
此处COMPRESSION在备份时指定,它将压缩数据库并进行备份
Use master
Go
BACKUP DATABASE [DatabaseName]
TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\DatabaseName_2017-08-07.bak'
WITH COPY_ONLY, NOFORMAT, NOINIT,
NAME = N'SqlClass-Full Database Backup',
SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 5
GO
答案 1 :(得分:0)
假设您不使用 if msg.is_multipart():
for part in msg.walk():
base = ""
if (part.is_attachment()):
payload = part.get_payload()
for elem in payload:
base+=str(elem)
withattachment = "yes"
name = part.get_filename()
base=base.replace("\n","")
else:
base = None
if (msg.is_attachment()):
withattachment = "yes"
name = msg.get_filename()
base =msg.get_payload()
选项,您的数据库会相应地拥有30Gb和12Gb的数据。备份仅备份数据而不备份空白区域。
如果你对win rar压缩比感兴趣,也许你最好搜索它的压缩算法,也许你的第二个备份由于重复的字节组合而更“可压缩”