首页 > Linux操作系统 > Linux操作系统 > 在可用的磁盘之间分布关键数据文件
经常被访问的表应该被放置在那些与相应的索引分开的文件系统上;联机重做日至、控制文件和归档日志都应该与那些被用来恢复的数据文件分开放置。
1、分开存储数据和索引文件
通常应该把所连接的表(在一个查询中同时访问的表)的数据和索引分开放置。
注意:
Ÿ 把下列关键数据文件分布在各个可用的磁盘上,这些文件包括SYSTEM表空间、TEMPORARY表空间、回滚段或UNDO段、联机重做日志文件、操作系统盘、Oracle_HOME目录中的关键Oracle文件、经常访问的表的数据文件以及经常访问的索引的数据文件。
Ÿ 把控制文件的多个备份存储到不同的磁盘和控制器上。
2、避免I/O磁盘争用
监控磁盘争用,可以使用FILEIO Monitor来完成以下任务:
Ÿ 显示用户访问实际的数据库文件的频率;
Ÿ 移动表和索引,在所有磁盘上均匀分布访问。
V$FILESTAT动态性能视图用于显示文件读写统计信息,主要描述以下信息:
|
Column |
Datatype |
Description |
|
FILE# |
NUMBER |
Number of the file |
|
PHYRDS |
NUMBER |
Number of physical reads done |
|
PHYWRTS |
NUMBER |
Number of times DBWR is required to write |
|
PHYBLKRD |
NUMBER |
Number of physical blocks read |
|
PHYBLKWRT |
NUMBER |
Number of blocks written to disk, which may be the same as PHYWRTS if all writes are single blocks |
|
SINGLEBLKRDS |
NUMBER |
Number of single block reads |
|
READTIM |
NUMBER |
Time (in hundredths of a second) spent doing reads if the TIMED_STATISTICS parameter is true; 0 if false |
|
WRITETIM |
NUMBER |
Time (in hundredths of a second) spent doing writes if the TIMED_STATISTICS parameter is true; 0 if false |
|
SINGLEBLKRDTIM |
NUMBER |
Cumulative single block read time (in hundredths of a second) |
|
AVGIOTIM |
NUMBER |
Average time (in hundredths of a second) spent on I/O, if the TIMED_STATISTICS parameter is true; 0 if false |
|
LSTIOTIM |
NUMBER |
Time (in hundredths of a second) spent doing the last I/O, if the TIMED_STATISTICS parameter is true; 0 if false |
|
MINIOTIM |
NUMBER |
Minimum time (in hundredths of a second) spent on a single I/O, if the TIMED_STATISTICS parameter is true; 0 if false |
|
MAXIORTM |
NUMBER |
Maximum time (in hundredths of a second) spent doing a single read, if the TIMED_STATISTICS parameter is true; 0 if false |
|
MAXIOWTM |
NUMBER |
Maximum time (in hundredths of a second) spent doing a single write, if the TIMED_STATISTICS parameter is true; 0 if false |
通过SQL查询来确定文件的I/O问题:
SQL> set pagesize 100
SQL> col phyrds format 999,999,999
SQL> col phywrts format 999,999,999
SQL> col readtim format 999,999,999
SQL> col writetim format 999,999,999
SQL> col name format a50
SQL> select name,phyrds,phywrts,readtim,writetim
2 from v$filestat a,v$dbfile b
3 where a.file#=b.file#
4 order by readtim desc;
NAME PHYRDS PHYWRTS
READTIM WRITETIM
-------------------------------------------------- ------------ ------------ ---
--------- ------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\SYSTEM01.D 16,967 9,417
11,892 539
BF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\SYSAUX01.D 6,567 54,448
6,176 3,218
BF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\UNDOTBS01. 77 20,913
976 1,253
DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\PERFSTAT.D 151 10
197 3
BF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\EXAMPLE01. 436 10
156 5
DBF
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\USERS01.DB 98 43
99 8
F
已选择6行。
为了获得一个较好的均衡,可以移动数据文件。把数据文件分布在多个磁盘上,或者使用分区,都可以将对表或索引的访问移动到另外一个磁盘上。
3、通过移动数据文件来均衡I/O
按照以下步骤来物理移动一个导致文件争用的数据文件:
Ÿ 使与数据文件有关的表空间脱机
Alter tablespace orders offline;
Ÿ 把数据文件复制到磁盘的新位置上
$cp /disk1/orders1.dbf /disk2/orders1.dbf
Ÿ 用新数据文件位置为表空间重命名数据文件
Alter tablespace orders rename datafile ‘/disk1/orders1.dbf’ to ‘/disk2/orders1.dbf’;
Ÿ 使表空间重新联机
Alter tablespace orders online;
$rm /disk1/orders1.dbf
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15203236/viewspace-538093/ ,如需转载,请注明出处,否则将追究法律责任。