Oracle¼ì²é¶ÔÏó[µÚ°ËÕ±ʼÇ]
Oracle ¼ì²é¶ÔÏó
8.3. Oracle¶ÔÏóµÄ״̬
¹²·ÖÁù¸ö²¿·Ö£¬·Ö±ðΪ£º¼ì²éOracle¿ØÖÆÎļþ״̬£»¼ì²éOracleÔÚÏßÈÕ־״̬£»¼ì²éOracle±í¿Õ¼äµÄ״̬£»¼ì²éOracleËùÓÐÊý¾ÝÎļþ״̬£»¼ì²éOracleËùÓÐ±í¡¢Ë÷Òý¡¢´æ´¢¹ý³Ì¡¢´¥·¢Æ÷¡¢°üµÈ¶ÔÏóµÄ״̬£»¼ì²éOracleËùÓлعö¶ÎµÄ״̬¡£
8.3.1. Oracle¿ØÖÆÎļþ״̬
¼ì²é¿ØÖÆÎļþ״̬ÊÇ·ñÕý³£¡£
$sqlplus system/manager
sql>select * from v$controlfile;
Êä³ö½á¹ûÓ¦¸ÃÓÐ3ÌõÒÔÉÏ£¨°üº¬3Ìõ£©µÄ¼Ç¼£¬“STATUS”Ó¦¸ÃΪ¿Õ¡£×´Ì¬Îª¿Õ±íʾ¿ØÖÆÎļþ״̬Õý³£¡£
8.3.2. OracleÔÚÏßÈÕ־״̬
¼ì²éÔÚÏßÈÕ־״̬ÊÇ·ñÕý³£¡£
$sqlplus system/manager
sql>select * from v$logfile;
Êä³ö½á¹ûÓ¦¸ÃÓÐ3ÌõÒÔÉÏ£¨°üº¬3Ìõ£©¼Ç¼£¬“STATUS”Ó¦¸ÃΪ·Ç“INVALID”£¬·Ç“DELETED”¡£
×¢£º“STATUS”ÏÔʾΪ¿Õ±íʾÕý³£¡£
8.3.3. Oracle±í¿Õ¼ä״̬
¼ì²éÓ¦ÓÃÏà¹Ø±í¿Õ¼ä״̬ÊÇ·ñΪ“ONLINE”¡£
$sqlplus system/manager
sql>select tablespace_name,status from dba_tablespaces;
ÆäÖГSTATUS”Ó¦¸Ã¶¼Îª“ONLINE”£¬¼Ó´ÖÊä³öÏÔʾµÄ²¿·ÖΪÎÒÃÇÓ¦ÓÃÏà¹ØµÄ±í¿Õ¼ä¡£
8.3.4. OracleËùÓÐÊý¾ÝÎļþ״̬
¼ì²éÊý¾ÝÎļþ״̬ÊÇ·ñΪ“ONLINE”¡£
$sqlplus system/manager
col NAME form a50
col STATUS form a10
sql>select name,status from v$datafile;
Êä³ö½á¹ûÖГSTATUS”Ó¦¸Ã¶¼Îª“ONLINE”¡£
8.3.5. OracleËùÓÐ±í¡¢Ë÷Òý¡¢´æ´¢¹ý³Ì¡¢´¥·¢Æ÷¡¢°üµÈ¶ÔÏóµÄ״̬
¼ì²éϵͳÊÇ·ñ´æÔÚÎÞЧ¶ÔÏó£¬ÎÞЧ¶ÔÏóÊÇ·ñÓëÓ¦ÓÃÏà¹Ø¡£
$sqlplus system/manager
sql>select owner,object_name,object_type
from dba_objects where status!=’VALID’ and owner!=’SYS’ and owner!=’SYSTEM’;
Èç¹ûÓмǼ·µ»Ø£¬Ôò˵Ã÷´æÔÚÎÞЧµÄ¶ÔÏó¡£ÈôÕâЩ¶ÔÏóÓëÎÒÃÇÓ¦ÓÃÏà¹Ø£¬ÄÇôÐèÒªÖØÐÂÉú³ÉÕâ¸ö¶ÔÏó¡£
8.3.6. OracleËùÓлعö¶ÎµÄ״̬
¼ì²é»Ø¹ö¶Î״̬ÊÇ·ñÕý³£¡£
$sqlplus system/manager
sql>select segment_name,status from dba_rollback_segs;
Ó¦¸ÃÓÐÈô¸ÉÌõ¼Ç¼·µ»Ø£¬²¢ÇÒÊä³ö½á¹ûÖÐËùÓлعö¶ÎµÄ“STATUS”Ó¦¸ÃΪ“ONLINE”¡£
8.4. OracleÏà¹Ø×ÊÔ´µÄʹÓÃÇé¿ö
¹²·ÖÎå¸ö²¿·Ö£¬·Ö±ðΪ£º¼ì²éOracle³õʼ»¯ÎļþÖÐÏà¹ØµÄ²ÎÊýÖµ£¬¼ì²éOracle¸÷¸ö±í¿Õ¼äµÄÔö³
Ïà¹ØÎĵµ£º
1¡¢²éѯµÚ¼¸ÐеļǼ
select sal from emp where rownum=1; //²éѯµÃµ½µÚÒ»ÐмǼ
select sal from emp where rownum=5; //²»¿ÉÒÔ²éѯµ½µÚÎåÐмǼ£¬ÒòΪrownum ×ÜÊÇ´Ó1¿ªÊ¼²éѯµÄ£¬¹ÊÕâÖÖ·½Ê½²»¿ÉÒÔÖ±½ÓµÃµ½µÚ¼¸ÐеļǼ¡£ÈôÏëµÃµ½µÚÎåÐмǼ£¬Ó¦²ÉÓÃÈçÏ·½Ê½£º
select r,sal from (select rownum r,sal from emp) wher ......
v$database Êý¾Ý¿âÐÅÏ¢
v$datafile Êý¾ÝÎļþÐÅÏ¢
v$controlfile ¿ØÖÆÎļþÐÅÏ¢
v$logfile ÖØ×öÈÕÖ¾ÐÅÏ¢
v$instance Êý¾Ý¿âʵÀýÐÅÏ¢
v$log ÈÕÖ¾×éÐÅÏ¢
v$loghist ÈÕÖ¾ÀúÊ·ÐÅÏ¢
v$sga Êý¾Ý¿âSGAÐÅÏ¢
v$parameter ³õʼ»¯²ÎÊýÐÅÏ¢
v$process Êý¾Ý¿â·þÎñÆ÷½ø³ÌÐÅÏ¢
v$bgprocess Êý¾Ý¿âºǫ́½ø³ÌÐÅÏ¢
v$controlfil ......
¡¾IT168 ¼¼ÊõÎĵµ¡¿Ëæ×ÅÍøÂçÓ¦Óú͵ç×ÓÉÌÎñµÄ²»¶Ï·¢Õ¹£¬¸÷¸öÕ¾µãµÄ·ÃÎÊÁ¿Ô½À´Ô½´ó£¬ÈçºÎʹÓÐÏ޵ļÆËã»úϵͳ×ÊԴΪ¸ü¶àµÄÓû§·þÎñ£¿ÈçºÎ±£Ö¤Óû§µÄÏìÓ¦ËٶȺͷþÎñÖÊÁ¿£¿ÕâЩÎÊÌⶼÊôÓÚ·þÎñÆ÷ÐÔÄÜÓÅ»¯µÄ·¶³ë¡£×÷Ϊ½Ï³É¹¦µÄÊý¾Ý¿â³§ÉÌ£¬Oracle¹«Ë¾Êý¾Ý¿âµÄÐÔÄÜÓÅ»¯ÊÇÈçºÎ½øÐеÄ
¡¡¡¡ ÓÅ»¯²ßÂÔ
¡¡¡¡ ΪÁ˱£Ö¤OracleÊý ......
Ñ¡Ôñ10gÊÇÒòΪ¶ÔÍø¸ñ¼¼Êõ±È½ÏºÃÆ棬ºÃÏñ»¹Ã»µÃµ½¹ã·ºÓ¦Óã¬Ò²¾ÍÎÞËùνÓëÇ°Ãæ°æ±¾ÓкܴóÇø±ðÁË¡£
ÔÚѸÀ×ÉÏÏÂÁ˸öÈí¼þ£¬ÔËÐÐsqlplusw£¬È»ºóÕÕ×ÅÊ飬¿ñÇÃÁËÒ»·£¬ÓÐÔÚÍøÉÏÏÂÁ˸öÊÓƵ½Ì³Ì£¨MLDNħÀֿƼ¼_Oracle¿ÎÌã©£¬½²µÃͦºÃµÄ£¬¾ÍÊÇʱ¼ä³¤Á˵㣬²»Èç¿´ÊéÀ´µÃ¿ì¡£·´ÕýÏÖÔÚÖ»ÊÇÏëÊìϤһÏ»ù±¾Óï¾ä¡£
¿´ÁËÁ½ÌìÊéÁË¡£Á˽âÁËÒ» ......
1) »ù±¾½á¹¹
BEGIN
... --Óï¾ä
EXCEPTION -- ÀýÍâ´¦Àí
WHEN ...
...
WHEN OTHERS
...
END;
2) ³£ÓÃÔ¤¶¨ÒåÀýÍâ
EXCEPTION
WHEN CU ......