升级应用程序数据库架构

问题描述:

我有来自应用程序供应商的70多个脚本来升级数据库,我正在尝试使用SQLCMD自动执行这些脚本。我试图通过将数据库置于单用户模式来保护数据库免受其他会话的影响。但是,当脚本从一个脚本移动到另一个脚本时,数据库
备份过程或其他杂项进程会阻止我。有没有更好的方法来处理这个?我已经禁用了尽可能多的已知流程。

I have 70+ scripts from an Application Vendor to upgrade a database and I am trying to automate executing these scripts using SQLCMD. I have tried to shield the database from other sessions by taking the database into Single-user mode. However, database backup process or other miscellaneous process keeps blocking me as the scripts move from one to another. Is there a better way to handle this? I have disabled as many known process as possible.

谢谢!

你是否使用脚本来在单用户模式下设置数据库,如下所示?

Do you use the script to set database in single user mode, like this?

USE master;

GO

ALTER DATABASE YourDatabase

SET SINGLE_USER

立即回滚;

GO