oracle ·ÖÇø±íµÄ½¨Á¢·½·¨
oracle ·ÖÇø±íµÄ½¨Á¢·½·¨
OracleÌṩÁË·ÖÇø¼¼ÊõÒÔÖ§³ÖVLDB(Very Large DataBase)¡£·ÖÇø±íͨ¹ý¶Ô·ÖÇøÁеÄÅжϣ¬°Ñ·ÖÇøÁв»Í¬µÄ¼Ç¼£¬·Åµ½²»Í¬µÄ·ÖÇøÖС£·ÖÇøÍêÈ«¶ÔÓ¦ÓÃ͸Ã÷¡£
OracleµÄ·ÖÇø±í¿ÉÒÔ°üÀ¨¶à¸ö·ÖÇø£¬Ã¿¸ö·ÖÇø¶¼ÊÇÒ»¸ö¶ÀÁ¢µÄ¶Î£¨SEGMENT£©£¬¿ÉÒÔ´æ·Åµ½²»Í¬µÄ±í¿Õ¼äÖС£²éѯʱ¿ÉÒÔͨ¹ý²éѯ±íÀ´·ÃÎʸ÷¸ö·ÖÇøÖеÄÊý¾Ý£¬Ò²¿ÉÒÔͨ¹ýÔÚ²éѯʱֱ½ÓÖ¸¶¨·ÖÇøµÄ·½·¨À´½øÐвéѯ¡£
·ÖÇøÌṩÒÔÏÂÓŵ㣺
ÓÉÓÚ½«Êý¾Ý·ÖÉ¢µ½¸÷¸ö·ÖÇøÖУ¬¼õÉÙÁËÊý¾ÝË𻵵ĿÉÄÜÐÔ£»
¿ÉÒÔ¶Ôµ¥¶ÀµÄ·ÖÇø½øÐб¸·ÝºÍ»Ö¸´£»
¿ÉÒÔ½«·ÖÇøÓ³Éäµ½²»Í¬µÄÎïÀí´ÅÅÌÉÏ£¬À´·ÖÉ¢IO£»
Ìá¸ß¿É¹ÜÀíÐÔ¡¢¿ÉÓÃÐÔºÍÐÔÄÜ¡£
OracleÌṩÁËÒÔϼ¸ÖÖ·ÖÇøÀàÐÍ£º
·¶Î§·ÖÇø£¨range£©£»
¹þÏ£·ÖÇø£¨hash£©£»
Áбí·ÖÇø£¨list£©£»
·¶Î§£¹þÏ£¸´ºÏ·ÖÇø£¨range-hash£©£»
·¶Î§£ÁÐ±í¸´ºÏ·ÖÇø£¨range-list£©¡£
OracleµÄÆÕͨ±íûÓа취ͨ¹ýÐÞ¸ÄÊôÐԵķ½Ê½Ö±½Óת»¯Îª·ÖÇø±í£¬±ØÐëͨ¹ýÖؽ¨µÄ·½Ê½½øÐÐת±ä£¬ÏÂÃæ½éÉÜÈýÖÖЧÂʱȽϸߵķ½·¨£¬²¢ËµÃ÷ËüÃǸ÷×ÔµÄÌص㡣
·½·¨Ò»£ºÀûÓÃÔ±íÖؽ¨·ÖÇø±í¡£
²½Ö裺
SQL> CREATE TABLE T (ID NUMBER PRIMARY KEY, TIME DATE);
±íÒÑ´´½¨¡£
SQL> INSERT INTO T SELECT ROWNUM, CREATED from DBA_OBJECTS;
ÒÑ´´½¨6264ÐС£
SQL> COMMIT;
Ìá½»Íê³É¡£
SQL> CREATE TABLE T_NEW (ID, TIME) PARTITION BY RANGE (TIME)
2 (PARTITION P1 VALUES LESS THAN (TO_DATE('2004-7-1', 'YYYY-MM-DD')),
3 PARTITION P2 VALUES LESS THAN (TO_DATE('2005-1-1', 'YYYY-MM-DD')),
4 PARTITION P3 VALUES LESS THAN (TO_DATE('2005-7-1', 'YYYY-MM-DD')),
5 PARTITION P4 VALUES LESS THAN (MAXVALUE))
6 AS SELECT ID, TIME from T;
±íÒÑ´´½¨¡£
SQL> RENAME T TO T_OLD;
±íÒÑÖØÃüÃû¡£
SQL> RENAME T_NEW TO T;
±íÒÑÖØÃüÃû¡£
SQL> SELECT COUNT(*) from T;
COUNT(*)
----------
6264
SQL> SELECT COUNT(*) from T PARTITION (P1);
COUNT(*)
----------
0
SQL> SELECT COUNT(*) from T PARTITION (P2);
COUNT(*)
----------
6246
SQL> SELECT COUNT(*) from T PARTITIO
Ïà¹ØÎĵµ£º
°²×°¸ÅÊö
±¾Æª½éÉÜÈçºÎ°²×°OracleÈí¼þ£¬Òª°²×°OracleÈí¼þÍƼöʹÓÃOracleͨÓð²×°¡£OracleͨÓð²×°³ÌÐòÊÇÒ»¸öͼÐÎÓû§½çÃ棨GUI£©¹¤¾ß£¬Ê¹Äú¿ÉÒԲ鿴OracleÈí¼þÒÑÔÚ¼ÆËã»úÉÏ°²×°»ò°²×°ÐµÄOracleÈí¼þ£¬²¢Ð¶ÔØOracleÈí¼þ£¬ÒÔϽ«ÐÖúÄúÍê³É°²×°¹ý³Ì¡£
¼ì²éÏȾöÌõ¼þ
°²×°³ÌÐò֮ǰ£¬Oracle¹«Ë¾Ö´ÐÐÒ»¸öÏȾöÌõ¼þ¼ì²éµÄ×Ô¶¯±àº ......
²ã´Î»¯²éѯ£º
select [level],colomn,...from table
[where where_clause]
[ [start with start_condition] [connect by prior prior_condition]&nbs ......
select column_name from all_cons_columns cc
where owner='SSH' --SSHΪÓû§Ãû³Æ£¬Òª×¢Òâ´óСд
and table_name='SYS_DEPT' --SYS_DEPTΪ±íÃû£¬×¢Òâ´óСд
and exists (select 'x' from all_constraints c
where c.owner = cc.owner
and c.constraint_name = cc.constraint_name
and c.constraint_type ='P'
......
1¡¢OracleÀïÃæÓû§µÄÃÜÂëÊǽøÐмÓÃܱ£´æµÄ,ËùÒÔÖ»ÄÜÖØÐÂÐÞ¸ÄÉú³ÉеÄÃÜÂë.
ÀûÓÃϵͳ¹ÜÀíÔ±(sys)µÇ¼,½«scottÓû§µÄÃÜÂëÐ޸ļ´¿É
SQL>conn / as sysdba ;
ÒÑÁ¬½Ó¡£
SQL>alter user scott identified by tiger
;
Óû§ÒѸü¸Ä¡£
µ±È»Ò²¿ÉÒÔµ½WEB¶Ë½øÐÐÐ޸ĵØÖ·È ......