ÔÚ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)»ñÈ¡±í¿Õ¼äµÄÏà¹ØÐÅÏ¢£¬Ê×ÏÈʹÓÿͻ§¶Ë¹¤¾ßÁ¬½Óµ½Êý¾
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
µÚÒ»²½¡¢¼ì²é²Ù×÷ϵͳ»·¾³
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*
Ö»ÒªÊÇûÓÐ×°µÄ¶¼Òª½øÐа ......
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º¯ÊýµÄд·¨Ïà¶Ô±È½Ï¼ò½à ......
DML:Data Manipulation Language Êý¾Ý²Ù×÷ÓïÑÔ
°üÀ¨£ºCRUD
1. insertÓï¾ä
(1) ´ÓÆäËü±íÖи´ÖÆÊý¾Ý,ʵÏÖ·½·¨:ÔÚinsert Óï¾äÖмÓÈë²éѯÓï¾ä
insert into sales_reps(id,name,salary,commission_pct) select employee_id,last_name,salary,commission_pct
from employees where job_id like '%rep';
(2) up ......
ÒÔÉÏΪתÔØ,¶àÊý²¢Î´ÑéÖ¤.
ÆäÖÐ,select trunc(sysdate,'dd') from dual,µÃµ½µÄÊÇ: 2009-3-23 ÉÏÎç12:00:00 ,ÓëÏÂÎIJ¢²»Ò»Ñù!
oracle trunc()º¯ÊýµÄÓ÷¨
1.TRUNC(for dates)
TRUNCº¯ÊýΪָ¶¨ÔªËضø½ØÈ¥µÄÈÕÆÚÖµ¡£
Æä¾ßÌåµÄÓï·¨¸ñʽÈçÏ£º
TRUNC£¨date[,fmt]£©
ÆäÖУº
date Ò»¸öÈÕÆÚÖµ
fmt ÈÕÆÚ¸ñʽ£¬¸ÃÈÕÆÚ½« ......