Chinaunix首页 | 论坛 | 博客
  • 博客访问: 956179
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-08-29 09:13:07

Managing Database Performance

select owner,object_name,object_type from dba_objects wherev status='INVALID';
alter procedure XXX compile;
alter view XX compile;
②Recompile hundreds or thousands of invalid objects.
$ORACLE_HOME/rdbms/admin/utlrp.sql
If a procedure does not compile,use the SQL*Plus command SHOW ERRORS to see why not. 
(Unfortunately, SHOW ERRORS is not supported for views.)
The DBMS_STATS procedures can take many arguments to influence the
depth of the analysis, far more than the older ANALYZE command.

表分析:
analyze table test compute statistics;
analyze index TEST_INDEX  validate structure

begin
  dbms_stats.gather_table_stats('GAU001', 'TEST');
end;

begin
  dbms_stats.gather_table_stats(ownname          => 'TESTUSER',
                                tabname          => 'TESTTAB',
                                estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
                                cascade          => true,
                                method_opt       => 'for all indexed columns size auto');
end;

eg:
SQL> edit;
已写入 file afiedt.buf

  1  create or replace procedure test1
  2  as
  3  begin
  4  insert into table x values(0);
  5  commit;
  6* end;
SQL> /

警告: 创建的过程带有编译错误。

SQL> show errors;
PROCEDURE TEST1 出现错误:

LINE/COL ERROR
-------- ------------------------------------------
4/1      PL/SQL: SQL Statement ignored
4/13     PL/SQL: ORA-00903: invalid table name

SQL> analyze table test compute statistics;

表已分析。


阅读(475) | 评论(0) | 转发(0) |
0

上一篇:8_提出话题

下一篇:Tips2_Monitoring Oracle

给主人留下些什么吧!~~