SQL Server:是否可以使用SQL脚本确定SQL Server备份或还原过程的进度? [英] SQL-Server: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process?

查看:155
本文介绍了SQL Server:是否可以使用SQL脚本确定SQL Server备份或还原过程的进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用MS SQL Server Management Studio备份或还原数据库时,可以直观地看到该过程进行了多长时间,因此还需要等待多长时间才能完成.如果我启动备份或使用脚本还原,是否有办法监视进度,或者我只是坐下来等待它完成(希望没有任何问题?)

When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish. If I kick off the backup or restore with a script, is there a way to monitor the progress, or do I just sit back and wait for it to finish (hoping that nothing has gone wrong?)

已编辑:我特别需要能够与启动备份或还原的会话完全独立地监视备份或还原的进度.

Edited: My need is specifically to be able to monitor the backup or restore progress completely separate from the session where the backup or restore was initiated.

推荐答案

是.如果您已安装 sp_who2k5 进入您的主数据库,您只需运行:

Yes. If you have installed sp_who2k5 into your master database, you can simply run:

sp_who2k5 1,1

结果集将包含所有活动交易.当前正在运行的备份将在 requestCommand 字段中包含字符串"BACKUP".适当命名的 percentComplete 字段将为您提供备份进度.

The resultset will include all the active transactions. The currently running backup(s) will contain the string "BACKUP" in the requestCommand field. The aptly named percentComplete field will give you the progress of the backup.

请注意:sp_who2k5应该成为每个人工具包的一部分,它所做的不仅仅限于此.

Note: sp_who2k5 should be a part of everyone's toolkit, it does a lot more than just this.

这篇关于SQL Server:是否可以使用SQL脚本确定SQL Server备份或还原过程的进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆