将我们的数据库恢复到新的服务器硬件失败并出现页面错误。
Message
SQL Server detected a logical consistency-based I/O error:
incorrect pageid (expected 49:8125916; actual 49:29097436).
It occurred during a read of page (49:8125916) in database ID 7 at
offset 0x00000f7fbb8000 in file x:\Databases\Data07\DataWarehouse_OperationalData_15.ndf'.
Additional messages in the SQL Server error log or system event
log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately.
Complete a full database consistency check (DBCC CHECKDB).
This error can be caused by many factors;
for more information, see SQL Server Books Online.
在这个 70 TB 数据库和 6 年历史的服务器上,DBCC CheckDB 将花费我们大约一周的时间。
有没有可能是我的备份损坏了?
还是说新服务器有问题?
还是问题出在旧服务器上的生产数据库?
这是 SQL Server 2016 SP1 CU1,page_verify_option_desc 是 CHECKSUM。
这是我从新服务器上的错误日志中可以看到的:
Starting up database 'DataWarehouse'.
The database 'DataWarehouse' is marked RESTORING and is in a state that does not allow recovery to be run.
Error: 824, Severity: 16, State: 2.
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 49:8125916; actual 49:29097436). It occurred during a read of page (49:8125916) in database ID 7 at offset 0x00000f7fbb8000 in file 'S:\MSSQL\DSA\Databases\DataWarehouse\Data07\DataWarehouse_OperationalData_15.ndf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
Error: 18456, Severity: 14, State: 38.
当我在旧服务器上运行它时:
DBCC TRACEON (3604);
DBCC PAGE ('datawarehouse', 49, 8125916, 0);
我明白了
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
PAGE: (49:8125916)
BUFFER:
BUF @0x000000802C5E9300
bpage = 0x0000004DF03E8000 bhash = 0x0000000000000000 bpageno = (49:8125916)
bdbid = 5 breferences = 1 bcputicks = 0
bsampleCount = 0 bUse1 = 5844 bstat = 0x9
blog = 0x15ab215a bnext = 0x0000000000000000 bDirtyContext = 0x0000000000000000
bstat2 = 0x0
PAGE HEADER:
Page @0x0000004DF03E8000
m_pageId = (49:8125916) m_headerVersion = 1 m_type = 3
m_typeFlagBits = 0x0 m_level = 0 m_flagBits = 0xa200
m_objId (AllocUnitId.idObj) = 10814647 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72058302786633728
Metadata: PartitionId = 72058370492596224 Metadata: IndexId = 1
Metadata: ObjectId = 1916450641 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 0 m_slotCnt = 2 m_freeCnt = 2452
m_freeData = 5764 m_reservedCnt = 0 m_lsn = (2455108:11140830:20)
m_xactReserved = 0 m_xdesId = (28:447547798) m_ghostRecCnt = 0
m_tornBits = 31453216 DB Frag ID = 1
Allocation Status
GAM (49:7668480) = ALLOCATED SGAM (49:7668481) = NOT ALLOCATED
PFS (49:8120352) = 0x42 ALLOCATED 80_PCT_FULL DIFF (49:7668486) = CHANGED
ML (49:7668487) = NOT MIN_LOGGED
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
DBCC CHECKFILEGROUP 当前正在运行。完成没有错误。
SeanGallardy 评论了二进制数。我花了很长时间才明白他的意思,但我终于在程序员模式下在 Windows 计算器中输入了这两个数字,它显示的内容如下:
更新:我们进行了另一次备份并从旧服务器恢复到新服务器。这次我们收到了这样的信息:
Could not redo log record (2456609:4261461:64), for transaction ID (28:972770238), on page (48:211577379), allocation unit 72058359886184448, database 'DataWarehouse' (database ID 7).
Page: LSN = (2456609:3279166:236), allocation unit = 72058351460417536, type = 20. Log: OpCode = 2, context 5, PrevPageLSN: (2456609:4250688:2).
Restore from a backup of the database, or repair the database.
我试图用谷歌搜索这条消息,但我能找到的唯一建议是恢复数据库(这是我想要做的)。
真正的问题是;接下来我该怎么办?
在进行还原之前,您没有备份。
这可能听起来不像是 DBA.SE 问题的“答案”,但坦率地说,您在这里唯一合理的选择是向 Microsoft 提出支持案例并寻求帮助,或者聘请有信誉的专业人士(顾问或公司)修复 SQL Server 损坏问题的可靠记录。如果您买不起这些选项,则意味着数据不值得。