<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sybase数据库技术，数据库恢复专家 &#187; 9561</title>
	<atom:link href="http://www.dbainfo.net/tag/9561/feed" rel="self" type="application/rss+xml" />
	<link>https://www.dbainfo.net</link>
	<description>提供Sybase ASE及Sybase SQL Anywhere数据库修复服务，电话：13811580958(微信)，QQ：289965371！We have many years of experience in recovering data from damanged Sybase devices. Contact us by Phone: +86 13811580958 Wechat: 13811580958 Email: 289965371@qq.com</description>
	<lastBuildDate>Sat, 14 Jun 2025 16:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Error: 9561的一种处理方法</title>
		<link>https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm</link>
		<comments>https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm#comments</comments>
		<pubDate>Wed, 25 Jun 2014 15:00:59 +0000</pubDate>
		<dc:creator>dbainfo</dc:creator>
				<category><![CDATA[Sybase ASE]]></category>
		<category><![CDATA[9561]]></category>

		<guid isPermaLink="false">http://www.dbainfo.net/?p=2516</guid>
		<description><![CDATA[本文的目的在于给出一种方法（或者workaround）来屏蔽错误Error: 9561。 在老环境ASE 12.5上测试某程序时，执行一些命令会报Error: 9561！ 环境介绍： ASE版本为： Adaptive Server Enterprise/12.5/SWR 9616 GA/P/NT (IX86)/OS 4.0/main/1647/32-bit/OPT/Fri Jun 01 16:58:25 2001 此版本为ASE 12.5 GA，裸奔很久了。 lock scheme=allpages 系统库model、tempdb以及用户数据库均启用了选项：allow nulls by default 现象描述： 使用存储过程sp_helpindex查看表上的索引信息时，会报Error:9561。 1&#62; sp_helpindex sysobjects 2&#62; go Msg 9561, Level 20, State 5: Server &#39;TEST&#39;, Procedure &#39;sp_helpindex&#39;, Line 306: An insert or update to table &#39;#spindtab____01000430020573012&#39; places column [...]]]></description>
			<content:encoded><![CDATA[<p>本文的目的在于给出一种方法（或者workaround）来屏蔽错误Error: 9561。</p>
<p>在老环境ASE 12.5上测试某程序时，执行一些命令会报Error: 9561！</p>
<p><strong><span style="font-size:14px;">环境介绍：<br />
	</span></strong></p>
<p>ASE版本为： Adaptive Server Enterprise/12.5/SWR 9616 GA/P/NT (IX86)/OS 4.0/main/1647/32-bit/OPT/Fri Jun 01 16:58:25 2001<br />
	此版本为ASE 12.5 GA，裸奔很久了。</p>
<p>lock scheme=allpages</p>
<p>系统库model、tempdb以及用户数据库均启用了选项：<span style="color:#f00;">allow nulls by default</span></p>
<p><span id="more-2516"></span></p>
<p><span style="font-size:14px;"><strong>现象描述：<br />
	</strong></span></p>
<p>使用存储过程sp_helpindex查看表上的索引信息时，会报Error:9561。</p>
<blockquote>
<p>1&gt; sp_helpindex sysobjects<br />
		2&gt; go<br />
		<span style="color:#f00;">Msg 9561, Level 20, State 5:</span><br />
		Server &#39;TEST&#39;, Procedure &#39;sp_helpindex&#39;, Line 306:<br />
		<span style="color:#f00;">An insert or update to table &#39;#spindtab____01000430020573012&#39; places column &#39;maxrowsperpage&#39; at offset 2, ending at offset 4. The maximum permitted ending offset for this column is 2. This is a server internal error.</span><br />
		Msg 9561, Level 20, State 5:<br />
		Server &#39;TEST&#39;, Procedure &#39;sp_helpindex&#39;, Line 306:<br />
		An insert or update to table &#39;#spindtab____01000430020573012&#39; places column &#39;maxrowsperpage&#39; at offset 2, ending at offset 4. The maximum permitted ending offset for this column is 2. This is a server internal error.<br />
		&nbsp;index_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_keys<br />
		&nbsp;-------------------- -------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
<p>		(0 rows affected)<br />
		(return status = 0)</p>
</blockquote>
<p>
	执行存储过程sp_helprotect查看对象权限分配信息时，也报类似的Error:9561。</p>
<blockquote>
<p>1&gt;sp_helprotect dbo<br />
		2&gt;go<br />
		<span style="color:#f00;">Msg 9561, Level 20, State 5:</span><br />
		Server &#39;TEST&#39;, Procedure &#39;sp_helprotect&#39;, Line 299:<br />
		<span style="color:#f00;">An insert or update to table &#39;#sysprotects201000430020573012&#39; places column &#39;id&#39; at offset 2, ending at offset 6. The maximum permitted ending offset for this column is 2. This is a server internal error.</span></p>
</blockquote>
<p>&nbsp;</p>
<p><span style="font-size:14px;"><strong>分析过程</strong></span></p>
<p>根据Error:9561的错误信息描述，曾经怀疑某系统表中某字段的偏移信息出现了差错。</p>
<p>在网上搜索一下CR： <strong>389129</strong>（ 来源于：<a href="http://www.sybase.com/detail?id=1038862" target="_blank">Targeted CR List for ASE 15.0 ESD #2</a> ）</p>
<blockquote>
<p>Error 511 &quot;Attempt to update or insert row failed because resultant row of size &lt; value &gt; bytes is larger than the maximum size ( &lt; value &gt; bytes) allowed for this table...&quot; may be raised during the<span style="color:#f00;"> execution of a stored procedure using the reformatting strategy and the creation of a DOL (Datarows Only Locking) work table. </span>Alternatively the error 9561 &quot;An insert or update to table &#39;temp worktable&#39; places column &#39;(unknown column)&#39; at offset &lt; value &gt; ...&quot; may be raised.</p>
</blockquote>
<p>很奇怪，我的ASE12.5配置的lock scheme为allpages，怎么会自动创建DOL类型的工作表呢？</p>
<p>浏览存储过程sp_helpindex的源代码，发现一张临时表#spindtab的创建语句：</p>
<blockquote>
<p>create table #spindtab</p>
<p>		(<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varchar(30),<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_keys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varchar(1024),<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varchar(68),<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_max_rows_per_page smallint,<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_fillfactor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; smallint,<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_reservepagegap&nbsp;&nbsp;&nbsp; smallint,<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index_created&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; datetime NULL<br />
		)</p>
</blockquote>
<p>Error:9561信息中显示的<span style="color:#f00;">#spindtab____01000430020573012</span>就是指的存储过程sp_helpindex中创建的临时表#spindtab！</p>
<p>此处你需要了解一下会话临时表的命名规则，可以参考Rob V.的文章：<a href="http://www.sypron.nl/temptab.html" target="_blank">Reading temporary tables that aren&#39;t yours</a></p>
<p>再继续追踪列名：maxrowsperpage，找到这样一条语句：</p>
<blockquote>
<p>insert into #spindtab<br />
		&nbsp;&nbsp;&nbsp; select name, @keys, @inddesc, <span style="color:#f00;">maxrowsperpage</span>, fill_factor,<br />
		&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; isnull(res_page_gap ,0), crdate<br />
		&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from sysindexes<br />
		&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; where id = object_id(@objname)<br />
		&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; and indid = @indid</p>
</blockquote>
<p>查看一下列maxrowsperpage在表sysindexes中的偏移情况：</p>
<blockquote>
<p>1&gt; select colid,name,offset,length from syscolumns where id= 2&nbsp; and name=&#39;maxrowsperpage&#39;<br />
		2&gt; go<br />
		&nbsp;colid&nbsp; name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; offset length<br />
		&nbsp;------ ------------------------------ ------ -----------<br />
		&nbsp;&nbsp;&nbsp;&nbsp; 16 maxrowsperpage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#f00;"><strong>48&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong></span>2</p>
</blockquote>
<p>列maxrowsperpage在sysindexes处于第16个位置，偏移48字节，好像和Error:9561提示的offset:2没有什么关系。</p>
<p>再来看看临时表#spindtab中的第4个字段： index_max_rows_per_page，它的类型是：smallint，占用2字节。和Error:9561提示的开始偏移2，结束偏移4可能有点关系！</p>
<p>字段index_max_rows_per_page前面的3个字段都是varchar类型，都是属于变长类型字段；</p>
<p>如果index_max_rows_per_page存储在offset=2位置处的话，必要要求index_max_rows_per_page定义为NOT NULL，表#spindtab的定义语句中没有指定NOT NULL或者NULL。这是问题所在！</p>
<p>&nbsp;</p>
<p><span style="font-size:14px;"><strong>解决方法<br />
	</strong></span></p>
<p>关闭临时数据库、model上的选项：allow nulls by default；</p>
<p>将lock scheme设置成datarows，Error:9561的错误信息就变成：</p>
<p>An insert or update to table &#39;#spindtab____01000430020573012&#39; places column &#39;maxrowsperpage&#39; <span style="color:#f00;">at offset 6, ending at offset 8. </span>The maximum permitted ending offset for this column is 6. This is a server internal error.</p>
<p>
	<span style="font-size:14px;"><strong>本文的关键信息</strong></span></p>
<p>1、选项：allow nulls by default会影响<u>没有显示指定是否为空</u>字段的<strong>为空</strong>属性；</p>
<p>2、一个字段是否为空，在行内的存储位置是不同的；</p>
<p>3、DOL表与APL表的初始offset值不同；</p>
<div style="clear: both; margin: 10px 0pt; border: 1px dashed rgb(153, 153, 153); font-size: 12px; padding: 5px 10px;">
<li>本文链接地址：<a href="https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm">https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm</a>；</li>
<li>本文为dbainfo个人原创，请在尊重作者劳动成果的前提下进行转载；</li>
<li>转载务必注明原始出处 : <a href="https://www.dbainfo.net/">Sybase数据库技术，数据库恢复专家</a>；</li>
<li>对《<a href="https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm">Error: 9561的一种处理方法</a>》有何疑问或见解，请在本文下方发表；</li>
<li>对网站还有其他问题或建议，请提交在<a href="https://www.dbainfo.net/messages" target="_blank">留言板</a>，谢谢！</li>
</div>
<h2  class="related_post_title">随机日志</h2><ul class="related_post"><li>2010-08-16 -- <a href="https://www.dbainfo.net/sqlserver2005-view-long-time-transacitons.htm" title="sql server 2005 中查找长事务的SQL语句">sql server 2005 中查找长事务的SQL语句</a> (0)</li><li>2010-06-21 -- <a href="https://www.dbainfo.net/ase-cross-platform-remote-backup.htm" title="ASE跨平台远程备份">ASE跨平台远程备份</a> (0)</li><li>2014-12-20 -- <a href="https://www.dbainfo.net/iq_certifications.htm" title="Sybase IQ各版本认证情况">Sybase IQ各版本认证情况</a> (0)</li><li>2011-01-24 -- <a href="https://www.dbainfo.net/ase_add_scheduled_job_by_sp_sjobcreate.htm" title="用存储过程来添加预定作业">用存储过程来添加预定作业</a> (0)</li><li>2010-10-18 -- <a href="https://www.dbainfo.net/sybase-ase15-0-3-sql-function-convert_datetime-format.htm" title="Sybase ASE15.0.3中用SQL Function来调整日期显示格式">Sybase ASE15.0.3中用SQL Function来调整日期显示格式</a> (0)</li><li>2012-01-17 -- <a href="https://www.dbainfo.net/sqlserver-2005-failover-cluster3.htm" title="在VM Server中配置SQL Server 2005故障转移群集(3)—安装实例">在VM Server中配置SQL Server 2005故障转移群集(3)—安装实例</a> (0)</li><li>2011-12-08 -- <a href="https://www.dbainfo.net/get-current-running-sql-statement.htm" title="Sybase ASE 统计当前执行的SQL语句的存储过程">Sybase ASE 统计当前执行的SQL语句的存储过程</a> (0)</li><li>2010-03-16 -- <a href="https://www.dbainfo.net/sybase-fast-bcp-utility.htm" title="关于Sybase中的快bcp">关于Sybase中的快bcp</a> (0)</li><li>2010-06-13 -- <a href="https://www.dbainfo.net/mount-an-iso-image-file-at-aix-solaris-platform.htm" title="aix与solaris中mount一个iso文件的方法">aix与solaris中mount一个iso文件的方法</a> (0)</li><li>2011-09-24 -- <a href="https://www.dbainfo.net/why-you-ll-want-to-upgrade-to-sybase-ase157.htm" title="Why You’ll Want to Upgrade to Sybase ASE 15.7 ?">Why You’ll Want to Upgrade to Sybase ASE 15.7 ?</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>https://www.dbainfo.net/one-way-to-deal-with-error-9561.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
