Shrinking a Locally Managed Temporary Tablespace
Large sortoperations performed by the database may result in a temporarytablespace growing and occupying a considerable amount of diskspace. After the sort operation completes, the extra space is notreleased; it is just marked as free and available for reuse.Therefore, a single large sort operation might result in a largeamount of allocated temporary space that remains unused after thesort operation is complete. For this reason, the database enablesyou to shrink locally managed temporary tablespaces and releaseunused space.
执行大的排序操作可能导致临时表空间占用比较大的磁盘空间。排序操作完成后,临时表空间额外的空间的并不跟着回收。仅仅标记为空闲和可以被重新使用。因此,一个大的排序操作完成导致大量的临时表空间保持unused。基于这个原因,shrink本地管理的临时表空间,释放unused的空间。
You use theSHRINK SPACE clause of the ALTER TABLESPACE statement to shrink atemporary tablespace, or the SHRINK TEMPFILE clause of the ALTERTABLESPACE statement to shrink a specific temp file of a temporarytablespace. Shrinking frees as much space as possible whilemaintaining the other attributes of the tablespace or temp file.The optional KEEP clause defines a minimum size for the tablespaceor temp file.
使用带有子句SHRINKSPACE的ALTER TABLESPACE语句shrink一个临时表空间,或者带有子句SHRINK TEMPFILE的ALTERTABLESPACE语句shrink指定的临时表空间的临时文件。当维护其他属性的表空间和临时文件,Shrinking释放尽可能多的空间。KEEP子句定义了表空间或者临时文件的最小的尺寸。
Shrinking isan online operation, which means that user sessions can continue toallocate sort extents if needed, and already-running queries arenot affected.
Shrinking是一个online操作,意味着不会影响用户可以分配排序区和已经运行的查询。
Thefollowing example shrinks the locally managed temporary tablespacelmtmp1 to a size of 20M.
下面是一个Shrinks本地管理临时表空间lmtmp1到20M的例子:
ALTERTABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;
Thefollowing example shrinks the temp file lmtemp02.dbf of the locallymanaged temporary tablespace lmtmp2. Because the KEEP clause isomitted, the database attempts to shrink the temp file to theminimum possible size.
下面的例子是shrinks本地管理的临时表空间lmtmp2的临时文件lmtemp02.dbf。因为忽略KEEP子句,数据库尝试shrink临时文件可能最小的尺寸。
ALTERTABLESPACE lmtemp2 SHRINK TEMPFILE'/u02/oracle/data/lmtemp02.dbf';
Shrinking a Locally Managed Temporary Tablespace
最新推荐文章于 2024-10-12 08:22:34 发布