oracle sql tuning
alert index mem_ct monitoring usage;
desc v$object_usage;
set linesize 190
select * from v$object_usage;
SQL>SET AUTOTRACE ON;
¡¡¡¡*autotrace¹¦ÄÜÖ»ÄÜÔÚSQL*PLUSÀïʹÓÃ
¡¡¡¡ÆäËûһЩʹÓ÷½·¨£º
¡¡¡¡2.2.1¡¢ÔÚSQLPLUSÖеõ½Óï¾ä×ܵÄÖ´ÐÐʱ¼ä
¡¡¡¡SQL> set timing on;
2.2.2¡¢Ö»ÏÔʾִÐмƻ®--(»áͬʱִÐÐÓï¾äµÃµ½½á¹û)
¡¡¡¡SQL>set autotrace on explain
¡¡¡¡±ÈÈ磺
¡¡¡¡sql> select count(*) from test;
¡¡¡¡count(*)
¡¡¡¡-------------
¡¡¡¡4
¡¡¡¡Execution plan
¡¡¡¡----------------------------
¡¡¡¡0 select statement ptimitzer=choose (cost=3 card=1)
¡¡¡¡1 0 sort(aggregate)
¡¡¡¡2 1 partition range(all)
¡¡¡¡3 2 table access (full) of 't_test' (cost=3 card=900)
¡¡¡¡2.2.3¡¢Ö»ÏÔʾͳ¼ÆÐÅÏ¢---(»áͬʱִÐÐÓï¾äµÃµ½½á¹û)
¡¡¡¡SQL>set autotrace on statistics;
¡¡¡¡(±¸×¢£º¶ÔÓÚSYSÓû§£¬Í³¼ÆÐÅÏ¢½«»áÊÇ0)
¡¡¡¡2.2.4¡¢ÏÔʾִÐмƻ®£¬ÆÁ±ÎÖ´Ðнá¹û--(µ«Óï¾äʵÖÊ»¹Ö´ÐеÄ
¡¡¡¡SQL> set autotrace on traceonly;
¡¡¡¡(±¸×¢£ºÍ¬SET AUTOTRACE ON; Ö»²»¹ý²»ÏÔʾ½á¹û£¬ÏÔʾ¼Æ»®ºÍͳ¼Æ)
¡¡¡¡2.2.5¡¢½ö½öÏÔʾִÐмƻ®£¬ÆÁ±ÎÆäËûÒ»Çнá¹û--(Óï¾ä»¹ÊÇÖ´ÐÐÁË)
¡¡¡¡SQL>set autotrace on traceonly explain;
¡¡¡¡¶ÔÓÚ½ö½ö²é¿´´ó±íµÄExplain Plan·Ç³£¹ÜÓá£
¡¡¡¡2.2.6¡¢¹Ø±Õ
¡¡¡¡SQL>set autotrace off;
Ïà¹ØÎĵµ£º
1¡£web.config ----appSettings--<add key="LimsConnection" value="data source=yzlims;user id=lims;password = lims"/>
2. c#´úÂëÖÐ
using System.Data.OracleClient;
public DataTable GetLimsTimeInSpace(string S_SAMPLE_NAME, string S_SAMPLING_P_N,Date ......
oracle ÔõôÀ´±éÀúÒ»¸öÊ÷£¬Ïà±È½ÏÆäËû·½·¨£¬oracleµÄconnectÓï·¨¸üÄܱܺãÀûµÄ½â¾öÎÊÌâ¡£
Óï·¨¸ñʽ£º
select ...
from ...
start with...
connect by prior expr=expr
order siblings by ..
start with µÄ¹¦ÄÜÀàËÆÓÚwhere£¬Ö¸Ã÷´ÓÄĸö·ÖÖ§¿ªÊ¼±ãÀû£»
connect by Ö¸Ã÷¸¸½ÚµãºÍ×Ó½ÚµãµØÁ¬½Ó·½Ê½£¬¹Ø¼ü×Öprior·ÅÔÚ¸¸½Ú ......
Ò». Oracle ¿ØÖÆÎļþÖ÷Òª°üº¬ÈçÏÂÌõÄ¿
DATABASE ENTRY
CHECKPOINT PROGRESS RECORDS
REDO THREAD RECORDS
LOG FILE RECORDS
DATA FILE RECORDS
TEMP FILE RECORDS
TABLESPACE RECORDS
LOG FILE HISTORY RECORDS
OFFLINE RANGE RECORDS
ARCHIVED LOG RECORDS
BACKUP SET RECORDS
BACKUP PIECE RECO ......
¶à±íÁª½Ó²éѯ
Ò»¡¢¶à±íÁª½Ó²éѯµÄ·ÖÀà
¶à±íÁª½Ó²éѯʵ¼ÊÉÏÊÇͨ¹ý¸÷¸ö±íÖ®¼ä¹²Í¬ÁеĹØÁªÐÔÀ´²éѯÊý¾ÝµÄ£¬ËüÊǹØϵÊý¾Ý¿â²éѯ×îÖ÷ÒªµÄÌØÕ÷¡£
Áª½Ó²éѯ¿É·ÖΪÈý´óÀ࣬·ÖÁíΪ£º
1£® ÄÚÁª½Ó¡£
2£® ÍâÁª½Ó¡£
3£® ½»²æÁª½Ó¡£
ÄÇôÎÒÃÇÒ»ÆðÀ´¿´Ò»ÏÂÈçºÎʹÓö ......
1.ʲô½ÐSQL×¢È룿ÈçºÎ·ÀÖ¹£¿Çë¾ÙÀý˵Ã÷
´ð£ºSQL×¢ÈëÊdz£¼ûµÄÀûÓóÌÐò©¶´½øÐй¥»÷µÄ·½·¨¡£µ¼ÖÂsql×¢Èë¹¥»÷²¢·ÇϵͳÔì³ÉµÄ£¬Ö÷ÒªÊdzÌÐòÖкöÂÔÁË°²È«ÒòËØ£¬ÀûÓÃsqlÓïÑÔ©¶´»ñµÃºÏ·¨Éí·ÝµÇ½ϵͳ
ÀýÈ磺
"Select * from users where name='"+uName+"' and pwd='"+uPwd+"' " ......