今天一个同事说在一个生产库执行某个存储过程,遇到了错误: Fatal error 605 occurred at jul 29 2014

我试着执行该存储过程,结果出现下面错误,每次执行该存储过程,得到的错误内容都不一样(page变化,还有就是allocation unit)变化

消息 605,级别 21,状态 3,过程 usp_xxxxxxxxx,第 228 行

Attempt to fetch logical page (7:121808) in database 2 failed. It belongs to allocation unit 8358680970783621120 not to 5332262008984567808.

消息 605,级别 21,状态 3,过程 usp_xxxxxxxxx,第 228 行

Attempt to fetch logical page (3:122376) in database 2 failed. It belongs to allocation unit 8574853753020284928 not to 5332262008984567808.

消息 605,级别 21,状态 3,过程 usp_xxxxxxxxx,第 228 行

Attempt to fetch logical page (7:394) in database 2 failed. It belongs to allocation unit 7782220197180997632 not to 1297036693380923392.

第一次遇到这个问题,首先我想到的是是否数据库tempdb是否有一致性错误问题,因为tempdb的database_id为2.于是我对tempdb数据库做了dbcc checkb 完整一致性检查,结果如下所示,没有发现任何问题。

DBCC CHECKDB('tempdb')

 

DBCC results for 'tempdb'. 

 

DBCC CHECKDB will not check SQL Server catalog or Service Broker consistency because a database snapshot could not be created or because WITH TABLOCK was specified. 

 

DBCC results for 'sys.sysrscols'. 

 

There are 754 rows in 8 pages for object "sys.sysrscols". 

 

DBCC results for 'sys.sysrowsets'. 

 

There are 107 rows in 1 pages for object "sys.sysrowsets". 

 

DBCC results for 'sys.sysallocunits'. 

 

There are 119 rows in 2 pages for object "sys.sysallocunits". 

 

DBCC results for 'sys.sysfiles1'. 

 

There are 8 rows in 1 pages for object "sys.sysfiles1". 

 

DBCC results for 'sys.syspriorities'. 

 

There are 0 rows in 0 pages for object "sys.syspriorities". 

 

DBCC results for 'sys.sysfgfrag'. 

 

There are 2 rows in 1 pages for object "sys.sysfgfrag". 

 

DBCC results for 'sys.sysphfg'. 

 

There are 1 rows in 1 pages for object "sys.sysphfg". 

 

DBCC results for 'sys.sysprufiles'. 

 

There are 8 rows in 1 pages for object "sys.sysprufiles". 

 

DBCC results for 'sys.sysftinds'. 

 

There are 0 rows in 0 pages for object "sys.sysftinds". 

 

DBCC results for 'sys.sysowners'. 

 

There are 14 rows in 1 pages for object "sys.sysowners". 

 

DBCC results for 'sys.sysprivs'. 

 

There are 131 rows in 1 pages for object "sys.sysprivs". 

 

DBCC results for 'sys.sysschobjs'. 

 

There are 84 rows in 1 pages for object "sys.sysschobjs". 

 

DBCC results for 'sys.syscolpars'. 

 

There are 598 rows in 10 pages for object "sys.syscolpars". 

 

DBCC results for 'sys.sysnsobjs'. 

 

There are 1 rows in 1 pages for object "sys.sysnsobjs". 

 

DBCC results for 'sys.syscerts'. 

 

There are 0 rows in 0 pages for object "sys.syscerts". 

 

DBCC results for 'sys.sysxprops'. 

 

There are 0 rows in 0 pages for object "sys.sysxprops". 

 

DBCC results for 'sys.sysscalartypes'. 

 

There are 34 rows in 1 pages for object "sys.sysscalartypes". 

 

DBCC results for 'sys.systypedsubobjs'. 

 

There are 0 rows in 0 pages for object "sys.systypedsubobjs". 

 

DBCC results for 'sys.sysidxstats'. 

 

There are 170 rows in 2 pages for object "sys.sysidxstats". 

 

DBCC results for 'sys.sysiscols'. 

 

There are 318 rows in 2 pages for object "sys.sysiscols". 

 

DBCC results for 'sys.sysbinobjs'. 

 

There are 23 rows in 1 pages for object "sys.sysbinobjs". 

 

DBCC results for 'sys.sysaudacts'. 

 

There are 0 rows in 0 pages for object "sys.sysaudacts". 

 

DBCC results for 'sys.sysobjvalues'. 

 

There are 179 rows in 26 pages for object "sys.sysobjvalues". 

 

DBCC results for 'sys.sysclsobjs'. 

 

There are 16 rows in 1 pages for object "sys.sysclsobjs". 

 

DBCC results for 'sys.sysrowsetrefs'. 

 

There are 0 rows in 0 pages for object "sys.sysrowsetrefs". 

 

DBCC results for 'sys.sysremsvcbinds'. 

 

There are 0 rows in 0 pages for object "sys.sysremsvcbinds". 

 

DBCC results for 'sys.sysxmitqueue'. 

 

There are 0 rows in 0 pages for object "sys.sysxmitqueue". 

 

DBCC results for 'sys.sysrts'. 

 

There are 1 rows in 1 pages for object "sys.sysrts". 

 

DBCC results for 'sys.sysconvgroup'. 

 

There are 0 rows in 0 pages for object "sys.sysconvgroup". 

 

DBCC results for 'sys.sysdesend'. 

 

There are 0 rows in 0 pages for object "sys.sysdesend". 

 

DBCC results for 'sys.sysdercv'. 

 

There are 0 rows in 0 pages for object "sys.sysdercv". 

 

DBCC results for 'sys.syssingleobjrefs'. 

 

There are 157 rows in 1 pages for object "sys.syssingleobjrefs". 

 

DBCC results for 'sys.sysmultiobjrefs'. 

 

There are 106 rows in 1 pages for object "sys.sysmultiobjrefs". 

 

DBCC results for 'sys.sysguidrefs'. 

 

There are 0 rows in 0 pages for object "sys.sysguidrefs". 

 

DBCC results for 'sys.syscompfragments'. 

 

There are 0 rows in 0 pages for object "sys.syscompfragments". 

 

DBCC results for 'sys.sysftstops'. 

 

There are 0 rows in 0 pages for object "sys.sysftstops". 

 

DBCC results for 'sys.sysqnames'. 

 

There are 97 rows in 1 pages for object "sys.sysqnames". 

 

DBCC results for 'sys.sysxmlcomponent'. 

 

There are 99 rows in 1 pages for object "sys.sysxmlcomponent". 

 

DBCC results for 'sys.sysxmlfacet'. 

 

There are 112 rows in 1 pages for object "sys.sysxmlfacet". 

 

DBCC results for 'sys.sysxmlplacement'. 

 

There are 18 rows in 1 pages for object "sys.sysxmlplacement". 

 

DBCC results for 'sys.sysobjkeycrypts'. 

 

There are 0 rows in 0 pages for object "sys.sysobjkeycrypts". 

 

DBCC results for 'sys.sysasymkeys'. 

 

There are 0 rows in 0 pages for object "sys.sysasymkeys". 

 

DBCC results for 'sys.syssqlguides'. 

 

There are 0 rows in 0 pages for object "sys.syssqlguides". 

 

DBCC results for 'sys.sysbinsubobjs'. 

 

There are 3 rows in 1 pages for object "sys.sysbinsubobjs". 

 

DBCC results for 'sys.syssoftobjrefs'. 

 

There are 0 rows in 0 pages for object "sys.syssoftobjrefs". 

 

DBCC results for 'sys.fulltext_thesaurus_phrase_table'. 

 

There are 0 rows in 0 pages for object "sys.fulltext_thesaurus_phrase_table". 

 

DBCC results for '#0519C6AF'. 

 

There are 0 rows in 0 pages for object "#0519C6AF". 

 

DBCC results for '#09DE7BCC'. 

 

There are 0 rows in 1 pages for object "#09DE7BCC". 

 

DBCC results for '#0AD2A005'. 

 

There are 0 rows in 1 pages for object "#0AD2A005". 

 

DBCC results for '#0BC6C43E'. 

 

There are 0 rows in 1 pages for object "#0BC6C43E". 

 

DBCC results for '#1CF15040'. 

 

There are 0 rows in 1 pages for object "#1CF15040". 

 

DBCC results for '#2D27B809'. 

 

There are 0 rows in 1 pages for object "#2D27B809". 

 

DBCC results for '#2E1BDC42'. 

 

There are 0 rows in 1 pages for object "#2E1BDC42". 

 

DBCC results for '#2F10007B'. 

 

There are 0 rows in 1 pages for object "#2F10007B". 

 

DBCC results for '#300424B4'. 

 

There are 0 rows in 1 pages for object "#300424B4". 

 

DBCC results for '#31EC6D26'. 

 

There are 0 rows in 0 pages for object "#31EC6D26". 

 

DBCC results for 'sys.queue_messages_1977058079'. 

 

There are 0 rows in 0 pages for object "sys.queue_messages_1977058079". 

 

DBCC results for 'sys.queue_messages_2009058193'. 

 

There are 0 rows in 0 pages for object "sys.queue_messages_2009058193". 

 

DBCC results for 'sys.queue_messages_2041058307'. 

 

There are 0 rows in 0 pages for object "sys.queue_messages_2041058307". 

 

DBCC results for 'sys.filestream_tombstone_2073058421'. 

 

There are 0 rows in 0 pages for object "sys.filestream_tombstone_2073058421". 

 

DBCC results for 'sys.syscommittab'. 

 

There are 0 rows in 0 pages for object "sys.syscommittab". 

 

DBCC results for 'sys.service_broker_map'. 

 

There are 14 rows in 1 pages for object "sys.service_broker_map". 

 

DBCC results for 'sys.fulltext_thesaurus_metadata_table'. 

 

There are 0 rows in 0 pages for object "sys.fulltext_thesaurus_metadata_table". 

 

DBCC results for 'sys.fulltext_thesaurus_state_table'. 

 

There are 0 rows in 0 pages for object "sys.fulltext_thesaurus_state_table". 

 

CHECKDB found 0 allocation errors and 0 consistency errors in database 'tempdb'. 

 

DBCC execution completed. If DBCC printed error messages, contact your system administrator. 

 

于是搜索一些外文资料,结果在下面两篇文章了解了一下这个错误的原因 :

http://connect.microsoft.com/SQLServer/feedback/details/469811/attempt-to-fetch-logical-page-in-database-2-failed-it-belongs-to-allocation-unit-not-to

https://connect.microsoft.com/SQLServer/feedback/details/641122/error-605-in-tempdb-on-sql-2008-r2-despite-bug-claims-to-be-fixed

Attempt to fetch logical page (...) in database 2 failed. It belongs to allocation unit xxxx not to xxx是一个bug来的。虽然声称已经fix了,但是实际在SQL SERVER 2008 R2  SP1 、SP2都存在。而我这边的版本恰好是SQL SERVER 2008 R2 SP2

下面摘取文章里面讨论的内容。看来不少人在不同版本中遇到过这类错误

由 dcrph127 在 2014/3/28 6:35 发送

 

I just received this same error in SQL Server 2008 R2 SP2.

 

 

由 Anatoly V. Popov 在 2013/2/14 3:04 发送

 

It seems, that issue fixed in Sql Server 2012 SP1 CU2

 

 

由 Atif-ullah Sheikh 在 2012/12/6 1:37 发送

 

I encountered this today on my production server. I am using temp tables in report procedures. Clustered Index resolved the issue but it is almost impossible for me to update all report procedures for this. I hope MS soon comes up with a hot fix to resolve this issue.

 

 

由 Anatoly V. Popov 在 2012/5/18 0:27 发送

 

We ran into it in Sql Server 2008 R2 SP1.

 

由 Erland Sommarskog 在 2011/2/3 14:44 发送

 

We ran into this today, big thanks to Richard Douglas for pointing me the solution. I've filed new bug with a repro for our case. https://connect.microsoft.com/SQLServer/feedback/details/641122/error-605-in-tempdb-on-sql-2008-r2-despite-bug-claims-to-be-fixed

 

 

由 Richard Douglas 在 2011/2/2 4:52 发送

 

There is still a problem on SQL Server 2008 SP2 with temp tables that do not have a clustered index as I encountered it this morning.

 

Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64) Sep 16 2010 19:43:16 Copyright (c) 1988-2008 Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.0 <;X64> (Build 6002: Service Pack 2)

 

 

由 Stefan M 在 2010/10/8 14:03 发送

 

I'm encountering this problem as well in both SQL Server 2008 SP1 and SP2.

In my case the workaround did solve the problem.

 

Some additional info:

The temp table is created in a stored procedure which populates a SQL Server Reporting Services report dataset.

 

The stored procedure executes without warnings for me when manually running it in SQL Server Management Studio.

However, when trying to run the report (using identical parameters), I see a variant of the reported error message.

 

 

由 colin leversuch-roberts 在 2010/3/16 6:34 发送

 

Just to add I can't find the source as this is a working production system, maybe 400+ concurrent users; just upgraded from sql 2000 so absolutley no chance to locate cause at this time.

 

由 colin leversuch-roberts 在 2010/3/16 6:31 发送

 

sql 2008 sp1+cu2 ent x64 getting a batch of these errors so obviously not fixed in sp1 - always worrying to get any issues in a production system.

 

由 Mike Wade 在 2010/2/23 6:03 发送

Im getting the same thing with SP1.

 

SELECT @@VERSION.....

 

Microsoft SQL Server 2008 (SP1) - 10.0.2746.0 (X64) Nov 9 2009 16:37:47 Copyright (c) 1988-2008 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 <;X64> (Build 3790: Service Pack 2) Microsoft SQL Server 2008 (SP1) - 10.0.2746.0 (X64) Nov 9 2009 16:37:47 Copyright (c) 1988-2008 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 <X64> (Build 3790: Service Pack 2)

 

由 Aviel Iluz 在 2010/2/10 2:05 发送

 

In Service Pack 1 the is still occuring. Clustered index helps.

 

由 Microsoft 在 2010/1/15 於 11:16 公佈

Hi,

It appears after further investigation that this issue was already identified and was fixed in Service Pack 1.

 

Thanks again for taking the time to report the issue!

 

emily

 

由 dy5005 在 2009/10/28 16:40 发送

 

Add a clustered index works. Thanks.

 

由 Microsoft 在 2009/7/17 於 9:52 公佈

Hi,

Thanks for taking the time to send us your feedback. We're looking in to the issue, and will get back to you when we know more about it.

 

thanks,

Emily

解决方法:

解决这个问题,只需要对临时表创建聚集索引。即可解决问题。我验证过了,对这个存储过程的临时表创建聚集索引后,上面错误就不见了。

参考资料:

http://connect.microsoft.com/SQLServer/feedback/details/469811/attempt-to-fetch-logical-page-in-database-2-failed-it-belongs-to-allocation-unit-not-to

https://connect.microsoft.com/SQLServer/feedback/details/641122/error-605-in-tempdb-on-sql-2008-r2-despite-bug-claims-to-be-fixed

Attempt to fetch logical page (...) in database 2 failed. It belongs to allocation unit xxxx not to xxx的更多相关文章

  1. ORA-38760: This database instance failed to turn on flashback database 第三篇

    ORA-38760: This database instance failed to turn on flashback database  第三篇 第一篇 第二篇 问题现象:      在数据库a ...

  2. 诊断:ORA-38760: This database instance failed to turn on flashback database

    $ oerr ora 38760 38760, 00000, "This database instance failed to turn on flashback database&quo ...

  3. ORA-38760: This database instance failed to turn on flashback database

    ORA-38760: This database instance failed to turn on flashback database 问题背景:        測试数据库运行shutdown ...

  4. Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';characterEncoding=UTF

    今天在使用springboot整合SSM的时候,配置好以后启动项目,报了一个这样的异常 java.sql.SQLNonTransientConnectionException: Cannot load ...

  5. .WrongArgumentException: Malformed database URL, failed to parse the connection string near ';characterEncoding=UTF-8&;serverTimezone=Asia/Shanghai'.)

    连接mysql库报的异常信息: org.springframework.transaction.CannotCreateTransactionException: Could not open JDB ...

  6. Oracle Forms Execute_Query Example To Fetch The Records From Database

    Execute_Query command is used to fetch all the records for current database data block in Oracle For ...

  7. 解决方法 test: database removal failed: ERROR: database "test" is being accessed by other users

    select * from pg_stat_activity where datname='test'; 找出哪个进程用了这个数据库,然后删除这个进程(pid) kill -9 47182 然后再删除 ...

  8. AX2012 R3 Data upgrade checklist sync database step, failed to create a session;

    最近在做AX2012 R3 CU9 到CU11的upgrade时 (用的Admin帐号), 在Date upgrade 的 synchronize database 这步 跑了一半,报出错误 说“fa ...

  9. pg_dump: [archiver (db)] connection to database “dbase” failed: FATAL: Peer authentication failed for user “postgres”

    "Peer authentication" means that it's comparing your database username against your Linux ...

随机推荐

  1. ios多线程-GCD基本用法

    ios中多线程有三种,NSTread, NSOperation,GCD 这篇就讲讲GCD的基本用法 平时比较多使用和看到的是: dispatch_async(dispatch_get_global_q ...

  2. 关于table的一些记录

    HTML有10个表格相关标签 <caption> 表格的大标题,该标记可以出现在<table> 之间的任意位置.它对于搜索引擎的机器人记录信息十分重要.参数有align.val ...

  3. UML中的六大关系(转)

    UML定义的关系主要有六种:依赖.继承.关联.实现.聚合和组合.这些类间关系的理解和使用是掌握和应用UML的关键,而也就是这几种关系,往往会让初学者迷惑.这里给出这六种主要UML关系的说明和类图描述, ...

  4. 表空间基于时间点的恢复(TSPITR)

    环境:RHEL 6.4 + Oracle 11.2.0.4 准备模拟环境 1. 验证表空间的依赖性 2. 确定执行TSPITR后会丢失的对象 3. 自动执行TSPITR Reference 准备模拟环 ...

  5. js制作点击会自动隐藏的导航栏(固定在在头部的)

    想必大家应该见过这样的特效,本来头部是固定在网页的最上方的,点一下缩进去,再点一下 又可以缩回来,这种效果怎么实现的呢,我今天就做了一个.菜鸟勿喷. @charset "utf-8" ...

  6. cssRules在不同浏览器中的兼容性

    在一份HTML文档中可以用三种方式添加样式信息: 1.通过<link>元素引用外部样式表: 2.通过<style>元素在文档的头部添加样式信息: 3.在具体的文档元素上通过st ...

  7. CSS-float详解,深入理解clear:both[转+部分原创]

    首先要知道,div是块级元素,在页面中独占一行,自上而下排列,也就是传说中的流. 可以看出,即使div1的宽度很小,页面中一行可以容下div1和div2,div2也不会排在div1后边,因为div元素 ...

  8. shell调用函数返回值深入分析

    编写shell脚本过程中,我们经常会自定义一些函数,并根据函数的返回值不同来执行相应的流程,那么我们如何来获取函数的返回值呢? 首先shell中调用函数有两种方式: 第一种:value=`functi ...

  9. php 数组动态添加实现代码(最土团购系统的价格排序)

    最近在实现最土团购系统的价格排序功能,需要对$oc数组进行扩展,经过测试用下面的方法即可. 核心代码如下: <?php $now=time(); $oc = array( 'team_type' ...

  10. sqlHelper做增删改查

    1.把数据库里面的数据显示出来 sqlHelper怎么用:[网上可以下载,需要可以找楼主要] 1.拷贝到项目,修改它的命名空间等于当前项目名称 2.数据库的连接信息,用户名,密码,登录方式等 < ...