a)如果你现在没有作这些的话,用‘MK VOLFACT.SQL’来创建测定体积的表。 
b)收集晚间数据大小的信息,用‘ANALYZE COMP.SQL’。 
c)收集统计结果,用‘POP VOL.SQL’。 
d)在空闲的时候检查数据,可能的话,每周或每个月进行。 
我是用MS EXCEL和ODBC的联接来检查数据和图表的增长 
 
==========================================================================================
 A.查找被破坏的目标 
 1.对于每个给定表空间的对象来说,NEXT_EXTENT的大小是相同的,如12/14/98,缺省的NEXT_EXTENT的          DATAHI为1G,DATALO为500MB,INDEXES为256MB。 
 A)检查NEXT_EXTENT的设置,可用‘NEXTEXT.SQL’。 
 B)检查已有的EXTENTS,可用‘EXISTEXT.SQL’。 
2.所有的表都应该有唯一的主键 
 a)查看那些表没有主键,可用‘NO_PK.SQL’。 
 b)查找那些主键是没有发挥作用的,可用‘DIS_PK.SQL’。 
 c)所有作索引的主键都要是唯一的,可用‘NONUPK.SQL’来检查。 
 
3.所有的索引都要放到索引表空间中。运行‘MKREBUILD_IDX.SQL’ 
4.不同的环境之间的计划应该是同样的,特别是测试环境和成品环境之间的计划应该相同。 
 a)检查不同的2个运行环境中的数据类型是否一致,可用‘DATATYPE.SQL’。 
 b)在2个不同的实例中寻找对象的不同点,可用‘OBJ_COORD.SQL’。 
 c)更好的做法是,使用一种工具,象寻求软件的计划管理器那样的工具。 
 
B.查看是否有危害到安全策略的问题。 
 
C.查看报错的SQL*NET日志。 
     1.客户端的日志。
      2.服务器端的日志。 
 
D..将所有的警告日志存档 
 
E..供应商的主页 
 
1. ORACLE供应商 
 http://www.oracle.com 
 http://technet.oracle.com 
 http://www.oracle.com/support 
 http://www.oramag.com 
 
2. Quest Software 
 http://www.quests.com 
 
3. Sun Microsystems 
 http://www.sun.com 
 
==========================================================================================
 
A.查看对数据库会产生危害的增长速度 
 1.从以前的记录或报告中回顾段增长的变化以此来确定段增长带来危害 
B.回顾以前数据库优化性能的调整 
 1.回顾一般ORACLE数据库的调整点,比较以前的报告来确定有害的发展趋势。 
C.查看I/O的屏颈问题 
 1.查看前期数据库文件的活动性,比较以前的输出来判断有可能导致屏颈问题的趋势。 
D.回顾FRAGMENTATION 
E.计划数据库将来的性能 
 1.比较ORACLE和操作系统的CPU,内存,网络,及硬盘的利用率以此来确定在近期将会有的一些资源争夺的趋         势; 
 2.当系统将超出范围时要把性能趋势当作服务水平的协议来看。 
F.完成调整和维护工作 
 1.使修改满足避免系统资源的争夺的需要,这里面包括增加新资源或使预期的停工。 
 
==========================================================================================
 
--To verify free space in tablespaces 
--Minimum amount of free space 
--document your thresholds: 
--<tablespace_name> = <amount> m 
SELECT tablespace_name, sum ( blocks ) as free_blk , trunc ( sum ( bytes ) /
(1024*1024) ) as free_m, max ( bytes ) / (1024) as big_chunk_k, count (*) as num_chunks 
FROM dba_free_space GROUP BY tablespace_name; 
 
 -- space.sql 
 -- To check free, pct_free, and allocated space within a tablespace 
 -- 11/24/98 
 SELECT tablespace_name, largest_free_chunk, nr_free_chunks, sum_alloc_blocks, sum_free_blocks 
 , to_char(100*sum_free_blocks/sum_alloc_blocks, '09.99') || '%' AS pct_free 
 FROM ( SELECT tablespace_name , sum(blocks) AS sum_alloc_blocks 
 FROM dba_data_files GROUP BY tablespace_name ) 
 , ( SELECT tablespace_name AS fs_ts_name 
 , max(blocks) AS largest_free_chunk 
 , count(blocks) AS nr_free_chunks 
 , sum(blocks) AS sum_free_blocks FROM dba_free_space 
 GROUP BY tablespace_name ) WHERE tablespace_name = fs_ts_name; 
 
 -- analyze5pct.sql 
 -- To analyze tables and indexes quickly, using a 5% sample size 
 -- (do not use this script. if you are performing the overnight collection of volumetric data) 
 -- 11/30/98 
BEGIN  
DBMS_UTILITY.ANALYZE_SCHEMA ('&OWNER', 'ESTIMATE',NULL, 5) ;  
END;  
/ 
 
  -- nr_extents.sql 
 -- To find out any object reaching <threshold> 
 -- extents, and manually upgrade it to allow unlimited 
 -- max_extents (thus only objects we *expect* to be big 
 -- are allowed to become big) 
 -- 11/30/98 
 SELECT e.owner, e.segment_type , e.segment_name , count(*) as nr_extents , s.max_extents 
 , to_char ( sum ( e.bytes ) / ( 1024 * 1024 ) , '999,999.90') as MB 
 FROM dba_extents e , dba_segments s 
 WHERE e.segment_name = s.segment_name 
 GROUP BY e.owner, e.segment_type , e.segment_name , s.max_extents 
 HAVING count(*) > &THRESHOLD 
 OR ( ( s.max_extents - count(*) ) < &&THRESHOLD ) 
 ORDER BY count(*) desc; 
 
 -- spacebound.sql 
 -- To identify space-bound objects. If all is well, no rows are returned. 
 -- If any space-bound objects are found, look at value of NEXT extent 
 -- size to figure out what happened. 
 -- Then use coalesce (alter tablespace <foo> coalesce . 
 -- Lastly, add another datafile to the tablespace if needed. 
 -- 11/30/98 
 SELECT a.table_name, a.next_extent, a.tablespace_name 
 FROM all_tables a, 
 ( SELECT tablespace_name, max(bytes) as big_chunk 
 FROM dba_free_space 
 GROUP BY tablespace_name ) f 
 WHERE f.tablespace_name = a.tablespace_name 
 AND a.next_extent > f.big_chunk; 
 
 
B.每晚处理程序
 
 -- mk_volfact.sql (only run this once to set it up; do not run it nightly!) 
 -- -- Table UTL_VOL_FACTS 
 CREATE TABLE utl_vol_facts ( 
 table_name VARCHAR2(30), 
 num_rows NUMBER, 
 meas_dt DATE ) 
 TABLESPACE platab 
 STORAGE ( 
 INITIAL 128k 
 NEXT 128k 
 PCTINCREASE 0 
 MINEXTENTS 1 
 MAXEXTENTS unlimited 
 ) 
 / 
 
-- Public Synonym 
 CREATE PUBLIC SYNONYM utl_vol_facts FOR &OWNER..utl_vol_facts 
 / 
 
-- Grants for UTL_VOL_FACTS 
 GRANT SELECT ON utl_vol_facts TO public 
 / 
	posted on 2012-08-29 15:35 
kxbin 阅读(183) 
评论(0)  编辑  收藏  所属分类: 
ORACLE 、
转发