Itpub电子杂志(第一期)

3,173 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,173
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Itpub电子杂志(第一期)

  1. 1. ITPUB µç×ÓÔÓÖ¾ ·âÃæ HOME: http://www.itpub.net MAIL: epub@itpub.net
  2. 2. ITPUB µç×ÓÔÓÖ¾ Ŀ¼ Ä¿ ¼ ¿ª¾íÊ×Óï Êý¾Ý¿â¹ÜÀí 2GB ÎÊÌâ The Oracle DBA’ Guide to NT s ÔÚ Oracle ÖÐÔËÐÐ ÃüÁî OS Oracle DBA ÈÕ³£¹ÜÀí Êý¾Ý¿â¿ª·¢ ¹ØÓÚracle Öдó¶ÔÏó O (lob)´¦ÀíµÄһЩ·½·¨ºÍʵÀý Developer2000 ϵÁн²×ùÒ» ²é¿´±í½á¹¹µÄ script ORACLE ÈÏÖ¤ OCP ²»ÍêÈ«Ö¸ÄÏ LZ0-024 ¿¼µã×ܽá ÆóÒµÐÅÏ¢»¯ ÖÐСÆóÒµÈçºÎÑ¡Ôñ MRP ϵͳ CRM µÄºËÐÄ¡¢Ó¦ÓÃÖص㼰·Ö²¼ÊµÊ©²½Öè Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ ÂÛ̳¾« »ª ÖÆ×÷ÈËÔ± HOME: http://www.itpub.net MAIL: epub@itpub.net
  3. 3. ITPUB µç×ÓÔÓÖ¾ ¿ª¾íÊ×Óï 1 ¿ª¾íÊ×Óï ÎÒÃÇÒ»Ö±Ôڳɳ¤ ¡-¡- ±¾¿¯ËùÓÐÎÄÕ°æȨ¹é×÷ÕßËùÓУ¬ÈçÓÐתÔØ£¬ÇëÓë webmaster@itpub.net ÁªÏµ£¬¶àл֧³Ö£¬Ò»Æð±£ »¤ÎÒÃǵÄÀͶ¯³É¹û ¡£ >> 2001 ITPUB µ®Éú 2001 ÄêÊÇ´´ÊÀ¼ÍµÄÒ»Äê¡£ 2001 ÄêÊÇÖйúÈËÑïüÍÂÆøµÄÒ»Ä꣬ WTO£¬°ÂÔ˻ᣬÊÀ½ç±-ΧÈÆ×ÅÎÒÃÇ¡£ÎÒÃǸе½ÎÞ± µÄÐÒ¸£¡£ 2001 ÄêÓÖÊÇÐÁËáµÄÒ»Ä꣬°éËæ×Å IT 911£¬ÕûÌåÏÝÈëÁË»¬Æ¡£ 2001 ÄêÔÚttp://www.smiling.com.cn£¬µ®ÉúÒ»¸öС×éÃû×ÖÊÇ h oracle¡£ 2001 Äê Ô£¬ 10 oracle С×é°á¼Ò£¬È«Ð嵀 ITPUB µ®Éú¡£ >> ¾ö ÐÄ ITPUB Á¢Ö¾³ÉΪ IT ¼¼ÊõÖÐÐĽ»Á÷ÉçÇø¡£ ITPUB ¼á³Ö×ÔÓÉƽµÈ¿ª·ÅµÄ¾«Éñ£¬ÕâÀïÈÝÄÉÒ»ÇжԼ¼ÊõµÄ²»Í¬µÄ¼û½â£¬ÕâÀ ±ðÈ˵ÄÈκθöÐÔ£¬Ä¿µÄÖ»ÓÐÒ»¸ö£¬Ï£ÍûÎÒÃǶ¼ÄÜÔÚ ITPUB Öн»Á÷£¬Ñ§Ï°ºÍ½ø²½¡£ >> Õ¹ Íû 2002 ÄêÊÇ ITPUB ¹Ø¼üµÄÒ»Ä꣬ÎÒÃǽ«×¥ºÃÒÔϼ¸¼þÊ £º 1£©ÂÛ̳µÄÎȶ¨ÐÔ 2£©µç×ÓÔÓÖ¾µÄÎȶ¨·¢ÐÐ 3£©Õë¶ÔÐÂÊÖÍƳöһЩÁÐÀ¸Ä¿£¬»î¶¯¡£ 4£©ÍƳö¼¸ÆÚÖØÁ¿¼¶µÄ¼Î±öÁÄÌì 5£©… … … … >> ×£ ¸£ 2001 Äê²»¹ÜËüÔõôÑù£¬¹ýÈ¥µÄ¾ÍÈÃËû¹ýÈ¥°É¡£ 2002 Äê¶Ô ÎÒÃÇÓÖÊÇÒ»¸öеÄÒ»Äê¡£ ÖÔÐĵÄ×£¸£´ó¼Ò¹¤×÷˳Àû£¬Ñ§Ï°½ø²½£¬Éú»îÐÒ¸£ ,ÉíÌ彡¿µ¡£ 2002 Äê ITPUB ÐèÒª´ó¼Ò¸ü¶àºÇ»¤ÓëÖ§³Ö£¬ÇëÏàÐÅÎÒÃÇ£¬ÎÒÃÇÒ»Ö±¶¼ÔÚ http://www.itpub.net HOME: http://www.itpub.net MAIL: epub@itpub.net
  4. 4. ITPUB µç×ÓÔÓÖ¾ 2GB ÎÊÌâ 2GB ÎÊÌâ ----2Gb or NOT 2Gb-File limits in ORACLE ±¾ÎÄÃèÊö "2GB"µÄÎÊÌâ¡£Ëü²ûÊöÁËΪʲô 2GB ÊÇÒ»¸ö¹Ø¼üÊý×Ö²¢ÇÒ¸ø³öÁËÈç¹ûÎļþ´óÓÚ 2GB ʱһЩÄãÐèÒªÖªµÀµÄ¶«Î÷¡£ ±¾ÎÄÖ÷Òª²ûÊöÔÚ Unix ϵͳÉ쵀 ÎÊÌâ¡£ 2GB ÌÖÂÛµÄÖ÷Ì⣺ Ϊʲô ÊÇÒ»¸öÌرðµÄÊý×Ö 2GB ΪʲôʹÓõÄÊý¾ÝÎļþ 2GB Export ºÍ2GB SQL*Loader ºÍ2GB ORACLE ºÍÆäËû ÎÊÌâ 2GB ÆäËû Ϊʲô ÊÇÒ»¸öÌØÊâµÄÊý×Ö 2GB Ðí¶àPU ºÍϵͳµ÷ÓÃ½Ó¿Ú 32 λµÄ×Ö£¨ © ¸ö λ¾ÍÔÚÐí¶àϵͳÉÏ´ø C (API)ʹÓà word£ ¡£Õâ 32 À´ÁËÏÞÖÆ¡£ÔÚÐí¶àÇé¿öÏ£¬±ê×¼Îļþ²Ù×÷µÄ word À´Ö¸¶¨Îļþ´óСºÍ API ʹÓÃ2 λÓзûºÅ 3 ÔÚÎļþÖеÄÏà¶ÔλÖá£ÓзûºÅµÄ 32 λword ʹÓÃ×î¸ßλΪ·ûºÅ룬Òò´Ë 31 λËùÄܱíʾµÄ×î ´óÖµ¾ÍÊÇ 0x7FFFFFFF£¨ +2147483647£© £¬±ÈGB С 2 1¡£ 2GB »ò´óÓÚ µÄÎļþͳ³Æ¡°´óÎļþ¡ λ»·¾³ÖоͻáÓöµ½Ðí¶àÎÊÌ⡣ΪÁË 2GB ± 32 ¡£ËùÒÔÔÚ ¿Ë·þÕâЩÎÊÌ⣬ÏÖÔڵIJÙ×÷ϵͳ´ó¶àʹÓà 64 붨ÒåÁËеÄϵͳµ÷Óá£Ð°汾µÄ ORACLE ʹÓÃÁËÕâЩ½Ó¿Úµ«ÊÇÔÚ´¦Àí¡°´óÎļþ¡±Ê±»¹ÊÇÓÐÐí¶àÎÊÌâÊÇÐèҪעÒâµÄ¡£ ÁíÒ»¸ö±È½ÏÌØÊâµÄ Êý×ÖÊÇ 4GB£¬0xFFFFFFFF ×÷ΪÎÞ·ûºÅ×ÖËùÄܱíʾµÄ×î´óÖµ¾ÍÊÇ 4294967295£¬±ÈGB ÉÙ 4 1¡£¼Ó ÔòÔì³ÉµÍ 1 32 λ±äΪ 0x00000000 ºÍÒ»¸ö½ø룬ÔÚ 32 λ ÌåϵÖÐÕâ¸ö½øλ»á±»¶ªµô£¬Òò´Ë 4GB ÊÇÁíÒ»¸ö¿ÉÄܻᷢÉúÎÊÌâµÄÊý×Ö¡£ 32 λӰÏì×Å ORACLE µÄÐí¶à·½Ã档ΪÁËʹÓôóÎļþ£¬ÄãÐèÒª£º 1.²Ù×÷ϵͳ֧³Ö 2GB+µÄÎļþ»òÂãÉ豸 2.²Ù×÷ϵͳ¾ßÓÐÖ§³Ö²Ù×÷ IO µÄ 2GB+Îļþ API 3.ORACLE ʹÓÃÕâЩ API Õâ¶Ô RACLE Òâζ×Åʲô£¿ O ÏÖ½ñ£¬´ó¶àÊýƽ̨֧³Ö´óÎļþ²¢ÇÒÓÐ 64 λµÄ API¡£´Ó ORACLE 7.3 ¿ªÊ¼Í¨³£¾ÍʹÓÃÕâ ЩAPI ÁË£¬µ«ÊÇÕâÒÀÀµÓÚƽ̨¡¢²Ù×÷ϵͳºÍ ORACLE µÄ°æ±¾¡£ÔÚ¶àÊýÇé¿öÏ´óÎļþÖ§³ÖÊÇ ¿ÉÐеģ¬µ«ÔÚijЩÇé¿öÏÂÐèÒªÒ»¸öרÃÅµÄ patch¡£ÔÚ±¾ÎÄд×÷ʱ£¬ÔÚ Öл¹ÓÐһЩ ORACLE ¹¤¾ßûÓÐʹÓÃÕâЩÐ嵀 64 λAPI£¬±ÈÈç export£¬ SQL*LOADER£¬µ±È»ÕâÊÇÒÀÀµÓÚƽ̨µÄ¾ß Ìå²Ù×÷ϵͳÊý¾Ý¿â°æ±¾µÄ¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  5. 5. ITPUB µç×ÓÔÓÖ¾ 2GB ÎÊÌâ 2GB+µÄÊý¾ÝÎļþ ΪʲôʹÓà /É豸×÷Ϊ ORACLE µÄÊý¾ÝÎļþµÄºÃ´¦ºÍȱµã£º ÕâÀïÎÒÃÇ×ܽá³öʹÓôóÎļþ ºÃ´¦£º ÔÚ´ó¶àÊýƽ̨ÉÏ£¬ ×î´óÖ§³Ö ¸öÊý¾ÝÎļþ¡£Ã¿¸öÎÄ 2GB£¬ÄÇ ORACLE7 1022 ¼þÈç¹ûСÓÚ Êý¾Ý¿â×î´óÒ²³¬²»¹ý£¨ÔÚ RACLE8 ÉÏÕâ²»ÊÇÎÊÌ⣬ Ö§³Öÿ¸ö±í¿Õ¼ä 2044GB¡ £ O ORACLE8 1022 ¸öÎļþ£ ©¡£´óÎļþµÄʹÓÿÉÒÔÍ»ÆÆ 2044GB µÄÏÞÖÆ¡£ ¶ÔÏà¶ÔСµÄÊý¾Ý¿âÀ´½²£¬´óÎļþÒâζןüÉÙµÄÎļþ¡£Ò²¾ÍÒâζ׎ÏÉÙµÄÎ ×ÊÔ´¡£ ȱµã£º »Ö¸´µÄµ¥Î»¸ü´ó¡£Ò»¸ö 2GB µÄÎļþÐèÒª 15 ·ÖÖÓµ½Ò»¸öСʱµÄ±¸·Ý /»Ö¸´Ê±¼ä£¨ÒÀÀµÓÚ ±¸·Ý½éÖʺʹÅÅÌËٶȣ µÄÎļþÐèÒª´Ëʱ¼äµÄ 8GB © ¡£Ò»¸ö 4 ±¶¡£ ²¢Ðб¸·Ý /»Ö¸´²Ù×÷»áÊÜÓ°Ïì¡£¿ÉÄÜÓвÙ×÷ϵͳÌØÊâµÄÏÞÖÆ£º±ÈÈç´óÓÚ 2GB µÄ²¿·Ö£¬Ò² ÐíÒì²½ Ö»ÄÜ´®ÐÐ IO (serialised)²Ù×÷ÁË¡£ ²Ù×÷´óÓÚ µÄÎļþÒ²ÐíÐèÒª²¹¶¡£¨ 2GB patch£ ©£¬ÌØÊâµÄÅäÖõȣ¬Ïà¶ÔСÎļþÀ´½²ÎÞÐÎÖÐ ÒýÈëÁËÐí¶à²»¿É²âÒòËØ£¬±ÈÈçÔÚһЩ AIX ÖС£ ʹÓôóÎļþʱÐèҪעÒâµÄ¼¸µã£º Ïò²Ù×÷ϵͳ³§ÉÌÈ·ÈÏÊÇ·ñÖ§³Ö´óÎļþ²¢ÇÒÈçºÎÅäÖÃËûÃÇ Ïò²Ù×÷ϵͳ³§ÉÌÈ·ÈÏ¿ÉÖ§³ÖµÄ×î´óʵ¼ÊÎļþ´óС ÏòORACLE Ö§³ÖÈ·ÈÏÊÇ·ñÐèÒª²¹¶¡»òÔÚÄãµÄƽ̨ÉÏ£¨Ó²¼þ¡¢²Ù×÷ϵͳ¡¢ ORACLE£© ÊÇ·ñÓÐʲôÏÞÖÆ µ±ÄãÉý¼¶²Ù×÷ϵͳ»ò ʱ£¬¼ì²éÒÔÉÏËùÌá¡£ ORACLE È·ÈÏÊÇ·ñÕýÈ·µÄÉèÖÃÁËϵͳ ÒÔÔÊÐíËùÓÐÓû§ÄÜʹÓôóÎļþ È·Èϱ¸·Ý½Å±¾ÄÜ´¦Àí´óÎļþ × ¢ Ò» ¹ Ó Ð Ò » ¸ ö Ê ¹ Ó Ã ´ ó Î Ä ¼ þ µ Ä Ï Þ Ö Æ ¡ £ Î Ä ¼ þ ´ ó Ð ¡ µ Ä ¾ ß Ì å Ê ý Ö µ Ò À À â DB_BLOCK_SIZE º Í Æ ½ Ì ¨ ¡ £ Ô Ú ´ ó ¶ à Ê ý Æ ½ Ì NT £¬ ¨ £ £ ¬ Î Ä ¼ þ ´ ó Ð ¡ Ï Þ Ö Æ Î ª Unix£¬ É Ï VMS © ¨ £ 4194302*DB_BLOCK_SIZE¡£ Çë²é¿´ [NOTE:112011.1]ÖеÄÏêϸ¼Ç¼ Alert Öصã×¢ÒâÊÂÏ µ±ÔÊÐíÎļþ×Ô¶¯Ôö³¤Ê±ÐèÒªÌرðСÐÄ¡£¶Ô AUTOEXTEND µÄÎļþÏÞÖÆ MAXSIZE СÓÚ 2GB ÊÇÃ÷Öǵġ£·ñÔò£¬ÓÉÓÚ [BUG:568232]£¬µ±ÎļþÔö³¤ ³¬¹ý ORACLE ²»ÄÜ´¦Àíʱ¿ÉÄÜ»á ³öÏÖ RA-600[3292]µÈ´íÎó¡£ O ´ó¶àÊýƽ̨ÉÏ ORACLE µÄÊý¾ÝÎļþ°üº¬Ò»¸öÌØÊâµÄÍ·Êý¾Ý¿é£¬ËùÒÔ´´½¨Ò»¸ö 2GB µÄ Îļþ£¬Êµ¼ÊÐèÒª´óÓÚ 2GB µÄ¿Õ¼ä¡£ÔÚ Æ½Ì¨ÉÏ£¬Õâ¸öÍ·´óСͨ³£ÊÇ Unix DB_BLOCK_SIZE£¬ µ«ÔÚÂãÉ豸ÉÏ¿ÉÄÜ»á¸ü´ó¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  6. 6. ITPUB µç×ÓÔÓÖ¾ 2GB ÎÊÌâ 2GB µÄÏà¹Ø ORACLE ´íÎó£º ORA-01119 Error in creating datafile xxxx ORA-27044 unable to write header block of file SVR4 Error: 22: Invalid argument ORA-19502 write error on file 'filename', blockno x (blocksize=nn) ORA-27070 skgfdisp: async read/write failed ORA-02237 invalid file size KCF:write/open error dba=xxxxxx block=xxxx online=xxxx file=xxxxxxxx file limit exceed. Unix error 27, EFBIG Export and 2Gb 2Gb Export File Size ±¾ÎÄд×÷ʱ´ó¶àÊýµÄ export °æ±¾Ê¹ÓÃĬÈϵÄÎļþ´¦Àíexport Îļþ¡£ÕâÒâζ API À´´´½¨ ×ÅÔÚÏ൱¶àµÄƽ̨ÉÏ£¬²»Äܵ¼³ö´óÓÚ 2GB µÄÎļþ¡£ ÒÔÏÂÊÇһЩ¿Ë·þµÄ·½·¨£º ͨ³£¿ÉÒÔµ¼³ö´óÓÚ 2GB µÄÎļþµ½ÂãÉ豸ÉÏ¡£ ÔÚ Unix ÉÏ¿ÉÒÔʹÓÃÃüÃû¹ÜµÀÀ´Ñ¹Ëõ/·Ö¸îÎļþ ¿ÉÒÔµ¼³öµ½´ÅÅÌÉÏ ORACLE8i ÔÊÐíµ¼³öµ½¶à¸öÎļþ¶ø²»ÊÇÒ»¸ö´óµÄÎļþ £¨Ò룺·½·¨¿É²Î¿¼ÎÄÕ½áβ´¦²¹³ä£© ÆäËûµÄ µ¼³öÎÊÌâ 2GB ORACLE ×î´ó extent µÄ´óСΪ 2GB.²»ÐÒµÄÊÇÐí¶à·¢Ðа汾µÄ ORACLE ÖеÄexport ¶¼ÓÐÒ»¸öÎÊÌ⣬¾ÍÊǵ±Ö¸¶¨Ê±£¬¿ÉÄܵ¼³öµÄÎļþÖÐÆä compress=y Next ´æ´¢×Ó¾ä»á³öÏÖ´ó ÓÚ2GB µÄÇé¿ö¡£Õâ»áµ¼Ö¼´Ê¹Ö¸¶¨ÁËimport Ò²»á³ö´í¡£±¾ÎÊÌâ¿É²Î¼û ignore=y ʱ£¬ [BUG:708790]ºÍ [NOTE:62436.1] µäÐ굀 2GB+ʱexport ´íÎó£º . . exporting table BIGEXPORT EXP-00015: error on row 10660 of table BIGEXPORT, column MYCOL, datatype 96 EXP-00002: error in writing to export file EXP-00002: error in writing to export file EXP-00000: Export terminated unsuccessfully ÔÚ[BUG:185855]Öл¹Ìáµ½ÁËÒ»¸öÎÊÌ⣺µ±µ¼³öÈ«¿âʱ²úÉúµÄ create tablespace ÃüÁî»á ʹÓÃytes ×÷Ϊµ¥Î»¡£µ± ʱ£¬Éú³ÉµÄÊý¾ÝÎļþÈô´óÓÚ b import 2GB£¬¿ÉÄܵ¼Ö ora-2237 ´íÎó¡£ ½â¾ö°ì·¨ÊÇÏÈ´´½¨±í¿Õ¼ä ytes)£¬È»ºóµ¼ÈëÎÄ (Óà ´úÌæ M b ¼þ¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  7. 7. ITPUB µç×ÓÔÓÖ¾ 2GB ÎÊÌâ µ¼³öµ½´Å´ø export ÖÐµÄ volsize ²ÎÊý×î´óµ½ 4GB.ÔÚһЩƽ̨ÉÏÖ»ÓÐ 2GB¡£ 8i ÖÐÒѾ-ÐÞ¸ÄÁ˱¾ÎÊÌâ¡£ [BUG:490190]ÃèÊöÁ˱¾ÎÊÌâ¡£ SQL*Loader and 2Gb µäÐ͵ģ¬µ±SQL*Loader ´ò¿ªÒ»¸ö´óÓÚ 2GB µÄÊäÈëÎļþʱ»á±¨ÈçÏ´íÎó£º SQL*Loader-500: Unable to open file (bigfile.dat) SVR4 Error: 79: Value too large for defined data type [NOTE:30528.1]ÖеÄÀý×Ó¿ÉÒÔÐ޸ĺóÓÃÓÚ´óµÄÊäÈëÎļþ¡£ ORACLE 8.0.6 Ìá¸ßÁ˶ԴóµÄ ºÍ ÎļþµÄÖ§³Ö¡£µ«×î´óµÄÊäÈëÎļþÒÀƽ̨²» discard log ͬ¶ø²»Í¬¡£ [BUG:948460]ÏêϸÃèÊöÁËÊäÈëÎļþµÄÏÞÖÆ¡£ [BUG:749600]½éÉÜÁË×î´óµÄ Îļþ´óС¡£ discard ORACLE ºÍÆäËû ÎÊÌâ 2GB ÏÂÃæÁгöÁËÆäËûµÄ 2GB ÎÊÌâ £-´Ó RACLE 8.0.5 ¿ªÊ¼¿ÉÒÔÔÚ´ó¶àÊýƽ̨ÉÏʹÓà 8.0.5 README Îļþ½é O 64 λORACLE ÉÜÁËÕâЩ¡£¼û [NOTE:62252.1] £- DBV Ò²Ðí²»ÄÜɨÃè´óÓÚ 2GB µÄÎļþ £¬²¢±¨¡° DBV-100¡±´í¡£¼û [BUG:710888] £-ÔÚ½¨Á¢´óÓÚ 2GB Îļþʱ£¬ ÃüÁî SQL datafile ... Size xxxxx ±ØÐëÓá® »ò¡®¯ M¡¯ K¡£¬·ñÔò ±¨´í¡® ORA-02237¡ºinvalid file size ¯£ £-ÔÚ RACLE 7.3.4 ֮ǰ±í¿Õ¼äµÄ ²»Äܳ¬¹ý O quotas 2GB¡£È磺 Eg£ºALTER USER <username> QUOTA 2500M ON <tablespacename> reports ORA-2187£ºinvalid quota specification¡£¼û [BUG:425831] ½â¾ö°ì·¨ÊǸ³Óè tablesapace ȨÏÞ¡£ unlimited £-ʹÓà spool ʱÈç¹û spool ³öµÄÎļþ³¬¹ý 2GB Ò²Ðí»á±¨´í¡£ ÆäËû ¾ßÌå¸÷ƽ̨ÉÏÎļþ´óСÏÞÖÆ Platform See ~~~~~~~~ ~~~ AIX (RS6000 / SP) [NOTE:60888.1] HP [NOTE:62407.1] Digital Unix [NOTE:62426.1] HOME: http://www.itpub.net MAIL: epub@itpub.net
  8. 8. ITPUB µç×ÓÔÓÖ¾ 2GB ÎÊÌâ Sequent PTX [NOTE:62415.1] Sun Solaris [NOTE:62409.1] Windows NT Maximum 4Gb files on FAT Theoretical 16Tb on NTFS ** See [NOTE:67421.1] before using large files on NT with ORACLE8 **2 There is a problem with DBVERIFY on 8.1.6 See [BUG:1372172] **3 There is a problem with 8.1.6 / 8.1.7 where an autoextend to 4Gb can cause a crash - see [BUG:1668488] ºó¼Ç ÕâƪÎÄÕÂÀ´×Ô £º metalink.ORACLE.com¡£±¾Ã»ÏëÈ«ÎÄ·-ÒëµÄ£¬ÒòΪÆäÖÐÐí¶àÏêϸµÄ½ Éܶ¼Òª²Î¿¼¸ÃÍøÕ¾ÉϵÄÐí¶àÆäËûÎÄÕ£-£-ÎÒÒ²ÖªµÀ¶ÁÕ߶Áµ½Ò»¸öÎÊÌ⣿ÉÓÖ ¬ ½â¾ö·½·¨»áºÜÄջ𣬵«ÎÞÂÛʱ¼ä¾«Á¦¶¼²»¿ÉÄÜÈÃÎÒÈ«²¿ÕÒÀ´£¬¶øÇÒËƺõҲû ±¾Îľ͵±Æð¸öÍ·°É¡£ ²¹³ä£º export ´óÎļþ¿ÉÒÔ²ÉÈ¡µÄ·½·¨£º 1. ÂãÉ豸 ±ÈÈçÖ±½Óµ¹³öµ½ /dev/rlvtest µÈ¡£ 2. ÃüÃû¹ÜµÀ Ï£© (Unix mknod /tmp/imp_pipe p compress < /tmp/exp_pipe > export.dmp.Z & exp file=/tmp/exp_pipe userid=xxx/xxx tables=... mknod /tmp/imp_pipe p uncompress < export.dmp.Z>/tmp/imp_pipe & imp file=/tmp/imp_pipe userid=xxx/xxx tables=... 3. ѹËõ/Îļþ²ð·Ö :(ÒÔÏÂÖ»ÔÚ ÖÐÓÐЧ£º ksh ) echo |exp file=>(compress | split -b 1024m - expdmp-) userid=xxx/xxx tables=... echo | imp file=<(cat expdmp- * |zcat) userid=xxx/xxx tables=... (ÏÂÃæÓÉ chao_ping ²¹³ä ) 4.¿ÉÒÔÖ±½Óµ¹³öµ½´Å´ø ±ÈÈçxp file=/dev/rmt0 .... e 5¡£¿ÉÒÔÔÚ ORACLE8i+°æ±¾ÀïÃ棬ͨ¹ýʹÓà file Ïà½áºÏ£¬µ¹³öÉú³É¶à¸öÎļþ¡£ filesize ºÍ HOME: http://www.itpub.net MAIL: epub@itpub.net
  9. 9. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT The Oracle DBA’ Guide to NT s Windows NT ƽ̨ÕýÔÚѸËÙÕ¼ÁìÖеͶËÊг¡£¬Äã×¼±¸ºÃÁËÂ𣿠ÔÚOracle ×îÔçÔÚ Äê´úÖÐÆÚ½øÈëÊý¾Ý¿âÊг¡µÄʱºò£¬ 80 Oracle Ñ¡ÔñµÄÖ÷Ҫƽ̨¾ÍÊÇ Digital ¹«Ë¾µÄVAXСÐÍ»úϵͳ£ VAXÉÏÃæµÄ °æ±¾µÄ ¬ ÔÚ¿ª·¢Íê VMS Oracle ÒÔºó£ Oracle ¬ ÔÙ°Ñ ÒÆÖ²µ½±ðµÄƽ̨µÄ²Ù×÷ϵͳÉÏ£¬±ÈÈç DG-OS£¬ MVS£¬ Unix µÈ¡£Èç¹ûÄãÔÚ87 Äê×óÓҾͿªÊ¼ ʹÓà racle£¬ÏàÐÅÄãÄǸöʱºòÓõÄÓ¦¸ÃÊÇ O VMS ϵͳ¡£ ÔÚ Äê´úÍíÆÚ¿ªÊ¼£¬ 80 Oracle µÄÖ÷ÒªÊг¡×ªÏòÁË¿ª·Å Ô ÏµÍ³nix¡ Ú90 Äê´úÖÐÆÚµ½ÏÖÔÚ£¬ U £ ¾ø´ó¶àÊýµÄ ϵͳ¶¼ÔËÐÐÔÚ Oracle Unix ϵͳÉÏ£¬ºÜ¶à³ÌÐòÔ±¶¼²»µÃ²»¼èÄѵĴÓVMS תÏòµ½ Unix ƽ̨¡£ ʱ¼ä×ßÏòÁË Ä꣬ÎÒÃÇÖ𽥿´µ½ÁËÁíÍâÒ»¸ö·¢Õ¹·½Ïò£-ËäȻûÓÐÏòµ±Ê±´Ó 2000 VMS ת ÏòUnix ÄÇôÃ÷ÏÔ£ºËäÈ» Unix ÈÔȻռ¾Ýן߶ËÊг¡£¬µ«ÊÇÔ½À´Ô½¶àµÄÖеͶËÓû§¿ªÊ Windows ϵͳ¡£ÎÒÃDz»Ó¦¸ÃºöÊÓÕâ¸öÏÖÏóµÄ´æÔÚ£¬Ó¦¸Ã¿ªÊ¼½Ó´¥ºÍѧϰOracle ÔÚ Windows ƽ̨ÉϵĹÜÀí¡£ ÔÚÕâƪÎÄÕÂÀïÃæ£ÎÒÏò´ó¼Ò½éÉÜ Æ½Ì¨ºÍÔÚ ¬ Oracle ÔÚUnix Windows ƽ̨ÉÏÓÐÄÄЩÇø±ð£¬ ÒÔ¼°ÔÚ Windows ƽ̨ÉϹÜÀí µÄ³£¼ûÎÊÌâ¡£ÎÒÃÇÏ£Íû¶ÁÕßÓÐÒ»¶¨µÄ Oracle Unix ºÍWindows ²Ù×÷ϵͳ»ù´¡ÖªÊ¶¡£ Oracle ÔÚWindows ϵͳÉϵÄÌåϵ½á¹¹ Oracle Ò»Ö±¶ÔÊý¾Ý¿âµÄ¿ÉÒÆÖ²ÐԷdz£ÖØÊÓ£¬Êµ¼ÊÉÏËüҲȷʵ×öµÄ·Ç³£ºÃ¡£Ã Oracle ¶¼ÓÐÒ»ÖµIJÙ×÷·½·¨ºÍÌØÐÔ¡£ÔÚ¼¸ºõËùÓÐƽ̨ÉÏ£¬¶¼¿ÉÒÔ¿´µ½ Oracle µÄ´æÔÚ¡£ÔÚ¸÷ ¸ö²»Í¬µÄƽ̨ÉÏ£ÓWindows95 ÉϵÄracle£½ IBM µÄ Intel ¬ µÄ ´ O ¬ µ S/MVS ÉϵÄracle£¬ O Oracle ¶¼ÊÇͬÑùµÄÒ»Ì×ͨÓõÄÌåϵ½á¹¹£º ¡ñ Ò»¿é¹«¹²ÄÚ´æÇøÓò£¬³ÆΪ SGA¡£ÀïÃæ´æ·ÅÊý¾Ý¿é»º³å£¬ SQL »º³åÇø£¬×ֵ仺³åÇø £¬ ÖØ×öÈÕÖ¾»º³åÇøµÈ¡£Èç¹ûÅäÖÃ³É MTS ½á¹¹µÄ»°£¬»¹ÓлỰÐÅÏ¢¡£ ¡ñ һЩÊý¾Ý¿âºǫ́½ø³Ì£¬±ÈÈç pmon£¬smon£¬arc0 µÈ¡£Èç¹ûÓзֲ¼ dbwr£¬lgwr£¬ ʽҵÎñ£¬²¢ÐÐÊý¾Ý¿â£¬×÷Òµ¶ÓÁеȣ¬»¹ÓÐһЩ±ðµÄÏà¹ØµÄºǫ́½ø³Ì¡£ ¡ñ Oracle Êý¾Ý¿âÓÃÀ´´æ·Å±í£¬Ë÷Òý£¬»Ø¹ö¶ÎµÈÊý¾ÝµÄÊý¾ÝÎļþ¡£ ¡ñ ÖØ×öÈÕÖ¾Îļþ£¬¼Ç¼ÔÚʵÀýʧ°ÜµÄʱºò»Ø¹öËùÐèÒªµÄÐÅÏ¢¡£ ¡ñ һЩ Server ½ø³Ì£¬ÓÃÀ´·þÎñÀ´×Ô¿Í»§½ø³ÌµÄÇëÇó¡£Èç¹ûÅäÖóÉÁ˹²Ïí·þÎ ¾ÍÊÇispatcher£¨µ÷¶È½ø³Ì£©ºÍһЩ¹² ½ø³ÌΪ¿Í»§ÇëÇó·þÎñ¡£ D ÏíµÄerver S ¡ñ Ò»¸öistener£¬ÓÃÀ´¼àÌýÀ´×ÔÍⲿ¿Í»§»úµÄÇëÇó¡£ L Êý¾ÝÎļþºÍÈÕÖ¾ÎļþÒ»°ã¶¼ÊÇÓòÙ×÷ϵͳµÄÎļþϵͳÉϵÄÎļþ»òÕßÊ¹Ó ·ÖÇøÀ´ÊµÏÖ£¬ÔÚ²»Í¬²Ù×÷ϵͳ¶¼ÊÇÒ»ÑùµÄ¡£µ«ÊÇ Oracle µÄÄÚ´æ½á¹¹ºÍ½ø³Ì½á¹¹ÔÚ Windows ƽ̨ÉϺͱðµÄƽ̨ÓÐЩÇø±ð¡£ ÔÚUnix ÏÂÃ棬ÿ¸ö ½ø³Ì¶¼ÊÇÒ»¸öµ¥¶ÀµÄ Oracle Unix ½ø³Ì£¬°üÀ¨ ºǫ́½ø³ÌºÍ Oracle Oracle Server ½ø³Ì¡£ ´æÔÚÓÚ µÄ¹²ÏíÄÚ´æ¶ÎÀïÃæ¡£ SGA Unix HOME: http://www.itpub.net MAIL: epub@itpub.net
  10. 10. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT Unix ÏÂÃæ racle µÄÌåϵ½á¹¹ ÏÂÃæÕâ·ùͼ±íÏÖÁË O £º µ«ÊÇT ƽ̨É쵀 N Oracle ÓÐЩÇø±ð¡£ ³ä·ÖÀûÓÃÁË Oracle NT ¶ÔÏ̵߳ÄÁ¼ºÃÖ§³Ö¡£ÏÂÃæ µÄ¸½Í¼ 2 ÀÎÒÃÇ¿ÉÒԱȽÏһϠracle ºÍ É쵀 racle µÄÇø±ð£º Unix É쵀 O NT O ÔÚ¼¸ºõËùÓвÙ×÷ϵͳÀïÃ棬һ¸ö½ø³ÌÊDz»ÔÊÐí²Ù×÷±ðµÄ½ø³ÌµÄÄÚ´æ¿Õ¼äµÄ£ Unix Ï ÃæÒªÅäÖù²ÏíÄÚ´æ¡£µ«ÊÇÔÚ NT ÀïÃ棬ÒòΪÕû¸ö ¾ÍÊÇÒ»¸öµ¥¶ÀµÄ½ø³Ì£¬Ã¿¸ö Oracle Oracle µÄ½ø³ÌÔÚ¶¼±íÏÖΪ OS Oracle ½ø³ÌµÄỊ̈߳¬Òò´Ë²»Í¬Ïß³ÌÔÊÐí²Ù×÷¹²Í¬µÄÄÚ´æ¿Õ¼ä¡ ÔÚ Æ½Ì¨ÉÏ£¬Ã¿¸ö ʵÀý¶¼ÊÇÒ»¸ö NT Oracle NT ½ø³Ì¡£ÔÚÕâ¸ö½ø³ÇÀïÃ棬°üÀ¨ÁËËùÓÐµÄ Oracle ½ø³Ì£¬Ã¿¸ö ½ø³Ìʵ¼ÊÉÏÒÔÏ̵߳ÄÐÎʽ³öÏÖ¡£ Oracle NT ƽ̨É쵀 Oracle ²ÉÓÃT µÄ¶à¸öÏß³Ì N /Ò»¸ö½ø³ÌµØ·½Ê½À´ÊµÏÖ Oracle¡£µ«Êǵ¥¸ö½ø³ÌµÄ ģʽ¾ö¶¨ÁËÒ»¸öʵÀýÄܹ»Ê¹ÓÃÄÚ´æµÄÊýÁ¿¡£ÔÚ Oracle NT4.0 ÀïÃ棬ÿ¸ö½ø³ÌÄܹ»Ñ°Ö· 4GB µÄÐéÄâ¿Õ¼ä£¬µ«ÊÇÓÐ 2G ÊDZ£Áô×÷Ϊ²Ù×÷ϵͳԤÁôµÄ£¬ Oracle ×î¶àÒ²Ö»Äܹ»Ê¹Óà 2GB ÄÚ´æ¡£ Ò»ÑÛ¿´È¥£¬ 2G ÄÚ´æ¶ÔÓÚ´ó¶àÊý½ø³ÌÓ¦¸ÃÊǹ»ÓÃÁË£¬µ«ÊǼÇס£ºÕâÀï Oracle ²»µ«Òª´æ·Å SGA£¬»¹Òª´æ·ÅËùÓеĻỰÐÅÏ¢µÈ¡£ÔÚNT4 ÀïÃ棬ÓÐÁ½¸ö°ì·¨¿ÉÒÔ¿¼ÂÇ£ºÊ¹ÓÃNT ÆóÒµ°æ£¬ ÕâÑù£¬¿ÉÒÔÉèÖòÙ×÷ϵͳֻ±£ÁôOracle ¿ÉÒÔÑ°Ö· 1GB ¿Õ¼ä£¬ 3Gb£¬»òÕßʹÓà °æ±¾µÄ Alpha HOME: http://www.itpub.net MAIL: epub@itpub.net
  11. 11. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT NT ϵͳ¡£ Oracle µÄ¶àÏ̷߳þÎñÆ÷ģʽ¿ÉÒÔÈúܶà¸ö Client ½ø³ÌºÍÉÙÊý¹²Ïí ½ø³ÌͨÐÅ£¬Õâ Server Ñù¾Í´ó´ó¼õÉÙÁ˵ķþÎñÆ÷½ø³Ì£¬´Ó¶ø¼õÉÙÁ˶ÔÄÚ´æµÄÐèÇó¡£ Oracle NT ƽ̨µÄ Oracle8 ¿ªÊ¼ Ö§³Ö¶àÏ̷߳þÎñÆ÷¡£Èç¹û½øÒ»²½²ÉÓÃºÍ Connection Pool Concentrating ¼¼Êõ£¬¿ÉÒÔ¸ü¼Ó¼õ ÉÙ¶ÔÄÚ´æµÄÐèÇó¡£ ÔÚWindows2000 ÀïÃæ£ ¬Ó¦ÓóÌÐòµÄ¿ÉÑ°Ö·¿Õ¼ä´ïµ½ÁË 32GB£¬Õâ¶ÔÓÚ¾ø´ó¶àÊýµÄ Oracle Ó¦Ó㬶¼ÊÇ×ã¹»ÁË¡£ Æô¶¯ºÍ¹Ø±Õ ÔÚUnix »·¾³Ï£¬ÎÒÃÇͨ³£Ê¹Óà dbstart/dbshut£¬svrmgrl »òÕß sqlplus À´Æô¶¯ /¹Ø±Õ¡£ ÔÚ Oracle Æô¶¯µÄʱºò£¬ Æô¶¯ÊµÀý£¬ Êý¾Ý¿â£¬ Êý¾Ý¿â£¬È»ºó »á×Ô Oracle Mount Open Oracle ¶¯ daemonize £¬³ÉΪºǫ́½ø³Ì£¬ºÍµÇ½»á»°ÍÑÀ룬ÕâÑù£¬µ±Óû§×¢ÏúµôÖ®ºó£¬ Oracle ÈÔ¾É ¼ÌÐøÔËÐС£ µ«ÊÇÔÚ Windows ƽ̨Ï£¬ÐèÒªÓû§×¢ÏúÖ®ºó£¬ Oracle ÈÔ¾ÉÄܹ»ÔËÐУ¬ Oracle ±ØÐë×¢²á ³ÉΪT µÄÒ»¸ö·þÎñ¡£ N NT ÏÂÃæµÄ Oracle Ö÷Òª°üº¬ÏÂÃæÕâЩ¹Ø¼ü·þÎñ£º ¡ñOracleServicesid Õâ¸ö·þÎñ¶¨ÒåÁË NT »úÆ÷ÉϵÄÒ»¸ö ʵÀý¡£Ò»°ã¸ñʽÊÇ Oracle OracleService%SID% ¡ £ ± È È ç ÎSID Ä ABC £ ¬ Ä Ç Ã ´ Ï à Ó ¦ µ Ä · þ Î ñ à û × Ö ¾ Í Ê Ç Ò µ ÊÇ OracleServiceABC¡ £ Ö»ÓÐÆô¶¯Õâ¸ö·þÎñ£ ¬ ²ÅÄܹ»½øÒ»²½Æô¶¯ ºÍ Oracle ʵÀý£¬Mount Open Êý¾Ý¿â¡£µ«ÊÇÒ²¿ÉÒÔÉèÖóÉʵÀý×Ô¶¯ Open Êý¾Ý¿â¡£ ¡ñOracleStartsid Õâ¸öÖ»ÊÇÔÚ Oracle8 °æ±¾ÀïÃæ²Å³öÏֵġ£ÔÚ Oracle8i ÀïÃ棬Õâ¸ö·þ ÎñºÍ OracleServiceSid ºÏ²¢ÁË¡£Æô¶¯Õâ¸ö·þÎñÏ൱ÓÚ¾ÍÊÇÖ´ÐÐÁËÒ»¸ö Æô¶¯Êý¾Ý¿âµÄ½Å ±¾¡£ ¡ñOracleTNSListener Õâ¸öʱ Oracle µÄ¼àÌý½ø³Ì¡£Ò»°ãÒ»¸öĬÈÏ Listener ¾Í¹»ÓÃÁË¡£ Èç¹ûÉèÖÃÁ˱ðµÄ Ãû×Ö£¬¾Í»á²úÉúÏàÓ¦µÄ·þÎñ¡£ listener Èç¹ûÏ£Íû Oracle Äܹ»×Ô¶¯Æô¶¯£¬¿ÉÒÔÉèÖÃÏàÓ¦·þÎñÊôÐÔΪ Auto¡£ net start OracleServiceGDB1 net start OracleStartGDB1 net start OracleTNSListener80 ÎÒÃÇ¿ÉÒÔͨ¹ý Õâ¸ö¹¤¾ßÀ´´´½¨£¬É¾³ý£¬±à¼-£¬Æô¶¯ºÍÍ£Ö¹ oradim OracleService ·þÎñ¡£ µ«ÊÇÎÒÃÇÒ»°ã½¨ÒéʹÓà sqlplus À´¹Ø±ÕÏàÓ¦µÄ·þÎñ¡ svrmgrl »òÕß £ÕâÊÇÒòΪÔڵͰ汾µÄ Oracle ÀïÃ棬ÔÚ Ò»¸ö¼¶±ðÍ£Ö¹ ·þÎñ£¬Ï൱ÓÚÔÚ ÀïÃæÖ´ÐÐÁË NT Oracle Oracle shutdown abort£¬Õâ ÊǺܲ»¹æ·¶µÄ²Ù×÷¡£ËäÈ»¾ø´ó¶àÊýÇé¿öÏ£¬ Oracle Ò²¶¼ÊÇÄܹ»×Ô¶¯»Ö¸´µÄ£¬µ«ÊÇÕâ¸ö²»ÊÇ Oracle ÍƼöµÄ¹Ø±ÕÊý¾Ý¿âµÄ·½·¨¡£ ´Ó Oracle8 ºÍ 8i ¿ ª Ê ¼Oracle Ì í ¼ Ó Á Ë × ¢ ² á ± í ² Î Ê ý £ º » ò Õ ß £¬ ora_shutdown ora_<sid>_shutdown£¬ Ora_shutdown_type£¬Ora_shutdown_timeout µÈ²ÎÊýÀ´¿ØÖÆ´Ó NT ¼¶±ð¹Ø±ÕÊý¾Ý¿âĬÈϲÉÈ¡µÃ·½Ê½¡£±ÈÈçÎÒÃÇÉ趨ÁË ora_<sid>_shutdowntype=I£¬ ora_<sid>_shutdow_timeout=30£¬ÄÇô Oracle »áÏÈʹÓà shutdown immediate À´¹Ø±Õ £¬Èç ¹û¹ýÁË Ã뻹ûÓйرճɹ¦£¬hutdown abort À´¹Ø±ÕÊý¾Ý¿â¡£ 30 NT ʹÓà s Oracle °æ±¾¹²´æʱºòµÄ¿¼ÂÇ ¶à¸ö ÔÚ Unix ÏÂÃæ¹ÜÀí¶à¸ö°æ±¾µÄ Oracle Ïà¶ÔÈÝÒ×£¬ÎÒÃÇÖ»ÐèÒª°Ñ²»Í¬µÄ Oracle Èí¼þ°²×° µ½²»Í¬µÄ Oracle_HOME Ï Ã棬ȻºóÇл»µÄʱºò£¬Ö¸¶¨»·¾³±äÁ¿ ¾Í¿ÉÒÔ $ORACLE_HOME ÁË¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  12. 12. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT ÔÚ NT Ï Â Ã æ £ ¬ Æ ä Ê µ Ò ² ² î ² » ¶ à ¡ £ ² » Í ¬ µ Ä Ê Ç × ¢ ² á ± í Ï Â Ã æ µ Ä ¼ ü Ö µ £ º NT Ä ¬ È Ï Ê ¹ Ó Ã HKEY_LOCAL_MACHINESOFTWAREORACLEORACLE_HOME À´¼Ç¼ÐÅÏ¢¡£ ÈçºÎ½øÐб¸·Ý ºÍ ÉÏÃæµÄ Unix Oracle ±¸·ÝÒ»Ñù£¬ÎÒÃÇͬÑùÓкܶàÖÖ¿ÉÑ¡µÄ±¸·Ý·½°¸£ºÀ䱸·Ý£¬ OS ÈÈ ±¸·Ý£¬ ±¸·Ý£¬ ±¸·ÝµÈ¡£¶ÔÓÚ exp Rman exp ºÍÀ䱸·Ý£¬ÔÚ NT ÉÏûÓÐʲôÇø±ð¡£ Unix ºÍ NT µÄ±¸·Ý¹¤¾ß¿ÉÒÔ±¸·Ýµ½´Å´ø£¬ Ö»Äܹ»±¸·Ýµ½´ÅÅÌ¡£Òò´ËÈç¹ûʹÓà Oracle µÄocopy OS ±¸·Ý£¬Ò»°ã¶¼ÐèÒªÓиöÖÐתµØ£¬Èà Oracle Ïȱ¸·Ýµ½´ÅÅÌÁíÍâÒ»¸ö¿Õ¼ä£¬ÔÙͨ¹ý NT Ö»´ý µÃ±¸·Ý¹¤¾ß¿½±´µ½´Å´øÉÏÈ¥¡£»òÕß¿ÉÒÔÓà Rman ºÍÏàÓ¦µÄ±¸·ÝÈí¼þ£¨Èç Oracle À¦°óµÄ Legato£©µÈʵÏÖÖ±½Ó±¸·Ýµ½´Å´ø¡£ ¶¨ÆÚʵÐб¸·Ý ÔÚ ÏÂÃ棬ÎÒÃÇͨ¹ý À´ÊµÏÖ¶¨ÆÚµÄ×÷Òµ¹ÜÀí£¬Í¬Ñù£¬ÔÚ Unix crontab Windows ÏÂÃ棬ÎÒ ÃÇÒ²¿ÉÒÔʵÏÖ£¬Í¨¹ý AT »òÕ߼ƻ®ÈÎÎñ¡£ÎÒÃÇ¿ÉÒÔ¾ö¶¨ÊÇÖ»Ö´ÐÐÒ»´Î£¬»¹ÊÇÒ»Ö±Ö´ At µÄ»ù±¾ÃüÁî¸ñʽÊÇ£º At ʱ¼ä [/every:date] [/next:date] ʱ¼äÊÇ Ð¡Ê±¸ñʽµÄ£¬ 24 date ¿ÉÒÔÊÇÿ¸öÔ嵀 1-31 »òÕßÿÐÇÆÚµÄ W£¬ M£¬T£¬ TH£¬ S£¬ F£¬ SU¡£ ÀýÈ磬ÎÒÃÇÏ£ÍûϵͳÄܹ»ÔÚÿÌìÏÂÎçÈýµã½øÐй鵵£º at 15:00 /every:m,t,w,th,f,s,su cmd /c c:binarchive.bat >c:logsarchive.log µ±È»£¬ÒªÊµÏÖ¶¨ÆÚÖ´ÐгÌÐò£¬ÎÒÃDZØÐë°Ñ Service ·þÎñÆô¶¯¡£ Windows µÄSchedule ½øÐÐÐÔÄܼì²é ¼àÊÓÊý¾Ý¿âµÄÐÔÄÜ£¬Õï¶ÏÐÔÄÜÎÊÌâºÍÐÔÄÜÉϵÄÆ¿¾±£¬´Ó¶ø¶ÔÊ DBA µÄÖ÷ÒªÖ°ÔðÖ®Ò»¡£ËäÈ»ÀíÂÛÉÏÀ´½²£¬ÔÚ NT ÉϺÍnix ÉÏÃæ½øÐÐÐÔÄܵ÷Óŵķ½·¨Ò»Ñù£¬ U µ«ÊÇʵ¼ÊʹÓõŤ¾ß»¹ÊDz»Ò»ÑùµÄ¡£ ÔÚ Unix ÏÂÃ棬ÎÒÃÇÒ»°ãͨ¹ý sar£¬top µÈ¹¤¾ßÀ´¼ì²éϵͳµÄÕûÌåÐÔÄܺ͵¥¶À vmstat£¬ ½ø³ÌµÄÇé¿ö¡£ÔÚNT ÏÂÃ棬ÎÒÃÇÒ»°ãͨ¹ý NT ×Ô´øµÄ½ø³Ì¹ÜÀíÆ÷ºÏÐÔÄܼàÊÓÆ÷À´¼ì²é·þÎñÆ µÄÕûÌåÐÔÄÜ¡£ NT µÄÐÔÄܼàÊÓÆ÷¿ÉÒÔ¼ì²éϵͳ·¶Î§ÄںܶàµÄ×ÜÌåÇé¿ö£¬±ÈÈç×ÜÌåµÄ CPU ʹÓã¬ÄÚ´æ ʹÓã¬ÍøÂçʹÓ㬴ÅÅ̵ÈÐÅÏ¢¡£Ò²¿ÉÒÔ¼ì²éij¸öµ¥¶ÀÏ̵߳ÄÐÅÏ¢¡£ ×÷ΪT ƽ̨É쵀 N Oracle DBA£¬±ØÐë¶Ô½ø³Ì¹ÜÀíÆ÷ºÍÐÔÄܼàÊÓÆ÷·Ç³£ÊìϤ¡£ Oracle »¹×Ô¼ºÌṩÁ˽ӿڣ¬ÀûÓà NT µÄÐÔÄܼàÊÓÆ÷À´¹ÜÀíºÍ¼àÊÓ Oracle Êý¾Ý¿âµÄÐÔÄÜ¡£ CPU ×ÊÔ´ ¼à¿Øÿ¸öÏß³ÌʹÓÃµÄ ËäÈ»ÔÚ NT µÄ½ø³Ì¹ÜÀíÆ÷ÀïÃæ¿ÉÒÔ¿´µ½¾¿¾¹ÄÄЩ½ø³ÌÕ¼ÓÃÁ˹ý¶àµÄ×ÊÔ´£¬µ« ½ø³Ì£¬¿´¾¿¾¹ÊÇÄǸöÏß³ÌÕ¼ÓÃÁ˹ý¶àµÄ×ÊÔ´¡£ÒòΪ¾ÍÈçÇ°ÃæËù˵£¬ Oracle ÔÚ ÉϵÄʵÏÖÊÇ NT Ò»¸ö½ø³Ì¶à¸öỊ̈߳¬´Ó OS µÄ½Ç¶È£¬¾ÍÊÇÒ»¸ö½ø³Ì¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÃæµÄ½Å±¾£¬À´¼à ÊÇÄǸö Oracle µÄÏß³ÌÕ¼ÓÃÁ˶àÉÙ×ÊÔ´¡££¨×¢Ò⣬ÕâÀïºǫ́½ø³ÌʹÓÃµÄ © CPU ×ÊÁÏÎÞ·¨¿´µ½££ ¡ HOME: http://www.itpub.net MAIL: epub@itpub.net
  13. 13. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT LISTING 1. CPU usage query. column program format a20 column username format a12 select p.spid thread£¬s.username£¬ decode(nvl(p.background£¬ 1£¬ 0)£¬ bg.description£¬ s.program ) program£¬ ss.value/100 CPU£¬ physical_reads disk_io from v$process p£¬ v$session s£¬ v$sesstat ss£¬ v$sess_io si£¬ v$bgprocess bg where s.paddr=p.addr and ss.sid=s.sid and ss.statistic#=12 and si.sid=s.sid and bg.paddr(+)=p.addr order by ss.value desc; ¿ÉÒÔͨ¹ý Oracle µÄOEM ¹¤¾ß£º Oracle Top Session À´¼ì²éÿ¸öµ¥¶ÀÏß³ÌÕ¼ÓÃCPU µÈ×ÊÔ´ µÄÇé¿ö¡£Ò²¿ÉÒÔʹÓõ¥¶ÀµÄµÚÈý·½¹¤¾ß£¬±ÈÈç dbtop.pl ½Å±¾ (werple.net.au~gharriso ¿ÉÒÔ ÏÂÔØ )¡£ ÐÔÄܵ÷ÓÅ ÔÚ Æ½Ì¨ÉÏ¶Ô ½øÐÐÐÔÄܵ÷ÓÅ£¬Æäʵ»ù±¾Ô-ÔòºÍÔÚ NT Oracle Unix ÉϽøÐÐÐÔÄܵ÷ÓÅûÓÐʲ ôÇø±ð£º ¡ñµ÷ÕûQL£¬ÓÅ»¯Ó¦ÓóÌÐòµÄÉè¼Æ S ¡ñÈ·±£Ê¹ÓÃÁ˺ÏÊʵĹ»ÓõÄÓ²¼þ£º°üÀ¨ CPU£¬Äڴ棬ÍøÂç×ÊÔ´£¬´ÅÅÌ×ÓϵͳµÈ£¬Äܹ»·û ºÏÓ¦ÓóÌÐòµÄÒªÇó¡£ ¡ñ¾¡Á¿°ÑÊý¾ÝÎļþ·Åµ½²»Í¬µÄÎïÀí´ÅÅÌÉÏÃ棬¼õÉÙ IO µÈ´ý¡£ ¡ñ¾¡Á¿°Ñ Oracle µÄredo log ºÍ¹éµµÈÕÖ¾Îļþ£¬Êý¾ÝÎļþµÈ·Åµ½²»Í¬µÄÎïÀí´ÅÅÌÉ Ö¤¿É»Ö¸´ÐÔºÍÀíÏëµÄÐÔÄÜ¡£ ¡ñ Oracle ·ÖÅä×ã¹»µÄ ¸ø SGA£¬»Ø¹ö¶Î£¬ÅÅÐòÇøºÍÁÙʱ±í¿Õ¼äµÈÄÚ²¿×ÊÔ´¡£ ÏÂÃæÕâЩÊÇ NT ƽ̨ÉÏÌØÓеÄһЩҪ¿¼Âǵķ½Ã棺 ¡ñ ¶ÔÓÚ ·Ç³£Ãܼ¯µÄÓ¦Ó㬿ÉÒÔ¿¼ÂÇʹÓÃÂãÉ豸¡£ÔÚ IO NT ÉÏÃæʹÓÃÂãÉ豸ÐèҪעÒâµÄ ¶«Î÷ºÍÔÚ ÉÏÓÃÂãÉ豸ûÓÐʲô²î±ð¡¿ÉÒÔʹÓà À´±¸·Ý ÉÏÃæµÄ Unix ocopy »òÕß £ rman NT ÂãÉ豸ÉÏÃæµÄÊý¾ÝÎļþ¡£ ¡ñ Èç¹ûʹÓÃÎļþϵͳÀ´´æ·ÅÊý¾ÝÎļþ£¬´¦ÓÚÐÔÄܵĿ¼ÂÇ£¬Á½Õ߲¶à£¬µ« µÄ¿¼ÂÇ£¬Ó¦¸ÃÓÅÏÈʹÓà NTFS£¬ÒòΪËüʵÏÖÁËȨÏÞ¿ØÖÆ£¬¶ÔÓÚ Oracle µÄ°²È«±È½ÏÖØÒª¡£ ¡ñ ÓÉÓÚ indows ϵͳ֧³ÖÎļþϵͳµÄÒì²½ W IO£¬Ò»°ã²»ÐèÒªÉèÖöà¸ö dbwr ½ø³Ì ¡£ BUGS? WHAT BUGS? I may have painted a fairly rosy picture of the Oracle/NT environment. However, the NT HOME: http://www.itpub.net MAIL: epub@itpub.net
  14. 14. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT environment is no more immune to bugs than others.Although most bugs are either noncritical or have workarounds or patches,you may encounter a few of them while attempting to implement some of the features I've discussed. For example: ¡ñThe Oracle8 facility to shut down a service cleanly is not functional in Oracle8.0.3.0 (see Oracle Product Change Request #513414). ¡ñ Running in archivelog mode--and hence performing online backups--is not supported in Oracle7.3.2.1 (see alert #10802099). ¡ñThe integration of Oracle logging into the NT performance monitor does not always work without manual intervention (see Oracle Product Change Requests #556846 and #520639). ORACLE ON NT: HERE TO STAY I've given you just a taste of Oracle administration under Windows NT. Oracle administration is a big topic,and we've barely scratched the surface here. However,I think you'll see that transitioning Oracle from Unix to N is neither particularly unpleasant nor T troublesome,although there are challenges. Both Unix and NT are here to stay,at least for the foreseeable future. While Oracle professionals who restrict themselves to the Unix environment will continue to be in demand,those who embrace both environments will have access to a greater range of Oracle installations and will experience greater variety in their professional lives. If you're an Oracle professional,you owe it to yourself to be at least familiar with Oracle on NT. Guy Harrison is an independent Oracle consultant specializing in Oracle development and performance issues and author of Oracle SQL High Performance Tuning (Prentice Hall, 1997). He is currently working with Quest Software Inc. in Australia. You can contact Guy at gharriso@werple.net.au or through his home page at werple.net.au/~gharriso/. ÎÒÃǾ¿¾¹Ê¹ÓÃʲôÎļþϵͳ£¿ ÔÚ Windows ÉÏÃ棬ÎÒÃÇ¿ÉÒÔʹÓà FAT £¬ FAT32£¬ NTFS£¬Ñ¹ËõµÄ ºÍÂãÉ豸¡£ÄÇô¾¿¾¹ NTFS ʹÓà ʲôÎļþϵͳµÄÐÔÄܸü¼ÓÓÅÔ½ÄØ£¿ÎÒÃÇÀ´×öÒ»¸ö¼òµ¥µÄÊÔÑ飬½øÐв ºÍÈ«±íɨÃ裬¿´¿´½á¹ûÈçºÎ¡£ ¶ÔÓÚÿ¸öÊÔÑ飬ÎÒÃÇͨ¹ýµ¼ÈëÒ»¸ö 8MB µÄÎļþ£¬È»ºó½øÐÐÒ»¸ö´óµÄ²éѯ£¨Éæ¼°Ëĸö¸ µ¼ÈëµÄ´ó±í£¬Í¨¹ýË÷Òý½øÐвéѯ£ ©¡£²âÊÔʹÓõĻúÆ÷ÅäÖÃΪ NT 4, Pentium Pro256MHZ, µ¥ ¿éCPU£¬ 64M Äڴ棬һ¸ö µØ 2.5GB IDE Ó²ÅÌ¡£Ã¿´Î²»Í¬µÄ²âÊÔ֮ǰ£¬»úÆ÷¶¼ÖØÐÂÆô¶ ´Î¡£ ´ÓÏÂÃæµÄ²âÊÔ½á¹ûÎÒÃÇ¿ÉÒÔ¿´µ½£¬ NTFS ºÍFAT µÄÐÔÄÜ»ù±¾Ò»Ñù£¬ÂãÉ豸µÄÐÔÄÜÔÚ¸÷¸ö· Ã涼Ã÷ÏÔ¸ßÓÚÎļþϵͳ¡£ NT µÄѹËõÎļþϵͳЧÂʷdz£µÍÏ£¬ ²»ÄÜ¿¼ÂÇ¡£ µ±È»£¬ÔÚÕæÕý¿¼ÂÇʹÓÃʲôÎļþϵͳµÄʱºò£¬»¹Ó¦¸Ãͬʱ¿¼Âǵ½°²È«ÐÔ Ò×¹ÜÀíÐÔ£¬Èç ºÎ½øÐб¸·ÝµÈ¸÷¸öÒòËØ¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  15. 15. ITPUB µç×ÓÔÓÖ¾ The Oracle DBA's Guide to NT Ô-×÷£º Harrison Guy ÍƼö£º snowhite2000 ·-Òë¸Ä±à£º chao_ping HOME: http://www.itpub.net MAIL: epub@itpub.net
  16. 16. ITPUB µç×ÓÔÓÖ¾ ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS ÔÚ Oracle 8i ÖУ¬ÍùÍù»á³öÏÖÒªÔÚ´æ´¢¹ý³ÌÖÐÔËÐвÙ×÷ϵͳÃüÁîµÄÇé¿ö¡£Ò»° ÓÃOracle Enterprise Manager É趨×÷ҵʱ¿ÉÒÔ´ïµ½Õâ¸öÄ¿µÄ¡£µ«ÊÇÓÉÓÚ OEM ÔÚÉ趨×÷Òµ ȱ·¦Áé»îÐÔ£¬É趨µÄ×÷ÒµµÄ²ÎÊýÊǹ̶¨µÄ¡£ÔÚʵ¼ÊÓ¦Óõ±ÖÐÍùÍùÐèÒªÔÚ SQL Óï¾äµ±ÖÐÔËÐÐ ÐèÒªËæʱÔËÐвÙ×÷ϵͳÃüÁî¡£ Oracle 8i ûÓÐÖ±½ÓÔËÐÐ OS ÃüÁîµÄÓï¾ä£¬ÎÒÃÇ¿ÉÒÔÀûÓà DBMS_PIPE ³ÌÐò°üʵÏÖÕâÒ»ÒªÇó¡£ DBMS_PIPE ͨ¹ý´´½¨¹ÜµÀ£¬¿ÉÒÔÈÃÖÁÉÙÁ½¸ö½ø³Ì½øÐÐͨÐÅ¡£ Oracle µÄ¹ÜµÀÓë²Ù×÷ϵ ͳ µÄ¹ÜµÀÔÚ¸ÅÄîÉÏÓÐÏàͬµÄµØ·½£¬µ«ÊÇÔÚʵÏÖ»úÖƲ»Í¬¡£ ÏÂÃæ½éÉÜʵÏÖ¾ßÌå²½Ö裺 1 ´´½¨Ò»¸ö³ÌÐò°ü£¬¹ÃÇÒÆðÃû½Ð Óï¾äÈçÏ£º DAEMON£¬ SQL /*´´½¨aemon ³ÌÐò°ü d */ CREATE OR REPLACE PACKAGE BODY daemon AS /*execute_system ÊÇʵÏÖÔËÐÐ os ÃüÁîµÄº¯Êý */ FUNCTION execute_system(command VARCHAR2, timeout NUMBER DEFAULT 10) RETURN NUMBER IS status NUMBER; result VARCHAR2(20); command_code NUMBER; pipe_name VARCHAR2(30); BEGIN pipe_name := DBMS_PIPE.UNIQUE_SESSION_NAME; DBMS_PIPE.PACK_MESSAGE('SYSTEM'); DBMS_PIPE.PACK_MESSAGE(pipe_name); DBMS_PIPE.PACK_MESSAGE(command); /*Ïò daemon ¹ÜµÀ·¢ËͱíʾÃü */ ÁîµÄ×Ö·û status := DBMS_PIPE.SEND_MESSAGE('daemon', timeout); IF status <> 0 THEN RAISE_APPLICATION_ERROR(-20010, 'Execute_system: Error while sending. Status = ' || status); END IF; status := DBMS_PIPE.RECEIVE_MESSAGE(pipe_name, timeout); IF status <> 0 THEN RAISE_APPLICATION_ERROR(-20011, 'Execute_system: Error while receiving. Status = ' || status); END IF; /*»ñÈ¡·µ»Ø½á¹û */ HOME: http://www.itpub.net MAIL: epub@itpub.net
  17. 17. ITPUB µç×ÓÔÓÖ¾ ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS DBMS_PIPE.UNPACK_MESSAGE(result); IF result <> 'done' THEN RAISE_APPLICATION_ERROR(-20012, 'Execute_system: Done not received.'); END IF; DBMS_PIPE.UNPACK_MESSAGE(command_code); DBMS_OUTPUT.PUT_LINE('System command executed. result = ' || command_code); RETURN command_code; END execute_system; /*stop ÊÇÈÃaemon Í£Ö¹ d */ PROCEDURE stop(timeout NUMBER DEFAULT 10) IS status NUMBER; BEGIN DBMS_PIPE.PACK_MESSAGE('STOP'); status := DBMS_PIPE.SEND_MESSAGE('daemon', timeout); IF status <> 0 THEN RAISE_APPLICATION_ERROR(-20030, 'stop: error while sending. status = ' || status); END IF; END stop; END daemon; ͨ¹ýql*Plus ÔËÐÐÒÔÉÏ S Óï¾ä£¬½«Îªµ±Ç°Óû§´´½¨ daemon ³ÌÐò°ü¡£ 2 ´´½¨ÔÚ ÉÏÔËÐеÄÊØ»¤½ø³Ì OS ,¼àÌýÓÉÉÏÃæµÄ ³ÌÐò°ü·¢À´µÄÒªÇóÖ´ÐÐ daemon OS ÃüÁî µÄÓï¾ä Pro*C µÄ´úÂ룬±ØÐëÓÉ .ÒÔÏ pro*c ÏȽøÐÐÔ¤±àÒë¡£ #include #include EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; char *uid = "scott/tiger";/*ÔÚÕâ¸öµØ·½¸ÄΪÄã×Ô¼º·ÃÎʵÄÓû§ ,ÃÜÂë ,·þÎñÃû */ int status; VARCHAR command[20]; VARCHAR value[2000]; VARCHAR return_name[30]; EXEC SQL END DECLARE SECTION; void HOME: http://www.itpub.net MAIL: epub@itpub.net
  18. 18. ITPUB µç×ÓÔÓÖ¾ ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS connect_error() { char msg_buffer[512]; int msg_length; int buffer_size = 512; EXEC SQL WHENEVER SQLERROR CONTINUE; sqlglm(msg_buffer, &buffer_size, &msg_length); printf("Daemon error while connecting:n"); printf("%.*sn", msg_length, msg_buffer); printf("Daemon quitting.n"); exit(1); } void sql_error() { char msg_buffer[512]; int msg_length; int buffer_size = 512; EXEC SQL WHENEVER SQLERROR CONTINUE; sqlglm(msg_buffer, &buffer_size, &msg_length); printf("Daemon error while executing:n"); printf("%.*sn", msg_length, msg_buffer); printf("Daemon continuing.n"); } main() { EXEC SQL WHENEVER SQLERROR DO connect_error(); EXEC SQL CONNECT :uid; printf("Daemon connected.n"); EXEC SQL WHENEVER SQLERROR DO sql_error(); printf("Daemon waiting...n"); while (1) { EXEC SQL EXECUTE BEGIN /*½ÓÊÕeamon ·¢À´µÄ×Ö·û d */ :status := DBMS_PIPE.RECEIVE_MESSAGE('daemon'); IF :status = 0 THEN /*È¡³ö×Ö·û */ DBMS_PIPE.UNPACK_MESSAGE(:command); END IF; HOME: http://www.itpub.net MAIL: epub@itpub.net
  19. 19. ITPUB µç×ÓÔÓÖ¾ ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS END; END-EXEC; IF (status == 0) { command.arr[command.len] = '0'; /*Èç¹ûÊÇ stop,¸Ã½ø³Ì¾ÍÍ˳ö */ IF (!strcmp((char *) command.arr, "STOP")) { printf("Daemon exiting.n"); break; } ELSE IF (!strcmp((char *) command.arr, "SYSTEM")) { EXEC SQL EXECUTE BEGIN DBMS_PIPE.UNPACK_MESSAGE(:return_name); DBMS_PIPE.UNPACK_MESSAGE(:value); END; END-EXEC; value.arr[value.len] = '0'; printf("Will execute system command '%s'n", value.arr); /*ÔËÐÐs ÃüÁî o */ status = system(value.arr); EXEC SQL EXECUTE BEGIN DBMS_PIPE.PACK_MESSAGE('done'); DBMS_PIPE.PACK_MESSAGE(:status); :status := DBMS_PIPE.SEND_MESSAGE(:return_name); END; END-EXEC; IF (status) { printf ("Daemon error while responding to system command."); printf(" status: %dn", status); } } ELSE { printf ("Daemon error: invalid command '%s' received.n", command.arr); HOME: http://www.itpub.net MAIL: epub@itpub.net
  20. 20. ITPUB µç×ÓÔÓÖ¾ ÔÚ ORACLE ÖÐÔËÐÐ ÃüÁî OS } } ELSE { printf("Daemon error while waiting for signal."); printf(" status = %dn", status); } } EXEC SQL COMMIT WORK RELEASE; exit(0); } HOME: http://www.itpub.net MAIL: epub@itpub.net
  21. 21. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí Oracle DBA ÈÕ³£¹ÜÀí Ð޸ģº 2000/8/23 ×÷Õߣº Thomas B. Cox£¬ with Christine Choi Ä¿µÄ£ºÕâƪÎĵµÓкÜÏêϸµÄ×ÊÁϼǼ×ŶÔÒ»¸öÉõÖÁ¸ü¶àµÄ ORACLE Êý¾Ý¿âÿÌìµÄ£¬Ã¿Ôµģ¬ ÿÄêµÄÔËÐеÄ״̬µÄ½á¹û¼°¼ì²éµÄ½á¹û£ ÔÚÎĵµµÄ¸½Â¼ÖÐÄ㽫»á¿´µ½ËùÓÐ¼ì ¬ SQL ºÍPL/SQL ´úÂë¡£ Ð޸ıʼǣº ÔÚ 1.1 Steve DeNunzio µÄ 'existext.sql'ÖÐËùʶ±ðµÄÀàÐÍ 1.2 ¹Ì¶¨µÄÀàÐÍ 1.3 ¼ÓµÄ nu Public License£»ÔÚÖؽ¨ ÖÐÔö¼Ó G index pctincr 0 1.4 ¼ Ó Á Ë Ò » ¸ ö × î Ð Â µ Ä ¹ ÛGEOCITIESÇ µ Ä Ö ÷ Ò ³ É Ï µ à µ ½ µ Ä ¡ £ µã£¬Ê ´Ó http://www.geocities.com/tbcox23 Ŀ¼ 1.ÈÕ³£Î¬»¤³ÌÐò A£®¼ì²éÒÑÆðµÄËùÓÐʵÀý B£®²éÕÒһЩеľ¯¸æÈÕÖ¾ C£®¼ì²éBSNMP ÊÇ·ñÔÚÔËÐÐ D D£®¼ì²éÊý¾Ý¿â±¸·ÝÊÇ·ñÕýÈ· E£®¼ì²é±¸·Ýµ½´Å´øÖеÄÎļþÊÇ·ñÕýÈ· F£®¼ì²éÊý¾Ý¿âµÄÐÔÄÜÊÇ·ñÕý³£ºÏÀí£¬ÊÇ·ñÓÐ×ã¹»µÄ¿Õ¼äºÍ×ÊÔ´ G£®½«ÎĵµÈÕÖ¾¸´ÖƵ½±¸·ÝµÄÊý¾Ý¿âÖÐ H£®Òª³£¿´ Óû§ÊÖ²á DBA 2.Íí¼äά»¤³ÌÐò A£®ÊÕ¼¯ VOLUMETRIC µÄÊý¾Ý 3.ÿÖÜά»¤¹¤×÷ A£®²éÕÒÄÇЩÆÆ»µ¹æÔòµÄ OBJECT B£®²éÕÒÊÇ·ñÓÐÎ¥·´°²È«²ßÂÔµÄÎÊÌâ C£®²é¿´´íÎóµØ·½µÄ ÈÕÖ¾ SQL*NET D£®½«ËùÓеľ¯¸æÈÕÖ¾´æµµ E£®¾-³£·ÃÎʹ©Ó¦É̵ÄÖ÷Ò³ 4.ÔÂά»¤³ÌÐò A£®²é¿´¶ÔÊý¾Ý¿â»á²úÉúΣº¦µÄÔö³¤ËÙ¶È B£®»Ø¹ËÒÔÇ°Êý¾Ý¿âÓÅ»¯ÐÔÄܵĵ÷Õû C£®²é¿´ µÄÆÁ¾±ÎÊÌâ I/O D£®»Ø¹ËFRAGMENTATION E£®½«À´µÄÖ´Ðмƻ® F£®²é¿´µ÷ÕûµãºÍά»¤ 5.¸½Â¼ A£®ÔÂά»¤¹ý³Ì B£®Íí¼äά»¤¹ý³Ì C£®ÖÜά»¤¹ý³Ì 6.²Î¿¼ÎÄÏ× HOME: http://www.itpub.net MAIL: epub@itpub.net
  22. 22. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí Ò»£®ÈÕά»¤¹ý³Ì A£®²é¿´ËùÓеÄʵÀýÊÇ·ñÒÑÆð È·¶¨Êý¾Ý¿âÊÇ¿ÉÓõģ ¬°Ñÿ¸öʵÀýдÈëÈÕÖ¾²¢ÇÒÔËÐÐÈÕ±¨¸æ»òÊ Îļþ¡£µ±È»ÓÐһЩ²Ù×÷ÎÒÃÇÊÇÏ£ÍûËüÄÜ×Ô¶¯ÔËÐеġ£ ¿ÉÑ¡ÔñÖ´ ORACLE ¹ÜÀíÆ÷Öеġ® ÐУºÓà PROBE¡¯Ê¼þÀ´²é¿´ B£®²éÕÒеľ¯¸æÈÕÖ¾Îļþ 1. Áª½Óÿһ¸ö²Ù×÷¹ÜÀíϵͳ 2. ʹÓá® TELNET¡¯»òÊǿɱȽϳÌÐò 3. ¶Ôÿһ¸ö¹ÜÀíʵÀý£¬¾-³£µÄÖ´ÐÐ $ORACLE_BASE/<SID>/bdump ²Ù ×÷£¬²¢Ê¹ÆäÄÜ»ØÍ˵½¿ØÖÆÊý¾Ý¿âµÄ SID¡£ 4. ÔÚÌáʾÏ£¬Ê¹Óà UNIX Öеġ® TAIL¡¯ÃüÁî²é¿´ alert_<SID>.log£¬»òÊÇ ÓÃÆäËû·½Ê½¼ì²éÎļþÖÐ×î½üʱÆڵľ¯¸æÈÕÖ¾ 5. Èç¹ûÒÔÇ°³öÏÖ¹ýµÄһЩ ORA_ERRORS ÓÖ³öÏÖ£¬½«Ëü¼Ç¼µ½Êý¾Ý¿â »Ö¸´ÈÕÖ¾Öв¢ÇÒ×ÐϸµÄÑо¿ËüÃÇ£¬Õâ¸öÊý¾Ý¿â»Ö¸´ÈÕÖ¾ÔÚ¡´ FILE¡µÖÐ C£®²é¿´ DBSNMP µÄÔËÐÐÇé¿ö ¼ì²éÿ¸ö±»¹ÜÀí»úÆ÷µÄ¡® DBSNMP¡¯½ø³Ì²¢½«ËüÃǼǼµ½ÈÕÖ¾ÖС£ ÔÚUNIX ÖУ¬ÔÚÃüÁîÐÐÖУ¬¼üÈë ps –ef | grep dbsnmp,½«»Ø¿´µ½ 2 ¸ö DBSNMP ½ø³ÌÔÚÔËÐС£Èç¹ûûÓУ¬ÖØÆô DBSNMP¡£ D£®²éÊý¾Ý¿â±¸·ÝÊÇ·ñ³É¹¦ E£®¼ì²é±¸·ÝµÄ´Å´øÎĵµÊÇ·ñ³É¹¦ F£®¼ì²é¶ÔºÏÀíµÄÐÔÄÜÀ´ËµÊÇ·ñÓÐ×ã¹»µÄ×ÊÔ´ 1. ¼ì²éÔÚ±í¿Õ¼äÖÐÓÐûÓÐÊ£Óà¿Õ¼ä¡£ ¶Ôÿһ¸öʵÀýÀ´Ëµ£¬¼ì²éÔÚ±í¿Õ¼äÖÐÊÇ·ñ´æÔÚÓÐÊ£Óà¿Õ¼äÀ´ µÄÔ¤ÆÚµÄÐèÒª¡£µ±Êý¾Ý¿âÖÐÒÑÓеÄÊý¾ÝÊÇÎȶ¨µÄ£¬Êý¾ÝÈÕÔö ÊýÒ² ÊÇ¿ÉÒÔ¼ÆËã³öÀ´£¬×îСµÄÊ£Óà¿Õ¼äÖÁÉÙÒªÄÜÂú×ãÿÌìÊ ³¤¡£ A£©ÔËÐС®FREE.SQL¡¯À´¼ì²é±í¿Õ¼äµÄÊ£Óà¿Õ¼ä¡£ B£©ÔËÐС®SPACE.SQL¡¯À´¼ì²é±í¿Õ¼äÖеÄÊ£Óà¿Õ¼ä°Ù·ÖÂÊ 2. ¼ì²é»Ø¹ö¶Î »Ø¹ö¶ÎµÄ״̬һ°ãÊÇÔÚÏߵģ¬³ýÁËһЩΪ¸´ÔÓ¹¤×÷×¼±¸ ¶Î£¬ËüÒ»°ã״̬ÊÇÀëÏߵġ£ a) ÿ¸öÊý¾Ý¿â¶¼ÓÐÒ»¸ö»Ø¹ö¶ÎÃû×ÖµÄÁÐ±í¡£ b) Äã¿ÉÒÔÓÃV$ROLLSTAT À´²éѯÔÚÏß»òÊÇÀëÏߵĻعö¶ÎµÄÏÖÔÚ×´ ̬ . c) ¶ Ô Ó Ú Ë ù Ó Ð » Ø ¹ ö ¶ Î µ Ä ´ æ ´ ¢ ² Î Ê ý ¼ ° à û DBA_ROLLBACK_SEGS À´²éѯ¡£µ«ÊÇËü²»Èç V$ROLLSTAT ׼ȷ¡£ 3. ʶ±ð³öһЩ¹ý·ÖµÄ Ôö³¤ ²é¿´Êý¾Ý¿âÖг¬³ö×ÊÔ´»òÊÇÔö³¤Ëٶȹý´óµÄ¶Î£¬ÕâЩ¶Îµ ÊýÐèÒªµ÷Õû¡£ a£© Õ ¼ ¯ È Õ Ê ý ¾ Ý ´ ó Ð ¡ µ Ä Ð Å Ï ¢ £ ¬ Ê ¡®ANALYZE5PCT.SQL¡¡Èç¹ûÄãÊÕ¼¯µÄÊÇÿÍíµÄÐÅÏ¢£¬ ¯£ Ôò¿ÉÌø¹ýÕâÒ»²½¡£ b£©¼ì²éµ±Ç°µÄ·¶Î§£¬¿ÉÓá® NR.EXTENTS.SQL¡£ ¯¡ HOME: http://www.itpub.net MAIL: epub@itpub.net
  23. 23. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí c£© ²éѯµ±Ç°±íµÄ´óСÐÅÏ¢¡£ d£© ²éѯµ±Ç°Ë÷Òý´óСµÄÐÅÏ¢¡£ e£© ²éѯÔö³¤Ç÷ÊÆ¡£ 4. È·¶¨¿Õ¼äµÄ·¶Î§¡£ Èç¹û·¶Î§¿Õ¼ä¶ÔÏóµÄNEXT_EXTENT ±È±í¿Õ¼äËùÄÜÌṩµÄ×î´ó·¶ Χ»¹Òª´ó£¬ÄÇôÕ⽫ӰÏìÊý¾Ý¿âµÄÔËÐС£Èç¹ûÎÒÃÇÕÒµ½ÁËÕâ¸ö ÒÔÓá® ALTER TABLESPACE COALESCE¡¯µ÷²éËüµÄλÖ㬻ò¼ÓÁíÍâ µÄÊý¾ÝÎļþ¡£ A£©ÔËÐС® SPACEBOUND.SQL¡ ¯ ¡£Èç¹û¶¼ÊÇÕý³£µÄ£¬½«²»·µ»ØÈκÎÐС£ 5. »Ø¹ËPU£¬Äڴ棬ÍøÂ磬Ӳ¼þ×ÊÔ´ÂÛµãµÄ¹ý³Ì C A£©¼ì²éPU µÄÀûÓÃÇé¿ö£ C ¬x:webphase2default.htm =>system ½øµ½ metrics=>CPU ÀûÓÃÒ³£¬ µÄ×î´óÏÞ¶ÈΪ CPU µÄÕ¼Óñ£³Ö CPU 400£¬µ± ÔÚ350 ÒÔÉÏÓÐÒ»¶Îʱ¼äµÄ»°£¬ÎÒÃǾÍÐèÒª²é¿´¼°Ñо¿³öÏÖµÄÎÊ G£®½«´æµµÈÕÖ¾¸´ÖƵ½±¸ÓÃÊý¾Ý¿âÖÐ Èç¹ûÓÐÒ»¸ö±¸ÓÃÊý¾Ý¿â£½«Êʵ±µÄ´æµµÈÕÖ¾¸´ÖƵ½±¸ÓÃÊý¾Ý¿ ¬ λÖ㬱¸ÓÃÊý¾Ý¿âÖб£´æ×î½üÆÚµÄÊý¾Ý¡£ F. ¾-³£²éÔÄ Óû§ÊÖ²á DBA Èç¹ûÓпÉÄܵĻ°£¬Òª¹ã·ºµÄÔĶÁ£¬°üÀ¨ DBA ÊֲᣬÐÐÒµÔÓÖ¾£¬ÐÂÎÅ ×é»òÊÇÓʼþÁÐ±í¡£ ¶þ£®Íí¼äά»¤¹ý³Ì ´ó²¿·ÖµÄÊý¾Ý¿â²úÆ·½«ÊÜÒæÓÚÿÍíÈ·¶¨µÄ¼ì²é½ø³ÌµÄÔËÐС£ A. ÊÕ¼¯OLUMETRIC Êý¾Ý V 1. ·ÖÎö¼Æ»®ºÍÊÕ¼¯Êý¾Ý ¸ü׼ȷµÄ·ÖÎö¼ÆËã²¢±£´æ½á¹û¡£ a£©Èç¹ûÄãÏÖÔÚûÓÐ×÷ÕâЩµÄ»°£¬Óá® MK VOLFACT. SQL¡¯À´´´½¨²â¶¨Ìå»ýµÄ ±í¡£ b£©ÊÕ¼¯Íí¼äÊý¾Ý´óСµÄÐÅÏ¢£¬Óá® ANALYZE COMP.SQL¡£ ¯¡ c£©ÊÕ¼¯Í³¼Æ½á¹û£¬Óá® POP VOL.SQL¡£ ¯¡ d£©ÔÚ¿ÕÏеÄʱºò¼ì²éÊý¾Ý£¬¿ÉÄܵĻ°£¬Ã¿ÖÜ»òÿ¸öÔ½øÐС£ ÎÒÊÇÓà EXCEL ºÍ MS ODBC µÄÁª½ÓÀ´¼ì²éÊý¾ÝºÍͼ±íµÄÔö³¤ Èý£®Ã¿ÖÜά»¤¹ý³Ì A£® ²éÕÒ±»ÆÆ»µµÄÄ¿±ê 1. ¶ÔÓÚÿ¸ö¸ø¶¨±í¿Õ¼äµÄ¶ÔÏóÀ´Ëµ£¬ µÄ´óСÊÇÏàͬµÄ£¬Èç NEXT_EXTENT 12/14/98£ ¬ ȱʡµÄ NEXT_EXTENT µÄ DATAHI Ϊ 1G£¬DATALO Ϊ 500MB£¬ INDEXES Ϊ 256MB¡£ A£© ¼ì²éEXT_EXTENT µÄÉèÖ㬿ÉÓá® N NEXTEXT¡£ SQL¡£ ¯¡ B£© ¼ì²éÒÑÓÐµÄ EXTENTS£¬¿ÉÓá® EXISTEXT¡£ SQL¡£ ¯¡ 2. ËùÓÐµÄ±í¶¼Ó¦¸ÃÓÐΨһµÄÖ÷¼ü a£© ²é¿´ÄÇЩ±íûÓÐÖ÷¼ü£¬¿ÉÓᮣNO_PK.SQL¡ ¯ ¡ b£© ²éÕÒÄÇЩÖ÷¼üÊÇûÓз¢»Ó×÷Óõģ¬¿ÉÓá®DIS_PK.SQL¡£ ¯ ¡ c£© ËùÓÐ×÷Ë÷ÒýµÄÖ÷¼ü¶¼ÒªÊÇΨһµÄ£¬¿ÉÓá®NONUPK¡£ SQL¡¯À´¼ì ²é¡£ 3. ËùÓеÄË÷Òý¶¼Òª·Åµ½Ë÷Òý±í¿Õ¼äÖС£ÔËÐС® MKREBUILD_IDX¡£ SQL¡¯ 4. ²»Í¬µÄ»·¾³Ö®¼äµÄ¼Æ»®Ó¦¸ÃÊÇͬÑùµÄ£¬ÌرðÊDzâÊÔ»·¾³ºÍ³ÉÆ·» HOME: http://www.itpub.net MAIL: epub@itpub.net
  24. 24. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí ¼Æ»®Ó¦¸ÃÏàͬ¡£ a£© ì ² é ² » Í 2 µ Ä Ô Ë Ð Ð » · ¾ ³ Ö Ð µ Ä Ê ý Ê Ç · ñ Ò » Ö Â £ ¬ ¿ É Ó Ã ¼ ¬ ¸ö ¾ÝÀàÐÍ ¡®DATATYPE.SQL¡£ ¯ ¡ b£© ÔÚ 2 ¸ ö ² » Í ¬ µ Ä Ê µ À ý Ö Ð Ñ ° Õ Ò ¶ Ô Ï ó µ Ä ² » Í ¬ µ ã ¡®OBJ_COORD.SQL¡£ ¯ ¡ c£© ¸üºÃµÄ×ö·¨ÊÇ£¬Ê¹ÓÃÒ»ÖÖ¹¤¾ß£¬ÏóÑ°ÇóÈí¼þµÄ¼Æ»®¹ÜÀíÆ ¹¤¾ß¡£ B£® ²é¿´ÊÇ·ñÓÐΣº¦µ½°²È«²ßÂÔµÄÎÊÌâ¡£ C£® ²é¿´±¨´íµÄ SQL*NET ÈÕÖ¾¡£ 1. ¿Í»§¶ËµÄÈÕÖ¾¡£ 2. ·þÎñÆ÷¶ËµÄÈÕÖ¾¡£ D£®.½«ËùÓеľ¯¸æÈÕÖ¾´æµµ E£®.¹©Ó¦É̵ÄÖ÷Ò³ 1. ORACLE ¹©Ó¦ÉÌ http://www.oracle.com http://technet.oracle.com http://www.oracle.com/support http://www.oramag.com 2. Quest Software http://www.quests.com 3. Sun Microsystems http://www.sun.com ËÄ£®ÔÂά»¤¹ý³Ì A£®²é¿´¶ÔÊý¾Ý¿â»á²úÉúΣº¦µÄÔö³¤ËÙ¶È 1. ´ÓÒÔÇ°µÄ¼Ç¼»ò±¨¸æÖлع˶ÎÔö³¤µÄ±ä»¯ÒÔ´ËÀ´È·¶¨¶ÎÔö³¤´ø B£® »Ø¹ËÒÔÇ°Êý¾Ý¿âÓÅ»¯ÐÔÄܵĵ÷Õû 1. »Ø¹ËÒ»°ã ORACLE Êý¾Ý¿âµÄµ÷Õûµã£¬±È½ÏÒÔÇ°µÄ±¨¸æÀ´È·¶¨Óк¦µÄ· Ç÷ÊÆ¡£ C£® ²é¿´ µÄÆÁ¾±ÎÊÌâ I/O 1. ²é¿´Ç°ÆÚÊý¾Ý¿âÎļþ µÄ»î¶¯ÐÔ£¬±È½ÏÒÔÇ°µÄÊä³öÀ´ÅжÏÓпÉÄܵ¼ÖÂÆ ÎÊÌâµÄÇ÷ÊÆ¡£ D£® »Ø¹Ë FRAGMENTATION E£® ¼Æ»®Êý¾Ý¿â½«À´µÄÐÔÄÜ 1. ±È½Ï ORACLE ºÍ²Ù×÷ϵͳµÄ CPU£¬Äڴ棬ÍøÂ磬¼°Ó²Å̵ÄÀûÓÃÂÊÒÔ´Ë À´È·¶¨ÔÚ½üÆÚ½«»áÓеÄһЩ×ÊÔ´Õù¶áµÄÇ÷ÊÆ 2. µ±ÏµÍ³½«³¬³ö·¶Î§Ê±Òª°ÑÐÔÄÜÇ÷ÊƵ±×÷·þÎñˮƽµÄÐ-ÒéÀ´¿´ F£® Íê³Éµ÷ÕûºÍά»¤¹¤×÷ 1.ʹÐÞ¸ÄÂú×ã±ÜÃâϵͳ×ÊÔ´µÄÕù¶áµÄÐèÒª£¬ÕâÀïÃæ°üÀ¨Ôö¼ÓÐÂ×Ê µÄÍ£¹¤¡£ Î壮¸½Â¼ A. ÈÕ³£³ÌÐò HOME: http://www.itpub.net MAIL: epub@itpub.net
  25. 25. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí -- -- free.sql -- --To verify free space in tablespaces --Minimum amount of free space --document your thresholds: --<tablespace_name> = <amount> m -- SELECT tablespace_name, sum ( blocks ) as free_blk , trunc ( sum ( bytes ) / (1024*1024) ) as free_m, max ( bytes ) / (1024) as big_chunk_k, count (*) as num_chunks FROM dba_free_space GROUP BY tablespace_name 1. Space.sql -- -- space.sql -- -- To check free, pct_free, and allocated space within a tablespace -- -- 11/24/98 SELECT tablespace_name, largest_free_chunk , nr_free_chunks, sum_alloc_blocks, sum_free_blocks , to_char(100*sum_free_blocks/sum_alloc_blocks, '09.99') || '%' AS pct_free FROM ( SELECT tablespace_name , sum(blocks) AS sum_alloc_blocks FROM dba_data_files GROUP BY tablespace_name ) , ( SELECT tablespace_name AS fs_ts_name , max(blocks) AS largest_free_chunk , count(blocks) AS nr_free_chunks , sum(blocks) AS sum_free_blocks FROM dba_free_space GROUP BY tablespace_name ) WHERE tablespace_name = fs_ts_name 2. analyze5pct.sql -- -- analyze5pct.sql -- -- To analyze tables and indexes quickly, using a 5% sample size -- (do not use this script if you are performing the overnight HOME: http://www.itpub.net MAIL: epub@itpub.net
  26. 26. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí -- collection of volumetric data) -- -- 11/30/98 BEGIN dbms_utility.analyze_schema ( '&OWNER', 'ESTIMATE', NULL, 5 ) ; END ; / 3. nr_extents.sql -- -- nr_extents.sql -- -- To find out any object reaching <threshold> -- extents, and manually upgrade it to allow unlimited -- max_extents (thus only objects we *expect* to be big -- are allowed to become big) -- -- 11/30/98 SELECT e.owner, e.segment_type , e.segment_name , count(*) as nr_extents , s.max_extents , to_char ( sum ( e.bytes ) / ( 1024 * 1024 ) , '999,999.90') as MB FROM dba_extents e , dba_segments s WHERE e.segment_name = s.segment_name GROUP BY e.owner, e.segment_type , e.segment_name , s.max_extents HAVING count(*) > &THRESHOLD OR ( ( s.max_extents - count(*) ) < &&THRESHOLD ) ORDER BY count(*) desc 4. spacebound.sql -- -- spacebound.sql -- -- To identify space-bound objects. If all is well, no rows are returned. -- If any space-bound objects are found, look at value of NEXT extent -- size to figure out what happened. -- Then use coalesce (alter tablespace <foo> coalesce;). -- Lastly, add another datafile to the tablespace if needed. -- -- 11/30/98 SELECT a.table_name, a.next_extent, a.tablespace_name FROM all_tables a, ( SELECT tablespace_name, max(bytes) as big_chunk HOME: http://www.itpub.net MAIL: epub@itpub.net
  27. 27. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí FROM dba_free_space GROUP BY tablespace_name ) f WHERE f.tablespace_name = a.tablespace_name AND a.next_extent > f.big_chunk B. ÿÍí´¦Àí³ÌÐò 1. mk_volfact.sql -- -- mk_volfact.sql (only run this once to set it up; do not run it nightly!) -- -- -- Table UTL_VOL_FACTS CREATE TABLE utl_vol_facts ( table_name VARCHAR2(30), num_rows NUMBER, meas_dt DATE ) TABLESPACE platab STORAGE ( INITIAL 128k NEXT 128k PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS unlimited ) / -- Public Synonym CREATE PUBLIC SYNONYM utl_vol_facts FOR &OWNER..utl_vol_facts / -- Grants for UTL_VOL_FACTS GRANT SELECT ON utl_vol_facts TO public / 2. analyze_comp.sql -- -- analyze_comp.sql -- BEGIN HOME: http://www.itpub.net MAIL: epub@itpub.net
  28. 28. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí sys.dbms_utility.analyze_schema ( '&OWNER','COMPUTE'); END ; / 3. pop_vol.sql -- -- pop_vol.sql -- insert into utl_vol_facts select table_name , NVL ( num_rows, 0) as num_rows , trunc ( last_analyzed ) as meas_dt from all_tables -- or just user_tables where owner in ('&OWNER') -- or a comma-separated list of owners / commit / C. ÿÖÜ´¦Àí³ÌÐò 1. nextext.sql -- -- nextext.sql -- -- To find tables that don't match the tablespace default for NEXT extent. -- The implicit rule here is that every table in a given tablespace should -- use the exact same value for NEXT, which should also be the tablespace's -- default value for NEXT. -- -- This tells us what the setting for NEXT is for these objects today. -- -- 11/30/98 SELECT segment_name, segment_type, ds.next_extent as Actual_Next , dt.tablespace_name, dt.next_extent as Default_Next FROM dba_tablespaces dt, dba_segments ds WHERE dt.tablespace_name = ds.tablespace_name AND dt.next_extent !=ds.next_extent AND ds.owner = UPPER ( '&OWNER' ) ORDER BY tablespace_name, segment_type, segment_name 2. existext.sql -- -- existext.sql -- HOME: http://www.itpub.net MAIL: epub@itpub.net
  29. 29. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí -- To check existing extents -- -- This tells us how many of each object's extents differ in size from -- the tablespace's default size. If this report shows a lot of different -- sized extents, your free space is likely to become fragmented. If so, -- this tablespace is a candidate for reorganizing. -- -- 12/15/98 SELECT segment_name, segment_type , count(*) as nr_exts , sum ( DECODE ( dx.bytes,dt.next_extent,0,1) ) as nr_illsized_exts , dt.tablespace_name, dt.next_extent as dflt_ext_size FROM dba_tablespaces dt, dba_extents dx WHERE dt.tablespace_name = dx.tablespace_name AND dx.owner = '&OWNER' GROUP BY segment_name, segment_type, dt.tablespace_name, dt.next_extent 3. No_pk.sql -- -- no_pk.sql -- -- To find tables without PK constraint -- -- 11/2/98 SELECT table_name FROM all_tables WHERE owner = '&OWNER' MINUS SELECT table_name FROM all_constraints WHERE owner = '&&OWNER' AND constraint_type = 'P' 4. disPK.sql -- -- disPK.sql -- -- To find out which primary keys are disabled -- -- 11/30/98 HOME: http://www.itpub.net MAIL: epub@itpub.net
  30. 30. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí SELECT owner, constraint_name, table_name, status FROM all_constraints WHERE owner = '&OWNER' AND status = 'DISABLED’ AND constraint_type = 'P' 5. nonuPK.sql -- -- nonuPK.sql -- -- To find tables with nonunique PK indexes. Requires that PK names -- follow a naming convention. An alternative query follows that -- does not have this requirement, but runs more slowly. -- -- 11/2/98 SELECT index_name, table_name, uniqueness FROM all_indexes WHERE index_name like '&PKNAME%' AND owner = '&OWNER' AND uniqueness = 'NONUNIQUE' SELECT c.constraint_name, i.tablespace_name, i.uniqueness FROM all_constraints c , all_indexes i WHERE c.owner = UPPER ( '&OWNER' ) AND i.uniqueness = 'NONUNIQUE' AND c.constraint_type = 'P' AND i.index_name = c.constraint_name 6. mkrebuild_idx.sql -- -- mkrebuild_idx.sql -- -- Rebuild indexes to have correct storage parameters -- -- 11/2/98 SELECT 'alter index ' || index_name || ' rebuild ' , 'tablespace INDEXES storage ' || ' ( initial 256 K next 256 K pctincrease 0 ) ; ' FROM all_indexes WHERE ( tablespace_name != 'INDEXES' OR next_extent != ( 256 * 1024 ) ) AND owner = '&OWNER' / 7. datatype.sql HOME: http://www.itpub.net MAIL: epub@itpub.net
  31. 31. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí -- -- datatype.sql -- -- To check datatype consistency between two environments -- -- 11/30/98 SELECT table_name, column_name, data_type, data_length, data_precision, data_scale, nullable FROM all_tab_columns -- first environment WHERE owner = '&OWNER' MINUS SELECT table_name, column_name, data_type, data_length, data_precision, data_scale, nullable FROM all_tab_columns@&my_db_link -- second environment WHERE owner = '&OWNER2' order by table_name, column_name 8. obj_coord.sql -- -- obj_coord.sql -- -- To find out any difference in objects between two instances -- -- 12/08/98 SELECT object_name, object_type FROM user_objects MINUS SELECT object_name, object_type FROM user_objects@&my_db_link HOME: http://www.itpub.net MAIL: epub@itpub.net
  32. 32. ITPUB µç×ÓÔÓÖ¾ Oracle DBA ÈÕ³£¹ÜÀí Áù ²Î¿¼ÎÄÏ× . 1. Loney, Kevin Oracle8 DBA Handbook 2. Cook, David Database Management from Crisis to Confidence [http://www.orapub.com/] 3. Cox, Thomas B. The Database Administration Maturity Model HOME: http://www.itpub.net MAIL: epub@itpub.net
  33. 33. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý ¹ØÓÚ oracle Öдó¶ÔÏó£¨ lob£©´¦ÀíµÄһЩ·½·¨ºÍʵÀý ÕûÀí£ºÀ¶´øÓã ²ÎÓëÌÖÂÛ£ºÀ¶´øÓ㣬 jlandzpa£¬ coolsword£¬ zl_king£¬ youngcow£¬ flytiger ÔÚ oracle ÖУ¬ÓÐ 4 ¸ö´ó¶ÔÏó£¨ lobs£©ÀàÐÍ¿ÉÓ㬷ֱðÊÇ blob,clob,bfile,nclob¡£ ÏÂÃæÊǶÔÊý¾ÝÀàÐ͵ļòµ¥½éÉÜ£º lob blob:¶þ½øÖÆ lob£¬Îª¶þ½øÖÆÊý¾Ý£¬×¿É´ï 4GB£¬´æÖüÔÚÊý¾Ý¿âÖС£ clob:×Ö·û lob,×Ö·ûÊý¾Ý ,×¿ÉÒÔ´ïµ½ 4GB,´æÖüÔÚÊý¾Ý¿âÖС£ bfile:¶þ½øÖÆÎļþ ;´æÖüÔÚÊý¾Ý¿âÖ®ÍâµÄÖ»¶ÁÐͶþ ½øÖÆÊý¾Ý£¬×î´ó³¤¶ÈÓɲÙ×÷ϵͳÏÞ ÖÆ¡£ nclob£ºÖ§³Ö¶Ô×Ö½Ú×Ö·û¼¯ºÏ (nultibyte characterset)µÄÒ»¸ö ÁС£ clob ¶ÔÓÚÈçºÎ¼ìË÷ºÍ²Ù×÷ÕâЩ lob Êý¾ÝÒ»Ö±ÊÇ Êý¾Ý¿â¿ª·¢Õß¾-³£Åöµ½µÄÎÊÌâ¡ oracle £ ÏÂÃæÎÒ ½«ÔÚracle ¶Ô Êý¾Ý´¦ÀíµÄһЩ·½·¨ºÍ¼¼ÇÉ£¬½éÉܸø¶ÁÕߣ¬Ï£ÍûÄܹ»¶Ô¶ÁÕßÒÔº o lob Ëù°ïÖú¡£ oracle ÖпÉÒÔÓöàÖÖ·½·¨À´¼ìË÷»ò²Ù×÷ lob Êý¾Ý¡ £Í¨³£µÄ´¦Àí·½·¨ÊÇͨ¹ý dbms_lob °ü¡£ ÆäËûµÄ·½·¨°üÀ¨Ê¹Óà api(application programming interfaces)Ó¦ÓÃ³Ì Ðò½Ó¿ÚºÍ oracle oci£¨ call interface£© oracle µ÷ÓýӿڳÌÐò¡£ Ò» ¡¢ÔÚ oracle ¿ª·¢»·¾³ÖÐÎÒÃÇ¿ÉÒÔÓà °üÀ´´¦Àí£¡ dbms_lob dbms_lob °ü¹¦ÄÜÇ¿´ó£¬¼ò µ¥Ó¦Ó᣼ȿÉÒÔÓÃÀ´¶ÁÈ¡ÄÚ²¿µÄ lob ¶ÔÏó£¬Ò²¿ÉÒÔÓÃÀ´´¦Àí bfile ¶ÔÏó¡£µ«´¦ÀíÁ½ÕßÖ®¼ä£¬ »¹ÓÐÒ»µã²î±ð¡£´¦ÀíÄÚ²¿ lob ¶ÔÏó£¨ blob,clob£©Ê±£¬¿ÉÒÔ½øÐжÁºÍд£¬µ«´¦ÀíÍⲿ lob ¶ÔÏó bfile ʱ£¬Ö»ÄܽøÐжÁ²Ù×÷£¬Ð´µÄ²Ù×÷¿ÉÒÔÓà sql Ò²¿ÉÒÔ´¦Àípl/sql ´¦Àí¡£ÁíÍâÓà lob£¬µ«Òª ×¢Òâ ½ö¿ÉÒÔ´¦ÀíÕû¸ö sql lob£¬²»ÄܲÙ×÷ lob µÄÊý¾ÝƬ ¡£ ÔÚ dbms_lob °üÖÐÄÚ½¨ÁË read(),append,write()£¬ erase()£¬ copy(),getlength()£¬ substr() µÈº¯Êý£¬¿ÉÒԺܷ½±ãµØ²Ù×÷ lob ¶ÔÏó¡£ÕâÀï²»×öÉîÈëÌÖÂÛ£¬¶ÁÕß¿ÉÒԲο´Ïà¹ØµÄÊé¼® ¶ÔÓÚl/sql£¬ÏÂÃæ½éÉÜÒ»ÖÖ¼¼ÇÉ£¬Óö¯Ì¬µÄ clob ¶ÔÏóÀ´´«Ìæ±íÃû£¡ p pl/sql Óï¾ä´¦Àí example 1. ¶¯Ì¬ PL/SQL,¶Ô CLOB ×ֶβÙ×÷¿É´«µÝ±íÃû ¬ table_name£ ±íµÄΨһ±êÖ¾×Ö¶ÎÃû field_id£¬ clob ×Ö¶ÎÃû field_name ¼Ç¼ºÅ ¬ v_id£ ¿ªÊ¼´¦Àí×Ö·ûµÄλÖà v_pos£ ¬´«ÈëµÄ×Ö·û´®±äÁ¿ v_clob ÐÞ¸ÄLOB µÄ C PL/SQL ¹ý³Ì£º updateclob create or replace procedure updateclob( table_name in varchar2, field_id in varchar2, field_name in varchar2, v_id in number, v_pos in number, v_clob in varchar2) is lobloc clob; c_clob varchar2(32767); amt binary_integer; pos binary_integer; query_str varchar2(1000); begin pos:=v_pos*32766+1; HOME: http://www.itpub.net MAIL: epub@itpub.net
  34. 34. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý amt := length(v_clob); c_clob:=v_clob; query_str :='select '||field_name||' from '||table_name||' where '||field_id||'= :id for update '; --initialize buffer with data to be inserted or updated EXECUTE IMMEDIATE query_str INTO lobloc USING v_id; --from pos position, write 32766 varchar2 into lobloc dbms_lob.write(lobloc, amt, pos, c_clob); commit; exception when others then rollback; end; /Ó÷¨ËµÃ÷£º ÔÚ²åÈë»òÐÞ¸ÄÒÔÇ°£¬ÏÈ°ÑÆäËü×ֶβåÈë»òÐ޸ģ¬ CLOB ×Ö¶ÎÉèÖÃΪ¿Õ empty_clob()£¬ È»ºóµ÷ÓÃÒÔÉϵĹý³Ì²åÈë´óÓÚ ¸ö×Ö·û¡£ 2048 µ½ 32766 Èç¹ûÐèÒª²åÈë´óÓÚ 32767 ¸ö×Ö·û£¬±àÒ»¸öÑ-»·¼´¿É½â¾öÎÊÌâ¡£ ²éѯLOB µÄ C PL/SQL º¯Êý£º getclob create or replace function getclob( table_name in varchar2, field_id in varchar2, field_name in varchar2, v_id in number, v_pos in number) return varchar2 is lobloc clob; buffer varchar2(32767); amount number := 2000; offset number := 1; query_str varchar2(1000); begin query_str :='select '||field_name||' from '||table_name||' where '||field_id||'= :id '; --initialize buffer with data to be found EXECUTE IMMEDIATE query_str INTO lobloc USING v_id; offset:=offset+(v_pos-1)*2000; --read 2000 varchar2 from the buffer dbms_lob.read(lobloc,amount,offset,buffer); return buffer; exception when no_data_found then return buffer; end; Ó÷¨ËµÃ÷£º Óà select getclob(table_name,field_id,field_name,v_id,v_pos) as partstr from dual; HOME: http://www.itpub.net MAIL: epub@itpub.net
  35. 35. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý ¿ÉÒÔ´Ó LOB ×Ö¶ÎÖÐÈ¡ C 2000 ¸ö×Ö·ûµ½ partstr ÖУ¬±àÒ»¸öÑ-»·¿ÉÒÔ°Ñ partstr ×éºÏ³É dbms_lob.getlength(field_name)³¤¶ÈµÄÄ¿±ê×Ö·û´®¡£ ¶þ¡¢¶ÔÓÚÔÚÆäËû²»Í¬µÄ¿ª·¢»·¾³£¬ÀýÈç vc,vb,pb,java µÈ»·¾³ÏÂ¶Ô lob µÄ´¦Àí£¬´¦Àí·½ ·¨²»¾¡Ïàͬ£¬ÔÚÕâÀォ¼òÒª¾Ù¼¸¸öÀý×ÓÀ´ËµÃ÷²»ÔÚ µÄ´¦Àí¡£ oracle ¿ª·¢»·¾³ÏÂ¶Ô lob £¨Ò»£©ÔÚ pb ÖеĴ¦Àí exampler 2. string ls_path,ls_filename,ls_jhdh long ll_num,ll_count,rtn blob ole_blob ll_num=dw_lb.getrow() if ll_num>0 then ls_jhdh=dw_lb.object.ct_njhdh[ll_num] select count(*) into :ll_count from sj_jh_jhfjb where ct_jhdlxbh='1' and ct_jhdh=:ls_jhdh and ct_jdlxbh=:is_jdlx; if ll_count>0 then rtn=messagebox("Ìáʾ ","ÊÇ·ñÒªÐ޸Ĵ˸½¼þ ",question!,yesno!,1) if rtn=1 then SELECTBLOB ct_jhfjnr INTO le_blob from sj_jh_jhfjb where ct_jhdlxbh='1' and ct_jhdh=:ls_jhdh and ct_jdlxbh=:is_jdlx; ole_1.objectdata =ole_blob If ole_1.activate(offsite!) <> 0 Then Messagebox("OLE Activate","²»Äܼ¤»î ") Return -1 end If end if else messagebox("Ìáʾ ","ûÓи½¼þ ") end if end if £¨¶þ£©ÔÚ vb ÖеĴ¦Àí ÔÚ Öд¦Àí´ó¶ÔÏó£¬Ò»°ã¿ÉÒÔÓà objects for ole)À´´¦Àí´ó¶ÔÏó¡£ÕâÀï½é vb OO4O(oracle ÉÜÒ»ÖÖ²»Óà ´¦Àí´ó¶ÔÏóµÄ·½·¨¡£ 0040 blob ÏÂÃæÕâ¶Î³ÌÐò¿ÉÒÔ½«Ò»¸öÎļþ£¨Îı¾Îļþ£¬ doc Îļþ£¬Í¼ÏóÎļþµÈ£©±£´æµ½Êý¾Ý¿âÖУ¬ ²¢¿ÉÒÔ½«Æä´ÓÊý¾Ý¿â¶Á³ö ÐèÒªÁ½¸ö commandbutton cmd1 Ãû³Æ cmdsave caption ±£´æ cmd2 Ãû³Æ cmdread caption ¶ÁÈ¡ Ò»¸ö cmddialog ¿Ø¼þ ͬʱÐèÒª´´½¨Ò»Õűí t_demo(×ֶΠÀàÐÍ id number,;×ֶΠÀàÐÍ text blob;) exmple 3. Option Explicit Dim rn As ADODB.Connection Public Function CreateDataSource(DataSource As String, UserID As String, Password As String) As Boolean HOME: http://www.itpub.net MAIL: epub@itpub.net
  36. 36. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý On Error GoTo DbConErr: Set rn = New ADODB.Connection With rn .ConnectionString = "Provider=OraOledb.Oracle.1;" & _ "password=" & Password & ";" & _ "User ID =" & UserID & ";" & _ "Data Source=" & DataSource & ";" & _ "Locale Identifier=2052" .Open End With CreateDataSource = True Exit Function DbConErr: CreateDataSource = False End Function Private Sub cmdRead_Click() Dim rs As New ADODB.Recordset rs.ActiveConnection = rn rs.LockType = adLockOptimistic rs.CursorLocation = adUseClient rs.Source = "select * from t_demo" rs.Open ComDlgDir.DialogTitle = "±£´æÎļþ " ComDlgDir.Filter = "*.*" ComDlgDir.ShowSave Call BlobToFile(rs.Fields("text"), ComDlgDir.filename) Set rs = Nothing Exit Sub Set rs = Nothing End Sub Private Sub cmdsave_Click() Dim rs As New ADODB.Recordset rs.ActiveConnection = rn rs.LockType = adLockOptimistic rs.CursorLocation = adUseClient rs.Source = "select * from t_demo" rs.Open rs.AddNew ComDlgDir.DialogTitle = "Ñ¡È¡Îļþ" ComDlgDir.ShowOpen rs.Fields("id").Value = 1 If ComDlgDir.filename <> "" Then HOME: http://www.itpub.net MAIL: epub@itpub.net
  37. 37. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý Call FileToBlob(rs.Fields("text"), ComDlgDir.filename) rs.Update End If Set rs = Nothing Exit Sub Set rs = Nothing End Sub Private Sub Form_Load() If Not CreateDataSource("sid", "systemp", "manager") Then MsgBox "Connection failure!" End If End Sub fld As ADODB.Field, filename As String, Optional ChunkSize As Long = 8192) Dim fnum As Integer, bytesleft As Long, bytes As Long Dim tmp() As Byte If (fld.Attributes And adFldLong) = 0 Then Err.Raise 1001, , "field doesn't support the GetChunk method." End If If Dir$(filename) = "" Then Err.Raise 53, , "File not found" fnum = FreeFile Open filename For Binary As fnum bytesleft = LOF(fnum) Do While bytesleft bytes = bytesleft If bytes > ChunkSize Then bytes = ChunkSize ReDim tmp(1 To bytes) As Byte Get fnum, , tmp fld.AppendChunk tmp bytesleft = bytesleft - bytes Loop Close #fnum End Sub Sub BlobToFile(fld As ADODB.Field, filename As String, Optional ChunkSize As Long = 8192) Dim fnum As Integer, bytesleft As Long, bytes As Long Dim tmp() As Byte If (fld.Attributes And adFldLong) = 0 Then Err.Raise 1001, , "field doesn't support the GetChunk method." End If If Dir$(filename) <> "" Then Kill filename fnum = FreeFile HOME: http://www.itpub.net MAIL: epub@itpub.net
  38. 38. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý Open filename For Binary As fnum bytesleft = fld.ActualSize Do While bytesleft bytes = bytesleft If bytes > ChunkSize Then bytes = ChunkSize tmp = fld.GetChunk(bytes) Put #fnum, , tmp bytesleft = bytesleft - bytes Loop Close #fnum End Sub £¨Èý£©Óà ´¦Àí jdbc lob exmple 4. Ê×ÏÈÊÇ Getting BLOB and CLOB Locators from a Result Set // Select LOB locator into standard result set. ResultSet rs =stmt.executeQuery ("SELECT blob_col, clob_col FROM lob_table"); while (rs.next()) {// Get LOB locators into Java wrapper classes. oracle.jdbc2.Blob blob = (oracle.jdbc2.Blob)rs.getObject(1); oracle.jdbc2.Clob clob = (oracle.jdbc2.Clob)rs.getObject(2); [...process...] } È»ºóÊÇ BLOB data from BLOB locator. Read InputStream byte_stream = my_blob.getBinaryStream(); byte [] byte_array = new byte [10]; int bytes_read = byte_stream.read(byte_array); ºÍ Writing BLOB Data java.io.OutputStream outstream; // read data into a byte array byte[] data = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // write the array of binary data to a BLOB outstream = ((BLOB)my_blob).getBinaryOutputStream(); outstream.write(data); »¹ÓÐassing a BLOB Locator to a Prepared Statement P OraclePreparedStatement ops = (OraclePreparedStatement)conn.prepareStatement "INSERT INTO blob_table VALUES(?)"); ops.setBLOB(1, my_blob); ops.execute(); ×îºóÓ¦¸Ã×¢Ò⣺ insert µÄʱºòÒ»¶¨ÒªÓà empty_blob()³õʼ»¯ stmt.execute ("insert into my_blob_table values ('row1', empty_blob()"); £¨ËÄ£©ÔÚ ÖеĴ¦Àí pro*c PRO*C ¿ÉÒÔÓÃÈýÖÖ·½Ê½¶Ô LOB ×ֶδ¦Àí¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  39. 39. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý 1¡¢ The DBMS_LOB package inside PL/SQL blocks. 2¡¢ OCI (Oracle Call Interface) function calls. 3¡¢ Embedded SQL statements. Embedded SQL statements.µÄ·½Ê½¼òµ¥¶øÇұȽÏÁé»î¡£ OTN ÉÏÌṩһ¸öÀý×Ó£º In this example we will be reading data from a BLOB with an unknown arbitrary length into a buffer and then writing the data from the buffer into an external file. Our buffer is small, so depending on the size of the BLOB we are reading, we may be able to read the BLOB value into the buffer in a single READ statement or we may be required to utilize a standard polling method instead. First we start off with oci.h and some simple local variable declarations example 5. #include <oci.h> OCIBlobLocator *blob ; FILE *fp ; unsigned int amt, offset = 1 ; Now we need a buffer to store the BLOB value and then write to the file from: #define MAXBUFLEN 5000 unsigned char buffer[MAXBUFLEN] ; EXEC SQL VAR buffer IS RAW(MAXBUFLEN) ; Allocate the BLOB host variable and select a BLOB which we will READ: EXEC SQL ALLOCATE :blob ; EXEC SQL SELECT a_blob INTO :blob FROM lob_table WHERE ... ; We can then open the external file to which we will write the BLOB value: fp = fopen((const char *)"image.gif", (const char *)"w") ; If the buffer can hold the entire LOB value in a single READ we need to catch the NOT FOUND condition to signal LOB READ termination: EXEC SQL WHENEVER NOT FOUND GOTO end_of_lob ; Now do our first READ.We set the amount to the maximum value of 4 Gigabytes. It is larger than our buffer so if the LOB doesn’fit we will READ using a polling t mode: amt = 4294967295 ; EXEC SQL LOB READ :amt FROM :blob AT ffset INTO :buffer ; If we get here then it means that the buffer was not large enough to hold the entire LOB value, so we must write what we have using binary I/O and continue reading: (void) fwrite((void *)buffer, (size_t)MAXBUFLEN, (size_t)1, fp) ; We use a standard polling method to continue reading with the LOB READ inside of an infinite loop. We can set up the NOT FOUND condition to terminate the loop: EXEC SQL WHENEVER NOT FOUND DO break ; while (TRUE) { During polling, the offset is not used so we can omit it in subsequent LOB READs. We need the amount, however, because it will tell us how much was READ in the last READ invocation EXEC SQL LOB READ :amt FROM :blob INTO :buffer ; HOME: http://www.itpub.net MAIL: epub@itpub.net
  40. 40. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý (void) fwrite((void *)buffer, (size_t)MAXBUFLEN, (size_t)1, fp) ; } Here, we have reached the end of the LOB value. The amount holds the amount of the last piece that was READ. During polling, the amount for each interim piece was set to MAXBUFLEN, or the maximum size of our buffer: end_of_lob: (void) fwrite((void *)buffer, (size_t)amt, (size_t)1, fp) ; £¨Î壩ÔÚ delphi ÖеĴ¦Àí ¶ÔÓÚ ×ֶζøÑÔ£¬¸öÈËÈÏΪÆäʹÓÃ±È lob long ÀàÐÍÓкܴóµÄÁé»îÐÔ£¬¶øÇÒ lob ×ֶοÉÒÔ±£´æ¸÷ ÀàµÄÊý¾Ý£¬¿ÉÒÔ±£´æͼƬ£¬´óÁ¿µÄÎÄ×Ö£¬ÏÖ¾Í clob ¸úblob Á½ÖÖÀàÐͼÓÒÔ˵Ã÷£¬ÆäÖÐ blob ±£´æͼƬÐÅÏ¢£¬ clob ±£´æ´óÁ¿ÎÄ×Ö¡£ exmple 6. Create table test_table (c_no number(1) not null, c_blob blob, c_clob clob, constraint pk_test_table primary key (c_no)); unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DBCtrls, Grids, DBGrids, DB, DBTables, ExtDlgs; type TForm1 = class(TForm) Database1: TDatabase; //ÓÃÓÚÁ¬½ÓÊý¾Ý¿â Table1: TTa ble; //»ñÈ¡±íÐÅÏ¢ DataSource1: TDataSource; DBGrid1: TDBGrid; DBMemo1: TDBMemo; //ÏÔʾ c_clob ×Ö¶ÎÄÚÈÝ DBImage1: TDBImage; //ÏÔʾ c_blob ×Ö¶ÎÄÚÈÝ Button1: TButton; //²åÈë°´Å¥ Button2: TButton; //±£´æ°´Å¥ Table1C_NO: TFloatField; //Tfiled Table1C_BLOB: TBlobField; Table1C_CLOB: TMemoField; OpenPictureDialog1: TOpenPictureDialog; //´ÓÎļþ»ñȡͼƬ OpenDialog1: TOpenDialog; //´ÓÎļþ»ñÈ¡ÎÄ×Ö procedure Button1Click(Sender: TObject); HOME: http://www.itpub.net MAIL: epub@itpub.net
  41. 41. ITPUB µç×ÓÔÓÖ¾ ¹ØÓÚ Oracle Öдó¶ÔÏó£¨ lob£© ´¦ÀíµÄһЩ·½·¨ºÍʵÀý procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin //²åÈë²Ù×÷ with Table1 do begin Insert; //½«±í״̬ÖÃΪ²åÈë״̬ if OpenPictureDialog1.Execute then //»ñµÃͼƬÐÅÏ¢ Table1C_BLOB.LoadFromFile(OpenPictureDialog1.FileName); if OpenDialog1.Execute then //»ñµÃÎÄ×ÖÐÅÏ¢ Table1C_CLOB.LoadFromFile(OpenDialog1.FileName); end; end; procedure TForm1.Button2Click(Sender: TObject); begin //Ìá½»²åÈëÄÚÈÝ try Table1.Post; except Application.MessageBox('´íÎó·¢Éú ',0); ','¾¯¸æ end; end; end. ×¢Ò⣺ openpiceturedilog Ö»ÄÜ´ò¿ª dmp,ico,wmf µÈÎļþ£¬ÊÂÏÈÐèÒª½«Í¼Æ¬Îļþ¸ñʽ±£´æ³ÉÕ ¼¸Àࣻ ÔÚÎÄ×Ö×ֶβ»´ÓÎļþ»ñµÃʱ£¬¿ÉÒÔÊÖ¶¯ÊäÈë¡£ ±¾ÀýÖ»ÊÇ¶Ô lob ×ֶεÄÒ»¸öССµÄ̽Ë÷£¬Ó÷¨²»µ±¼°Ðè¸ÄÕýÖ®´¦£¬»¹Çë¶à¶àÖ ×¢ :±¾ÆªÎÄÕ´󲿷ÖÀý×Ó¾ùÈ¡×ÔÂÛ̳£¬ÈçÓÐÇÖ·¸ÄúµÄ°æȨ£¬ÇëÀ´ÐŸæ Öª£¬ÎÒÃÇ»á×öÏàÓ¦´¦Àí¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net

×