V$Datafile_Header相关字段的使用:
◆1、FUZZY也是用于表示数据文件 status的一个选项。
◆2、checkpoint_time用于查看何时发生了检查点,可用于判断一个操作是否会发出检查点。
在v9.0.1及之前的版本,FUZZY可以用于标识数据文件是不是处于hot backup状态。
当一个数据文件begin backup 时,fuzzy列即为yes,当end backup时这一列又被置为null
在9.2之后的版本,当数据库打开后,fuzzy这一列便为yes了
当数据文件为read write状态且为online时,则fuzzy列为yes
当数据文件为read only,则fuzzy为no
当数据文件为offline,则fuzzy为null
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> select * from v$tablespace;
TS# NAME INC
---------- ------------------------------ ---
0 SYSTEM YES
1 UNDOTBS1 YES
2 TEMP YES
3 INDX YES
4 TOOLS YES
5 USERS YES
6 CATTBS YES
已选择7行。
SQL> select status,fuzzy,tablespace_name,name from v$datafile_header;
STATUS FUZ TABLESPACE_NAME NAME
------- --- ------------------------------ -----------------------------------
ONLINE YES SYSTEM E:ORACLEORADATARCATSYSTEM01.DBF
ONLINE YES UNDOTBS1 E:ORACLEORADATARCATUNDOTBS01.DBF
ONLINE YES INDX E:ORACLEORADATARCATINDX01.DBF
ONLINE YES TOOLS E:ORACLEORADATARCATTOOLS01.DBF
ONLINE YES USERS E:ORACLEORADATARCATUSERS01.DBF
ONLINE YES CATTBS E:ORACLEORADATARCATCATTBS01.DBF
已选择6行。
SQL> alter tablespace users read only;
表空间已更改。
SQL> select status,fuzzy,tablespace_name,name from v$datafile_header;
STATUS FUZ TABLESPACE_NAME NAME
------- --- ------------------------------ -----------------------------------
ONLINE YES SYSTEM E:ORACLEORADATARCATSYSTEM01.DBF
ONLINE YES UNDOTBS1 E:ORACLEORADATARCATUNDOTBS01.DBF
ONLINE YES INDX E:ORACLEORADATARCATINDX01.DBF
ONLINE YES TOOLS E:ORACLEORADATARCATTOOLS01.DBF
ONLINE NO USERS E:ORACLEORADATARCATUSERS01.DBF
ONLINE YES CATTBS E:ORACLEORADATARCATCATTBS01.DBF
已选择6行。
SQL> alter tablespace users read write;
表空间已更改。
SQL> select status,fuzzy,tablespace_name,name from v$datafile_header;
STATUS FUZ TABLESPACE_NAME NAME
------- --- ------------------------------ -----------------------------------
ONLINE YES SYSTEM E:ORACLEORADATARCATSYSTEM01.DBF
ONLINE YES UNDOTBS1 E:ORACLEORADATARCATUNDOTBS01.DBF
ONLINE YES INDX E:ORACLEORADATARCATINDX01.DBF
ONLINE YES TOOLS E:ORACLEORADATARCATTOOLS01.DBF
ONLINE YES USERS E:ORACLEORADATARCATUSERS01.DBF
ONLINE YES CATTBS E:ORACLEORADATARCATCATTBS01.DBF
已选择6行。
SQL> alter tablespace users offline;
表空间已更改。
SQL> select status,fuzzy,tablespace_name,name from v$datafile_header;
STATUS FUZ TABLESPACE_NAME NAME
------- --- ------------------------------ --------------------------------
ONLINE YES SYSTEM E:ORACLEORADATARCATSYSTEM01.DBF
ONLINE YES UNDOTBS1 E:ORACLEORADATARCATUNDOTBS01.DBF
ONLINE YES INDX E:ORACLEORADATARCATINDX01.DBF
ONLINE YES TOOLS E:ORACLEORADATARCATTOOLS01.DBF
OFFLINE
ONLINE YES CATTBS E:ORACLEORADATARCATCATTBS01.DBF
已选择6行。
SQL> alter tablespace users online;
表空间已更改。
SQL> select status,fuzzy,tablespace_name,name from v$datafile_header;
STATUS FUZ TABLESPACE_NAME NAME
------- --- ------------------------------ ----------------------------------
ONLINE YES SYSTEM E:ORACLEORADATARCATSYSTEM01.DBF
ONLINE YES UNDOTBS1 E:ORACLEORADATARCATUNDOTBS01.DBF
ONLINE YES INDX E:ORACLEORADATARCATINDX01.DBF
ONLINE YES TOOLS E:ORACLEORADATARCATTOOLS01.DBF
ONLINE YES USERS E:ORACLEORADATARCATUSERS01.DBF
ONLINE YES CATTBS E:ORACLEORADATARCATCATTBS01.DBF
已选择6行。
通过checkpoint_time字段,可以判断是否发生检查点
SQL> alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
会话已更改。
SQL> select status,fuzzy,tablespace_name,checkpoint_time from v$datafile_header;
STATUS FUZ TABLESPACE_NAME CHECKPOINT_TIME
------- --- ------------------------------ -------------------
ONLINE YES SYSTEM 2008-02-28 08:34:20
ONLINE YES UNDOTBS1 2008-02-28 08:34:20
ONLINE YES INDX 2008-02-28 08:34:20
ONLINE YES TOOLS 2008-02-28 08:34:20
ONLINE YES USERS 2008-02-28 10:07:28
ONLINE YES CATTBS 2008-02-28 08:34:20
已选择6行。
SQL> alter system suspend;
系统已更改。
SQL> alter system resume;
系统已更改。
SQL> select status,fuzzy,tablespace_name,checkpoint_time from v$datafile_header;
STATUS FUZ TABLESPACE_NAME CHECKPOINT_TIME
------- --- ------------------------------ -------------------
ONLINE YES SYSTEM 2008-02-28 08:34:20
ONLINE YES UNDOTBS1 2008-02-28 08:34:20
ONLINE YES INDX 2008-02-28 08:34:20
ONLINE YES TOOLS 2008-02-28 08:34:20
ONLINE YES USERS 2008-02-28 10:07:28
ONLINE YES CATTBS 2008-02-28 08:34:20
已选择6行。