您的位置:首页 > 其它

ORA FAQ 性能调整系列之——本地管理表空间环境下查询dba_free_space很慢——有什么办法加速么?

2004-09-30 10:08 459 查看
ORA FAQ 性能调整系列之——
Queries against dba_free_space with locally managed tablespaces are slow - is there any way to speed them up ?
本地管理表空间环境下查询dba_free_space很慢——有什么办法加速么?
--------------------------------------------------------------------------------

Author's name: Hans-Peter Sloot
Author's Email:Hans-Peter.Sloot@atosorigin.com
Date written: 9th August 2003
Oracle version(s): 8i

When Oracle introduced Locally managed tablespaces, they had to change their definition of the view dba_free_space to report free space in locally managed tablespaces. As a result, some systems have very poor response times when reporting free space. Is there anything you can do.
当Oracle引入本地管理表空间,他们不得不修改了视图dba_free_space的定义来报告本地管理表空间的空闲空间。于是一些系统在报告空闲空间时响应时间很差。我们能做什么?

--------------------------------------------------------------------------------

Just because Oracle Corp. supplies a view definition, that doesn't mean you have to use it. You might create a new definition of dba_free_space that is much faster than the original one.
Oracle公司提供了一个视图定义,并不意味着你必须使用它。你可以创建一个比原先快的新dba_free_space定义。

On one database used for BAAN a query on dba_free_space lasted 50 minutes, whereas the following new definition returned the same results within 50 seconds.Of course, as versions of Oracle change, you may have to keep updating the definitions of your views to cater for new features.
用于BAAN的一个数据库上,一个对dba_free_space的查询持续了50分钟,而下面的新定义在50秒内返回了同样的结果。随着Oracle版本变迁,你可能得保持更新你的视图的定义来利用新特性。

CREATE OR REPLACE VIEW DBA_FREE_SPACE_NEW (
TABLESPACE_NAME,
FILE_ID,
BLOCK_ID,
BYTES,
BLOCKS,
RELATIVE_FNO
) AS
select /*+use_hash (tsfi, fet2 ) */
tsfi.tablespace_name, tsfi.file_id, fet2.block_id,
tsfi.blocksize * fet2.blocks, fet2.blocks, tsfi.relfile#
from
(
select /*+ use_hash ( ts, fi ) */
ts.name tablespace_name, fi.file# file_id, ts.BLOCKSIZE,
fi.relfile#, ts.ts#
from sys.ts$ ts, sys.file$ fi
where ts.ts# = fi.ts#
and ts.online$ in (1,4)
) tsfi,
(
select f.block# block_id, f.length blocks, f.file# file_id, f.ts#
from sys.fet$ f
union all
select f.ktfbfebno block_id, f.ktfbfeblks blocks, f.ktfbfefno, ktfbfetsn
from sys.x_$ktfbfe f
) fet2
where
fet2.file_id = tsfi.relfile# and
fet2.ts# = tsfi.ts#;
--------------------------------------------------------------------------------
本文翻译自http://www.jlcomp.demon.co.uk/faq/autotrace_pruning.html 译者仅保留翻译版权
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐