简体   繁体   English

SQL Server:为什么备份速度这么慢?

[英]SQL Server: Why is the backup speed so slow?

I have a backup query like this:我有一个像这样的备份查询:

BACKUP DATABASE @temp_baza TO DISK = @temp_bak
BACKUP LOG @temp_baza TO DISK = @temp_log

It is run by sqlcmd like this:它由 sqlcmd 运行,如下所示:

sqlcmd -l 120 -S %SQL_SERVER% -i %KOPIA_KATALOG%backupPELNY.sql 
       -o %KOPIA_KATALOG%output_PELNY.txt -v NAZWA_BAZY="%NAZWA_BAZY%" 
       -v KOPIA="%PELNY_KOPIA%\"
       

In output_PELNY.txt I have this kind of results:output_PELNY.txt我有这样的结果:

BACKUP DATABASE successfully processed 645127 pages in 2819.651 seconds (**1.787 MB/sec**).

or或者

BACKUP DATABASE successfully processed 26338 pages in 227.348 seconds (**0.905 MB/sec**).

Main DB is on one Disc, backup is on second disk.主数据库在一张磁盘上,备份在第二张磁盘上。

When I use Explorer to copy files between these two disks, I get a transfer speed of approximately 100 MB/s.当我使用资源管理器在这两个磁盘之间复制文件时,我获得了大约 100 MB/s 的传输速度。

QUESTION:题:

Why is the backup speed so slow - I mean less than 3MB/s?为什么备份速度这么慢——我的意思是低于 3MB/s?

REMARKS:评论:

  • Windows 2012 Essential + SQL Server 2008 R2 EXPRESS Windows 2012 Essential + SQL Server 2008 R2 EXPRESS
  • Intel XEON E3-1270 v3 + 16GB RAM英特尔至强 E3-1270 v3 + 16GB 内存

SQL Server 2008 R2 Express has the following limitations: SQL Server 2008 R2 Express 有以下限制:

  • Constrained to a single CPU (this limitation was raised in 2012 to "The lesser of one socket or four cores", so multi-threading is possible)受限于单个 CPU(此限制在 2012 年提高到“一个插槽或四个内核中的较小者”,因此多线程是可能的)
  • 1GB RAM 1GB 内存
  • 10GB database size (per database) 10GB 数据库大小(每个数据库)

So your backup is likely to be CPU bound and/or memory bound.因此,您的备份很可能受 CPU 限制和/或内存限制。

(Of course, it raises the obvious question: Why are you using an express version on your server? and why not a later SQL Server version?) (当然,它提出了一个显而易见的问题:为什么在服务器上使用快速版本?为什么不使用更高版本的 SQL Server?)

Ref.: SQL Server 2008 R2 Express Database Size Limit Increased to 10GB :参考: SQL Server 2008 R2 Express 数据库大小限制增加到 10GB

What about CPU and memory limits? CPU和内存限制呢? Are any other limits changed in SQL Server 2008 R2 Express? SQL Server 2008 R2 Express 中是否有任何其他限制更改?

  • No, the database size limit is the only limit we updated in SQL Server 2008 R2 Express.不,数据库大小限制是我们在 SQL Server 2008 R2 Express 中更新的唯一限制。 SQL Server 2008 R2 Express is still limited to 1 CPU and 1 GB of RAM. SQL Server 2008 R2 Express 仍然限制为 1 个 CPU 和 1 GB RAM。

To solve your problem, please refer to the following links:要解决您的问题,请参考以下链接:

  1. Options to Improve SQL Server Backup Performance 提高 SQL Server 备份性能的选项
  2. Is your SQL Server backup running slow? 您的 SQL Server 备份运行缓慢吗? Here's how you can speed it up 这是加快速度的方法
  3. Super-Fast Backup and Restore Throughput for SQL Server SQL Server 的超快备份和恢复吞吐量
  4. MS SQL Server backup optimization MS SQL Server 备份优化
  5. How to Make SQL Server Backups Go Faster 如何使 SQL Server 备份更快

Below are some sample queries for download以下是一些可供下载的示例查询

To solve the problem, I suggest that the following part of the query:为了解决这个问题,我建议查询的以下部分:

backup database DBNAME to disk='C:\1\DBNAME.bak' with buffercount=16 ,maxtransfersize=4194304

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM