waterye

          Partitioned Tables

          Partitioned Tables

          -- ?Range?Partitioning?Example
          CREATE ? TABLE ?sales_range?
          (salesman_id??
          NUMBER ( 5 ),?
          salesman_name?
          VARCHAR2 ( 30 ),?
          sales_amount??
          NUMBER ( 10 ),?
          sales_date????DATE)
          PARTITION?
          BY ?RANGE(sales_date)?
          (
          PARTITION?sales_jan2006?
          VALUES ?LESS?THAN(TO_DATE( ' 02/01/2006 ' , ' MM/DD/YYYY ' )),
          PARTITION?sales_feb2006?
          VALUES ?LESS?THAN(TO_DATE( ' 03/01/2006 ' , ' MM/DD/YYYY ' )),
          PARTITION?sales_mar2006?
          VALUES ?LESS?THAN(TO_DATE( ' 04/01/2006 ' , ' MM/DD/YYYY ' )),
          PARTITION?sales_apr2006?
          VALUES ?LESS?THAN(TO_DATE( ' 05/01/2006 ' , ' MM/DD/YYYY ' )),
          PARTITION?sales_may2006?
          VALUES ?LESS?THAN(TO_DATE( ' 06/01/2006 ' , ' MM/DD/YYYY ' ))
          );


          insert ? into ?sales_range? values ( 12345 ,? ' test ' ,? 1000 ,?to_date( ' 2006-01-15 ' ,? ' yyyy-mm-dd ' ));
          insert ? into ?sales_range? values ( 12345 ,? ' test ' ,? 1000 ,?to_date( ' 2006-02-15 ' ,? ' yyyy-mm-dd ' ));
          insert ? into ?sales_range? values ( 12345 ,? ' test ' ,? 1000 ,?to_date( ' 2006-03-15 ' ,? ' yyyy-mm-dd ' ));
          insert ? into ?sales_range? values ( 12345 ,? ' test ' ,? 1000 ,?to_date( ' 2006-04-15 ' ,? ' yyyy-mm-dd ' ));
          insert ? into ?sales_range? values ( 12345 ,? ' test ' ,? 1000 ,?to_date( ' 2006-05-15 ' ,? ' yyyy-mm-dd ' ));

          create ? index ?idx_sales_range_sales_date? on ?sales_range?(sales_date);

          ALTER ? TABLE ?sales_range? DROP ?PARTITION?sales_jan2006? UPDATE ?GLOBAL?INDEXES;

          When to Partition a Table
          Here are some suggestions for when to partition a table:

          • Tables greater than 2GB should always be considered for partitioning.
          • Tables containing historical data, in which new data is added into the newest partition. A typical example is a historical table where only the current month's data is updatable and the other 11 months are read-only.

          參考:? ora92_doc/server.920/a96524/c12parti.htm

          詳細(xì)請參考o(jì)racle文檔

          posted on 2006-05-12 16:37 waterye 閱讀(1087) 評論(1)  編輯  收藏 所屬分類: oracle

          Feedback

          # re: Partitioned Tables 2007-11-25 17:55 柯夢楠

          good  回復(fù)  更多評論   

          主站蜘蛛池模板: 高唐县| 醴陵市| 柳河县| 洪雅县| 仲巴县| 乐山市| 句容市| 应城市| 天全县| 成都市| 商洛市| 黎城县| 沁源县| 四平市| 灯塔市| 临西县| 贵溪市| 昌邑市| 定襄县| 清水河县| 苍南县| 土默特右旗| 贵溪市| 宣武区| 南江县| 清水河县| 论坛| 安多县| 桂林市| 阿拉善右旗| 灵台县| 思南县| 武清区| 京山县| 山东| 雅安市| 桃园县| 千阳县| 沁水县| 巴彦淖尔市| 新丰县|