X$KCCDI是对应了DUMP CONTROLFILE中数据库信息部分的视图,其中V$DATABASE基本来自于此FIXED TABLE,为了能够更好的备查今记录于此
数据库信息 TRACE文件
(size = 316, compat size = 316, section max = 1, section in-use = 1,
last-recid= 0, old-recno = 0, last-recno = 0)
(extent = 1, blkno = 1, numrecs = 1)
10/04/2013 22:10:43
DB Name "XUEXI"
Database flags = 0x00404001 0x00001000
Controlfile Creation Timestamp 10/04/2013 22:10:44
Incmplt recovery scn: 0x0000.00000000
Resetlogs scn: 0x0000.001d599f Resetlogs Timestamp 10/04/2013 22:14:48
Prior resetlogs scn: 0x0000.001d494d Prior resetlogs Timestamp 10/04/2013 21:54:38
Redo Version: compatible=0xa200100
#Data files = 10, #Online files = 10
Database checkpoint: Thread=1 scn: 0x0000.0085102b
Threads: #Enabled=1, #Open=1, Head=1, Tail=1
enabled threads: 01000000..00000000
Max log members = 3, Max data members = 1
Arch list: Head=5, Tail=5, Force scn: 0x0000.008173ca scn: 0x0000.0085102a
Activation ID: 2190560931
Controlfile Checkpointed at scn: 0x0000.00851068 02/25/2015 19:45:02
thread:0 rba:(0x0.0.0)
enabled threads: 00000000..00000000
X$KCCDI部分字段解析
INST_ID 实例ID
DICTS 对应 10/04/2013 22:10:43,这按照V$DATABASE定义应该是数据库的建立时间他和V$DATABASE中CREATED字段一样
DIDBN 数据库名对应DB Name "XUEXI",对应v$database的name
DICCT 控制文件建立时间对应 Controlfile Creation Timestamp 10/04/2013 22:10:44
DIFLG 对应Database flags = 0x00404001转换为10进制为4210689,这是一个重要的状态位,V$DATABASE中很多信息是通过bitand按位与后能够查出各种状态,如是STANDBY还是CURRENT库和STANDBY的模式
DIRLS 对应Resetlogs scn: 0x0000.001d599f,同样需要转换为10进制,对应V$DATABASE RESETLOGS_CHANGE#
DIRLC 对应Resetlogs Timestamp 10/04/2013 22:14:48,对应V$DATABASE RESETLOGS_TIME
DIRLC_I 是当前的RESETLOGS_ID
DIPRS 对应Prior resetlogs scn: 0x0000.001d494d,同样需要转换为10进制 ,对应V$DATABASE PRIOR_RESETLOGS_CHANGE#
DIPRC 对应Prior resetlogs Timestamp 10/04/2013 21:54:38 ,对应V$DATABASE PRIOR_RESETLOGS_TIME
DIPRC_I 是上一次的RESETLOGS_ID
DINDF 应该是#Data files = 10
DINTF 应该是Threads: #Enabled=1 为1表示Enabled thread bitmap vector
DINOF 应该是#Online files = 10
DICPT 应该是Database checkpoint: Thread=1
DISCN 对应了Database checkpoint scn: 0x0000.0085102b,就是LOW CACHE RBA对应的SCN,正常情况下这以前的数据是干净的,他就是V$DATABASE的CHECKPOINT_CHANGE#
DIMLM 对应了Max log members = 3,这实际上是MAXLOGMEMBERS
DIMDM 对应了Max data members = 1 恒等于1 (A structural hook to allow for duplexing datafiles, not implemented)
DIARH 对应了Arch list: Head=5 不知道意义
DIART 对应了Tail=5 不知道意义
DIFAS 对应了Force scn: 0x0000.008173ca,对应v$database中的ARCHIVE_CHANGE# (Database force archiving SCN.
Any redo log with a start SCN below this will be forced to archive out.)
DICKP_SCN 对应了Controlfile Checkpointed at scn: 0x0000.00851068,对应v$database中controlfile_change#
DICKP_TIM 对应了02/25/2015 19:45:02 ,对应了V$DATABASE中CONTROLFILE_TIME
DICSQ 对应了CONTROLFILE HEADER的DUMP OF CONTROL FILES, Seq # 9156 = 0x23c4,对应V$DATABASE中的controlfile_sequence#
(The control file sequence number at the time ofthe last control fileupdate of the file
header. This is used to check for an old control file. If the number in a data file is
higher than the current control file, then the control file must bea backup or have a
different resetlogs stamp)
DIDBI 对应了CONTROLFILE HEADER的Db ID=2183744397=0x82294b8d,就是数据库的ID对应V$DATABASEDBID
DIVTS 对应了V$DATABASE中的VERSION TIME
DIDOR 通过换算得到V$DATABASE中的open_mode decode(di.didor,0,'MOUNTED',decode(di.didor, 1, 'READ WRITE', 'READ ONLY'))
DIRAE 通过换算得到V$DATABASE中的REMOTE_ARCHIVE decode(di.dirae,0,'DISABLED',1,'SEND',2,'RECEIVE',3,'ENABLED','UNKNOWN')
DIARS 对应V$DATABASE中的ARCHIVELOG_CHANGE# (Highest NEXT_CHANGE#(from the V$ARCHIVED_LOGview) for an archive log)
DISOS 通过换算得到V$DATABASE中的switchover_status
decode(di.disos, 0,'IMPOSSIBLE',1,'NOT ALLOWED',2,'SWITCHOVER LATENT',3,'SWITCHOVER PENDING',4,'TO PRIMARY',
5,'TO STANDBY',6,'RECOVERY NEEDED',7,'SESSIONS ACTIVE',8,'PREPARING SWITCHOVER',9,'PREPARING DICTIONARY',
10,'TO LOGICAL STANDBY','UNKNOWN'),
DIDGD 通过换算得到V$DATABASE中的dataguard_blocker decode(di.didgd, 0, 'DISABLED', 'ENABLED')
DIFL2 通过换算得到V$DATABASE中的SUPPLEMENTAL_LOG_DATA_ALL decode(bitand(difl2, 2), 2, 'YES', 'NO')
DIPLID 对应了V$DATABASE的LAST_OPEN_INCARNATION# Record number of the incarnation in V$DATABASE_INCARNATIONthat was last opened successfully
DIPLN 对应了V$DATABASE的PLATFORM_ID,这是平台ID,通过v$transportable_platform可以找到对应的平台
DICUR_SCN 对应了V$DATABASE的CURRENT_SCN,没什么说的当前SCN
DIDBUN 对应了V$DATABASE中的UNIQUE_NAME,这是做DATAGUARD的时候需要的
DIFSTS 通过换算得到V$DATABASE中的FS_FAILOVER_STATUS
由此发现很多字段实际都对应了V$DATABASE中的值或者通过换算得到,并且我们需要注意几个SCN的值
select DISCN,DIFAS,DIARS,DICKP_SCN,DICUR_SCN from x$kccdi;
等价于
select CHECKPOINT_CHANGE#,ARCHIVE_CHANGE#,ARCHIVELOG_CHANGE#,controlfile_change#,CURRENT_SCN from v$database;
可以通过
select to_number(DISCN),to_number(DIFAS),to_number(DIARS),to_number(DICKP_SCN),to_number(DICUR_SCN) from x$kccdi
union all
select CHECKPOINT_CHANGE#,ARCHIVE_CHANGE#,ARCHIVELOG_CHANGE#,controlfile_change#,CURRENT_SCN from v$database;
语句进行比较
数据库信息 TRACE文件
(size = 316, compat size = 316, section max = 1, section in-use = 1,
last-recid= 0, old-recno = 0, last-recno = 0)
(extent = 1, blkno = 1, numrecs = 1)
10/04/2013 22:10:43
DB Name "XUEXI"
Database flags = 0x00404001 0x00001000
Controlfile Creation Timestamp 10/04/2013 22:10:44
Incmplt recovery scn: 0x0000.00000000
Resetlogs scn: 0x0000.001d599f Resetlogs Timestamp 10/04/2013 22:14:48
Prior resetlogs scn: 0x0000.001d494d Prior resetlogs Timestamp 10/04/2013 21:54:38
Redo Version: compatible=0xa200100
#Data files = 10, #Online files = 10
Database checkpoint: Thread=1 scn: 0x0000.0085102b
Threads: #Enabled=1, #Open=1, Head=1, Tail=1
enabled threads: 01000000..00000000
Max log members = 3, Max data members = 1
Arch list: Head=5, Tail=5, Force scn: 0x0000.008173ca scn: 0x0000.0085102a
Activation ID: 2190560931
Controlfile Checkpointed at scn: 0x0000.00851068 02/25/2015 19:45:02
thread:0 rba:(0x0.0.0)
enabled threads: 00000000..00000000
X$KCCDI部分字段解析
INST_ID 实例ID
DICTS 对应 10/04/2013 22:10:43,这按照V$DATABASE定义应该是数据库的建立时间他和V$DATABASE中CREATED字段一样
DIDBN 数据库名对应DB Name "XUEXI",对应v$database的name
DICCT 控制文件建立时间对应 Controlfile Creation Timestamp 10/04/2013 22:10:44
DIFLG 对应Database flags = 0x00404001转换为10进制为4210689,这是一个重要的状态位,V$DATABASE中很多信息是通过bitand按位与后能够查出各种状态,如是STANDBY还是CURRENT库和STANDBY的模式
DIRLS 对应Resetlogs scn: 0x0000.001d599f,同样需要转换为10进制,对应V$DATABASE RESETLOGS_CHANGE#
DIRLC 对应Resetlogs Timestamp 10/04/2013 22:14:48,对应V$DATABASE RESETLOGS_TIME
DIRLC_I 是当前的RESETLOGS_ID
DIPRS 对应Prior resetlogs scn: 0x0000.001d494d,同样需要转换为10进制 ,对应V$DATABASE PRIOR_RESETLOGS_CHANGE#
DIPRC 对应Prior resetlogs Timestamp 10/04/2013 21:54:38 ,对应V$DATABASE PRIOR_RESETLOGS_TIME
DIPRC_I 是上一次的RESETLOGS_ID
DINDF 应该是#Data files = 10
DINTF 应该是Threads: #Enabled=1 为1表示Enabled thread bitmap vector
DINOF 应该是#Online files = 10
DICPT 应该是Database checkpoint: Thread=1
DISCN 对应了Database checkpoint scn: 0x0000.0085102b,就是LOW CACHE RBA对应的SCN,正常情况下这以前的数据是干净的,他就是V$DATABASE的CHECKPOINT_CHANGE#
DIMLM 对应了Max log members = 3,这实际上是MAXLOGMEMBERS
DIMDM 对应了Max data members = 1 恒等于1 (A structural hook to allow for duplexing datafiles, not implemented)
DIARH 对应了Arch list: Head=5 不知道意义
DIART 对应了Tail=5 不知道意义
DIFAS 对应了Force scn: 0x0000.008173ca,对应v$database中的ARCHIVE_CHANGE# (Database force archiving SCN.
Any redo log with a start SCN below this will be forced to archive out.)
DICKP_SCN 对应了Controlfile Checkpointed at scn: 0x0000.00851068,对应v$database中controlfile_change#
DICKP_TIM 对应了02/25/2015 19:45:02 ,对应了V$DATABASE中CONTROLFILE_TIME
DICSQ 对应了CONTROLFILE HEADER的DUMP OF CONTROL FILES, Seq # 9156 = 0x23c4,对应V$DATABASE中的controlfile_sequence#
(The control file sequence number at the time ofthe last control fileupdate of the file
header. This is used to check for an old control file. If the number in a data file is
higher than the current control file, then the control file must bea backup or have a
different resetlogs stamp)
DIDBI 对应了CONTROLFILE HEADER的Db ID=2183744397=0x82294b8d,就是数据库的ID对应V$DATABASEDBID
DIVTS 对应了V$DATABASE中的VERSION TIME
DIDOR 通过换算得到V$DATABASE中的open_mode decode(di.didor,0,'MOUNTED',decode(di.didor, 1, 'READ WRITE', 'READ ONLY'))
DIRAE 通过换算得到V$DATABASE中的REMOTE_ARCHIVE decode(di.dirae,0,'DISABLED',1,'SEND',2,'RECEIVE',3,'ENABLED','UNKNOWN')
DIARS 对应V$DATABASE中的ARCHIVELOG_CHANGE# (Highest NEXT_CHANGE#(from the V$ARCHIVED_LOGview) for an archive log)
DISOS 通过换算得到V$DATABASE中的switchover_status
decode(di.disos, 0,'IMPOSSIBLE',1,'NOT ALLOWED',2,'SWITCHOVER LATENT',3,'SWITCHOVER PENDING',4,'TO PRIMARY',
5,'TO STANDBY',6,'RECOVERY NEEDED',7,'SESSIONS ACTIVE',8,'PREPARING SWITCHOVER',9,'PREPARING DICTIONARY',
10,'TO LOGICAL STANDBY','UNKNOWN'),
DIDGD 通过换算得到V$DATABASE中的dataguard_blocker decode(di.didgd, 0, 'DISABLED', 'ENABLED')
DIFL2 通过换算得到V$DATABASE中的SUPPLEMENTAL_LOG_DATA_ALL decode(bitand(difl2, 2), 2, 'YES', 'NO')
DIPLID 对应了V$DATABASE的LAST_OPEN_INCARNATION# Record number of the incarnation in V$DATABASE_INCARNATIONthat was last opened successfully
DIPLN 对应了V$DATABASE的PLATFORM_ID,这是平台ID,通过v$transportable_platform可以找到对应的平台
DICUR_SCN 对应了V$DATABASE的CURRENT_SCN,没什么说的当前SCN
DIDBUN 对应了V$DATABASE中的UNIQUE_NAME,这是做DATAGUARD的时候需要的
DIFSTS 通过换算得到V$DATABASE中的FS_FAILOVER_STATUS
由此发现很多字段实际都对应了V$DATABASE中的值或者通过换算得到,并且我们需要注意几个SCN的值
select DISCN,DIFAS,DIARS,DICKP_SCN,DICUR_SCN from x$kccdi;
等价于
select CHECKPOINT_CHANGE#,ARCHIVE_CHANGE#,ARCHIVELOG_CHANGE#,controlfile_change#,CURRENT_SCN from v$database;
可以通过
select to_number(DISCN),to_number(DIFAS),to_number(DIARS),to_number(DICKP_SCN),to_number(DICUR_SCN) from x$kccdi
union all
select CHECKPOINT_CHANGE#,ARCHIVE_CHANGE#,ARCHIVELOG_CHANGE#,controlfile_change#,CURRENT_SCN from v$database;
语句进行比较