ORACLE MODEL×Ó¾äѧϰ±Ê¼Ç
ORACLE 10GÖÐÐÂÔöµÄMODEL×Ó¾ä¿ÉÒÔÓÃÀ´½øÐÐÐÐ¼ä¼ÆËã¡£MODEL×Ó¾äÔÊÐíÏñ·ÃÎÊÊý×éÖÐÔªËØÄÇÑù·ÃÎʼǼÖеÄij¸öÁС£Õâ¾ÍÌṩÁËÖîÈçµç×Ó±í¸ñ¼ÆËãÖ®ÀàµÄ¼ÆËãÄÜÁ¦¡£
1¡¢MODEL×Ó¾äʾÀý
ÏÂÃæÕâ¸ö²éѯ»ñÈ¡2003ÄêÄÚÓÉÔ±¹¤#21Íê³ÉµÄ²úÆ·ÀàÐÍΪ#1ºÍ#2µÄÏúÁ¿£¬²¢¸ù¾Ý2003ÄêµÄÏúÊÛÊý¾ÝÔ¤²â³ö2004Äê1Ô¡¢2Ô¡¢3ÔµÄÏúÁ¿¡£
select prd_type_id,year,month,sales_amount
from all_sales
where prd_type_id between 1 and 2
and emp_id=21
model
partition by (prd_type_id)
dimension by (month,year)
measures (amount sales_amount)
(
Sales_amount[1,2004]=sales_amount[1,2003],
Sales_amount[2,2004]=sales_amount[2,2003] + sales_amount[3,2003],
Sales_amount[3,2004]=ROUND(sales_amount[3,2003]*1.25,2)
)
Order by prd_type_id,year,month;
ÏÖÔÚС·ÖÎöÒ»ÏÂÉÏÃæÕâ¸ö²éѯ£º
partition by (prd_type_id)Ö¸¶¨½á¹ûÊǸù¾Ýprd_type_id·ÖÇøµÄ¡£
dimension by (month,year)¶¨ÒåÊý×éµÄά¶ÈÊÇmonthºÍyear¡£Õâ¾ÍÒâζ×űØÐëÌṩÔ·ݺÍÄê·Ý²ÅÄÜ·ÃÎÊÊý×éÖеĵ¥Ôª¡£
measures (amount sales_amount)±íÃ÷Êý×éÖеÄÿ¸öµ¥Ôª°üº¬Ò»¸öÊýÁ¿£¬Í¬Ê±±íÃ÷Êý×éÃûΪsales_amount¡£
MEASURESÖ®ºóµÄÈýÐÐÃüÁî·Ö±ðÔ¤²â2004Äê1Ô¡¢2Ô¡¢3ÔµÄÏúÁ¿¡£
Order by prd_type_id,year,month½ö½öÊÇÉèÖÃÕû¸ö²éѯ·µ»Ø½á¹ûµÄ˳Ðò¡£
ÉÏÃæÕâ¸ö²éѯµÄÊä³ö½á¹ûÈçÏ£º
PRD_TYPE_ID YEAR MONTH SALES_AMOUNT
----------- ---------- ---------- ------------
1 2003 1 10034.84
1 2003 2 15144.65
1 2003 3 20137.83
1 2003 &
Ïà¹ØÎĵµ£º
ORACLE ʱ¼ä×Ö¶ÎÅÅÐòÎÊÌâ
ÔçÉÏÔÚŪEXTÅÅÐòµÄʱºò£¬ÒòΪÊý¾Ý¿âIDÊÇSTRINGµÄ£¬Òò´ËÔÚcommandÀàÀï¶àÁËÒ»¸öinteger idSort×ֶΣ¬
ûÏëµ½£¬¸ù¾ÝÕâ¸öÕûÐ͵Ä×ֶνøÐÐÅÅÐòÒ²²»ÐУ¬ÒòΪEXT·ÖÒ³³öÀ´µÄËäÈ»ÊǸù¾ÝÕâ¸öÕûÐÍ×Ö¶ÎÅÅÐòÁË¡£µ«ÊÇ
¸÷¸öÒ³ÃæÃ»ÓÐÍêÈ«µÄͳһÅÅÐò¡£
Òò´Ë£¬ÔÚDAOÀïдÁËÈçÏÂHQLÓï¾ä£º
select tbl from Tr ......
oracleÊý¾Ý¿âͬ²½¼¼Êõ
¸ß¼¶¸´ÖÆ
ʲôÊǸ´ÖÆ£¿¼òµ¥µØËµ¸´ÖƾÍÊÇÔÚÓÉÁ½¸ö»òÕß¶à¸öÊý¾Ý¿âϵͳ¹¹³ÉµÄÒ»¸ö·Ö²¼Ê½Êý¾Ý¿â»·¾³Öп½±´Êý¾ÝµÄ¹ý³Ì¡£
¸ß¼¶¸´ÖÆ£¬ÊÇÔÚ×é³É·Ö²¼Ê½Êý¾Ý¿âϵͳµÄ¶à¸öÊý¾Ý¿âÖи´ÖƺÍά»¤Êý¾Ý¿â¶ÔÏóµÄ¹ý³Ì¡£ Oracle ¸ß¼¶¸´ÖÆÔÊÐíÓ¦ÓóÌÐò¸üÐÂÊý¾Ý¿âµÄÈκθ±±¾ ......
1.ÒÔsysdbaÉí·Ý進Èë
2.show parameter audit
3.alter system set audit_sys_operations = true scope = spfile
4.alter system set audit_trail = db,extended scope = spfile
5.startup force
6.show parameter audit
7.audit select table,insert table,delete ta ......
֮ǰ¶ÔORACLEÖеıäÁ¿Ò»Ö±Ã»¸öÌ«Çå³þµÄÈÏʶ£¬±ÈÈç˵ʹÓ㺡¢&¡¢&&¡¢DEIFINE¡¢VARIABLE……µÈµÈ¡£½ñÌìÕýºÃÏÐÏÂÀ´£¬ÉÏÍøËÑÁËËÑÏà¹ØµÄÎÄÕ£¬»ã×ÜÁËһϣ¬ÌùÔÚÕâÀ·½±ãѧϰ¡£
==================================================================================
ÔÚoracle ÖУ¬¶ÔÓÚÒ»¸öÌá½ ......
1£º ¼Ó´ó»Ø¹ö¶Î£¨¿ÉÒÔ¸ø500MÉõÖÁ1G£©
2£º·Ö¶Îcommit
iCount :=1;
for rec in cur_name loop
insert into table_name (.....);//DML Lanaguage
if iCount =2000 then
commit;
iCount:=0;
else
iCount:= iCount +1;
......