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

          詳細請參考oracle文檔

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

          Feedback

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

          good  回復  更多評論   

          主站蜘蛛池模板: 民县| 姚安县| 彭山县| 贞丰县| 淮阳县| 乌苏市| 林甸县| 安岳县| 龙陵县| 岢岚县| 西乌珠穆沁旗| 遵义县| 北海市| 钟祥市| 芦山县| 彩票| 宣汉县| 南平市| 阿尔山市| 五大连池市| 沛县| 大石桥市| 温泉县| 镇康县| 康平县| 南岸区| 扶余县| 大方县| 奉贤区| 嘉黎县| 襄汾县| 垦利县| 都兰县| 浦东新区| 舟曲县| 陇南市| 邢台县| 泗阳县| 林口县| 阜新市| 彩票|