Oracle²éÕÒµÚn¸ö×î´óÖµ
ÔÚ¹úÄÚÍâÐí¶àOracle DBAÕ¾µãÉÏ£¬Óкܶà²éÕÒ±íÖеÚn¸ö×î´óÖµµÄС¼¼ÇÉ£¬ÕâЩÓï¾äȷʵÏ൱ÇÉÃËüÃǶ¼¶À±Ùõè¾¶µØÓõ½ÁËOracle±íÖеÄÒ»¸öα×ֶΓlevel”¡£µ«ÊÇÔںܶàÇé¿öÏ£¬Õâ¸öÓï¾ä±ä³ÉÁË ÃÀÀöµÄÏÝÚå¡£Èç¹ûÄãÏëÖªµÀΪʲô£¬²¢ÔõÑùÈÆ¹ýËü£¬ÇëÌýÎÒµÀÀ´£¡
Ñо¿Á˼¸Ì죬ÎÒ·¢ÏÖÒ»ÖÖÑÜÉúËã·¨£¬¼´ÕÒ³öµÚn¸öºÍµÚm¸ö×î´óÖµµÄ²î£¨ÈçÏ£©£º
ÁбíÒ»£º
select max(salary) from empdetails
where level = &n
connect by prior salary>salary
start with salary = ( select max(salary) from empdetails);
´ËºóÓÖ·¢ÏÖÈçÏÂËã·¨£¬ÀûÓÃOracleµÄα×Ö¶Îlevel£¬´Ó×î´óÖµ¿ªÊ¼£¬°´ÖµµÝ¼õ˳Ðò£¬°Ñ¼Ç¼Ö𲽷ֲ㣬×îºóÕÒ³öµÚn¸ö×î´óÖµºÍµÚm¸ö×î´óÖµÖ®¼äµÄ²îÖµ¡£
Áбí¶þ£º
select a.nmax_salary – b.mmax_salary from
(select max(salary) from empdetails
where level = &n
connect by prior salary > salary
start with salary = (select (max(salary)) from empdetails)
) a ,
(select max(salary) mmax_salary from empdetails
where level = &m
connect by prior salary > salary
start with salary = (select (max(salary)) from empdetails)
) b ;
ÎÒΪ´ËËã·¨µÄÐÂÆæÔÞ̾Á˺ܾã¬Öµµ½Ò»ÌìÎÒÏëÀûÓÃÕâ¸ö·½·¨Ê±£¬²Å·¢ÏÖÕâ¸ö·½·¨²¢²»ÈçÏëÏóÖÐÄÇôÃÀÃî¡£
ÎÒÒª´Ó60¶à¸ö²»Í¬ÖµÖÐÕÒ³öµÚn¸ö×î´óֵʱ£¬ÊäÈë´ËÓï¾äºó£¬·¢ÏÖÈçͬʯ³Á´óº£¡¢èÃÎÞÒôѶ£¬ÆÁÄ»ÉÏÖ»ÓГStatement is running”µÄÌáʾ¡£ÎªÁËÁ˽âOracleÊÇÔõÑù·Ö²ãµÄ£¬ÎÒÊäÈëÈçÏÂÓï¾ä£º
ÁбíÈý£º
select lpad(‘ ‘,level)||salary from empdetails
connect by prior salary > salary
start with salary = (select (max(salary)) from empdetails) ;
·¢ÏÖÆÁÄ»ÔÚ²»¶ÏÊä³ö½á¹û£¬×ã×ãµÈÁËÊ®¶à·ÖÖÓ£¬»¹ÔÚ²»Í£µØ¹ö¶¯£¬ÎÒÒâʶµ½ÕâËã·¨´æÔÚijЩÎÊÌâ¡£
ÊÔ×Å·ÖÎöÒ»ÏÂÁбíÈýµÄ½á¹û£¬·¢ÏÖÕâ¸öÓï¾äµÄ»ØËͼǼÊýÓë¿âÖв»Í¬ÊýÖµµÄ¸öÊýÊÇÖ¸ÊýÔö³¤£¬Æä¹«Ê½Îª RecordsRe = 2Rdeferent_value – 1 £¬ÒªÔÚ60¶à¸ö²»Í¬ÖµÖÐÓøÃËã·¨ÕÒ³öµÚn¸ö×î´óÖµ£¬²»
Ïà¹ØÎĵµ£º
The following are number examples for the to_char
function.
to_char
(1210.73,
'9999.9')
would return '1210.7'
to_char
(1210.73,
'9,999.99')
would return '1,210.73'
to_char
(1210.73,
'$9,999.00')
would return
'$1,210.73'
to_char
(21,
'000099')
would return '000021'
The foll ......
Ò». ËÀËøµÄ¼ì²â
--²éËÀËøµÄ»á»°¡£
select A.sid, b.serial#,
decode(A.type,
'MR', 'Media Recovery',
'RT','Redo Thread',
'UN','User Name',
'TX', 'Transaction',
'TM', ' ......
×î½ü·¢ÏÖÒ»¸ö±È½ÏÓÐÒâ˼µÄÎÊÌ⣺
µ±ÎÒÃÇÔÚÖ´ÐÐÒ»Ìõ²éѯÓï¾äʱ£¬Èç¹ûÌõ¼þν´ÊÖк¬Óк¯Êý£¬Èç abs(age)<10£¬´Ëʱ£¬Í¨¹ý²éѯ¼Æ»®¿´µ½µÄ½á¹û¼¯µÄ»ùÊýÖµÓëʵ¼ÊµÄÖµÏà²îºÜ´ó¡£µ±ÎÒÃǸıä²éѯÌõ¼þʱ£¬Èçabs(age)<20£¬ÕâʱµÄ»ùÊýÖµ²»»á¸Ä±ä£¬ºÍabs(age)<10µÃµ½µÄ»ùÊýÖµÒ»Ñù¡£
µ«ÏÖÔÚ»¹Ã»ÕÒµ½ÎÊÌâµÄÔÒò£¬searching... ......
˵µ½HWM,ÎÒÃÇÊ×ÏÈÒª¼òÒªµÄ̸̸ORACLEµÄÂß¼´æ´¢¹ÜÀí.ÎÒÃÇÖªµÀ,ORACLEÔÚÂß¼´æ´¢ÉÏ·Ö4¸öÁ£¶È:±í¿Õ¼ä,¶Î,ÇøºÍ¿é.
(1)¿é:ÊÇÁ£¶È×îСµÄ´æ´¢µ¥Î»,ÏÖÔÚ±ê×¼µÄ¿é´óСÊÇ8K,ORACLEÿһ´ÎI/O²Ù×÷Ò²Êǰ´¿éÀ´²Ù×÷µÄ,Ò²¾ÍÊÇ˵µ±ORACLE´ÓÊý¾ÝÎļþ¶ÁÊý¾Ýʱ,ÊǶÁÈ¡¶àÉÙ¸ö¿é,¶ø²»ÊǶàÉÙÐÐ.
(2)Çø:ÓÉһϵÁÐÏàÁÚµÄ¿é¶ø×é³É,ÕâÒ²ÊÇORACLE¿Õ¼ ......