问个不可理解的问题,数据库的容器不存在,怎么还能访问数据呢?
问个不可理解的问题,数据库的容器不存在,怎么还能访问数据呢?我是把生产系统上的数据备份下来直接恢复到测试环境测试的。恢复后表空间的容器不存在,但我却可以访问数据库。很是纳闷。
$ oslevel -s
5300-07-02-0806
$ pwd
/home/db2inst1
$ db2 list db directory
System Database Directory
Number of entries in the directory = 3
Database 1 entry:
Database alias = PROD
Database name = PROD
Local database directory = /home/db2inst1
Database release level = b.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 2 entry:
Database alias = ERP
Database name = ERP
Local database directory = /home/db2inst1
Database release level = b.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 3 entry:
Database alias = SAMPLE
Database name = SAMPLE
Local database directory = /home/db2inst1
Database release level = b.00
Comment = A sample database
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
$ db2 list tabablespaces show detail
SQL0104NAn unexpected token "tabablespaces" was found following "LIST".
Expected tokens may include:"ACTIVE".SQLSTATE=42601
$ db2 connect to ERP
Database Connection Information
Database server = DB2/AIX64 9.1.0
SQL authorization ID = DB2INST1
Local database alias = ERP
$ db2 list tabablespaces show detail
SQL0104NAn unexpected token "tabablespaces" was found following "LIST".
Expected tokens may include:"ACTIVE".SQLSTATE=42601
$ db2 list tabblespaces show detail
SQL0104NAn unexpected token "tabblespaces" was found following "LIST".
Expected tokens may include:"ACTIVE".SQLSTATE=42601
$ db2 list tablespaces show detail
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 16384
Useable pages = 16380
Used pages = 13204
Free pages = 3176
High water mark (pages) = 13204
Page size (bytes) = 4096
Extent size (pages) = 4
Prefetch size (pages) = 12
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 = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 131072
Useable pages = 131040
Used pages = 130752
Free pages = 288
High water mark (pages) = 131008
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 96
Number of containers = 1
Tablespace ID = 3
Name = NNC_DATA01
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 4
Name = NNC_DATA02
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 6
Name = NNC_INDEX01
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 7
Name = NNC_INDEX02
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
$ db2 list tablespace containers for 0
Tablespace Containers for Tablespace 0
Container ID = 0
Name = /home/db2inst1/db2inst1/NODE0000/ERP/T0000000/C0000000.CAT
Type = File
$ db2 list tablespace containers for 3
Tablespace Containers for Tablespace 3
Container ID = 0
Name = /db2/datafile/data1
Type = File
$ db2 list tablespace containers for 4
Tablespace Containers for Tablespace 4
Container ID = 0
Name = /db2/datafile/data2
Type = File
$ cd /db2
ksh: /db2:not found.
$ db2 list tables
Table/View Schema TypeCreation time
------------------------------- --------------- ----- --------------------------
ARAP_AUDIT DB2INST1 T 2009-12-29-04.20.08.095825
ARAP_BILLCONFER DB2INST1 T 2009-12-29-04.20.09.609022
ARAP_BILLMAP DB2INST1 T 2009-12-29-04.20.10.855955
ARAP_CREATEBILL DB2INST1 T 2009-12-29-04.20.12.012740
ARAP_DJLX DB2INST1 T 2009-12-29-04.20.13.266024
ARAP_DZTZ DB2INST1 T 2009-12-29-04.20.14.195069
ARAP_FENGCUN DB2INST1 T 2009-12-29-04.20.15.214127
ARAP_GZ DB2INST1 T 2009-12-29-04.20.16.466866
ARAP_GZ_DEFINE DB2INST1 T 2009-12-29-04.20.17.713744
ARAP_GZ_DEFINE_B DB2INST1 T 2009-12-29-04.20.18.835039
ARAP_ID_NTB DB2INST1 T 2009-12-29-04.20.20.076315
ARAP_ITEM DB2INST1 T 2009-12-29-06.08.35.845071
ARAP_ITEM_B DB2INST1 T 2009-12-29-06.08.37.734105
ARAP_ITEM_CLB DB2INST1 T 2009-12-29-04.20.21.304093
ARAP_ITEMCONFIG DB2INST1 T 2009-12-29-04.20.22.509862
ARAP_POWER_DJLX DB2INST1 T 2009-12-29-04.20.23.648643
ARAP_SYSCODE DB2INST1 T 2009-12-29-04.20.25.201245
ARAP_TB_ITEM DB2INST1 T 2009-12-29-04.20.25.567893
CMP_BILLTYPEREG DB2INST1 T 2009-12-29-04.23.54.857125
CMP_BUSIBILL DB2INST1 T 2009-12-29-06.10.32.895995
CMP_BUSIBILL_B DB2INST1 T 2009-12-29-06.10.34.503910
SRPT_SEGDEF_DIR DB2INST1 T 2009-12-29-04.38.51.762816
TM_CUBASDOC_UPGRADE DB2INST1 T 2009-12-29-04.38.53.668931
XX_AUXIREGISTER DB2INST1 T 2009-12-29-04.38.55.221761
XX_CONTRASTTABLE DB2INST1 T 2009-12-29-04.38.56.306957
XX_DEFAULTINFOTABLE DB2INST1 T 2009-12-29-04.38.57.643665
XX_EXSYSTEM DB2INST1 T 2009-12-29-04.38.58.716769
XX_EXSYSTEM_B DB2INST1 T 2009-12-29-04.39.00.293549
XX_IDCONTRASTPK DB2INST1 T 2009-12-29-04.39.01.240499
XX_XLOG DB2INST1 T 2009-12-29-04.39.02.607410
XX_XSYSREGISTER DB2INST1 T 2009-12-29-04.39.04.082030
937 record(s) selected.
$ db2 "select * from XX_EXSYSTEM"
DR EXSYSTEMCODE EXSYSTEMNAME PFXXRULE PK_EXSYSTEM TS VDEF1 VDEF10 VDEF2 VDEF3 VDEF4 VDEF5 VDEF6 VDEF7 VDEF8 VDEF9
------ ---------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------- -------------------- ------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
0 01 项目档案 2 0001G1100000000005Q0 2009-12-02 10:14:34 - - - - - - - - - -
1 record(s) selected.
$ db2 "select count(*) from xx_xlog"
1
-----------
287
1 record(s) selected.
[ 本帖最后由 feiaix 于 2010-1-22 11:41 编辑 ] 原帖由 feiaix 于 2010-1-21 22:38 发表 http://bbs.chinaunix.net/images/common/back.gif
问个不可理解的问题,数据库的容器不存在,怎么还能访问数据呢?
我是把生产系统上的数据备份下来直接恢复到测试环境测试的。恢复后表空间的容器不存在,但我却可以访问数据库。很是纳闷。
$ oslevel -s
5 ...
typo.
the command should be like the following,
db2 list tablespaces show detail Tablespace ID = 3
Name = NNC_DATA01
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 4
Name = NNC_DATA02
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 6
Name = NNC_INDEX01
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
Tablespace ID = 7
Name = NNC_INDEX02
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0xc000
Detailed explanation:
Offline
Drop Pending
你上面的3,4,6,7都有问题,状态不对!
你的数据应该是在2里面,所以这就不奇怪了!
页:
[1]