oracleÊý¾Ý¿â¼¶±ðÓÅ»¯·ÖÎö¹¤¾ß½éÉÜ
author£ºskate
time£º2010/03/04
oracleÊý¾Ý¿â¼¶±ðÓÅ»¯·ÖÎö¹¤¾ß½éÉÜ
µ±ÎÒÃǶÔÊý¾Ý¿âÓÅ»¯Õï¶Ïʱ£¬ÐèÒªÊÕ¼¯ÏàÓ¦µÄÐÅÏ¢ÒÔ¹©²Î¿¼£¬´Ó¸öÈ˵ÄʹÓþÑéÀ´Ëµ£¬ÕâÖÖͳ¼ÆÊý¾Ý·ÖΪÁ½´óÀà
Ò»ÀàÊÇÊý¾Ý¿â¼¶±ðµÄͳ¼ÆÐÅÏ¢
¶þÀàÊÇos¼¶±ðµÄͳ¼ÆÐÅÏ¢
ÏÂÃæ¾Í·Ö±ð½éÉÜÔÚ²»Í¬µÄ¼¶±ðÏ£¬³£ÓÃʲô¹¤¾ßÀ´ÊÕ¼¯ÐÅÏ¢°ïÖúÓÅ»¯Õï¶Ï
Ê×ÏÈÊÇoracleÊý¾Ý¿â¼¶±ðÓÅ»¯·ÖÎö¹¤¾ß½éÉÜ
Ŀ¼£º
1.statspack
2.ASH
3.AWR
4.ORACLE EXPLAIN PLANµÄ×ܽá(²éѯsqlµÄÖ´Ðмƻ®)
a.autotrace
b.explainµÄʹÓÃ
1.statspack
a¡£°²×°
sql> sqlplus "/ as sysdba"
SQL> select file_name from dba_data_files;
SQL> create tablespace perfstat datafile 'e:\oracle\oradata\skate\perfstat.dbf' size 2000m;
sql> @ORACLE_HOME\rdbms\admin\spcreate.sql
b¡£Ê¹ÓÃ
SQL> conn perfstat/passwd
ÊÕ¼¯Í³¼ÆÐÅÏ¢
sql> execute statspack.snap
»ò
SQL> exec statspack.SNAP(i_snap_level =>5);
Éú³É±¨¸æ
sql> @ORACLE_HOME\rdbms\admin\spreport.sql
¶¨Ê±ÊÕ¼¯ÐÅÏ¢ÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇoracle job£¬Ò»ÖÖÊÇosµÄcrontab£¬ÎұȽÏÏ°¹ßÓÃos¼¶±ðµÄcrontab
É趨Æäÿ¸öСʱ×Ô¶¯ÊÕ¼¯Ò»´Î²ÉÑùµÄjob
declare
Variable job number ;
begin
dbms_job.submit(:job, "statspack.snap;" ,trunc( sysdate + 1/24 , 'hh24' ), "trunc(sysdate+1/24,'hh24')" );
commit ;
end ;
/
²é¿´jobʹÓÃÇé¿ö
SQL> select job,schema_user,next_date,interval,what from user_jobs
×Ô¶¯Í£Ö¹²ÉÑùjob
declare
Variable job number ;
begin
dbms_job.submit(:job, "dbms_job.broken(44,true);" ,trunc( sysdate + 1 ), "null" );
commit ;
end ;
/
Çå¿ÕËùÓÐstatsͳ¼ÆÐÅÏ¢±íÀïµÄÊý¾Ý
sql> @ORACLE_HOME\rdbms\admin\sptrunc.sql
snapshotµÄlevel£¬Õâ¿ÉÒÔͨ¹ýEXEC STATSPACK.MODIFY_STATSPACK_PARAMETER(i_snap_level=N)À´Ð޸ģ¬N¿ÉÒÔΪ0£¬5£¬6£¬7£¬10£¬È±Ê¡Îª5¡£
¡¡¡¡ 0 ½öÌṩһ°ãÐÔÄÜͳ¼Æ
¡¡¡¡ 5 Ôö¼ÓÁ˶ÔSQLÓï¾ä×ÜÌå·ÖÎö
¡¡¡¡ 6 Ôö¼ÓÁËSQL¼Æ»®ºÍʹÓÃ
¡¡¡¡ 7 Ôö¼ÓÁ˷ֶΣ¨Segments£©¼¶µÄͳ¼Æ
¡¡¡¡ 10Ôö¼ÓÁ˶ÔãÅËø£¨Latches£©µÄ·ÖÎö
¡¡¡¡ÆäÖÐÎĵµ½¨Òé¶Ô10ÒªÉ÷ÖØ£¬ÒòΪ´ú¼Û½Ï¸ß¡£
eg£º
SQL> exec statspack.SNAP(i_snap_level =>6);
oracle²»½öÌṩÉú³É
Ïà¹ØÎĵµ£º
Ò»¡¢Íü¼Ç³ýSYS¡¢SYSTEMÓû§Ö®ÍâµÄÓû§µÄµÇ¼ÃÜÂë¡£
ÓÃSYS (»òSYSTEM)Óû§µÇ¼¡£
CONN SYS/PASS_WORD AS SYSDBA;
ʹÓÃÈçÏÂÓï¾äÐÞ¸ÄÓû§µÄÃÜÂë¡£
ALTER USER user_name IDENTIFIED BY newpass;
......
ÔÚ¿ª·¢¹ý³Ì³öÏÖÕâôһ¸öÎÊÌ⣺
±ÈÈ磺һ¸ö×Ö¶Îcontent ÀàÐÍCLOB£¬ÕâÆäÖдæµÄÓпÉÄܸ´ÖÆÕ³Ìù¹ýÀ´µÄword excel htmlÖеÄÄÚÈÝ£¬ÓÃjava½«ÕâЩÄÚÈÝ´æÈ룬´æÈëºóÓÐÌØÊâµÄ·ûºÅ ±ÈÈç»Ø³µ»»Ðеȡ£ÄÇô²»ÄÜÕý³£Õ¹Ê¾µÄÊý¾Ý¡£
½â¾ö·½°¸£º
´æÈëÊý¾ÝµÄÊǽ«Õâ¸öÊý¾ÝcontentdataÔÚjsÖнøÐÐ
......
¿ªÆô£º
net start oracledbconsoleorcl
net start oracleOraDb10g_home1iSQL*Plus
net start oracleOraDb10g_home1TNSListener
net start oracleServiceORCL
net start oraclejobschedulerorcl //¿ÉÒÔ½ûÓÃ
¹Ø±Õ£º
net stop oracledbconsoleorcl
net stop oracleOraDb10g_home1iSQL*Plus
net stop oracleOraDb10g_h ......
p580 ÎÄƽ
³£¼ûÎÊÌâÒ»:°º¹óµÄÊý¾Ý¿âÁ¬½Ó¿ªÏú
ÔÚÓ¦Óÿª·¢ÖУ¬¿Í»§¶ËΪÁËijÖÖÊý¾Ý¿â²Ù×÷¶ø½øÐÐijÖÖÊý¾Ý¿âÁ¬½ÓºÍ¶Ï¿ªµÄ²Ù×÷¡£ÕâÊÇ2000ÄêÇ°ºó¶¯Ì¬ÍøÒ³Ó¦ÓÃÀàÐͳ£¼ûµÄ´íÎó¡£ÔÚÕâÖÖÓ¦ÓÃÖУ¬Ã¿µ±Ò»¸öÓû§µ¥»÷Ò»¸öÍøÒ³£¬Èç¹ûÕâ¸öÍøҳǶÈëÁËÊý¾Ý¿â²Ù×÷£¬Ôò¸ÃÍøÒ³Òª½øÐÐÒ»´Î»òÈô¸É´ÎµÄÊý¾Ý¿âÁ¬½ÓºÍ¶Ï¿ª¡ ......
1.DUAL±íµÄÓÃ;
Dual ÊÇ OracleÖеÄÒ»¸öʵ¼Ê´æÔÚµÄ±í£¬ÈκÎÓû§¾ù¿É¶ÁÈ¡£¬³£ÓÃÔÚûÓÐÄ¿±ê±íµÄSelectÓï¾ä¿éÖÐ
--²é¿´µ±Ç°Á¬½ÓÓû§
SQL> select user from dual;
USER
------------------------------
SYSTEM
--²é¿´µ±Ç°ÈÕÆÚ¡¢Ê±¼ä
SQL> select sysdate from dual;
SYSDATE
-----------
2007-1-2 ......