Oracle spool Ó÷¨Ð¡½á
ת×Ô£ºhttp://wallimn.javaeye.com/blog/472182
¶ÔÓÚSPOOL
Êý¾ÝµÄSQL£¬×îºÃÒª×Ô¼º¶¨Òå¸ñʽ£¬ÒÔ·½±ã³ÌÐòÖ±½Óµ¼Èë,SQLÓï¾ä
È磺
select
taskindex||'|'||commonindex||'|'||tasktype||'|'||to_number(to_char(sysdate,'YYYYMMDD'))
from ssrv_sendsms_task;
spool
³£ÓõÄÉèÖÃ
set colsep' ';¡¡¡¡¡¡ //ÓòÊä³ö·Ö¸ô·û
set echo off;¡¡¡¡¡¡¡¡//ÏÔʾstartÆô¶¯µÄ½Å±¾ÖеÄÿ¸ösqlÃüÁȱʡΪon
set feedback off;¡¡¡¡//»ØÏÔ±¾´ÎsqlÃüÁî´¦ÀíµÄ¼Ç¼ÌõÊý£¬È±Ê¡Îªon
set heading off;¡¡¡¡ //Êä³öÓò±êÌ⣬ȱʡΪon
set pagesize 0;¡¡¡¡¡¡//Êä³öÿҳÐÐÊý£¬È±Ê¡Îª24,ΪÁ˱ÜÃâ·ÖÒ³£¬¿ÉÉ趨Ϊ0¡£
set termout off;¡¡¡¡ //ÏÔʾ½Å±¾ÖеÄÃüÁîµÄÖ´Ðнá¹û£¬È±Ê¡Îªon
set trimout on;¡¡¡¡¡¡//È¥³ý±ê×¼Êä³öÿÐеÄÍÏβ¿Õ¸ñ£¬È±Ê¡Îªoff
set trimspool on;¡¡¡¡//È¥³ýÖض¨Ïò£¨spool
£©Êä³öÿÐеÄÍÏ
β¿Õ¸ñ£¬È±Ê¡Îªoff
µ¼³öÎı¾Êý¾ÝµÄ½¨Òé¸ñʽ£º
SQL*PLUS»·¾³ÉèÖÃSET NEWPAGE NONE
SET HEADING OFF
SET SPACE 0
SET PAGESIZE 0
SET TRIMOUT ON
SET TRIMSPOOL ON
SET LINESIZE 2500
×¢£ºLINESIZEÒªÉÔ΢ÉèÖôóЩ£¬ÃâµÃÊý¾Ý±»½Ø¶Ï£¬ËüÓ¦ºÍÏàÓ¦µÄTRIMSPOOL½áºÏʹÓ÷ÀÖ¹µ¼³öµÄÎı¾ÓÐÌ«¶àµÄβ²¿¿Õ¸ñ¡£µ«ÊÇÈç¹û
LINESIZEÉèÖÃÌ«´ó£¬»á´ó´ó½µµÍµ¼³öµÄËٶȣ¬ÁíÍâÔÚWINDOWSϵ¼³ö×îºÃ²»ÒªÓÃPLSQLµ¼³ö£¬ËٶȱȽÏÂý£¬Ö±½ÓÓÃCOMMENDϵÄ
SQLPLUSÃüÁî×îС»¯´°¿ÚÖ´ÐС£
¶ÔÓÚ×Ö¶ÎÄÚ°üº¬ºÜ¶à»Ø³µ»»ÐзûµÄÓ¦¸Ã¸øÓë¹ýÂË£¬ÐγɱȽϹæ¾ØµÄÎı¾Îļþ¡£Í¨³£Çé¿öÏ£¬ÎÒÃÇʹÓÃSPOOL
·½
·¨£¬½«Êý¾Ý¿âÖÐµÄ±íµ¼³öΪÎı¾ÎļþµÄʱºò»á²ÉÓÃÁ½ÖÖ·½·¨£¬ÈçÏÂÊö£º
·½·¨Ò»£º²ÉÓÃÒÔϸñʽ½Å±¾¡¡
set colsep '|' &
Ïà¹ØÎĵµ£º
Ô ÎÄ£ºÆ½·²ËêÔ£ºjiraµÄ°²×°£¨oracleÊý¾Ý¿â£©http://www.trucy.org/blog/ray/archives/000927.html
ÒÔÏÂÊÇ»ùÓÚÔÎĵIJ¹³äÍêÉƺóµÄÄÚÈÝ£º
JIRAÊÇÒ»¸öÓÅÐãµÄÎÊÌâ(or bugs£¬task£¬improvement£¬new feature  ......
1¡¢OracleÀïÃæÓû§µÄÃÜÂëÊǽøÐмÓÃܱ£´æµÄ,ËùÒÔÖ»ÄÜÖØÐÂÐÞ¸ÄÉú³ÉеÄÃÜÂë.
ÀûÓÃϵͳ¹ÜÀíÔ±(sys)µÇ¼,½«scottÓû§µÄÃÜÂëÐ޸ļ´¿É
SQL>conn / as sysdba ;
ÒÑÁ¬½Ó¡£
SQL>alter user scott identified by tiger
;
Óû§ÒѸü¸Ä¡£
µ±È»Ò²¿ÉÒÔµ½WEB¶Ë½øÐÐÐ޸ĵØÖ·È ......
»ù±¾´ÓÀ´²»ÓÃleft/right join
Ò»¸öÏîÄ¿±»ÆÈÒªÓñðÈËдµÄ sql
±¾´òËã¸ÄдһÏ£¬Ìá¸ßЧÂÊ
·¢ÏÖ£º
¡¾1¡¿
select * from a
left outer join b on a.id= b.id AND ...1...
where ...2...
Óë
¡¾2¡¿
select * from a , b
where a.id= b.id(+)
A ......
COMMITÊÇÒ»¸ö·Ç³£¿ìµÄ²Ù×÷£¬µ±ÎÒÃÇ·¢²¼commitÃüÁîʱ£¬ÕæÕýÀ§ÄѵĶ¯×÷ÒѾÍê³É£¬
ÔÚÊý¾Ý¿âÖÐÒѾִÐÐÁËÊý¾Ý¸ü¸Ä£¬ËùÒÔÒѾÍê³ÉÁË99%µÄÈÎÎñ£¬ÀýÈ磺ÏÂÁвÙ×÷ÒѾ²úÉú£º
1.ÔÚSGA(Buffer Cache)ÖÐÒѾÉú³ÉÁËundo¿é£»
2.ÔÚSGA(Buffer Cache)ÖÐÒѾÉú³ ......
PRAGMA RESTRICT_REFERENCES()£¬Õâ¸öPRAGMA±È½Ï¸´ÔÓ£¬ ×ܵÄÀ´Ëµ£¬ËüÊÇÒ»¸ö³ÌÐò¸¨Öú¼ìÑéÂ룬¼ì²é×Ó³ÌÐòµÄ´¿¶È£¨PURITY£©£¬°ïÖú¼ìÑé×Ó³ÌÐòÊÇ·ñÓÐÎ¥·´¹æÔòµÄµØ·½¡£Ò»°ãÓÃÔÚº¯ÊýÉÏ£¬µ«µ±º¯Êýµ÷Óùý³Ìʱ£¬Ò²Òª×÷ÏàÓ¦µÄÉèÖüì²é¡£ÕâÊÇΪÁ˱ÜÃâµ±ÔÚDMLÓï¾äÉϵ÷Óú¯ÊýʱÕý³£Ö´Ðв»ÖÁÓÚ²úÉú´íÎó¡£
Óï·¨£¬PRAGMA ......