Skip to Content
0

Testing ASE MOUNT WITH FIXDBID clause

Mar 06, 2017 at 05:09 PM

44

avatar image

Hello,

I downloaded a newer version of ASE with the fix for CR 798271:

Adaptive Server Enterprise/15.7/EBF 26393 SMP SP138 /P/Solaris AMD64/OS 5.10/ase157sp138x/4002/64-bit/FBO/Mon Aug 29 21:14:14 2016

I wanted to try out the new "WITH FIXDBID" clause but it doesn't seem to work. I used the steps we used originally to cause 798271. I'm not sure if I am using "WITH FIXDBID" correctly?

NOTE: The "WITH ALLOW_DBID_MISMATCH" clause seems to work as I would expect it.

First I create some database devices and a database and then unmount it:

disk init name="d1", physname="/export/home/sybase/device/d1.dat", skip_alloc="true", size="10M"
disk init name="d1_log", physname="/export/home/sybase/device/d1_log.dat", skip_alloc="true", size="2M"
disk init name="d2", physname="/export/home/sybase/device/d2.dat", skip_alloc="true", size="10M"
disk init name="d2_log", physname="/export/home/sybase/device/d2_log.dat", skip_alloc="true", size="2M"
go
create database db1 on d1 = "6M" log on d1_log = '1M'
go
select db_id("db1")
go
        
 ------ 
      5 


unmount database db1 to "/tmp/db1.manifest" with override
go

Then I create a second database so that the dbid of the original database gets used:

unmount database db1 to "/tmp/db1.manifest" with override
go


create database db2 on d2 = "6M" log on d2_log = '1M'
go
CREATE DATABASE: allocating 1536 logical pages (6.0 megabytes) on disk 'd2' (1536 logical pages requested).
CREATE DATABASE: allocating 256 logical pages (1.0 megabytes) on disk 'd2_log' (256 logical pages requested).
Database 'db2' is now online.
select db_id("db2")
go
        
 ------ 
      5 

Now I mount the original database back and ignore the suggestion to run DBCC CHECKALLOC(). I issue "ALTER DATABASE" on this database to force the issue described under CR 798271 and then UNMOUNT it:

1> mount database db1 from "/tmp/db1.manifest"
2> go
Started estimating recovery log boundaries for database 'db1'.
Database 'db1', checkpoint=(1543, 13), first=(1543, 13), last=(1543, 13).
Completed estimating recovery log boundaries for database 'db1'.
Started ANALYSIS pass for database 'db1'.
Completed ANALYSIS pass for database 'db1'.
Started REDO pass for database 'db1'. The total number of log records to process is 1.
Completed REDO pass for database 'db1'.
Recovery of database 'db1' will undo incomplete nested top actions.
Started recovery checkpoint for database 'db1'.
Completed recovery checkpoint for database 'db1'.
Started filling free space info for database 'db1'.
Completed filling free space info for database 'db1'.
Started cleaning up the default data cache for database 'db1'.
Completed cleaning up the default data cache for database 'db1'.
MOUNT DATABASE: Completed recovery of mounted database 'db1'.
MOUNT DATABASE: A new database id was required for database 'db1' in order to mount it. Execute DBCC CHECKALLOC(db1, fixdbid) to
correct it.
1> ALTER DATABASE db1 on d1="4M"
2> go
Extending database by 1024 pages (4.0 megabytes) on disk d1
1> UNMOUNT DATABASE db1 to "/tmp/db1.bad.manifest"
2> go

Now I try to use the "WITH FIXDBID" clause but it fails:

1> MOUNT DATABASE db1 from "/tmp/db1.bad.manifest" WITH FIXDBID
2> go
Msg 14545, Level 16, State 1:
Server 'SRC_157_4K', Line 1:
Cannot locate the logical page 1792 for database 'db1', dbid=5, on the device 'd1'. The page on the device is logical page 1792 for
dbid 21.
Msg 14547, Level 16, State 1:
Server 'SRC_157_4K', Line 1:
The device '/export/home/sybase/device/d1.dat' does not correspond to the device 'd1' in the manifest file.
Msg 14519, Level 16, State 1:
Server 'SRC_157_4K', Line 1:
MOUNT DATABASE: Failed to validate the devices. The device allocations are not consistent with the descriptions in the manifest
file.

So I try again using the "WITH ALLOW_DBID_MISMATCH" clause and it seems to work:


1> MOUNT DATABASE db1 from "/tmp/db1.bad.manifest" WITH ALLOW_DBID_MISMATCH 2> go Started estimating recovery log boundaries for database 'db1'. Database 'db1', checkpoint=(1543, 13), first=(1543, 13), last=(1543, 13). Completed estimating recovery log boundaries for database 'db1'. Started ANALYSIS pass for database 'db1'. Completed ANALYSIS pass for database 'db1'. Started REDO pass for database 'db1'. The total number of log records to process is 1. Completed REDO pass for database 'db1'. Recovery of database 'db1' will undo incomplete nested top actions. Started recovery checkpoint for database 'db1'. Completed recovery checkpoint for database 'db1'. Started filling free space info for database 'db1'. Completed filling free space info for database 'db1'. Started cleaning up the default data cache for database 'db1'. Completed cleaning up the default data cache for database 'db1'. MOUNT DATABASE: Completed recovery of mounted database 'db1'. MOUNT DATABASE: A new database id was required for database 'db1' in order to mount it. Execute DBCC CHECKALLOC(db1, fixdbid) to correct it. 1> dbcc page(db1,0, 0, 0) 2> dbcc page(db1,1536, 0, 0) 3> dbcc page(db1,1792, 0, 0) 4> go | grep dbid bmass_next=0x0 bmass_prev=0x0 bdbid=21 pageno=0 dealloc_count=102 allocnode=0 ptnid=99 allocation_page dbid=5 timestamp=0000 00002730, segmap=0x00000003 (0x00000002 bmass_next=0x0 bmass_prev=0x0 bdbid=21 pageno=1536 dealloc_count=0 allocnode=0 ptnid=99 allocation_page dbid=5 timestamp=0000 00000001, segmap=0x00000004 (0x00000004 bmass_next=0x0 bmass_prev=0x0 bdbid=21 pageno=1792 dealloc_count=0 allocnode=0 ptnid=99 allocation_page dbid=21 timestamp=0000 00000001, segmap=0x00000003 (0x00000002 1> dbcc checkalloc(db1) 2> go Checking db1: Logical pagesize is 4096 bytes Database 'db1' is not in single user mode - may find spurious allocation problems due to transactions in progress. …etc… 7 allocation pages have been corrected to match database ID 21.

Am I using the "WITH FIXDBID" clause correctly?

Thanks,

Neal

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers