ÔÚOracleÖвéѯ±íµÄ´óСºÍ±í¿Õ¼äµÄ´óС
ÓÐÁ½ÖÖº¬ÒåµÄ±í´óС¡£Ò»ÖÖÊÇ·ÖÅä¸øÒ»¸ö±íµÄÎïÀí¿Õ¼äÊýÁ¿£¬¶ø²»¹Ü¿Õ¼äÊÇ·ñ±»Ê¹Ó᣿ÉÒÔÕâÑù²éѯ»ñµÃ×Ö½ÚÊý£º
select segment_name, bytes
from user_segments
where segment_type = 'TABLE';
»òÕß
Select Segment_Name,Sum(bytes)/1024/1024 from User_Extents Group By Segment_Name
ÁíÒ»ÖÖ±íʵ¼ÊʹÓõĿռ䡣ÕâÑù²éѯ£º
analyze table emp compute statistics;
select num_rows * avg_row_len
from user_tables
where table_name = 'EMP';
²é¿´Ã¿¸ö±í¿Õ¼äµÄ´óС
Select Tablespace_Name,Sum(bytes)/1024/1024 from Dba_Segments Group By Tablespace_Name
1.²é¿´Ê£Óà±í¿Õ¼ä´óС
SELECT tablespace_name ±í¿Õ¼ä,sum(blocks*8192/1000000) Ê£Óà¿Õ¼äM from dba_free_space GROUP BY tablespace_name;
2.¼ì²éϵͳÖÐËùÓбí¿Õ¼ä×ÜÌå¿Õ¼ä
select b.name,sum(a.bytes/1000000)×Ü¿Õ¼ä from v$datafile a,v$tablespace b where a.ts#=b.ts# group by b.name;
¡¡¡¡1¡¢²é¿´OracleÊý¾Ý¿âÖбí¿Õ¼äÐÅÏ¢µÄ¹¤¾ß·½·¨£º
¡¡¡¡Ê¹ÓÃoracle enterprise manager console¹¤¾ß£¬ÕâÊÇoracleµÄ¿Í»§¶Ë¹¤¾ß£¬µ±°²×°oracle·þÎñÆ÷»ò¿Í»§¶Ëʱ»á×Ô¶¯°²×°´Ë¹¤¾ß£¬ÔÚwindows²Ù×÷ϵͳÉÏÍê³Éoracle°²×°ºó£¬Í¨¹ýÏÂÃæµÄ·½·¨µÇ¼¸Ã¹¤¾ß£º¿ªÊ¼²Ëµ¥——³ÌÐò——Oracle-OraHome92——Enterprise Manager Console(µ¥»÷)——oracle enterprise manager consoleµÇ¼——Ñ¡Ôñ‘¶ÀÁ¢Æô¶¯’µ¥Ñ¡¿ò——‘È·¶¨’ —— ‘oracle enterprise manager console£¬¶ÀÁ¢’ ——Ñ¡ÔñÒªµÇ¼µÄ‘ʵÀýÃû’ ——µ¯³ö‘Êý¾Ý¿âÁ¬½ÓÐÅÏ¢’ ——ÊäÈë’Óû§Ãû/¿ÚÁî’ (Ò»°ãʹÓÃsysÓû§)£¬’Á¬½ÓÉí·Ý’Ñ¡ÔñÑ¡ÔñSYSDBA——‘È·¶¨’£¬ÕâʱÒѾ³É¹¦µÇ¼¸Ã¹¤¾ß£¬Ñ¡Ôñ‘´æ´¢’ ——±í¿Õ¼ä£¬»á¿´µ½ÈçϵĽçÃ棬¸Ã½çÃæÏÔʾÁ˱í¿Õ¼äÃû³Æ£¬±í¿Õ¼äÀàÐÍ£¬Çø¹ÜÀíÀàÐÍ£¬ÒÔ”ÕהΪµ¥Î»µÄ±í¿Õ¼ä´óС£¬ÒÑʹÓõıí¿Õ¼ä´óС¼°±í¿Õ¼äÀûÓÃÂÊ¡£
¡¡¡¡Í¼1 ±í¿Õ¼ä´óС¼°Ê¹ÓÃÂÊ
¡¡¡¡2¡¢²é¿´OracleÊý¾Ý¿âÖбí¿Õ¼äÐÅÏ¢µÄÃüÁî·½·¨£º
¡¡¡¡Í¨¹ý²éѯÊý¾Ý¿âϵͳÖеÄÊý¾Ý×Öµä±í(data dictionary tables)»ñÈ¡±í¿Õ¼äµÄÏà¹ØÐÅÏ¢£¬Ê×ÏÈʹÓÿͻ§¶Ë¹¤¾ßÁ¬½Óµ½Êý¾
Ïà¹ØÎĵµ£º
µÚÒ»²½¡¢¼ì²é²Ù×÷ϵͳ»·¾³
rpm -q gcc make binutils openmotif glibc setarch compat-db compat-gcc-34 openmotif compat-gcc-34-c++ compat-libstdc++-33
Èç¹û¼ì²âµ½Äĸö°üûÓÐ×°£¬Ôò·Ö±ðÔÚISO¾µÏñÎļþÖÐÕÒµ½½øÐа²×°
¹ÒÔØ6ÕÅ»ò7ÕÅISOÎļþ£¬
±ÈÈç˵£ºrpm -ivh /mnt/iso/3/CentOS/openmotif*
Ö»ÒªÊÇûÓÐ×°µÄ¶¼Òª½øÐа ......
ORACLE SQLÓï¾äÓÅ»¯×ܽá
1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, Ä ......
¸Õ¸ÕÔÚinthirtiesÀÏ´óµÄ²©¿ÍÀï¿´µ½ÕâƪÎÄÕ£¬Ð´µÄ²»´í£¬ÕýºÃ×Ô¼º×î½üÔÚѧϰPL/SQL£¬×ª¹ýÀ´Ñ§Ï°Ñ§Ï°¡£
==================================================================================
bulk collectÊÇ¿ÉÒÔ¿´×öÊÇÒ»ÖÖÅú»ñÈ¡µÄ·½Ê½£¬ÔÚÎÒÃǵÄplsqlµÄ´úÂë¶ÎÀï¾³£×÷ΪintoµÄÀ©Õ¹À´Ê¹Ó᣶ÔÓÚselect id into v from ... ......
Case¾ßÓÐÁ½ÖÖ¸ñʽ¡£¼òµ¥Caseº¯ÊýºÍCaseËÑË÷º¯Êý¡£
--¼òµ¥Caseº¯Êý
CASE sex
WHEN '1' THEN 'ÄÐ'
WHEN '2' THEN 'Å®'
ELSE 'ÆäËû' END
--CaseËÑË÷º¯Êý
CASE WHEN sex = '1' THEN 'ÄÐ'
WHEN sex = '2' THEN 'Å®'
ELSE 'ÆäËû' END
ÕâÁ½ÖÖ·½Ê½£¬¿ÉÒÔʵÏÖÏàͬµÄ¹¦ÄÜ¡£¼òµ¥Caseº¯ÊýµÄд·¨Ïà¶Ô±È½Ï¼ò½à ......