I did some analysis on my side, and I debug the script used to restore the database and the transaction log.
The first step is to restore the dump of the database using the load command.
Below the output of the load command after having received the 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.
Then there are a lot roll foward and the end of the execution, I have:
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.
So everything looks good, and the database remains offline as exepected:
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
Then, the same script is used to load the transaction log and the first thing is to check if the database is offline.
During this check, the following query is performed:
SELECT CONVERT(int, lct_admin('logsegment_freepages', db_id('db_warehouse')))
This query returns the following error:
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
Do you why this query returns this error? The only solution is to put online the db but then the transaction log restore fails (there was an activity in the db and then the sequence is not matching anymore).
Thanks
P