备份还原因多用户模式错误而失败
Backup restore fails on multi-user mode error
我有一个脚本可以自动从备份中恢复数据库。我的脚本首先停止所有应用程序服务器实例,停止所有数据库,然后从备份中恢复。下面是伪代码:
foreach appserver:
asbman -name (appserver) -stop
foreach database:
dbman -name (database) -stop
proutil database.db -C enablelargefiles
echo y | prorest database.db backup.bak -verbose
一旦我的脚本执行到 prorest 命令,它就会输出以下错误:
** The database D:\Directory\Wrk\db\database is in use in multi-user mode. (276)
等待约 60 秒后,运行 prorest 命令再次按预期执行,数据库已正确恢复。我的猜测是,在数据库停止后,有一些与数据库相关的进程仍然 运行。我想找到解决这个问题的方法,而不必使用诸如睡眠重试之类的方法来确定数据库何时能够恢复。这个问题有没有解决办法,或者有更好的方法可以这样恢复数据库吗?
有一些超时可以发挥作用:
When an unconditional batch shutdown runs (PROSHUT -by), the following sequence of events takes place:
If there are any running processes left after:
- 30 Seconds - wake up clients waiting for locks.
- 60 Seconds - wake up clients waiting for locks.
- 90 Seconds - wake up clients waiting on screen input.
- 5 Minutes - Resend the shutdown signal to remaining clients.
- 10 Minutes - Send a terminate (SIGTERM) signal to remaining clients.
更多信息在这里:
http://knowledgebase.progress.com/articles/Article/P3222
您可以跟踪 database.lg 文件并查找告诉您数据库已关闭的消息:
[2017/02/06@20:20:56.353+0100] P-14292 T-13420 I SHUT 5: (542) Server shutdown started by Jens on CON:.
[2017/02/06@20:20:56.499+0100] P-10276 T-11404 I BROKER 0: (15193) The normal shutdown of the database will continue for 10 Min 0 Sec if required.
[2017/02/06@20:20:56.499+0100] P-10276 T-11404 I BROKER 0: (2248) Begin normal shutdown
[2017/02/06@20:20:57.499+0100] P-10276 T-11404 I BROKER 0: (2263) Resending shutdown request to 0 user(s).
[2017/02/06@20:21:01.692+0100] P-10276 T-11404 I BROKER 0: (15109) At Database close the number of live transactions is 0.
[2017/02/06@20:21:01.692+0100] P-10276 T-11404 I BROKER 0: (15743) Before Image Log Completion at Block 1 Offset 5300.
[2017/02/06@20:21:01.693+0100] P-10276 T-11404 I BROKER 0: (453) Logout by Jens on CON:.
[2017/02/06@20:21:01.694+0100] P-10276 T-11404 I BROKER : (16869) Removed shared memory with segment_id: 50528256
[2017/02/06@20:21:01.694+0100] P-10276 T-11404 I BROKER : (334) Multi-user session end.
[2017/02/06@20:21:02.356+0100] P-14292 T-13420 I SHUT 5: (453) Logout by Jens on CON:.
(334) 消息基本上是在告诉您数据库已关闭。
另一种选择是检查数据库锁定文件 (database.lk)。仅当数据库为 运行:
时才存在
...
2017-02-06 20:21 2 228 224 mySportsDb.b1
2017-02-06 20:21 1 703 936 mySportsDb.d1
2017-02-06 20:21 32 768 mySportsDb.db
2017-02-06 20:21 89 643 mySportsDb.lg
2017-02-06 18:00 920 mySportsDb.lic
2017-02-06 20:26 265 mySportsDb.lk
...
还有几个脚本可以运行检查数据库的状态。在这里查看更多:
我有一个脚本可以自动从备份中恢复数据库。我的脚本首先停止所有应用程序服务器实例,停止所有数据库,然后从备份中恢复。下面是伪代码:
foreach appserver:
asbman -name (appserver) -stop
foreach database:
dbman -name (database) -stop
proutil database.db -C enablelargefiles
echo y | prorest database.db backup.bak -verbose
一旦我的脚本执行到 prorest 命令,它就会输出以下错误:
** The database D:\Directory\Wrk\db\database is in use in multi-user mode. (276)
等待约 60 秒后,运行 prorest 命令再次按预期执行,数据库已正确恢复。我的猜测是,在数据库停止后,有一些与数据库相关的进程仍然 运行。我想找到解决这个问题的方法,而不必使用诸如睡眠重试之类的方法来确定数据库何时能够恢复。这个问题有没有解决办法,或者有更好的方法可以这样恢复数据库吗?
有一些超时可以发挥作用:
When an unconditional batch shutdown runs (PROSHUT -by), the following sequence of events takes place:
If there are any running processes left after:
- 30 Seconds - wake up clients waiting for locks.
- 60 Seconds - wake up clients waiting for locks.
- 90 Seconds - wake up clients waiting on screen input.
- 5 Minutes - Resend the shutdown signal to remaining clients.
- 10 Minutes - Send a terminate (SIGTERM) signal to remaining clients.
更多信息在这里: http://knowledgebase.progress.com/articles/Article/P3222
您可以跟踪 database.lg 文件并查找告诉您数据库已关闭的消息:
[2017/02/06@20:20:56.353+0100] P-14292 T-13420 I SHUT 5: (542) Server shutdown started by Jens on CON:.
[2017/02/06@20:20:56.499+0100] P-10276 T-11404 I BROKER 0: (15193) The normal shutdown of the database will continue for 10 Min 0 Sec if required.
[2017/02/06@20:20:56.499+0100] P-10276 T-11404 I BROKER 0: (2248) Begin normal shutdown
[2017/02/06@20:20:57.499+0100] P-10276 T-11404 I BROKER 0: (2263) Resending shutdown request to 0 user(s).
[2017/02/06@20:21:01.692+0100] P-10276 T-11404 I BROKER 0: (15109) At Database close the number of live transactions is 0.
[2017/02/06@20:21:01.692+0100] P-10276 T-11404 I BROKER 0: (15743) Before Image Log Completion at Block 1 Offset 5300.
[2017/02/06@20:21:01.693+0100] P-10276 T-11404 I BROKER 0: (453) Logout by Jens on CON:.
[2017/02/06@20:21:01.694+0100] P-10276 T-11404 I BROKER : (16869) Removed shared memory with segment_id: 50528256
[2017/02/06@20:21:01.694+0100] P-10276 T-11404 I BROKER : (334) Multi-user session end.
[2017/02/06@20:21:02.356+0100] P-14292 T-13420 I SHUT 5: (453) Logout by Jens on CON:.
(334) 消息基本上是在告诉您数据库已关闭。
另一种选择是检查数据库锁定文件 (database.lk)。仅当数据库为 运行:
时才存在...
2017-02-06 20:21 2 228 224 mySportsDb.b1
2017-02-06 20:21 1 703 936 mySportsDb.d1
2017-02-06 20:21 32 768 mySportsDb.db
2017-02-06 20:21 89 643 mySportsDb.lg
2017-02-06 18:00 920 mySportsDb.lic
2017-02-06 20:26 265 mySportsDb.lk
...
还有几个脚本可以运行检查数据库的状态。在这里查看更多: