0

我们的 DR sybase 解决方案基于恢复完整备份,然后从主站点转储事务日志。sybase 是旧版本:ASE15.0 但是,解决方法不行。恢复完整备份后(没有错误),事务日志的恢复失败(说在数据库上执行了活动)。我认为是因为在恢复完整备份之后,序列被破坏了:

数据库'db_warehouse',检查点=(2511803, 20), first=(2511803, 20), last=(2511900, 1)

谁能帮我理解我为什么会有这种行为?

用于恢复数据库的命令如下:

load database db_warehouse from "/dumps/sybase/db_warehouse_20191215010001.dmp

提前谢谢P

4

1 回答 1

0

我做了一些分析,我调试了用于恢复数据库和事务日志的脚本。

第一步是使用 load 命令恢复数据库的转储。在收到 100% 后的加载命令的输出下方

Backup Server: 3.42.1.1: LOAD is complete (database db_warehouse).
Started estimating recovery log boundaries for database 'db_warehouse'.
Database 'db_warehouse', checkpoint=(2511803, 20), first=(2511803, 20), last=(2511900, 1).
Completed estimating recovery log boundaries for database 'db_warehouse'.
Started ANALYSIS pass for database 'db_warehouse'.
Completed ANALYSIS pass for database 'db_warehouse'.
Started REDO pass for database 'db_warehouse'. The total number of log records to process is 1315.

然后有很多前滚和执行结束,我有:

Redo pass of recovery has processed 145 committed and 0 aborted transactions.
Completed REDO pass for database 'db_warehouse'.
Use the ONLINE DATABASE command to bring this database online; ASE will not bring it online automatically.

所以一切看起来都很好,并且数据库按预期保持离线:

name                           dbid   suid        status version logptr      crdate                  dumptrdate              status2 audflags    deftabaud   defvwaud    defpraud    def_remote_type def_remote_loc                                                                                                                                                                                                                                                                                                                                                status3     status4     audflags2                         
 ------------------------------ ------ ----------- ------ ------- ----------- ----------------------- ----------------------- ------- ----------- ----------- ----------- ----------- --------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ----------------------------------
 db_warehouse                              8           1     12       1     2510827 2019-12-16 22:28:44.006 2019-12-14 23:50:00.866      16           0           0           0           0            NULL NULL                                                                                                                                                                                                                                                                                                                                                               131072           0 NULL 

然后,使用相同的脚本加载事务日志,首先检查数据库是否处于脱机状态。在此检查期间,将执行以下查询:

SELECT CONVERT(int, lct_admin('logsegment_freepages', db_id('db_warehouse')))

此查询返回以下错误:

Msg 921, Level 14, State 2
Server 'SYBASE_WAREHOUSE', Line 1
Database 'db_warehouse' has not been recovered yet - please wait and try again.

 -----------
           0

你为什么这个查询返回这个错误?唯一的解决方案是使数据库联机,但事务日志恢复失败(数据库中有活动,然后序列不再匹配)。

谢谢P

于 2019-12-17T16:40:50.727 回答