Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle Ë÷Òý

2009-07-16 10:59
Ë÷Òý´´½¨²ßÂÔ
1.µ¼ÈëÊý¾ÝºóÔÙ´´½¨Ë÷Òý
2.²»ÐèҪΪºÜСµÄ±í´´½¨Ë÷Òý
3.¶ÔÓÚÈ¡Öµ·¶Î§ºÜСµÄ×ֶΣ¨±ÈÈçÐÔ±ð×ֶΣ©Ó¦µ±½¨Á¢Î»Í¼Ë÷Òý
4.ÏÞÖƱíÖеÄË÷ÒýµÄÊýÄ¿
5.ΪË÷ÒýÉèÖúÏÊʵÄPCTFREEÖµ
6.´æ´¢Ë÷ÒýµÄ±í¿Õ¼ä×îºÃµ¥¶ÀÉ趨
´´½¨²»Î¨Ò»Ë÷Òý
create index emp_ename on employees(ename)
tablespace users
storage(......)
pctfree 0;
´´½¨Î¨Ò»Ë÷Òý
create unique index emp_email on employees(email)
tablespace users;
´´½¨Î»Í¼Ë÷Òý
create bitmap index emp_sex on employees(sex)
tablespace users;
´´½¨·´ÐòË÷Òý
create unique index order_reinx on orders(order_num,order_date)
tablespace users
reverse;
´´½¨º¯ÊýË÷Òý(º¯ÊýË÷Òý¼´¿ÉÒÔÊÇÆÕͨµÄBÊ÷Ë÷Òý£¬Ò²¿ÉÒÔÊÇλͼË÷Òý)
create index emp_substr_empno
on employees(substr(empno,1,2))
tablespace users;
ÐÞ¸ÄË÷Òý´æ´¢²ÎÊý(Óë±íÀàËÆ£¬INITIALºÍMINEXTENTS²ÎÊýÔÚË÷Òý½¨Á¢ÒÔºó²»ÄÜÔٸıä)
alter index emp_ename storage(pctincrease 50); ÓÉÓÚ¶¨ÒåÔ¼ÊøʱÓÉoracle×Ô¶¯½¨Á¢µÄË÷Òýͨ³£ÊDz»ÖªµÀÃû³ÆµÄ£¬¶ÔÕâÀàË÷ÒýµÄÐ޸ľ­³£ÊÇÀûÓÃalter table ..using indexÓï¾ä½øÐеÄ,¶ø²»ÊÇalter indexÓï¾ä
ÀûÓÃÏÂÃæµÄÓï¾ä½«employees±íÖÐprimary keyÔ¼Êø¶ÔÓ¦µÄË÷ÒýµÄPCTFREE²ÎÊýÐÞ¸ÄΪ5
alter table employees enable primary key using index pctfree 5;
ÇåÀíË÷ÒýËéƬ
1.ºÏ²¢Ë÷Òý(Ö»ÊǼòµ¥µÄ½«BÊ÷Ò¶½áµãÖеĴ洢ËéƬºÏ²¢ÔÚÒ»Æ𣬲¢²»»á¸Ä±äË÷ÒýµÄÎïÀí×éÖ¯½á¹¹£©
alter index emp_pk coalesce;
2.Öؽ¨Ë÷Òý(²»½öÄܹ»Ïû³ý´æ´¢ËéƬ,»¹¿ÉÒԸıäË÷ÒýµÄÈ«²¿´æ´¢²ÎÊýÉèÖ㬲¢ÇÒ¿ÉÒÔ½«Ë÷ÒýÒƶ¯µ½ÆäËüµÄ±í¿Õ¼äÖÐ,Öؽ¨Ë÷Òý
ʵ¼ÊÉϾÍÊÇÔÙÖ¸¶¨µÄ±í¿Õ¼äÖÐÖØн¨Á¢Ò»¸öеÄË÷Òý,È»ºóɾ³ýÔ­À´µÄË÷Òý)
alter index emp_pk rebuild;
ɾ³ýË÷Òý
drop index emp_ename;
Èç¹ûË÷ÒýÖаüº¬Ë𻵵ÄÊý¾Ý¿é£¬»òÕß°üº¬¹ý¶àµÄ´æ´¢ËéƬ£¬ÐèÒªÊ×ÏÈɾ³ýÕâ¸öË÷Òý£¬È»ºóÔÙÖؽ¨Ëü.
Èç¹ûË÷ÒýÊÇÔÚ´´½¨Ô¼ÊøʱÓÉoracle×Ô¶¯²úÉúµÄ,¿ÉÒÔͨ¹ý½ûÓÃÔ¼Êø»òɾ³ýÔ¼ÊøµÄ·½·¨À´É¾³ý¶ÔÓ¦µÄË÷Òý.
ÔÚɾ³ýÒ»¸ö±íʱ,oracle»á×Ô¶¯É¾³ýËùÓÐÓë¸Ã±íÏà¹ØµÄË÷Òý.
Ë÷ÒýÊý¾Ý×Öµä
all_indexes/dba_indexes/user_indexes Ë÷ÒýµÄ»ù±¾ÐÅÏ¢
all_ind_columns/dba_ind_columns/user_ind_columns Ë÷Òý¶ÔÓ¦µÄ×Ö¶ÎÐÅÏ¢
create unique index Ë÷ÒýÃû on    ±íÃû(×Ö¶ÎÃû)
create


Ïà¹ØÎĵµ£º

oracle ±í¿Õ¼ä²Ù×÷

oracle±í¿Õ¼ä²Ù×÷Ïê½â
  1
  2
  3×÷Õߣº   À´Ô´£º    ¸üÐÂÈÕÆÚ£º2006-01-04 
  5
  6 
  7½¨Á¢±í¿Õ¼ä
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

OracleÖд´½¨¡¢Ð޸ġ¢É¾³ýÐòÁÐ

1¡¢´´½¨ÐòÁÐÓï·¨£º(ÐèÒªCREATE SEQUENCEϵͳȨÏÞ)
CREATE SEQUENCE ÐòÁÐÃû
[INCREMENT BY n] ---ÓÃÓÚ¶¨ÒåÐòÁеIJ½³¤¡£
                                ......

Oracleѧϰ±Ê¼Çժ¼4

 ½¨Á¢±íÈçÏÂ:
ѧÉú»ù±¾ÐÅÏ¢±í
CREATE Student(
[Studentid][Int]IDENTITY(1,1)NOT NULL primary key,--Ö÷¼ü
[StudentName][char]NOT NULL
)
¿Î³ÌÐÅÏ¢±í
CREATE Subject(
[SubjectID][char]NOT NULL primary key,          --Ö÷¼ü
[SubjectName][char]NOT NULL
)
³ ......

Oracleѧϰ±Ê¼Çժ¼9

   a)Êý¾Ý¿â±¾ÉíµÄÓÅ»¯
       ³õʼ»¯Îļþ init.ora
         open_cursors = 150 ´ò¿ªµÄÓαêµÄ¸öÊý
            ºÜ¶àµÄ´æ´¢¹ý³ÌµÄʱºò ¿ÉÒÔ°ÑËüµ÷´óЩ
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ