DB2不允许访问表空间解决
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1. DB2进行异常操作后,如命令未执行完将其中断,或对DB2表进行
load/restore操作后,DB2将只能select,不能update,altet,insert,报错如下:
DB2 SQL Error: SQLCODE=-290, SQLSTATE=55039, SQLERRMC=null,
DRIVER=3.50.152
消息:不允许访问表空间。. SQLCODE=-290, SQLSTATE=55039, DRIVER=3.50.152
2. 可查看DB2的表空间状态,确认状态后进行相应的处理解决
$ db2 "list tablespace show detail"
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = System managed space
Contents = Any data
State = 0x0000
Detailed explanation:
Normal
Total pages = 2519
Useable pages = 2519
Used pages = 2519
Free pages = Not applicable
High water mark (pages) = Not applicable
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Total pages = 1
Useable pages = 1
Used pages = 1
Free pages = Not applicable
High water mark (pages) = Not applicable
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
Tablespace ID = 2
Name = USERSPACE1
Type = System managed space
Contents = Any data
State = 0x0004 这个代码意义就是“停顿的独占”,正常状态为0x0000,
非0就是有问题,都可以用下面方法解决。
Detailed explanation:
Quiesced: EXCLUSIVE
Total pages = 687
Useable pages = 687
Used pages = 687
Free pages = Not applicable
High water mark (pages) = Not applicable
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
Number of quiescers = 1 注意下面几行
Quiescer 1:
Tablespace ID = 2
Object ID = 50 “object id是造成死锁表的id”
3. 若处于0X0004“停顿的独占”,可执
行db2 => select tabname from syscat.tables where tableid=50 通过所住的id号找出是哪个表
TABNAME
--------------------------------------------------------------------------------------------------------------------------------
SYSINDEXEXTENSIONPARMS
TEST 就是这个表
2 record(s) selected.
db2 => quiesce tablespaces for table test reset 执行该命令清除错误的状态
DB20000I The QUIESCE TABLESPACES command completed successfully.
4. 若处于0X0020“备份暂挂”,对整个数据库进行backup后即可将其恢复正常db2 "backup db enms tablespace(userspace1) online include logs"(需等待较长时间,然后会echo出备份的时间戳)