Oracleά»¤³£ÓÃSQLÓï¾ä»ã×Ü
Oracleά»¤³£ÓÃSQLÓï¾ä»ã×Ü
ÉÏһƪ / ÏÂһƪ 2008-09-04 11:25:01
²é¿´( 1991 ) / ÆÀÂÛ( 0 ) / ÆÀ·Ö( 0 / 0 )
ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
select * from v$version;
²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
from SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;
3¡¢²é¿´»Ø¹ö¶ÎÃû³Æ¼°´óС
select segment_name, tablespace_name, r.status,
(initial_extent/1024) InitialExtent,(next_extent/1024) NextExtent,
max_extents, v.curext CurExtent
from dba_rollback_segs r, v$rollstat v
Where r.segment_id = v.usn(+)
order by segment_name ;
4¡¢²é¿´¿ØÖÆÎļþ
select name from v$controlfile;
5¡¢²é¿´ÈÕÖ¾Îļþ
select member from v$logfile;
6¡¢²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
from SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;
7¡¢²é¿´Êý¾Ý¿â¿â¶ÔÏó
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;
8¡¢²é¿´Êý¾Ý¿âµÄ°æ±¾¡¡
Select version from Product_component_version
Where SUBSTR(PRODUCT,1,6)='Oracle';
9¡¢²é¿´Êý¾Ý¿âµÄ´´½¨ÈÕÆں͹鵵·½Ê
Ïà¹ØÎĵµ£º
SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
A A ZERO &nbs ......
Íⲿ±íÊÇÖ¸²»ÔÚÊý¾Ý¿âÖÐµÄ±í£¬Èç²Ù×÷ϵͳÉϵÄÒ»¸ö°´Ò»¶¨¸ñʽ·Ö¸îµÄÎı¾Îļþ»òÕßÆäËûÀàÐÍµÄ±í¡£Õâ¸öÍⲿ±í¶ÔÓÚOracleÊý¾Ý¿âÀ´Ëµ£¬¾ÍºÃÏñÊÇÒ»ÕÅÊÓͼ£¬ÔÚÊý¾Ý¿âÖпÉÒÔÏñÊÔͼһÑù½øÐвéѯµÈ²Ù×÷¡£Õâ¸öÊÔͼÔÊÐíÓû§ÔÚÍⲿÊý¾ÝÉÏÔËÐÐÈκεÄSQLÓï¾ä£¬¶ø²»ÐèÒªÏȽ«Íⲿ±íÖеÄÊý¾Ý×°ÔؽøÊý¾Ý¿âÖС£²»¹ýÐèҪעÒâÊÇ£¬ÍⲿÊý¾Ý±í¶¼ÊÇÖ»¶ ......
ÔÚ´óÐ͵ÄÆóÒµÓ¦ÓûòÆóÒµ¼¶µÄÊý¾Ý¿âÓ¦ÓÃÖУ¬Òª´¦ÀíµÄÊý¾ÝÁ¿Í¨³£¿ÉÒÔ´ïµ½¼¸Ê®µ½¼¸°ÙGB£¬ÓеÄÉõÖÁ¿ÉÒÔµ½TB¼¶¡£ËäÈ»´æ´¢½éÖʺÍÊý¾Ý´¦Àí¼¼ÊõµÄ·¢Õ¹Ò²ºÜ¿ì£¬µ«ÊÇÈÔÈ»²»ÄÜÂú×ãÓû§µÄÐèÇó£¬ÎªÁËʹÓû§µÄ´óÁ¿µÄÊý¾ÝÔÚ¶Áд²Ù×÷ºÍ²éѯÖÐËٶȸü¿ì£¬OracleÌṩÁ˶ԱíºÍË÷Òý½øÐзÖÇøµÄ¼¼Êõ£¬ÒÔ¸ÄÉÆ´óÐÍÓ¦ÓÃϵͳµÄÐÔÄÜ¡£
ʹÓ÷ÖÇøµÄÓŵ㣠......
Ò»¡¢ ROWIDµÄ¸ÅÄî
¡¡¡¡´æ´¢
ÁËrowÔÚÊý¾ÝÎļþÖеľßÌåλÖãº64λ±àÂëµÄÊý¾Ý£¬A-Z, a-z, 0-9, +, ºÍ /£¬
¡¡¡¡rowÔÚÊý¾Ý¿éÖеĴ洢
·½Ê½
¡¡¡¡SELECT ROWID, last_name from hr.employees WHERE department_id = 20;
¡¡¡¡±ÈÈ磺OOOOOOFFFBBBBBBRRR
¡¡¡¡OOOOOO£ºdata object number, ¶ÔÓ¦dba_objects.data_object_id
¡¡¡ ......
ÔÚOracleÊÇÌṩÁËnext_dayÇóÖ¸¶¨ÈÕÆÚµÄÏÂÒ»¸öÈÕÆÚ.
Óï·¨ : next_day( date, weekday )
date is used to find the next weekday.
weekday is a day of the week (ie: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY)
¿ÉÓÃÓÚ:
Oracle 9i, Oracle 10g, Oracle 11g
For example:
next_day('01- ......