Sparse Files
作者 :OoNiceDream【转载时请务必以超链接形式标明文章原始出处和作者信息】
链接:http://www.dbaroad.me/archives/2009/02/sparse-files.html
链接:http://www.dbaroad.me/archives/2009/02/sparse-files.html
在Unix操作系统上,Oracle创建TEMP表空间,添加TEMP文件时,可以观察到瞬间就完成了,而且文件系统的使用率又没增长多少。这其实就是因为TEMP文件是Sparse Files的原因。
什么是Sparse Files
On many Unix filesystems, files containing long strings of nulls can be stored
much more efficiently than other files. To be specific, if a string of nulls
spans an entire allocation block, that whole block is not stored on disk at all.
Files where one or more blocks are omitted in this way are called sparse files.
The missing blocks are also known as holes.
下面来看看添加TEMP文件时的情况:
[/home/oraadm]$ bdf Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 2097152 1411752 680104 67% / /dev/vg00/lvol1 1031544 116184 812200 13% /stand /dev/vg00/lvol8 5144576 2820144 2307448 55% /var /dev/vg00/lvol7 3145728 1286120 1845104 41% /usr /dev/vg00/lvol4 2097152 331432 1754600 16% /tmp /dev/vgdba/lvol1 533790720 90518648 439809136 17% /oradata /dev/vg00/lvol6 5242880 3181736 2045160 61% /opt /dev/vg00/lvol5 4194304 1838336 2337584 44% /home /dev/vg00/lvol9 10256384 6144404 3983508 61% /app [/oradata/TADBA]$ exit SQL> set timi on SQL> alter tablespace temp add tempfile 2 '/oradata/TADBA/temp03.dbf' size 5120M autoextend off; Tablespace altered. Elapsed: 00:00:00.03 SQL> exit Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.8.0 - Production [/oradata/TADBA]$ bdf Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 2097152 1411752 680104 67% / /dev/vg00/lvol1 1031544 116184 812200 13% /stand /dev/vg00/lvol8 5144576 2836528 2291200 55% /var /dev/vg00/lvol7 3145728 1286120 1845104 41% /usr /dev/vg00/lvol4 2097152 331456 1754576 16% /tmp /dev/vgdba/lvol1 533790720 90518728 439809056 17% /oradata /dev/vg00/lvol6 5242880 3181736 2045160 61% /opt /dev/vg00/lvol5 4194304 1838336 2337584 44% /home /dev/vg00/lvol9 10256384 6144492 3983424 61% /app [/oradata/TADBA]$ [/oradata/TADBA]$ ls -l temp03.dbf -rw-r----- 1 oracle dba 5368717312 Feb 10 14:17 temp03.dbf [/oradata/TADBA]$ du -k temp03.dbf 72 temp03.dbf [/oradata/TADBA]$
添加TEMP文件后,空间使用率,没有上升,只增长了439809136-439809056=80K。
只有当TEMP文件使用后,空间才会分配,这一点在添加TEMP文件时需要引起注意。
— The End —
关键字: Unix | Shell, 基础知识


站内搜索