kxbin
          成功留給有準備的人
          posts - 10,  comments - 35,  trackbacks - 0

          2. analyze_comp.sql 

           -- 

           -- analyze_comp.sql 

           -- 

          BEGIN  
          SYS.DBMS_UTILITY.ANALYZE_SCHEMA ( '&OWNER','COMPUTE');  
          END;

           / 

           

               3. pop_vol.sql 

           -- 

           -- pop_vol.sql 

           -- 

           insert into utl_vol_facts 

           select table_name 

           , NVL ( num_rows, 0) as num_rows 

           , trunc ( last_analyzed ) as meas_dt 

           from all_tables

          -- or just user_tables 

           where owner in ('&OWNER')

          -- or a comma-separated list of owners 

           / 

           commit 

           /

           

           

          C.每周處理程序

           

                1. nextext.sql 

           -- 

           -- nextext.sql 

           -- 

           -- To find tables that don't match the tablespace default for NEXT extent. 

           -- The implicit rule here is that every table in a given tablespace should 

           -- use the exact same value for NEXT, which should also be the tablespace's 

           -- default value for NEXT. 

           -- 

           -- This tells us what the setting for NEXT is for these objects today. 

           -- 

           -- 11/30/98 

           SELECT segment_name, segment_type, ds.next_extent as Actual_Next 

           , dt.tablespace_name, dt.next_extent as Default_Next 

           FROM dba_tablespaces dt, dba_segments ds 

           WHERE dt.tablespace_name = ds.tablespace_name 

           AND dt.next_extent !=ds.next_extent 

           AND ds.owner = UPPER ( '&OWNER' ) 

           ORDER BY tablespace_name, segment_type, segment_name; 

           

                2. existext.sql 

           -- 

           -- existext.sql 

           -- 

           -- To check existing extents 

           -- 

           -- This tells us how many of each object's extents differ in size from 

           -- the tablespace's default size. If this report shows a lot of different 

           -- sized extents, your free space is likely to become fragmented. If so, 

           -- this tablespace is a candidate for reorganizing. 

           -- 

           -- 12/15/98 

            SELECT segment_name, segment_type 

           , count(*) as nr_exts 

           , sum ( DECODE ( dx.bytes,dt.next_extent,0,1) ) as nr_illsized_exts 

           , dt.tablespace_name, dt.next_extent as dflt_ext_size 

           FROM dba_tablespaces dt, dba_extents dx 

           WHERE dt.tablespace_name = dx.tablespace_name 

           AND dx.owner = '&OWNER' 

           GROUP BY segment_name, segment_type, dt.tablespace_name, dt.next_extent; 

           

                3. No_pk.sql 

           -- 

           -- no_pk.sql 

           -- 

           -- To find tables without PK constraint 

           -- 

           -- 11/2/98 

           SELECT table_name 

           FROM all_tables 

           WHERE wner = '&OWNER' 

           MINUS 

           SELECT table_name 

           FROM all_constraints 

           WHERE wner = '&&OWNER' 

           AND constraint_type = 'P' ;

           

                4. disPK.sql 

           -- 

           -- disPK.sql 

           -- 

           -- To find out which primary keys are disabled 

           -- 

           -- 11/30/98 

           SELECT owner, constraint_name, table_name, status 

           FROM all_constraints 

           WHERE wner = '&OWNER' AND status = 'DISABLED’ AND constraint_type = 'P'; 

           

                5. nonuPK.sql 

           -- 

           -- nonuPK.sql 

           -- 

           -- To find tables with nonunique PK indexes. Requires that PK names 

           -- follow a naming convention. An alternative query follows that 

           -- does not have this requirement, but runs more slowly. 

           -- 

           -- 11/2/98 

           SELECT index_name, table_name, uniqueness 

           FROM all_indexes 

           WHERE index_name like '&PKNAME%' 

           AND wner = '&OWNER' AND uniqueness = 'NONUNIQUE' 

           SELECT c.constraint_name, i.tablespace_name, i.uniqueness 

           FROM all_constraints c , all_indexes i 

           WHERE c.owner = UPPER ( '&OWNER' ) AND i.uniqueness = 'NONUNIQUE' 

           AND c.constraint_type = 'P' AND i.index_name = c.constraint_name 

           

                6. mkrebuild_idx.sql 

           -- 

           -- mkrebuild_idx.sql 

           -- 

           -- Rebuild indexes to have correct storage parameters 

           -- 

           -- 11/2/98 

           SELECT 'alter index ' || index_name || ' rebuild ' 

           , 'tablespace INDEXES storage ' 

           || ' ( initial 256 K next 256 K pctincrease 0 ) ; ' 

           FROM all_indexes 

           WHERE ( tablespace_name != 'INDEXES' 

           OR next_extent != ( 256 * 1024 ) 

           ) 

           AND wner = '&OWNER' 

           / 

           

                7. datatype.sql 

           -- 

           -- datatype.sql 

           -- 

           -- To check datatype consistency between two environments 

           -- 

           -- 11/30/98 

           SELECT table_name, column_name, data_type, data_length, data_precision, data_scale, nullable

           FROM all_tab_columns -- first environment 

           WHERE wner = '&OWNER' 

           MINUS 

           SELECT table_name, column_name, data_type, data_length, data_precision, data_scale, nullable 

           FROM all_tab_columns@&my_db_link -- second environment 

           WHERE wner = '&OWNER2' 

           order by table_name, column_name 

           

                8. obj_coord.sql 

           -- 

           -- obj_coord.sql 

           -- 

           -- To find out any difference in objects between two instances 

           -- 

           -- 12/08/98 

           SELECT object_name, object_type 

           FROM user_objects 

           MINUS 

           SELECT object_name, object_type 

           FROM user_objects@&my_db_link 

          posted on 2012-08-29 15:36 kxbin 閱讀(153) 評論(0)  編輯  收藏 所屬分類: ORACLE轉發(fā)
          你恨一個人是因為你愛他;你喜歡一個人,是因為他身上有你沒有的;你討厭一個人是因為他身上有你有的東西;你經(jīng)常在別人面前批評某人,其實潛意識中是想接近他。

          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(5)

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          J2EE

          java技術網(wǎng)站

          Linux

          平時常去的網(wǎng)站

          數(shù)據(jù)庫

          電影網(wǎng)站

          網(wǎng)站設計

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 津市市| 汨罗市| 宁河县| 邮箱| 高淳县| 临安市| 乌兰县| 灵武市| 镇巴县| 来宾市| 桓仁| 克山县| 新余市| 凤庆县| 仁怀市| 荆州市| 西丰县| 林芝县| 济南市| 陵水| 永川市| 平乡县| 新源县| 乌审旗| 淮南市| 道孚县| 扎赉特旗| 九龙县| 碌曲县| 曲阳县| 灌南县| 曲周县| 衡水市| 兴安盟| 土默特右旗| 昌乐县| 铁岭市| 阿拉善盟| 浮山县| 宜良县| 临泉县|