Itpub电子杂志(第三期)

  • 724 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
724
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. ITPUB µç×ÓÔÓÖ¾ ·âÃæ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 2. ITPUB µç×ÓÔÓÖ¾ ÄÚÈݵ¼¶Á ±¾ÆÚÎÄÕÂÄÚÈݵ¼¶Á ¡¤ ý¾Ý¿â¹ÜÀí Ê Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ Ê²Ã´ÑùµÄ ²ÅÊÇÒ»¸öºÃµÄ DBA DBA£¿Ò»¸öºÃµÄ ¾¿¾¹Ó¦¸Ã×öʲô£¬²»Ó¦¸Ã×öʲô£¿ DBA ÕâƪÎÄÕ±ȽϺõĻشðÁËÕâ¸öÎÊÌâ¡£ Using 3 Linux Boxes to Setup OPS Oracle8.1.7 ²úÆ·ÔÚ Aix4.3.3 Éϵݲװ ibm ʵ¼ù³öÕæÖª¡£±¾ÆÚÍƳöÁ½ÆªÊµÕ½ÐÔµÄÎÄÕ£ºto Setup OPS ½éÉÜÁË Using 3 Linux Boxes ÓÃÈý̨ Ö÷»úÄ£ÄâÒ»¸ö linux OPS »·¾³µÄ·½·¨£» Oracle8.1.7 ²úÆ·ÔÚ Aix4.3.3 ÉÏ IBM µÄ°²×° ÔòÏêϸ½éÉÜÁËCLUSTER »·¾³Ï°²×°µÄÏêϸ²½Öè¼°×¢ÒâÊÂÏî ¡£ ¡¤Êý¾Ý¿â¿ª·¢ ORACLE µÄ¸ôÀ뼶±ð ˵ÆðÊý¾Ý¿âÖеÄÊÂÎñ (TRANSACTION) £¬´ó¼Ò¶¼²»Ä°Éú¡£µ«ÊǶÔÓÚÊý¾Ý¿âµÄ¸ôÀ뼶 (isolation level)£¬¿ÖÅÂÀí½â͸³¹µÄÈË»¹²»ÊǺܶࡣϣÍû±¾ÎÄÄÜ°ïÖúÄã¸üºÃµÄÀí½â À뼶±ðÒÔ¼°¸÷ÖÖ¸ôÀ뼶±ðµÄÏàÓ¦µÄЧ¹û¡£ oracle8i º¯Êý½éÉÜ (Ò») ¾-³£ÓÐÈËÎÊ£º 8.1.6/8.1.7 ±ÈÆð 8.1.5 ÓÐÄÄЩ¸Ä½ø£¿ÎÒ¸öÈËÈÏΪ³ýÁËÐÞÕýÁËһЩ bug Ö®Í⣬ ×¶¯ÈËÐĵÄÔöÇ¿¹¦ÄܾÍÊÇÐÂÔöµÄͳ¼Æ·ÖÎöº¯ÊýÁË¡£´Ó±¾ÆÚ¿ª ʼ£¬ jlandzpa ½«Ïò´ó¼Ò·ÖÏíËû ¶ÔÕâЩº¯ÊýµÄʹÓÃÐĵᣠoracle ÈÏÖ¤ ¡¤ Åàѵ£º Lesson 1-10 023 1Z0-023 (Architecture and Administration) ÊÇ OCP ¿¼ÊÔµÄÖصã /Äѵ㣬ҲÊÇÒ»¸öºÏ¸ñµÄ DBA ±ØÐëÊìÁ·ÕÆÎÕµÄÄÚÈÝ¡£±¾ÆÚÔÝʱ¸éÖÃһϠµÄÖص㡣 001£¬Îª´ó¼Ò½éÉÜ 023 ¡¤ÆóÒµÐÅÏ¢»¯ BAAN ϵͳµÄ²úÆ·ÅäÖà ¹«Ë¾µÄ¾ºÕùÁ¦Ô½À´Ô½ÌåÏÖÔÚËûÄܲ»ÄÜÔÚ×î¶ÌµÄʱ¼äÄÚÉú²ú³ö·ûºÏ¿Í»§Òª ˾µÄ²úÆ·ÐòÁÐÖÐÒ²½«³öÏÖÔ½À´Ô½¶àµÄ¡°±ê×¼²úÆ·¡±µÄ±äÖÖ -----¼´Õë¶Ô²»Í¬¿Í »§×öÊʵ±µÄÐ޸ġ£ ±¾ÎÄΪ´ó¼Ò½éÉÜÁËBAAN ϵͳµÄ²úÆ·ÅäÖà ( PCF: Product Configuration£©Ä£¿é¡£ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (2) ±¾ÆÚ¼ÌÐøÓÉ Kevon_zengÏò´ó¼Ò½éÉÜÔÚʹÓà Oracle Applications 11iʱµÄһЩ¾-Ñé¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 3. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM Oracle8.1.7 ²úÆ·ÔÚ Aix4.3.3 Éϵݲװ ibm ×÷Õߣ £ º¨ *¼û¸½×¢£© 1. ϵͳ¸Å¿ö Ó²¼þÇé¿ö£º IBM H85 Ö÷»úÁ½Ì¨£¬¸÷ÓÐ 1 ¸öCPU£¬ÄÚ´æ¸÷Ϊ 2G£¬±¾µØ¸÷ÓÐ µÄÓ²ÅÌ 18.2G 2 ¿é£¬ ×ܹ²´æ´¢Á¿×óÓÒ£¬7133 SSA ´ÅÅÌÕóÁйñ¹²ÓÐ 9 ¿é£ 36G IBM 36G Ó²ÅÌ ¬×ܹ²´æ´¢Á¿ 320G ×óÓÒ¡£ Èí¼þÇé¿ö£º ²Ù×÷ϵͳ£º IBM-AIX 4.3.3 64-bit ʹÓà HACMP CASCADE 4.4.0.0 Ë«»ú»·¾³ IBM ´òIBM ÓйØACMP ºÍ H AIX µÄ²¹¶¡ Êý¾Ý¿âϵͳ£º 8.1.7 FOR IBM-AIX ENTERPRISE EDITION 64-bit ORACLE ±¾µØÓ²ÅÌ×÷³ÉÒ»¸ö vg £º rootvg£¬ÈÝÁ¿Îª 36G£¬ÓÃÀ´°²×° Oracle Êý¾Ý¿âϵͳ¡£ AIX ºÍ ´ÅÅ̳ÂÁйñÅäÖÃÖУ¬ÓÐ 2 ¿éÓ²Å̲»×ö RAID£¬×÷³ÉÒ»¸ö datavg2£¬ÈÝÁ¿Îª ÈκΠvg:£º 70G ×óÓÒ£¬ÓÃÓÚ´æ·Å±¸ÓÃÊý¾Ý¿âµÄÊý¾Ý¡£ÓàÏ 7 ¿éÓ²ÅÌ×ö RAID5£¬×÷³ÉÒ»¸ödatavg1£¬ vg£º ÈÝÁ¿Îª 180G ×óÓÒ£¬ÓÃÓÚ´æ·ÅÕýʽÊý¾Ý¿âÊý¾Ý¡£ Á½Ì¨Ö÷»úµÄ Çø ¬ rootvg Éϸ÷½¨Ò»¸öÎļþϵͳ£¬ swap 2G£Ú Ô 4G£¬Ãû×ÖΪ ´óСΪ lvoracle, Æämount µãΪ/oracle,ÓÃÀ´·Å oracle RDBMS £¬ÕýʽÊý¾Ý¿â layb µÄÊý¾ÝÕ¼ÓÃµÄ vg Ϊ datavg1£¬²¢½¨Á¢Èý¸ö lv£¬·Ö±ðΪ datavg1_lv01£¬datavg1_lv02 ºÍ datavg1_lv03£¬·Ö±ð ¶ÔÓ¦Îļþϵͳ60G£¬u02£¨ u01£¨ © £ 10G£¬u03£¨ ©£ 40G£©£¬Îļþϵͳ²»Ö§³Ö´óÓÚ 2GB µÄÎÄ ¼þ£¬Æämount µã·Ö±ðΪ /a01£¬ /u01£¬ /backup1£¬ÆäÖÐ ´æ·Å RACLE µÄÊý¾ÝÎļþ£¬ /u01 O ¿ØÖÆÎļþºÍÈÕÖ¾Îļþ£¬Archived log files£¬ /a01 ´æ·Å /backup1 ´æ·ÅÀ䱸·ÝÊý ¾Ý¡£Êý¾Ý ¿â±í¿Õ¼ä³õʼ´óС¹æ»®ÈçÏ£º SYSTEM ±í¿Õ¼äÊý¾ÝÎļþ 500M TOOLS ±í¿Õ¼äÊý¾ÝÎļþ 64M USERS ±í¿Õ¼äÊý¾ÝÎļþ 256M RBS ±í¿Õ¼äÊý¾ÝÎļþ 256M INDX ±í¿Õ¼äÊý¾ÝÎļþ 256M TEMP ±í¿Õ¼äÊý¾ÝÎļþ 128M ¿ØÖÆÎļþ ¹²Èý¸ö ÈÕÖ¾Îļþ Ò»¸ö¹²Èý¸ö 50M HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 4. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM TRACE ÎļþµÄ´æ·ÅλÖÃĬÈÏ·ÅÔÚ±¾µØÅÌÉÏ¡£ ±¸ÓÃϵͳÊý¾Ý¿â µÄÊý¾ÝÕ¼ÓÃµÄ laybbak vg Ϊdatavg2£¬²¢½¨Á¢Á½¸ölv£¬·Ö±ðΪ datavg2_lv01£¬ datavg1_lv02£¬·Ö±ð¶ÔÓ¦Îļþϵͳ © u02£¨30G£¬backup2£¨ £ 30G£ ©£¬Îļþ ϵͳ²»Ö§³Ö´óÓÚ 2GB µÄÎļþ£¬Æä µã·Ö±ðΪ /backup2£¬ÆäÖÐ ´æ·Å mount /u02£¬ /u02 ORACLE µÄÊý¾ÝÎļþ£¬¿ØÖÆÎļþºÍÈÕÖ¾Îļþ£¬ /backup2 ´æ·ÅÀ䱸·ÝÊý¾Ý¡£Êý¾Ý¿â±í¿Õ ¼ä³õʼ´óС¹æ»®ÈçÏ£º SYSTEM ±í¿Õ¼äÊý¾ÝÎļþ 500M TOOLS ±í¿Õ¼äÊý¾ÝÎļþ 64M USERS ±í¿Õ¼äÊý¾ÝÎļþ 256M RBS ±í¿Õ¼äÊý¾ÝÎļþ 256M INDX ±í¿Õ¼äÊý¾ÝÎļþ 256M TEMP ±í¿Õ¼äÊý¾ÝÎļþ 128M ¿ØÖÆÎļþ ¹²Èý¸ö ÈÕÖ¾Îļþ Ò»¸ö¹²Èý 50M ¸ö TRACE ÎļþµÄ´æ·ÅλÖÃĬÈÏ·ÅÔÚ±¾µØÅÌÉÏ¡£ 2. ÉèÖü°°²×°²½Ö裺 1£©´´½¨×é ¬ dba£ ¼°ÆäËùÊôÓû§ dba ΪÆäÖ÷×é¡ Óû§µÄ¹¤×÷Ŀ¼Π¡ oracle£¬ £ /oracle¡¬ª ° ±£ uid=1001 gid=1001£»Ö÷±¸»ú±£³ÖÒ»Ö¡£ÒÔϲÙ×÷ÔÚÖ÷»úÉÏ¡£ 2£©±à¼-racle Óû§µÄ o .profile£¬¶¨ÒåÏÂÁРʹÓõĻ·¾³±äÁ¿£º oracle ORACLE_BASE=/oracle/app/oracle ORACLE_HOME=$ORACLE_BASE/product/8.1.7 ORACLE_SID=layb£¨ »ú£© B »ú£© A /£¨ ORACLE_TERM=vt100 ORACLE_NLS33=$ORACLE_HOME/ocommon/nls/admin/data NLS_LANG=american_america.zhs16gbk LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib LIBPATH=$ORACLE_HOME/lib PATH=$PATH:$ORACLE_HOME/bin:/usr/local/bin DISPLAY=172.16.25.1:0.0 JAVA_HOME=/usr/jdk_base HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 5. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM export ORACLE_NLS33 NLS_LANG LD_LIBRARY_PATH LIPPATH export PATH DISPLAY JAVA_HOME umask 022 3£©¼ì²é HACMP ÊÇ·ñÒѳɹ¦Æô¶¯£» IBM 4) °²×° racle Êý¾Ý¿âϵͳ£¬·ÅÈëµÚÒ»ÕŹâÅ̲¢ÇÒ O MOUNT CDROM mount -rv cdrfs /dev/cd0/cdrom 5£©ÒÔ Éí·Ý½øÈë Ŀ¼ root /cdrom ÔËÐÐÃüÁî sh rootpre.sh xhost + ʹÓÃÃüÁ oracle¡±½øÈë su ¨C oracle Óû§Éí·Ý£¬½øÈëĿ¼£¬ÔÚÖ÷»úÉÏÔËÐÐ /cdrom oracle °²×°³ÌÐò runInstaller¡ ±£¬°²×°¡° 8i Enterprise Edtion 8.1.7.0.0¡°£¬Ñ¡Ôñ Oracle ¡°Custom¡± £¬Ñ¡Ôñ°²×°×é¼þ¡£×¢Ò⣺¼ÓÉÏ OUI£¬È¥µô OCI£¬SQLJ£¬ LEGATO¡£µ±ËùÓÐ×é ¼þ°²×°Íê±Ï£¬ÐèÒªÒÔÖ´ÐÐ root Éí·Ý /oracle/app/oracle/product/8.1.7/root.sh£¬¿ÉÒÔÔÚÒ» ¸öÐéÄâÖÕ¶ËÖÐÒÔ root Éí·ÝÖ´ÐиòÙ×÷£¬ÏȲ»ÅäÖà Net8 Configuration Assistant¡£ 6£©¼ì²é¸÷°²×° log Îļþ£¬È·ÈÏ°²×°³É¹¦¡£ 7£©ÒÔracle Éí·ÝÖ´ÐÐ o dbassist ¿ªÊ¼½¨Á¢Êý¾Ý¿âlayb£¬Ñ¡Ôñ¡° a database¡¬ create ± £ Ñ¡Ô¡ñ° Custom¡Ñ¡Ô¡ LTP¡£ÊäÈë²¢·¢Óû§ÊýÄ¡ ñ°edicated Server Mode¡¬ ± ñ° O ±¬ 300¡£Ñ¡Ô¡ ±¬ ¿° D ± £ È¥µôËùÓÐÊý¾Ý¿âÌØÐÔÑ¡ÏÔÚ¡° Name:¡±ÊäÈë Global Database layb£¬ÔÚ¡°SID:¡±ÊäÈë layb£¬ÔÚ¡° Compatible Parameter:¡°Ñ¡Ôñ 8.1.0£¬ÔÚ×Ö·û¼¯ÖÐÑ¡Ôñ zhs16gbk£¬ÊäÈë¿ØÖÆ ÎļþµÄλÖá£É趨¸÷¸ö±í¿Õ¼äµÄ²ÎÊý£¬ÊäÈëÈý¸öÈÕÖ¾ÎļþµÄλÖúʹóС SGA Çø µÄ²ÎÊý: shared_pool_size=256000000 db_block_buffer=50000 log_buffer=1638400 process=512 db_block_size=4096 Ñ¡Ôñ±£´æ½¨¿â½Å±¾£¬Ãû×ÖΪ createlayb.sh¡£ 8) ÔÚ$ORACLE_HOME/assistants/dbca Ä ¿  ¼ Ï Â ² createlayb.sh, laybrun.sh, úÉú laybrun1.sh, laybrun2.sh ºÍlaybalterTablespace.sh ½Å±¾Îļþ¡£ 9£©·Ö±ðÖ´Ðнű¾½¨¿â laybprun.sh,laybrun1.sh,laybrun2.sh,laybalterTablespace.sh ½¨Á¢Êý¾Ý¿â layb¡£ 10£©Ê¹Óà ~9£©µÄ·½·¨½¨Á¢Êý¾Ý¿â 7£© laybbak¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 6. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM 11£©ÔËÐÐ netca ÃüÁîÅäÖà listener.ora & tnsnames.ora¡£ net8 12£©ÔÚÁ½¸ö½ÚµãµÄ Ŀ¼Ï½¨Á¢ Îļþ£¬±£Ö¤ ¸÷½ÓµãµÄ¡° /oracle .rhosts cluster user equivalence¡¬ rcp£¬ ±£ rlogin ʱ²»Ðè¿ÚÁî¡£ 13£©Ê¹Óà µÄÉí·ÝÐÞ¸Ä root /etc Ŀ¼ÏµÄÎļþ services£¬ÔÚ×îºóÌí¼ÓÈçÏÂÄÚÈÝ£º listener_main 1521/tcp #Net8 listener for layb listener_bak 1522/tcp #Net8 listener for bak ½«Ð޸ĹýµÄÎļþ ¿½±´µ½±¸»úÉÏ¡£ services 14£© ÓÉÓÚ×÷Ë«»ú½á¹¹£±ØÐëÒÔ oracle Éí·ÝʹÓà ÃüÁî×ö ¬ RCP ORACLE Óû§ $HOME/ Ŀ¼µÄÈ«¿½±´£¬Í¬Ê±£¬Ó¦×¢ÒâÔÚµÚ¶þ½ÚµãÖУ¬Ö´ÐÐ /etc Ŀ¼Ï /cdrom/rootpre.sh ½Å±¾£¬ ora*Îļþ£¨¹²Á½¸ö£©µÄ¸´ÖÆ¡£ 15£©±à¼- listener.ora ºÍtnsnames.ora¡£ LISTENER.ORA ÎļþÈçÏ£º # LISTENER.ORA Network Configuration File: /oracle/app/oracle/product/8.1.7/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER_MAIN = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = layb1_service)(PORT = 1521)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) ) ) SID_LIST_LISTENER_MAIN = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /oracle/app/oracle/product/8.1.7) (PROGRAM = extproc) ) (SID_DESC = (SID_NAME = layb) (ORACLE_HOME = /oracle/app/oracle/product/8.1.7) ) ) HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 7. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM LISTENER_BAK = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = layb2_service)(PORT = 1522)) ) ) ) SID_LIST_LISTENER_BAK = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /oracle/app/oracle/product/8.1.7) (PROGRAM = extproc) ) (SID_DESC = (SID_NAME = laybbak) (ORACLE_HOME = /oracle/app/oracle/product/8.1.7) ) ) TNSNAMES.ORA ÎļþÈçÏ£º #TNSNAMES.ORA Configuration File:/oracle/app/oracle/product/8.1.7/network/admin/tnsnames.ora # Generated by Oracle configuration tools. layb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = layb1_service)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = layb) ) ) laybbak = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = layb2_service)(PORT = 1522)) HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 8. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM ) (CONNECT_DATA = (SERVICE_NAME = laybbak) ) ) 16) ORACLE Êý¾Ý¿âµÄÆô¶¯ºÍ¹Ø±ÕÓÉ IBM AIX HACMP CASCADE µÄÆô¶¯ºÍ¹Ø±Õ½Å ±¾¸ºÔð¡£ ÆäÖÐastartmain ºÍ h hastopmain£¨ Ŀ¼Ï£©¸ºÔðÊý¾Ý¿â /etc layb µÄÆô¶¯ºÍ¹Ø±Õ¡££ ¡ ËùÒÔÊÖ¹¤½¨Á¢Êý¾Ý¿âÆô¶¯½Å±¾ startdbmain ºÍÊý¾Ý¿â¹Ø±Õ½Å±¾ shutdowndbmain£¨ÔÚ /etc Ï£© ,²¢¿½±´µ½±¸»úÉϵÄÏàӦĿ¼Ï¡£ ¸½¸÷½Å±¾ÄÚÈÝ£º hastartmain ½Å±¾ÄÚÈÝ£º su - oracle -c startdbmain £¨root Óû§ÒÔ oracle Óû§µÄÉí·ÝÖ´Ðнű¾ startdbmain£© hastopmain ½Å±¾ÄÚÈÝ£º su - oracle -c shutdowndbmain (root Óû§ÒÔoracle Óû§µÄÉí·ÝÖ´Ðнű¾ shutdowndbmain£© startdbmain ½Å±¾ÄÚÈÝ£º export ORACLE_SID=layb /oracle/app/oracle/product/8.1.7/bin/svrmgrl<<EOF connect internal startup exit EOF lsnrctl start listener_main shutdowndbmain ½Å±¾ÄÚÈÝ export ORACLE_SID=layb lsnrctl stop listener_main /oracle/app/oracle/product/8.1.7/bin/svrmgrl<<EOF connect internal shutdown normal EOF hastartbak ºÍ ÆäÖÐ hastopbak£¨ Ŀ¼Ï£©¸ºÔðÊý¾Ý¿â /etc laybbak µÄÆô¶¯ºÍ¹Ø±Õ¡£ £ ¡ ËùÒÔÊÖ¹¤½¨Á¢Êý¾Ý¿âÆô¶¯½Å±¾ startdbbak ºÍÊý¾Ý¿â¹Ø±Õ½Å±¾ shutdowndbbak ¨ÔÚ Ï£© £ /etc , HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 9. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM ²¢¿½±´µ½±¸»úÉϵÄÏàӦĿ¼Ï¡£ ¸½ ¸÷½Å±¾ÄÚÈÝ£º hastartbak ½Å±¾ÄÚÈÝ£º su - oracle -c startdbbak £¨root Óû§ÒÔ oracle Óû§µÄÉí·ÝÖ´Ðнű¾ startdbbak£© hastopbak ½Å±¾ÄÚÈÝ£º su - oracle -c shutdowndbbak £¨root Óû§ÒÔ oracle Óû§µÄÉí·ÝÖ´Ðнű¾ shutdowndbbak£© startdbbak ½Å±¾ÄÚÈÝ£º export ORACLE_SID=laybbak /oracle/app/oracle/product/8.1.7/bin/svrmgrl<<EOF connect internal startup exit EOF lsnrctl start listener_bak shutdowndbbak ½Å±¾ÄÚÈÝ export ORACLE_SID=laybbak lsnrctl stop listener_bak /oracle/app/oracle/product/8.1.7/bin/svrmgrl<<EOF connect internal shutdown normal EOF ×¢£º IBM HA ²Ù ×÷£º clstart smit clstop ·Ö±ðΪÆô¶¯¡¢¹Ø±Õ smit IBM HA Varyonvg datavg varyoffvg datavg ·Ö±ðΪÆô¶¯¡¢¹Ø±Õ´ÅÅ̹ñµÄ vg 3. Êý¾Ý¿âË«»úÑéÖ¤·½Ê½£º layb ¼°Æä¼àÌý³ÌÐòÔËÐÐÔÚ ¬ Õý³£Çé¿öÏÂÖ÷Êý¾Ý¿â A »úÉÏ£±¸ÓÃÊý¾Ý¿â ¼°Æä¼à laybbak Ìý³ÌÐòÔËÐÐÔÚ B »úÉÏ¡£ 1£©Èç¹û »úµ±»ú£¬Ö÷Êý¾Ý¿â A layb ¼°Æä¼àÌý³ÌÐò»á×Ô¶¯Çл»µ½ B »ú£¬»úÔËÐÐÖ÷ B Êý¾Ý¿â ¼°Æä¼àÌý³ÌÐòºÍ±¸ÓÃÊý¾Ý¿â layb laybbak ¼°Æä¼àÌý³ÌÐò¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 10. ITPUB µç×ÓÔÓÖ¾ ORACLE8.1.7 ²úÆ·ÔÚ AIX4.3.3 Éϵݲװ IBM 2£©Èç¹û »ú»Ö¸´ÔËÐУ¬Ö÷Êý¾Ý¿â A layb ¼° Æä¼àÌý³ÌÐò»á×Ô¶¯±» A »ú½Ó¹Ü¡£ 3£©Èç¹û »úµ±»ú£¬±¸ÓÃÊý¾Ý¿â B laybbak ¼°Æä¼àÌý³ÌÐò»á×Ô¶¯Çл»µ½ A »ú£¬»úÔË A ÐÐÖ÷Êý¾Ý¿â¼°Æä¼àÌý³ÌÐòºÍ±¸ÓÃÊý¾Ý¿â layb laybbak ¼°Æä¼àÌý³ÌÐò¡£ 4£©Èç¹û »ú»Ö¸´ÔËÐУ¬±¸ÓÃÊý¾Ý¿â B laybbak ¼°Æä¼àÌý³ÌÐò»á×Ô¶¯±» B »ú½Ó¹Ü¡£ *** *** *** *** *** ×¢£º±¾ÎÄ×÷ÕßÇëÓë epub@itpub.net ÁªÏµ , ÒÔ±ãÈ·ÈÏÊðÃû . HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 11. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS Using 3 Linux Boxes to Setup OPS ×÷Õß : Parrotao 1. Ðò ÔÚ Oracle µÄÎĵµÖÐ »·¾³ÐèÒªÒ»¸ö¹²Ïí´ÅÅÌÕûÁУ¬¿ÉÊǾ޴óµÄÓ²¼þͶ×Ê OPS ÎÒÃÇÕâЩ Oralce µÄѧϰÕßÊÇÄÑÒÔ³ÐÊܵġ£±¾È˾-¹ýÊÔÑ飬½«Ò»Ì¨ Linux Ö÷»úÄ£Äâ³É¹² Ïí´ÅÅÌÕûÁУ¬´Ó¶ø½¨Á¢ÁËÒ»¸ö OPS µÄʵÑé»·¾³¡£±¾ÎÄÖ÷Ҫ˵Ã÷ÁËÈçºÎÓà 3 ̨Linux Ö÷ »ú¹¹Ôì³ö Oracle OPS µÄʵÑé»·¾³¡£ 2. »ù±¾Ó²¼þÅäÖà Linux Ö÷»úÈý̨ ×îµÍÅäÖà ¡¤ Intel x86 ÈüÑï ¡¤ 128M RAM ÒÔÉÏ ¡¤ 10G£¨ÆäÖÐһ̨ÍƼö 20G£© ÍƼöÅäÖà ¡¤ Intel x86 PIII 800mHz ÒÔÉÏ ¡¤ 256M RAM ÒÔÉÏ ¡¤ 20G ÒÔÉÏ£¨ÆäÖÐһ̨ÍƼö 40G£© 3. Ó²¼þ¼Ü¹¹ -------------- -------------- -------------- | | | | | | | Linux01 | | Linux02 | | ShareDisk| | | | | | | | Com1|=====|Com1 | | | | | | | | | | NBD Client | | NBD Client | | NBD Server | --- ----------- -------------- -------------- | | | | | | | | | | | | ------------------------------------------------------ | HUB | ------------------------------------------------------ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 12. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS 4. »ù±¾Èí¼þ RedHat 6.2 ·¢²¼°æ NBD2.4.26(NetWork Block Device) refer http://www.linux-ha.org Oracle 8.1.7 for Linux OPS option refer http://www.oracle.com 5. Âß¼-¼Ü¹¹ Logic Concept -------------- -------------- | | | | | Linux01 | | Linux02 | | | Heartbeat | | | Heartbeat |-----------| Heartbeat | | | Line | | | NBD Client | | NBD Client | -------------- -------------- | | | | | | | -------------- | | | | | |------| ShareDisk |-----| | | | | | | | NBD Server | -------------- 6. °²×°Ö¸ÄÏ a. OS °²×° Linux01/Linux02 ¸Ã»úÆ÷ÓÃÓÚ°²×° OPS µÄϵͳ¡£°²×°ÊÇÑ¡Ôñ Custom °²×°²¢Ñ¡Ôñ ºÍ Cluster Kernel Developer ×é¼þ¡£ ShareDisk ¸Ã»úÆ÷ÓÃÓÚÄ£Äâ¹²Ïí´ÅÅÌÕûÁУ¬°²×°Ê±²»Òª½«ËùÓÐÓ²ÅÌÈ«²¿»®·Ö£¬Áô ´ÅÅÌ ¿Õ¼ä£¬×÷Ϊ Linux01/Linux02 µÄ¹²Ïí´ÅÅÌ£¬ÓÃÓÚ´æ·Å OPS µÄÊý¾ÝÎļþ£¨ RAW ·½Ê½£© HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 13. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS Sample Only£© ÄãÈç¹ûÓÐÁ½¸ö´ÅÅÌ£¬Ò²¿É°´ÕÕÏÂÁз½·¨·ÖÇø£¨ Partition List Command (m for help): p Disk /dev/hda: 16 heads, 63 sectors, 12483 cylinders Units = cylinders of 1008 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 1 17 8536+ 83 Linux /dev/hda2 18 12483 6282864 5 Extended /dev/hda5 18 830 409720+ 83 Linux /dev/hda6 831 932 51376+ 83 Linux /dev/hda7 933 1136 102784+ 83 Linux /dev/hda8 1137 1340 102784+ 83 Linux /dev/hda9 1341 1442 51376+ 83 Linux /dev/hda10 1443 1544 51376+ 83 Linux /dev/hda11 1545 1646 51376+ 83 Linux /dev/hda12 1647 1667 10552+ 83 Linux /dev/hda13 1668 1688 10552+ 83 Linux /dev/hda14 1689 1729 20632+ 83 Linux /dev/hda15 1730 1770 20632+ 83 Linux /dev/hda16 1771 1811 20632+ 83 Linux /dev/hda17 1812 1852 20632+ 83 Linux Èç¹ûÔڸð²×°¹ý³ÌÖÐÈçÓÐÈκÎÎÊÌâ¿É²ÎÔÄ Linux HOWTO¡£ b. ÍøÂç¿éÉ豸µÄ°²×°£¨ NBD £© Download NBD software From http://www.linux-ha.org °´ÕÕBD µÄ°²×°Êֲᰲװ¡£ N tar xfvz nbd-current.tar.gz cd nbd-2.4.26 make make install ¸Ã°²×°±ØÐëÔÚÈý̨»úÆ÷ÉÏÖ´ÐÐ c.OPS µÄ°²×° ? Oracle °²×°´ó¼Ò¶¼»á°É£¬ÌáÐÑһϲ»ÒªÍüÁËÑ¡Ôñ OPS Ñ¡ÏîŶ 7. ²âÊÔÄãµÄ°²×° a. ²âÊÔ OS ×îÖ÷Òª¿´¿´ Sharedisk ÉÏÓÃÓÚ¹²ÏíµÄ·ÖÇøÊÇ·ñÔÚ±¾»úÄܶÁд¡£ mkfs /dev/hda5 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 14. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS b. ²â NBD ÊÔ 1.ÔÚ Sharedisk ÉÏÆô¶¯ NBD-Server ³ÌÐò nbd-server 3100 /dev/hda5 2.ÔÚ Linux01/Linux02 ÉÏÆô¶¯ NBD-client ³ÌÐò insmod nbd.o nbd-client sharedisk 3100 -n 2 /dev/nda 3.ÔÚ Linux01/Linux02 ÉÏ ,È¡µÃ¹²ÏíÎļþϵͳ mkfs /dev/nda mount /dev/nda /mnt/nda cp /ect/lilo.conf /mnt/nda 4.ÈçÓÐÎÊÌâÇë²ÎÔÄ http://www.linux-ha.org ÉϵÄ×ÊÁÏ¡£ 8. ÉèÖà NBD ÔÚÒ»ÇпªÊ¼Ç°ÇëÏÈÉèÖà NBD ¿ÉÓà NBD ²¢È·ÈÏ a. ÔÚsharedisk ÉÏÆô¶¯ËùÓÐServer ½ø³Ì NBD For Linux01 nbd-server 2000 /dev/hda1 nbd-server 4010 /dev/hda5 nbd-server 4020 /dev/hda6 nbd-server 4030 /dev/hda7 nbd-server 4040 /dev/hda8 nbd-server 4050 /dev/hda9 nbd-server 4060 /dev/hda10 nbd-server 4070 /dev/hda11 nbd-server 4080 /dev/hda12 nbd-server 4090 /dev/hda13 nbd-server 4100 /dev/hda14 nbd-server 4110 /dev/hda15 nbd-server 4120 /dev/hda16 nbd-server 4130 /dev/hda17 For Linux02 nbd-server 3000 /dev/hda1 nbd-server 5010 /dev/hda5 nbd-server 5020 /dev/hda6 nbd-server 5030 /dev/hda7 nbd-server 5040 /dev/hda8 nbd-server 5050 /dev/hda9 nbd-server 5060 /dev/hda10 nbd-server 5070 /dev/hda11 nbd-server 5080 /dev/hda12 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 15. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS nbd-server 5090 /dev/hda13 nbd-server 5100 /dev/hda14 nbd-server 5110 /dev/hda15 nbd-server 5120 /dev/hda16 nbd-server 5130 /dev/hda17 b. ÔÚLinux01 ÉÏÆô¶¯ËùÓÐClient ½ø³Ì NBD nbd-client sharedisk 4000 -n 2 /dev/nda nbd-client sharedisk 4010 -n 2 /dev/ndb nbd-client sharedisk 4020 -n 2 /dev/ndc nbd-client sharedisk 4030 -n 2 /dev/ndd nbd-client sharedisk 4040 -n 2 /dev/nde nbd-client sharedisk 4050 -n 2 /dev/ndf nbd-client sharedisk 4060 -n 2 /dev/ndg nbd-client sharedisk 4070 -n 2 /dev/ndh nbd-client sharedisk 4080 -n 2 /dev/ndi nbd-client sharedisk 4090 -n 2 /dev/ndj nbd-client sharedisk 4100 -n 2 /dev/ndk nbd-client sharedisk 4110 -n 2 /dev/ndl nbd-client sharedisk 4120 -n 2 /dev/ndm nbd-client sharedisk 2000 -n 2 /dev/ndn c. ÔÚLinux01 ÉÏÆô¶¯ËùÓÐClient ½ø³Ì NBD nbd-client sharedisk 5000 -n 2 /dev/nda nbd-client sharedisk 5010 -n 2 /dev/ndb nbd-client sharedisk 5020 -n 2 /dev/ndc nbd-client sharedisk 5030 -n 2 /dev/ndd nbd-client sharedisk 5040 -n 2 /dev/nde nbd-client sharedisk 5050 -n 2 /dev/ndf nbd-client sharedisk 5060 -n 2 /dev/ndg nbd-client sharedisk 5070 -n 2 /dev/ndh nbd-client sharedisk 5080 -n 2 /dev/ndi nbd-client sharedisk 5090 -n 2 /dev/ndj nbd-client sharedisk 5100 -n 2 /dev/ndk nbd-client sharedisk 5110 -n 2 /dev/ndl nbd-client sharedisk 5120 -n 2 /dev/ndm nbd-client sharedisk 3000 -n 2 /dev/ndn d. È·ÈÏ ¿ÉÓà NBD mkfs /dev/nda ..... ..... mkfs /dev/ndn HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 16. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS 9. ÉèÖà ORACLE_SID Linux01 ORACLE_SID=orcl1 Linux02 ORACLE_SID=orcl2 10. Àí½â Oracle µÄCluster Manager Oracle Ìṩluster Manager ÒÔ±ã PS ¸üºÃµÄ¹¤×÷ C O | ------------------------ | | ------------------------ | ----- |LMON Oracle Instance | |LMON Oracle Instance | | | -- +--------------------- | | -- +--------------------- | | | | | | -- +--------------------- | | -- +------------------ --- | | | Oracle Cluster Manager | | Oracle Cluster Manager | | | -- +--------------------- | | -- +--------------------- | |Oracle | | | | | ----------------- | | | --- -------------- | |provided | | Node Manager | | | Node Manager | | | | -------- +-------- | | | -------- +-------- | | | | | | | | | | | | | -- +------------ +-------- | | -- +------------ +-------- | | | WatchDog Daemon | | WatchDog Daemon | ----- | -- +--------------------- | | -- +--------------------- | | | | | | | | | #========================# #========================# ----- # Linux Watchdog # # Linux Watchdog # |Linux OS # /dev/watchdog # # /dev/watchdog # |provided #========================# #========================# ----- Oracle ÌṩÁËÒ»¸ö½Ð WatchDog Daemon µÄ³ÌÐò£¬Í¨¹ý OS µÄÌṩµÄ WatchDog(Èí ) É豸½øÐÐͬ²½ºÍͨÐÅ¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 17. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS 11. Æô¶¯ Oracle Cluster Manager a. Æô¶¯ OSµÄÌṩµÄ WatchDog( í É豸 È) insmod softdog b. ÉèÖÃÔËÐÐ Ëù±ØÐëµÄ»·¾³±äÁ¿ Oralce ÈçORACLE_HOME ORACLE_SID c. ÉèÖà Oracle Cluster Manager OCM ÓÐÁ½¸ö¿ØÖÆÎļþ $ORACLE_HOME /oracm/admin/nmcfg.ora $ORACLE_HOME /oracm/admin/ocmargs.ora Èç²»´æÔÚ£¬Çë´´½¨¡£ # Sample configuration file $ORACLE_HOME/oracm/admin/ocmargs.ora -----cut here------ watchdogd -gdba -e $ORACLE_HOME/oracm/log/wddRAC1.log oranm $ORACLE_HOME/oracm/log/nmRAC1.log oracm $ORACLE_HOME/oracm/log/cmRAC1.log -----cut here------ $ORACLE_HOME/oracm/admin/nmcfg.ora -----cut here------ CmHostName=Linux01 CmDiskFile=/dev/raw/raw1 DefinedNodes=Linux01 Linux02 CmServiceName=ocms ClusterName=oracleops WatchdogMarginWait=40000 PollInterval=1000 MissCount= 5 -----cut here------ d. Æô¶¯ OCM cd $ORACLE_HOME cd oracm/bin ./ocmstart.sh e. ¼ì²é ÊÇ·ñÆô¶¯ OCM µÈÉϼ¸Ê®ÃëÖÓÓÃÈçÏÂÃüÁî¼ì²é OCM ÊÇ·ñÆô¶¯ ps -ef | grep ora HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 18. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS UID PID PPID CMD ... root 830 1 watchdogd -g dba -e /u01/ora/pro <-- WD root 831 1 oranm /m /e:/u01/ora/product/8.1 <-- NM root 832 1 oracm /e:/u01/ora/product/8.1.7. <-- CM root 844 831 oranm /m /e:/u01/ora/product/8.1 root 845 844 oranm /m /e:/u01/ora/product/8.1 root 851 844 oranm /m /e:/u01/ora/product/8.1 <-- child root 852 832 oracm /e:/u01/ora/product/8.1.7. threads root 853 852 oracm /e:/u01/ora/product/8.1.7. root 854 844 oranm /m /e:/u01/ora/product/8.1 root 855 844 oranm /m /e:/u01/ora/product/8.1 root 856 844 oranm /m /e:/u01/ora/product/8.1 ... f . ÔÚLinux02 ÉÏÖظ´ÒÔÉϲÙ×÷£¬²¢È·ÈÏ OCMÊÇ·ñÆô¶¯ g. ÈçÓÐÎÊÌâÇë²ÎÔÄLog 12. ÉèÖà Oracle ÂãÎļþ 1. ÔÚLinux01/Linux02 ÉÏ´´½¨ÂãÎļþ NOD mknod /dev/system c 162 10 mknod /dev/temp c 162 11 mknod /dev/users c 162 12 mknod /dev/rbs c 162 13 mknod /dev/indx c 162 14 mknod /dev/tools c 162 15 mknod /dev/drsys c 162 16 mknod /dev/control1 c 162 17 mknod /dev/control2 c 162 18 mknod /dev/redo1_1 c 162 19 mknod /dev/redo1_2 c 162 20 mknod /dev/redo2_1 c 162 21 mknod /dev/redo2_2 c 162 22 2. ÔÚLinux01/Linux02 ÉÏÉèÖÃÂãÎļþÊôÐÔ chown oracle /dev/system HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 19. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS chown oracle /dev/temp chown oracle /dev/users chown oracle /dev/rbs chown oracle /dev/indx chown oracle /dev/tools chown oracle /dev/drsys chown oracle /dev/control1 chown oracle /dev/control2 chown oracle /dev/redo1_1 chown oracle /dev/redo1_2 chown oracle /dev/redo2_1 chown oracle /dev/redo2_2 3. ÔÚLinux01/Linux02 ÉϽ«ÂãÎļþ Link µ½¹²Ïí´ÅÅÌ ×¢Òâÿ´ÎÆô¶¯Ê±¶¼±ØÐë½øÐÐÕâÏî²Ù×÷ raw /dev/system /dev/nda raw /dev/temp /dev/ndb raw /dev/users /dev/ndc raw /dev/rbs /dev/ndd raw /dev/indx /dev/nde raw /dev/tools /dev/ndf raw /dev/drsys /dev/ndg raw /dev/control1 /dev/ndh raw /dev/control2 /dev/ndi raw /dev/redo1_1 /dev/ndj raw /dev/redo1_2 /dev/ndk raw /dev/redo2_1 /dev/ndl raw /dev/redo2_2 /dev/ndm 13. ´´½¨Êý¾Ý¿â ÔÚLinux01 »òLinux02 ÉϾù¿É×ö¡£ a. ÉèÖà DBCA_RAW_CONFIG Îļþ DBCA_RAW_CONFIG Îļþ¼ÇÔØÁËÊý¾Ý´´½¨Ê±Êý¾ÝÎļþºÍ±í¿Õ¼äµÄ¶ÔÓ¦¹Ø ϵ Create dbca_raw.map file ----cut here----- system1 /dev/system users1 /dev/users temp1 /dev/temp rbs1 /dev/rbs HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 20. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS indx1 /dev/indx tools1 /dev/tools drsys1 /dev/drsys control1 /dev/control1 control2 /dev/control2 redo1_1 /dev/redo1_1 redo1_2 /dev/redo1_2 redo2_1 /dev/redo2_1 redo2_2 /dev/redo2_2 ----cut here----- ÉèÖÃBCA_RAW_CONFIG ÎļþµÄ»·¾³±äÁ¿ D bourne shell (sh) and korn shell (ksh) example: $ DBCA_RAW_CONFIG=/home/oracle/dbca_raw.map ; export DBCA_RAW_CONFIG c shell (csh) example: % setenv DBCA_RAW_CONFIG /home/oracle/dbca_raw.map b. ´´½¨Êý¾Ý¿â ÓÃdbassist ´´½¨Êý¾Ý¿â 1. Start Xwindows 2. cd $ORACLE_HOME /bin/ 3. ./dbassist 4. Select OPS option,then next 5. Èç¹ûÄãµÄÉèÖÃÒ»ÇÐÕýÈ· £¬Äã»áÔÚÒ»¸öÁбí¿òÖÐÓÐLinux02 Linux01 ºÍ 6. ÓÃĬÈÏÑ¡Ïî´´½¨Êý¾Ý¿â 14. Æô¶¯Êý¾Ý¿â <Linux01> | <Linux02> sqlplus / as sysdba | sqlplus / as sysdba startup | startup ... | ... HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 21. ITPUB µç×ÓÔÓÖ¾ USING 3 LINUX BOXES TO SETUP OPS 15. ½øÒ»²½µÄ¹¤×÷ Linux ÉÏ¿ÉÒÔÓà À´»® LVM ·Ö·ÖÇø£¬ÓиüºÃµÄÀ©Õ¹ÐÔ¡£µ«ÔÚRH6.2 Ï°²×°±È½ÏÀ§ÄÑ Óà Heartbeat Èí¼þ£¬¿ÉÒÔ½« Linux01/Linux02 ×ö³É S µÄ O Cluster£¬ µ«¶ÔÓÚ ×÷Óò»´ó£¬¹Ë²»ÔÚ´ËÌÖÂÛ¡£ OPS 16. ²Î¿¼×ÊÁÏ http://www.linux-ha.org http://metalink.oracle.com Intel_Oracle_9iRAC_workshoptechnicalsession.pdf From www.intel.com 17. ¼¼Êõ±³¾° ÒÔÉÏÎĵµµÄÿһ²½ÎÒ¶¼ÊµÏÖ¹ý£¬Î¨Ò»²»Í¬µÄÊÇÎÒÓÃÁË VMWARE. ÈçÓÐÎÊÌâ¿ÉÒÔÔÚÉϸøÎÒÁôÑÔ ITPUB . »òmail to angelwg@public2.sta.net.cn ================================== ×÷ÕßÁªÏµ·½Ê½£º E TaoPuyin G System Engineer Oracle DBA HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 22. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ Ê ý ¾ Ý ¿ â ¹ Ü À í ³ É Ê ì ¶ È Ä £ Ð Í Ver 1.1 ×÷Õß Thomas B. Cox : ·-Òë ´ÞÏþ²¨ : (local0) 2002/2/17 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 23. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ Ä¿Â¼ ¡¤Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ¡¤Êý¾Ý¹ÜÀíÔ±¡¢Êý¾Ý¿â¹ÜÀíÔ±ºÍÊý¾ÝÉè¼ÆÕßµÄÇø±ð ¡¤ÈÎÎñÐÔÖʵÄÇø±ð ¡¤Êý¾Ý¿âÉúÃüÖÜÆÚ ¡¤Êý¾Ý¿âÉè¼ÆÕߺÍÊý¾Ý¿â¹ÜÀíÔ± ¡¤Êý¾Ý¿âÉúÃüÖÜÆÚÖеÄÈÎÎñ ¡¤Êý¾Ý¿âÉúÃüÖÜÆÚºÍ DBA µÄÈÎÎñ ¡¤ DBA ÈÎÎñÁ÷³Ì£¨¶ÔÓÚ³ÉÊìÊý¾Ý¿â£© ¡¤ SLA Ð-ÒéÑù±¾ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 24. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ Ò»¡¢ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ DBA MM£ºDatabase Administration Maturity Model ±¾ÎĵµÌÖÂÛÁËÊý¾Ý¿â¹ÜÀí£¬¹´»-³öORACLE Êý¾Ý¿â¹ÜÀíÔ±ÔÚ¿ª·¢½×¶ÎºÍά»¤²úÆ· ½×¶ÎÓ¦¸ÃÖ´ÐеÄÈÎÎñ¡£ DBA MM ·ÖΪ ¸ö¼¶±ð 5 ¼¶±ð ½¹µã ¹Ø¼ü´¦ÀíÓò ³õ²½£¨ INITIAL£© ¹Ø×¢£ºÃ»ÓÐ ¡ ³É¹¦ÊÇż¶û·¢ÉúµÄºÍ²»¿ÉÖظ´µÄ ¤ ¹¤¾ß£º¸öÈË·¢»Ó£¨ HEROISM£© ¡¤¹¤×÷±íÏÖΪ£º½ô¼±Ó¦¶Ô¡¢¾È»ð¡¢ ¸öÈË·¢»Ó ¿ É Ö ¹Ø×¢£º¿ÉÖظ´µÄ´ Ø ¸ DBA ¹ý³Ì ¡¤ÏîÄ¿¼Æ»®£¨ DBA ÏîÄ¿¡¢ ¿ª DBA £¨REPEATABLE£© ¹¤¾ß£º ÈÕ³£¼ì²éÁбí DBA ·¢Ö§³Ö£© ¡¤ÏîÄ¿¸ú×Ù¡¢DBA ÏîÄ¿£© ¿±Â©£¨ ¡¤×ÓÏîÄ¿¹ÜÀí£¨ DBA ÏîÄ¿Íâ°ü»ò ×ÓÏîÄ¿£© ¡¤ÅäÖùÜÀí£¨Êý¾Ý¿âÈí¼þ¡¢ DBA ¹¤¾ß¡¢±ä¸ü¹ÜÀí£© ¶¨Ò壨 DEFINED£© ¹Ø×¢£º½« ´¦Àí¹¤×÷¶¨Òå DBA ¡¤ÐèÇó¹ÜÀí£¨·þÎñ¼¶±ð£© »¯¡¢Îĵµ»¯ ¡¤ÖÊÁ¿±£Ö¤£¨ DBA ÈÎÎñ£© ¹¤¾ß£º Åàѵ DBA ¡¤×î¼ÑµÄʵ¼ù±»Ã÷È·»¯²¢¿É´«²¥ £¨Åàѵ£© ¡¤¹¤×÷±»Ã÷È·¶¨Ò壬ÈÎÎñÖ´ÐÐÇé¿ö ¿ÉÒÔ±»È·ÇеĶÈÁ¿ ¹ÜÀí£¨ MANAGED£© ¹Ø×¢£º¹ý³Ì¿ØÖÆ£¬¼´ ¡¤ËùÓб仯¶¼ÄܿɿصļǼÏÂÀ´£¬ DBA ´¦ ÀíÁ÷³ÌÊÇÎȶ¨µÄºÍ¿É ²¢Ôڱ仯µÄ֮ǰºÍÖ®ºó½øÐжÈÁ¿£¬ ¶ÈÁ¿µÄ£¬ËùÓеı仯¼° ÒÔÈ·Èϱ仯ÊÇ·ñÓÐЧ¡£ ÆäÆðÒò¶¼±»¼Ç¼ºÍ±ê ×¢¡£ ¹¤¾ß£º SLA ÓÅ»¯£¨ OPTIMIZING£© Á¬ÐøµÄ¹ý³ÌÓÅ»¯£º ¡¤¹ÜÀíʵ¼ùÖеõ½Ìá¸ß£¬¼¼Çɵõ½ Ê×ÏÈÒª¿ÉÖظ´²ÅÄÜÌá¸ßÌáÁ¶ Ê×ÏÈÒª¿É¶¨Òå²ÅÄܶÈÁ¿¡¤±ä»¯µÄÒòËصõ½ÏµÍ³µÄ¿ØÖÆ£¬½Ì Ê×ÏÈÒª¿É¶ÈÁ¿²ÅÄܹÜÀíѵѧϰÖеõ½¸ü´óµÄÌá¸ß ¶þ¡¢ Êý¾Ý¹ÜÀíÔ±¡¢Êý¾Ý¿â¹ÜÀíÔ±ºÍÊý¾ÝÉè¼ÆÕßµÄÇø±ð ¸ù¾ÝÊý¾Ý¿âʹÓùý³ÌÖÐÈÎÎñµÄ²»Í¬£¬»®·ÖΪ 3 ¸öÈÎÎñ¼¯ºÏ£º £¨ 1£© Êý¾Ý¹ÜÀíÈÎÎñ £¨ 2£© Êý¾ÝÉè¼ÆÈÎÎñ £¨ 3£© Êý¾Ý¿â¹ÜÀíÈÎÎñ ¿ÉÄÜ»áÒ»ÈËͬʱµ£µ±¶à¸ö½ÇÉ«£¬µ«ÊÇ 3 Àà½ÇÉ«µÄÈÎÎñÊDz»Í¬µÄ£¬±íÏÖÔÚ£ºÒ»·½ÃæÈÎÎñµÄ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 25. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ÊDz»Ò»ÑùµÄ£¬ÁíÍâÒ»·½Ã棬²»Í¬µÄÈÎÎñ³öÏÖÔÚÊý¾Ý¿âÉúÃüÖÜÆڵIJ»Í¬½×¶Î¡£ Èý¡¢ ÈÎÎñÐÔÖʵÄÇø±ð 1¡¢Êý¾ÝÉè¼Æ Êý¾ÝÉè¼Æ¹Ø×¢Êý¾ÝµÄÂß¼-¡¢ÎïÀíÄ£Ð͵Ľ¨Á¢£¬ÕâЩģÐÍÖ®ºó»á×÷Ϊ¶ÔÏó´ Ϊ½â¾öÌض¨µÄÉÌÒµÎÊÌ⣬ÔÚÓ¦ÓÃËùÉæ¼°µÄ·¶Î§ÖУ¬½¨Á¢ÕâЩģÐÍ£¬Ë³ÐòÊ Ó¦Ó÷¶Î§ÉÌÒµÐèÇó ? ? Êý¾ÝÂß¼-Ä£ÐÍ ? Êý¾ÝÎïÀíÄ£ÐÍ Êý¾ÝÉè¼Æ¸ºÔðÒÔϾßÌå·½Ã棺 ¡¤½¨Á¢µÄÄ£ÐÍÄܹ»³ä·ÖÂú×ãÉÌÒµÎÊÌâµÄÐèÒª¡£ ¡¤È·±£Ä£ÐÍÔÚ¹¹½¨ÔÚÓ¦ÓÃÁìÓòÖ®ÄÚ£¨Í¨³£Ä£Ðͺ-¸ÇµÄ·¶Î§Â À´Ó¦ÓÃϵͳÓëÆäËûϵͳ½Ó¿Ú£¬µ«ÊÇÄ£ÐͲ»Äܹý´óµÄÍÑÀëʵ¼ ¡¤½¨Á¢Ò»¸öÓû§¿ÉÒÔ½ÓÊܵÄÎïÀíÄ£ÐÍ£¨Ó°ÏìÐÔÄÜÌá¸ßµÄÖ÷Ò Êý¾ÝÉè ¼ÆÕßÓ¦¸Ã¾¡¿ÉÄܵÄÌá¸ßÐÔÄÜ£¬¶ø²»ÊÇÆÆ»µËü£© 2¡¢Êý¾Ý¹ÜÀí Êý¾Ý¹ÜÀí¸ºÔðÖƶ¨·ÃÎʲßÂÔ£ºË-ÓµÓÐʲôÊý¾Ý¡¢Ë-ÄÜ´´½¨¡¢¸Ä±ä¡¢É¾³ýʲ ÀíÕß±ØÐë¸ú×Ù¿ØÖÆÊý¾ÝÔªËصÄËùÓÐȨ£¬ÕâÏ×÷ÓëÊý¾ÝµÄÉè¼ÆÎ޹أ¬Ò²º £¨ DBA£©Î޹ء£¾ßÌå¶øÑÔ£º ¡¤Ë-ÓµÓÐÊý¾Ý ¡¤Ë-ÓµÓÐÊý¾ÝµÄ¶¨Òå ¡¤ÔÚÊý¾ÝµÄÉú´æÖÜÆÚÖУ¬Èç¹ûÐèÒª±ä¸üËùÓÐȨ£¬Ê²Ã´Ê±ºò¡¢ÈçºÎ¸Ä±ä£¨ ¶¨µ¥Ò»Ö±µ½¶¨µ¥Ìá½»£¬·¢»õÈËÔ±½Ó×ÅÓµÓÐËüÒ»Ö±µ½»õÎï·¢³ö£¬È»ºóÓÉ²Æ µ½Êܵ½»õ¿î£© 3¡¢Êý¾Ý¿â¹ÜÀí Êý¾Ý¿â¹ÜÀíÔ±¸ºÔðά»¤Êý¾Ý¿âµÄÎïÀíÔË ÐУ¨È罫Êý¾Ý´æ·ÅÔÚij¸ö´ÅÅÌÉÏ£¬ DBA ¸ºÔ𣺠©£ ¡¤Î¬»¤Êý¾Ý¿â£¬Ê¹ËüÔËÐÐÔÚÊý¾Ý¿â¿ª·¢ÕßÒªÇóµÄ״̬Ï¡£ ¡¤½øÐе÷ÓÅ¡¢·Öµ£¸ºÔØ¡¢´ò PATCH¡¢Éý¼¶¡¢±¸·Ý¡¢»Ö¸´µÈ ¡¤³ýÁËÂß¼-·ÃÎÊ£¨Ó¦Óü¶£©ÒÔÍâµÄÊý¾Ý¿âËùÓз½Ãæ¡£ Ìرð×¢Ò⣬ DBA µÄÖ°ÔðÖÐûÓÐд SQL Ó¦Óã¬Ð´ Ó¦ÓÃÊÇ¿ª·¢ÕߵŤ×÷£¬Èç¹û SQL DBA ³Ðµ£ ÕâÏîÈÎÎñ£¬Ëû¾Í³ÉΪ¿ª·¢ÈËÔ±£¬²»ÊÇ DBA¡£ ËÄ¡¢ Êý¾Ý¿âÉúÃüÖÜÆÚ Ò»¸öеÄÊý¾Ý¿âµ®Éú£¬Í¨³£ÊÇΪÁËÂú×ãеÄÓ¦Ó㨻òÐèÒªÔÚÀϵÄÊý¾Ý¿â ¸Ä±ä£ ©£¬ÎªºÏÀíµÄ¹¹½¨Êý¾Ý¿â£¬±ØÐëÓÐÈË·ÖÎöÓ¦Óã¬Éè¼ÆºÏÊʵıí½á¹¹£¨ E- RÄ£ÐÍ£¬ ¶øºóÓ°ÉäΪÊý¾Ý±í£¬Ò²¿ÉÒÔÖ±½ÓÉè¼ÆÊý¾Ý±í£© ¡£Éè¼Æ±íÓ¦ÏÈÓÚÆäËûµÄ½×¶Î Éè¼Æ±íÖ÷ÒªÓÉÊý¾ÝÉè¼ÆÕßÍê³É£¬³ýÁËÉè¼Æ±íÖ®Í⣬Êý¾ÝÉè¼ÆÈËÔ±»¹¸ºÔð ÉúÔÚÓ¦ÓÃÐèÇó±ä»¯Ê±£¬¾ö¶¨ÐèÒª½øÐÐÄÄЩ±ä¸ü¡£ Êý¾Ý¿âÉúÃüÖÜÆÚ Éè¼ÆÕß Êý¾Ý¹ÜÀíÕß DBA 1£®¾ö²ß¡¢·ÖÎö ±íÉè¼Æ£¬°²È«Éè¼Æ Êý¾ÝËùÓÐȨ£¬°²È«²ß HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 26. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ÂÔ Êý¾Ý¿âÉúÃüÖÜÆÚ Éè¼ÆÕß Êý¾Ý¹ÜÀíÕß DBA 2£®Éè¼Æ£¬½¨Ôì Ó°Ïì·ÖÎö ±ä¸ü¹ÜÀí °²×°£ Éú³ÉÊý¾ÝÎÄ ¬ ¼þ£¬±í¡¢±í¿Õ¼ä½¨ Á¢£¬±¸·Ý /»Ö¸´¼Æ »®£¬°²È«¹ý³Ì 3£®Ó×Äê ÎïÀíÖØ×é£ ÐÔÄܵ÷ ¬ ÓÅ 4£®³ÉÊì Òì³£Çé¿ö¼à¿Ø £Ð ¬Ô Äܼà²â£¬ÐÔÄܵ÷ ÓÅ£¬Ö´Ðб¸·Ý /»Ö ¸´£ Êý¾ÝÎļþ¹ÜÀí ¬ A£®Ð¡±ä¸ü Ó°Ïì·ÖÎö ±ä¸ü¹ÜÀí ±íÐÞ¸Ä B£®´ó±ä¸ü Ó°Ïì·ÖÎö£¬±íÖØÉè¼Æ ±ä¸ü¹ÜÀí ½¨±í ÿµ±Ó¦ÓõÄÐèÇó·¢Éú±ä»¯Ê±£¬Êý¾Ý¹ÜÀíÔ±¶¼ÐèÒª½øÐбä¸ü¹ÜÀí£¬ÒÔÈ·± ÓÚÏàÓ¦µÄÓû§¡£ ÔÚÏîÄ¿µÄºóÆÚ£¬±íµÄÉè¼ÆÍê³Éºó£¬¿ªÊ¼ÓÉ DBA ½øÐн¨±í£¬°üÀ¨¿Õ¼ä»®·Ö£¬´æ´¢²ÎÊý ÉèÖ㨸ù¾ÝÊý¾ÝÉè¼ÆÈËÔ±µÄÒªÇó£ © £¬·Ö²¼Êý¾ÝÒÔ»ñµÃ¸ºÔØƽºâ¡£Èç¹û×ñ´Ó OFA£¨ OPTIMAL FLEXIBLE ARCHITECTURE£© DBA ±ØÐë°´ÕÕ µÄÒªÇó½øÐÐÊý¾ÝÎļþ OFA »®·Ö¡£ Îå¡¢ Êý¾Ý¿âÉè¼ÆÕߺÍÊý¾Ý¿â¹ÜÀíÔ± Çø·ÖÊý¾ÝÉè¼ÆÕßºÍ DBA£¬¹Ø¼üµÄÒ»µã²»Í¬ÊÇ£º ¡¤Êý¾ÝÉè¼ÆÈËÔ±µÄ¹¤×÷ÔÚÓÚÊý¾Ý¿âµÄÂß¼-¹¹½¨£¨ÊµÌå¡¢¹Øϵ¡¢±íÉè¼Æ£© ¡¤Êý¾Ý¿â¹ÜÀíÔ±µÄ¹¤×÷ÔÚÓÚÎïÀíÎÊÌâµÄ½â¾ö£¨Êý¾ÝÎļþ¡¢´ÅÅ̸ºÔØ·Öµ£ ÕâÖÖ¹ÛµãÓÐÆäÕýÈ·ÐÔ£¬µ«ÊÇÈç¹ûÑϸñ°´ÕÕÕâÖÖ·Ö·¨£¬Ò²´æÔÚDZÔÚµÄÎÊÌ ÈËÔ±ÓÐÊý¾Ý¿âÎïÀí¹¹½¨·½ÃæµÄ֪ʶ£¬ÊÇÒ»Öֺܺõķ½·¨£¬ÕâʹÊý¾ÝµÄÉè¼Æ ºÍά»¤¡£ÔÚÆû³µÖÆÔìÐÐÒµ£¬ÀàËƵÄÐÐΪ³ÆΪ¡°ÎªÖÆÔì¶øÉè¼Æ¡¡ÉèÏëÉè¼ÆÈËÔ± ±£ ËüÃÇÔÚ¹¦ÄÜÉÏÍêÈ«Ò»Ñù£¬µ«ÆäÒ»µÄÖÆÔì ºÜÁ®¼Û£¬Èç¹ûÉè¼ÆÕßûÓÐÉú²ú·½ÃæµÄ֪ʶ£¬Ëû½ ÖªµÀÄĸö·½°¸¸üÁ®¼Û¡¢¸üÈÝÒ×ʵÏÖ¡£ ÁíÍâÇú½âÕâÒ»¹ÛµãµÄ×ö·¨ÊÇ£ºÈà DBA ¸ºÔðÊý¾Ý¿âÉè¼Æ¡£ÓÐЩÈ˵ÄÈ·ÕâÑù×ö£¬ËûÃÇ ³£½øÐÐÉè¼Æ½ö½ö¿¼ÂÇÈçºÎÒ×ÓÚά»¤£¬¶øºöÂÔÁËÓ¦ÓõÄÒªÇó£¬ÕâÑùµÄÉè¼Æͨ ÒÔÏÂÊǸù¾ÝÈÎÎñµÄ²»Í¬£¬ÁгöÊý¾Ý¿âÉúÃüÖÜÆÚµÄÈÎÎñ·Ö²¼£º Ö´ÐÐÕß ÈÎÎñ ƵÂÊ ÉúÃüÖÜÆÚµÄ ÃèÊö ½×¶Î Éè¼ÆÕß ±íÉè¼Æ Ò»´Î 1 £¬B Éè¼Æ·ûºÏÓ¦ÓÃÒªÇóµÄ±í ½á¹¹£¬µ±ÐèÇó¸Ä±äʱ£¬ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 27. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ×öÏàÓ¦µÄµ÷Õû Ö´ÐÐÕß ÈÎÎñ ƵÂÊ ÉúÃüÖÜÆÚ ÃèÊö Éè¼ÆÕß °²È«Éè¼Æ Ò»´Î 1 È·±£Êý¾Ý ¿âµÄÉè¼ÆÂú×ã Ó¦ÓõݲȫÐÔÒªÇó Ó°Ïì·ÖÎö ¸ù¾ÝÐèÒª A£¬ 2£¬ B µ±Ó¦Óøıäʱ£¬ÉóÊÓÊý ¾Ý¿âÉè¼ÆµÄÄÇЩ·½ÃæÐè ÒªÏàÓ¦µÄµ÷Õû¡£ Êý¾Ý¹ÜÀíÕß Êý¾ÝËùÓÐȨ Ò»´Î 1 È·ÈÏË-ÓµÓÐÄÄЩÊý¾Ý£¬ ²¢¶ÔÖ®½øÐÐά»¤¡£ °²È«²ßÂÔ Ò»´Î 1 ¾ö¶¨Ë-¿ÉÒÔÊÚȨ·ÃÎÊÊý ¾Ý£¬Ë-¿ÉÒÔÔÚʲôʱºò ½«ÄÇЩÊý¾Ý¹²Ïí¸ø±ðÈË ±ä¸ü¹ÜÀí ¸ù¾ÝÐèÒª A£¬ 2£¬ B µ±Ó¦ÓûòÆäÊý¾Ý·¢Éú±ä »¯Ê±£¬È·±£ËùÓÐÊý¾Ý±£ ³ÖÇåÎúµÄËùÓйØϵ£¬Í¨ ÖªÏà¹ØÐèÒª¸Ä±äµÄÓû§ DBA °²×° Ò»´Î 2 °²×°Êý¾Ý¿â ´´½¨Êý¾ÝÎļþ Ò»´Î 2 ΪÌض¨µÄ±í¿Õ¼ä´´½¨Êý ¾ÝÎļþ£¬¼õÉÙ´ÅÅÌ·ÃÎÊ ³ å Í »¸ ù ¾ Ý É è ¼ Æ Ê ¹ Ó Ã £¬ OFA¡£ Öƶ¨±¸·Ý ´ / » Ö ¸ Ò»´Î 2 ½¨Á¢±¸·Ý»Ö¸´·½°¸£¬²¢ ·½°¸ ½øÐвâÊÔ °²È«´ëÊ© Ò»´Î 2 ´´½¨ role,·ÖÅäÊý¾Ý·ÃÎÊ È¨ÏÞ£¬ÏµÍ³È¨ÏÞ£¬´´½¨ Óû§£ ³õʼ»¯Éó¼Æ¹¦ÄÜ¡£ ¬ ±í -±í¿Õ¼äÓ³Éä Ò»´Î 2 ¸ù¾ÝOFA »òÆäËûµÄ×¼ Ôò£¬´´½¨±í -±í¿Õ¼ä¶ÔÓ¦ ¹Øϵ£¬²¢ÏòʹÓÃÎĵµ¼Í ¼ ´´½¨±í Ò»´Î 2£¬ B ÔÚÏàÓ¦µÄ±í¿Õ¼äÉÏ´´½¨ ±í ÎïÀíÖع¹ ¸ù¾ÝÐèÒª 3 ÔÚ±í¿Õ¼äÄÚÖع¹±í£¬´´ ½¨ /¸Ä±äË÷Òý£/¸Ä±ä ¬´´½¨ ´Ø£¬ ÐÔÄܵ÷ÓÅ ¸ù¾ÝÐèÒª 4 3£¬ Æð³õ²éÕÒÎïÀíÅäÖõÄÑÏ ÖØÎÊÌ⣬ÈçË÷ÒýûÓн¨ µÈ¡£µ±Êý¾Ý¿â½¨³Éºó£¬ ͨ¹ýÐÔÄܼà²âÈÎ Îñ£¬¶Ô ÐèÒªµ÷ÕûµÄ²¿·Ö½øÐе÷ ÓÅ¡£ Òì³£¼à²â ÿÌì 2£¬ 4 3£¬ ͨ¹ýOG£¬ L TRACE µÈ ÈÕÖ¾¼ì²éÒì³£Çé¿ö£¬Í¨ ¹ýEMAIL ½ÓÊÜÓû§µÄ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 28. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ÎÊÌⱨ¸æ¡£ ÐÔÄܼà²â ÿÖÜ 4 ¸ù¾ÝÊÂÇ°¶¨ÒåµÄ SLA µÈ£¬¶ÔÊý¾Ý¿âµÄÐÔÄܽø Ðмì²é¡£ Êý¾ÝÎļþ¹ÜÀí ¸ù¾ÝÐèÒª 4 ¸ù¾ÝÐèÒª·Ö²¼Êý¾ÝÎÄ ¼þ£¬À©Õ¹Êý¾Ý±í¿Õ¼ä Ö´ÐÐÕß ÈÎÎñ ƵÂÊ ÉúÃüÖÜÆÚ ÃèÊö DBA Ö´Ðб¸·Ý /»Ö¸´ ÿÌì 4 Ö´ÐÐÔÚÏß¡¢ÀëÏß¡¢ÈÕÖ¾ µÈ±¸·Ý£¬ÐèҪʱ½øÐÐ»Ö ¸´¡£ ±íÐÞ¸Ä ¸ù¾ÝÐèÒª A µ±Ó¦Ó÷¢ÉúСµÄ¸Ä¶¯Ðè Òª±ä¶¯±íʱ£¬ DBA ±ØÐë ÔÚ±£Ö¤ÒÑÓÐÊý¾Ý¿É¿¿ÐÔ Ç°ÌáϽøÐÐÐ޸ġ£ Áù¡¢Êý¾Ý¿âÉúÃüÖÜÆÚÖеÄÈÎÎñ 1¡¢°²×° 2¡¢´´½¨Êý¾ÝÎļþ 3¡¢Öƶ¨±¸·Ý / »Ö¸´¼Æ»® ±¸·Ý /»Ö¸´ÊDZ£Ö¤Êý¾Ý¿â¿ÉÓÃÐÔµÄÖØÒªÊֶΣ¬Òª¾¡¿ÉÄܵĽ«ÒÔÍâµÄÖжϽµµ ²½Ö裺 ¡¤½¨Á¢Êý¾Ý¿âµÄ±¸·Ý»Ö¸´²ßÂÔ ¡¤Ðγɱ¸·Ý»Ö¸´Îĵµ ¡¤²âÊÔ±¸·Ý»Ö¸´ ¡¤ÓÉÆäËûר¼Ò½øÐÐÉó²é ¡¤Ê¹±¸·Ý /»Ö¸´²ßÂÔ·ûºÏ SLA ¡¤Èç¹û×ÊÔ´²»ÄÜ´ïµ½ SLA µÄÒªÇó£¬Öð²½Éý¼¶¡£ 4 ¡¢°²È«²ßÂÔ ¹ØÓÚÊý¾Ý¿â°²È«ÐÔÓÐÈý¸ö¼¶±ð£º UNIX Óû§Ãû /¿ÚÁîÈÏÖ¤ ORACLE Óû§Ãû /¿ÚÁîÈÏÖ¤ ÓëÓ¦ÓÃÏà¹ØµÄ°²È«ÌØÐÔ ÍøÂçµÄÈÏÖ¤ ÓëÊý¾Ý¿âûÓÐÖ±½ÓµÄ¹ØÁª£¬µ«ÊÇËüÒ²¹¹³ÉÁËÒ»¸ö°²È«¼¶¡£ ²½Ö裺 ¡¤¾ö¶¨Ê¹ÓÃÄĸö¼¶±ðµÄ°²È«¿ØÖÆ ¡¤²¿ÊðÏàÓ¦µÄ°²È«»úÖÆ ¡¤¸ù¾ÝÐèÒª¹ÜÀíÓû§¡¢½ÇÉ« ¡¤¼ì²é°²È«»úÖÆ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 29. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ 5 ¡¢±í ±í¿Õ¼ä¶ÔÓ¦ - 6 ¡¢½¨±í 7 ¡¢ÎïÀíÔªËØÖØ×é °üº¬ÒÔÏ£º ¡¤½«Ò»¸ö±íÓÉÒ»¸ö±í¿Õ¼ä°áÒƵ½ÁíÒ»¸ö ¡¤´´½¨ËùÐèµÄË÷Òý ¡¤´´½¨¼¯´Ø ¡¤¶¨Òåˮƽ·Ö¸î ¡¤Ñ¹Ëõ±íµÄ extents£¬Í¨¹ý backup/exp/drop/imp ¡¤Ñ¹ËõË÷ÒýµÄ extent£¬Í¨¹ý drop/re-create ORACLE ÎïÀí´æ´¢µÄ¼¸¸ö¸ÅÄ ¡¤ Data blocks ×îСµÄ´æ´¢Á£¶È£¬ËùÓеÄORACLE Êý¾ÝÒÔ BLOCK Ϊµ¥Î»´æ´¢ºÍ·ÖÅä¿Õ ¼ä£¨ÓÖ³ÆÂß¼-¿é¡¢ ¿é¡¢Ò³£ ORACLE © ¡£Ò»¸öÊý¾Ý¿é¶ÔÓ¦×ÅÒ»¶¨ BYTES µÄ ´ÅÅ̿ռ䣬µ±Êý¾Ý¿â´´½¨Ê±¼´Ö¸¶¨ÁËÊý¾Ý¿é´óС¡£ Ïà±È½Ï£¬²Ù×÷ϵͳµÄ¿é½ö½öÊÇÒ»¶¨ÊýÁ¿µÄ BYTES ¼¯ºÏ£¬Êý¾ÝµÄÎïÀí´æ´¢ ÒÔ BYTE Ϊµ¥Î»¡£ ¡¤ Extents EXTENT ÊÇÒ»¶¨Á¬ÐøµÄ µÄ¼¯ºÏ£¬ÓÃÓÚ·ÖÅä´æ´¢Ò»¸öÌض¨µÄÐÅÏ¢¡£ BLOCK ¡¤ Segments Âß¼-ÉÏ EXTENT Ö®ÉÏÊÇSEGMENT £¬ SEGMENT ÊÇÒ»¸öEXTENT µÄ¼¯ºÏ£¬ ÓÃÓÚ¸øÒ»¸öÌض¨µÄ½á¹¹·ÖÅä¿Õ¼ä£¬ SEGMENT ÏÞÖÆÔÚÒ» ¸ö±í¿Õ¼äÖС£ 8¡¢ÐÔÄܵ÷ÓÅ ÐÔÄܵ÷ÕûÊÇÒ»¸ö³¤ÆڵĹý³Ì£¬ÕýÈ·µÄµ÷ÓÅ¿ÉÒÔ´øÀ´ºÜ´óµÄºÃ´¦£¬µ«ÊÇ ¿ÉÄÜ»á´øÀ´¸ºÃæµÄÓ°Ï죬ËæÒâµÄµ÷Õû¿ÉÄÜ´øÀ´²»¿ÉÔ¤ÖªµÄºó¹û¡£ ͨ³£µ÷ÓűØÐëÔÚÒ»¶¨µÄÔ¼¶¨·¶Î§ÄÚ½øÐУ¬²¢×ñÑ-Ô¤ÏÈÉèÖõÄ×¼Ôò£¬Õâ ÄÜ¿ÉÒÔ±»¶ÈÁ¿¡¢¿ÉÐÅÀµºÍ¾«È·¡£ ÔÚÈçϵÄÇé¿öϲŽøÐÐÊý¾Ý¿âµ÷ÓÅ£º £¨ 1£©ÓÐÊʵ±µÄ SLA £¨ 2£©ÓпÉÐÅÀµµÄÐÔÄܶÈÁ¿Ö¸±ê £¨ 3£©Êý¾Ý¿âûÓдﵽ SLA µÄÐÔÄÜÒªÇó ÓÐÁ½ÖÖ¿ÉÒÔ½ÓÊܵĵ÷ÓŽá¹û£º £¨ 1£©Êý¾Ý¿âµÄÐÔÄÜ´ïµ½ÁË SLA µÄÒªÇó £¨ 2£©µ÷ÓŵIJ»¿ÉÐлò²»¿ÉÄÜ£¬ SLA µÄ±ê×¼¾-¹ýÐ-ÉÌ ½ÓÊÜÄ¿Ç°µÄÐÔÄÜ 9¡¢Òì³£Çé¿ö¼à²â Òì³£¼à²âÊÇ ×îÖØÒªµÄÀýÐй¤×÷£¬Ëü¿ÉÒÔʹ DBA DBA Ô¤ÏÈ·¢ÏÖÎÊÌâµÄÇ°Õס£ DBA ÖÁÉÙÐèÒª¼à²â£º £¨1£© Óû§·´Ó³µÄÒì³£Çé¿ö£¬³ö´íÐÅÏ¢µÈ£¨ DBA Ó¦¸ÃÏêϸ¼Ç¼ÏÂÀ´£© £¨2£© ÔÚalert¡¢ trace µÈÈÕÖ¾ÖеÄÒì³£¼Ç¼ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 30. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ 10 ¡¢ÐÔÄܼà²â ÕâÏ×÷ʹ ¸ÐÊÜÊý¾Ý¿â·¢ÉúÎÊÌâµÄ¶úÄ¿£¬ÖÁÉÙÐèÒª×ö£º DBA £¨ 1£© ÿ¸ö±í¿Õ¼ä¿ÕÏÐÄÚ´æµÄËéƬÇé¿ö £¨ 2£© ÿ¸ö±í¿Õ¼äµÄ¿ÕÏÐ¿Õ¼ä £¨ 3£© Êý¾Ý¿âµÄÔö³¤ÂÊ £¨ 4£© ²âËã³öÊý¾Ý¿âÄ¿Ç°×ÊԴʲôʱºò»áºÄ¾¡ £¨ 5£© ÿ¸ö±í¡¢Ë÷Òý³¬¹ýÃÅÏÞµÄ extent ÊýÁ¿ £¨ 6£© ¶Ô²éѯ»òÊÂÎñ£¨ insert,update,delete£©µÄÏìӦʱ¼ä £¨ 7£© alert,trace ÈÕÖ¾ÖÐÒì³£µÄ¼Ç¼ 11 ¡¢Êý¾ÝÎļþ¹ÜÀí 12 ¡¢Ö´Ðб¸·Ý / »Ö¸´ 13 ¡¢±íµÄÐÞ¸Ä DBA Æß¡¢ Êý¾Ý¿âÉúÃüÖÜÆÚºÍ µÄÈÎÎñ ʲôʱºò×öʲôÈÎÎñ£¬Ç°ÌáÊÇÊý¾Ý¿âÒѾ-´¦ÓÚ¡°³É 1¡¢ÐÔÄܼà²â ÐÔÄܼà²â±ØÐëÒÀÕÕ SLA ²¢¾-³£ÓÉÓû§½øÐз´À¡£¬¸ù¾Ý¾-Ñ飬µ±ÏµÍ³¸Õ¸Õ½¨³Éʱ ÿÌì¼à²â£¬µ±ÏµÍ³ÒѾ-Îȶ¨£¬Ã¿Öܼà²âÒ»´Î¡£ £¨ 1£©Ã¿¸ö±í¿Õ¼ä¿ÕÏпռäµÄËéƬÇé¿ö Èç¹û³öÏÖ·ä³²×´ËéƬ£¬ÔòʹÓÃÕ³ºÍ¹¤¾ß£¨ ORACLE7 ÒÔ ºó°æ±¾×Ô¶¯½øÐÐ coalescing ¹¤×÷£ ©£»Èç¹û¿Õ¶´µÄËéƬ̫´ó£¬¿ÕÏпռä½ÏС£¬ÔòºöÂÔ¿Õ¶´£¬ÔÚ½¨Á¢ ¼þ£»Èç¹û´Ëʱ´ÅÅÌ¿Õ¼ä¹ýС£¬Ôò½øÐÐ backup/exp/drop/imp À´ÖØÐÂÕûÀí¡£ £¨ 2£©Ã¿¸ö±í¿Õ¼äµÄÊ£Óà¿Õ¼ä £¨ 3£©¼ÆËã±í¿Õ¼ä¿ÕÏÐÂÊ ×¢ÒâEMP ²»ÔÚ¹Ø×¢Ö®ÄÚ£¬È·ÈÏ Ê¹ÓÃÁË T ROLLBACK OPTIMAL ´æ´¢²ÎÊý¡£ £¨ 4£©¹Øעʲôʱºò¿Õ¼ä»áºÄ¾¡ £¨ 5£©¹Ø×¢´óÓÚEXTENT µÄ¶ÔÏó 4 ¸ö ¶¨ÆÚѹËõ EXTENT £¬Èç¹ûij¸ö¶ÔÏóµÄ ×ܱ»Ñ¹Ëõ£¬Ó¦¿¼ÂÇÔö¼ÓÆä EXTENT NEXT EXTENT ´óС£¬Èç ¹ûij¸ö¶ÔÏó´ïµ½ÁË×î´óµÄ EXTENT Êý£¬Ó¦Á¢¼´Ôö¼Ó NEXT ºÍѹËõ¡£ £¨ 6£©¼ì²é²âÊÔ²éѯ¡¢ÐÞ¸ÄÀý³ÌµÄÏìӦʱ¼ä ¹¹½¨Àý³ÌÊǵÄÒ»²¿·Ö£¬Ò»µ© SLA SLA Ð-ÉÌÈ·¶¨ÏÂÀ´£¬¶¨ÆÚÔËÐÐÒÔºâÁ¿Êý¾Ý¿âµÄ ÔËÐÐÇé¿ö£¬Èç¹û³öÏÖÎÊÌâʱÀý³ÌûÓбíÏÖ³öÀ´£¬Ôò¸ü»»Àý³Ì¡£ £¨ 7£©¸ù¾Ý ¼Ç¼ÏìӦʱ¼ä SLA £¨ 8£©Ã¿Ìì¼ì²éÏà¹ØµÄÈÕÖ¾Îļþ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 31. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ £¨ 9£©¼Ç¼Ï·¢ÏÖµÄÎÊÌâ»òÒì³£ÏÖÏó 2¡¢Öƶ¨±¸·Ý / »Ö¸´¼Æ»® £¨ 1£©¸ù¾Ý Öƶ¨±¸·Ý¼Æ»®£¬²¢Éú³ÉÎĵµ SLA £¨ 2£©ÓÉÆäËûר¼Ò½øÐÐÈ·ÈÏ £¨ 3£©Õë¶ÔÖ÷ÒªµÄÊý¾Ý¿â·¢ÉúÎÊÌâµÄÇé¿ö£¬Öƶ¨»Ö¸´ ·½°¸£¬²¢Éú³ÉÎĵµ £¨ 4£©ÔÚ²âÊÔ ORACLE INSTANCE ÉϽøÐлָ´¼Æ»®²âÊÔ £¨ 5£©Èç¹û µÄij¸öÒªÇó´ï²»µ½£¬»òÕ߸Ľø·½°¸»òÐÞ¸Ä SLA SLA 3 ¡¢Ö´Ðб¸·Ý / »Ö¸´ Ïêϸ¼Ç¼ÏÂËùÓеIJÙ×÷²½ÖèºÍʱ¼ä¡£ 4¡¢ Service Level Agreement £¨ SLA Ó¦¸Ã¾ÍÊý¾Ý¿â·þÎñµÄÒÔÏ·½Ãæ»®·Ö³ö¼¶±ð 1£© ¡¤ÁгöÍ£»úʱ¼ä±í £ºhours/day , days/week , days/year ¡¤´¦ÀíµäÐͲéѯ¡¢ÊÂÎñµÄÏìӦʱ¼ä ¡¤ÔÚ±ÀÀ£Çé¿öÏ£¬×µÄ»Ö¸´Ê±¼äºÍ×î´óµÄÊý¾ÝËðʧÇé¿ö £¨ SLA µÄ 2£© ϸ½Ú½«ÔÚ µÄÈÎÎñÖÐÌåÏÖ DBA Èç ¡ ¤¡°Ã¿ÄêµÄ×î´óÍ£»úʱ¼ä¡± ==¡µDBA ¼à²âÊý¾Ý¿âµÄƵÂÊ ¡ ¤¡°×î´óÊý¾ÝËðʧ¡± ÎļþµÄ´óС£¬µÄ¼ä¸ô ==¡µlog CKPT HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 32. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ °Ë¡¢ DBA ÈÎÎñÁ÷³Ì£¨¶ÔÓÚ³ÉÊìÊý¾Ý¿â£© ²Ù×÷¼¶±ðÐ-Òé £¨OLA£© No ×ÊÔ´¿ÉÒÔÂú×ãOLA ²Ù×÷¹ÜÀí Yes ¼à²âÊý¾Ý¿â Ö´Ðб¸·Ý /»Ö¸´ÈÎÎñ Ê£Óà¿Õ¼ä Êý¾ÝÔö³¤Çé ¿ö Ôö³¤ÂÊ ËéƬ Êý¾ÝÎļþ¹Ü ÎïÀíÖع¹ Àí ¶ÔÏóµÄ extentÊýÄ¿ Êý¾Ý¿âµ÷ÓÅ ÏìӦʱ¼ä ÈÕÖ¾¡¢Óû§Í¶ ÆäËû²Ù×÷(Èç¼Ó Ëß Èí¼þpatch) ¾Å¡¢ Ð-ÒéÑù±¾ SLA Service Level Agreement ·þÎñ ¼¶±ð¶¨Òå ϵͳÔËÐÐʱ¼ä 24 Сʱ ϵͳ¿ÉÓÃʱ¼ä 24 Сʱ £¬7 Ìì /Ìì /ÖÜ Èȱ¸·ÝƵÂÊ Ã¿Ì죬ÔöÁ¿±¸·Ý archive log À䱸·ÝƵÂÊ Ã¿Äê4 ´Î ÿ´Î±ÀÀ£×î´óÊý¾ÝËðʧ ²»´óÓÚÒ»ÌìµÄÊý¾Ý ´ÓÈí±ÀÀ££¨Èç¶Ïµç£©Æô¶¯Ê±¼ä ·ÖÖÓÄÚ µçÔ´Õý³£ºó15 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 33. ITPUB µç×ÓÔÓÖ¾ Êý¾Ý¿â¹ÜÀí³ÉÊì¶ÈÄ£ÐÍ ´ÓÓ²±ÀÀ££¨Èç´ÅÅÌʧЧ£¬µ«ÊDz»¶ªÊ§ Êý¾Ý£©Æô¶¯Ê±¼ä ¸ü»»Ó²¼þ 1 Сʱ£¬Æô¶¯ 15 ·ÖÖÓÄÚÍê³É ´ÓÓ²±ÀÀ££¨Èç´ÅÅÌʧЧ£¬Ëð»µÊý¾Ý£© 1 Сʱ¸ü»»Ó²¼þ£¬ 15 ·ÖÖÓÆô¶¯Êý¾Ý¿â£¬ 3 Сʱ´Ó±¸·Ý Æô¶¯Ê±¼ä »Ö¸´ ÿÄêå´»úʱ¼ä 12 Ìì /Ä꣬һÌì /Ô£¬Ã¿Ôµĵڶþ¸öÖÜÁù BUG ±¨¸æÏìӦʱ¼ä Ð-ÉÌ ÔöÇ¿¹¦ÄÜÏìӦʱ¼ä Ð-ÉÌ ÐÂÓ¦ÓÃÐèÇóÏìӦʱ¼ä Ð-ÉÌ ²éѯÏìӦʱ¼ä Ð-ÉÌ£¨ÐèÒªÖƶ¨Ö¸±ê²âÊÔ³ÌÐò£© ÿÄê×ܼƼƻ®Í£ »úʱ¼ä 12 Сʱ ¼Æ»®Í£»úʱ¼ä ÀͶ¯½Ú¡¢¸Ð¶÷½Ú¡¢Ê¥µ®½Ú¡¢ÐÂÄ꣬ÿ´Î 3 Сʱ ÿÄê»ú¶¯Í£»úʱ¼ä 4 Сʱ /Äê HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 34. ITPUB µç×ÓÔÓÖ¾ ORACLE8i º¯Êý½éÉÜ£¨ Ò»£© oracle8i º¯Êý½éÉÜ (Ò» ):RANK(),DENSE_RANK() ×÷Õß : jlandzpa RANK(),DENSE_RANK()ÊÇoracle8i µÄÁ½¸öÓÐȤµÄ·ÖÎöº¯Êý , ¿ÉÒÔÓÃÀ´½â¾ö top-N ÎÊÌâ . Á½¸öº¯ÊýµÄÇø±ð¿ÉÒÔ´ÓÏÂÃæÀý×ÓÖп´³ö£º create table emp (Empno varchar2(10), Ename varchar2(10), Job varchar2(10), Mgr varchar2(10), Sal varchar2(10) ); insert into emp values('Empno1','Ename1','Job1','Mgr1','1'); insert into emp values('Empno2','Ename2','Job2','Mgr2','2'); insert into emp values('Empno3','Ename3','Job3','Mgr3','3'); insert into emp values('Empno4','Ename4','Job4','Mgr4','4'); insert into emp values('Empno5','Ename5','Job5','Mgr5','5'); insert into emp values('Empno6','Ename6','Job6','Mgr6','6'); insert into emp values('Empno7','Ename7','Job7','Mgr7','4'); insert into emp values('Empno8','Ename8','Job8','Mgr7','5'); insert into emp values('Empno9','Ename9','Job9','Mgr7','6'); commit; SELECT Empno, Ename, Job, Mgr, Sal, RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Rank, DENSE_RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Drank FROM Emp ORDER BY SAL Desc NULLS LAST; EMPNO ENAME JOB MGR SAL RANK DRANK ---------- ---------- ---------- ---------- ---------- ---------- ---------- Empno6 Ename6 Job6 Mgr6 6 1 1 Empno9 Ename9 Job9 Mgr7 6 1 1 Empno5 Ename5 Job5 Mgr5 5 3 2 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 35. ITPUB µç×ÓÔÓÖ¾ ORACLE8i º¯Êý½éÉÜ£¨ Ò»£© Empno8 Ename8 Job8 Mgr7 5 3 2 Empno4 Ename4 Job4 Mgr4 4 5 3 Empno7 Ename7 Job7 Mgr7 4 5 3 Empno3 Ename3 Job3 Mgr3 3 7 4 Empno2 Ename2 Job2 Mgr2 2 8 5 Empno1 Enam e1 Job1 Mgr1 1 9 6 ½á¹ûÊDz»ÊǺÜÆæÃÈç¹ûÎÒÃÇ×Ô¼ºÐ´ sql ʵÏÖ£¬ÊÇÐèҪһЩ¼¼Çɵġ£ 1. ÀûÓà RANK()¿ÉÒÔʵÏÖ - N ÎÊÌâ top sql ¿ÉÒÔÏÔʾ ÏÂÃæÕâ¸ö ,×î´óµÄ¼¸¸ö Sal,Ïàͬal µÄ¼Ç¼ҲͬÑùÏÔʾ S . SELECT Empno, Ename, Job, Mgr, Sal FROM (SELECT Empno, Ename, Job, Mgr, Sal, RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank FROM Emp ORDER BY SAL Desc NULLS LAST) WHERE Emp_Rank = 1; EMPNO ENAME JOB MGR SAL ---------- ---------- ---------- ---------- ---------- Empno6 Ename6 Job6 Mgr6 6 Empno9 Ename9 Job9 Mgr7 6 SELECT Empno, Ename, Job, Mgr, Sal FROM (SELECT Empno, Ename, Job, Mgr, Sal, RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank FROM Emp ORDER BY SAL Desc NULLS LAST) WHERE Emp_Rank < 4; EMPNO ENAME JOB MGR SAL ---------- ---------- ---------- ---------- ---------- Empno6 Ename6 Job6 Mgr6 6 Empno9 Ename9 Job9 Mgr7 6 Empno5 Ename5 Job5 Mgr5 5 Empno8 Ename8 Job8 Mgr7 5 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 36. ITPUB µç×ÓÔÓÖ¾ ORACLE8i º¯Êý½éÉÜ£¨ Ò»£© SELECT Empno, Ename, Job, Mgr, Sal FROM (SELECT Empno, Ename, Job, Mgr, Sal, RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank FROM Emp ORDER BY SAL Desc NULLS LAST) WHERE Emp_Rank < 3; EMPNO ENAME JOB MGR SAL ---------- ---------- ---------- ---------- ---------- Empno6 Ename6 Job6 Mgr6 6 Empno9 Ename9 Job9 Mgr7 6 2. ÀûÓà RANK()¿ÉÒÔʵÏÖ top(n,m) ÎÊÌâ . SELECT Empno, Ename, Job, Mgr, Sal FROM (SELECT Empno, Ename, Job, Mgr, Sal, RANK() OVER (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank FROM Emp ORDER BY SAL Desc NULLS LAST) WHERE Emp_Rank > 3 and Emp_Rank < 6; EMPNO ENAME JOB MGR SAL ---------- ---------- ---------- ---------- ---------- Empno4 Ename4 Job4 Mgr4 4 Empno7 Ename7 Job7 Mgr7 4 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 37. ITPUB µç×ÓÔÓÖ¾ ORACLE µÄ¸ôÀ뼶±ð ORACLE µÄ¸ôÀ뼶±ð isolation level£© ¸ôÀ뼶±ð£¨ ¡¤¸ôÀ뼶±ð¶¨ÒåÁËÊÂÎñÓëÊÂÎñÖ®¼äµÄ¸ôÀë³Ì¶È¡£ ¡¤¸ôÀ뼶±ðÓë²¢·¢ÐÔÊÇ»¥ÎªÃ¬¶ÜµÄ£º¸ôÀë³Ì¶ÈÔ½¸ß£¬Êý¾Ý¿âµÄ²¢·¢ÐÔÔ½²î£ Êý¾Ý¿âµÄ²¢·¢ÐÔÔ½ºÃ¡£ ¡¤ANSI/ISO SQL92 ±ê×¼¶¨ÒåÁËһЩÊý¾Ý¿â²Ù×÷µÄ¸ôÀ뼶±ð£º ¡¤Î´Ìá½»¶Á£¨ read uncommitted£© ¡¤Ìá½»¶Á£¨ read committed£© ¡¤Öظ´¶Á£¨ repeatable read£© ¡¤ÐòÁл¯£¨ serializable£© ¡¤Í¨¹ýһЩÏÖÏ󣬿ÉÒÔ·´Ó³³ö ¸ôÀ뼶±ðµÄЧ¹û¡£ÕâЩÏÖÏóÓУº ¡¤¸üжªÊ§£¨ lost update£ © £ºµ±ÏµÍ³ÔÊÐíÁ½¸öÊÂÎñͬʱ¸üÐÂͬһÊý¾ÝÊÇ£¬·¢Éú¸üÐ ¡¤Ôà¶Á£¨ read£ dirty © £ºµ±Ò»¸öÊÂÎñ¶ÁÈ¡ÁíÒ»¸öÊÂÎñÉÐδÌá½»µÄÐÞ¸Äʱ£¬²úÉúÔà ¡¤·ÇÖظ´¶Á£¨ nonrepeatable read£© £ºÍ¬Ò»²éѯÔÚͬһÊÂÎñÖжà´Î½øÐУ¬ÓÉÓÚÆäËûÌ ÊÂÎñËù×öµÄÐ޸Ļòɾ³ý£¬Ã¿´Î·µ»Ø²»Í¬µÄ½á¹û¼¯£¬´Ëʱ·¢Éú·ÇÖظ´¶Á¡£ (A transaction rereads data it has previously read and finds that another committed transaction has modified or deleted the data. ) ¡¤»ÃÏñ£¨ phantom read£ ©£ºÍ¬Ò»²éѯÔÚͬһÊÂÎñÖжà´Î½øÐУ¬ÓÉÓÚÆäËûÌá½»ÊÂÎñ ²åÈë²Ù×÷£Ã¿´Î·µ»Ø²»Í¬µÄ½á¹û¼¯£´Ëʱ·¢Éú»ÃÏñ¶Á¡£a query ¬ ¬(A transaction reexecutes returning a set of rows that satisfies a search condition and finds that another committed transaction has inserted additional rows that satisfy the condition. ) ¡¤ÏÂÃæÊǸôÀ뼶±ð¼°Æä¶ÔÓ¦µÄ¿ÉÄܳöÏÖ»ò²»¿ÉÄܳöÏÖµÄÏÖÏó Dirty Read NonRepeatable Phantom Read Read Read uncommitted Possible Possible Possible Read committed Not possible Possible Possible Repeatable read Not possible Not possible Possible Serializable Not possible Not possible Not possible ORACLE µÄ¸ôÀ뼶±ð ¡¤RACLE ÌṩÁË O SQL92 ±ê×¼ÖÐµÄ committed ºÍ read serializable£¬Í¬Ê±ÌṩÁË·Ç SQL92 ±ê×¼µÄ read-only¡£ ¡¤ read committed£º ¡¤ÕâÊÇ ORACLE ȱʡµÄÊÂÎñ¸ôÀ뼶±ð¡£ ¡¤ÊÂÎñÖеÄÿһÌõÓï¾ä¶¼×ñ´ÓÓï¾ä¼¶µÄ¶ÁÒ»ÖÂÐÔ¡£ ¡¤±£Ö¤²»»áÔà¶Á£»µ«¿ÉÄܳöÏÖ·ÇÖظ´¶ÁºÍ»ÃÏñ¡£ ¡¤ serializable£º HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 38. ITPUB µç×ÓÔÓÖ¾ ORACLE µÄ¸ôÀ뼶±ð serializable ¾ÍÊÇʹÊÂÎñ¿´ÆðÀ´ÏóÊÇÒ»¸ö½Ó×ÅÒ»¸öµØ˳ÐòµØÖ´ÐС ¡¤¼òµ¥µØ˵£¬ ¡¤½ö½öÄÜ¿´¼ûÔÚ±¾ÊÂÎñ¿ªÊ¼Ç°ÓÉÆäËüÊÂÎñÌá½»µÄ¸ü¸ÄºÍÔÚ±¾ÊÂÎñÖÐËù ¡¤±£Ö¤²»»á³öÏÖ·ÇÖظ´¶ÁºÍ»ÃÏñ¡£ ¡¤ Serializable¸ôÀ뼶±ðÌṩÁË read-onlyÊÂÎñËùÌṩµÄ¶ÁÒ»ÖÂÐÔ£¨ÊÂÎñ¼¶µÄ¶ÁÒ»Ö ÐÔ£ © £¬Í¬Ê±ÓÖÔÊÐí DML²Ù×÷¡£ ¡¤Èç¹ûÓÐÔÚ serializable ÊÂÎñ¿ªÊ¼Ê±Î´Ìá½»µÄÊÂÎñÔÚ serializable ÊÂÎñ½áÊø֮ǰÐÞ¸Ä ÁË serializable ÊÂÎñ½«ÒªÐ޸ĵÄÐв¢½øÐÐÁËÌá½»£¬Ôò serializable ÊÂÎñ²»»á¶Áµ½ÕâЩ ±ä¸ü£¬Òò´Ë·¢ÉúÎÞ·¨ÐòÁл¯·ÃÎʵĴíÎó¡ £ £¨»»Ò»ÖÖ½âÊÍ·½·¨£ºÖ»ÒªÔÚ serializable Ê Îñ¿ªÊ¼µ½½áÊøÖ®¼äÓÐÆäËûÊÂÎñ¶Ô serializable ÊÂÎñÒªÐ޸ĵĶ«Î÷½øÐÐÁËÐ޸IJ¢Ìá½» ÁËÐ޸ģ¬Ôò·¢ÉúÎÞ·¨ÐòÁл¯·ÃÎʵĴíÎó¡© £ £ ¡¤ a serializable transaction contains data manipulation language (DML) that If attempts to update any resource that may have been updated in a transaction uncommitted at the start of the serializable transaction, £¨²¢ÇÒÐÞ¸ÄÔÚºóÀ´±»Ìá½» ¶øûÓлعö£¬the DML statement fails. ·µ»ØµÄ´íÎóÊÇ then ©£ ORA-08177: Cannot serialize access for this transaction¡£ ¡¤ RACLE ÔÚÊý¾Ý¿éÖмǼ O ×î½ü¶ÔÊý¾ÝÐÐÖ´ÐÐÐ޸IJÙ×÷µÄ N ¸öÊÂÎñµÄÐÅÏ¢£¬Ä¿µÄÊÇ È·¶¨ÊÇ·ñÓÐÔÚ±¾ÊÂÎñ¿ªÊ¼Ê±Î´Ìá½»µÄÊÂÎñÐÞ¸ÄÁ˱¾ÊÂÎñ½«ÒªÐ޸ĵÄÐÐ ¼ûÓ¢ÎÄ£º Oracle permits a serializable transaction to modify a data row only if it can determine that prior changes to the row were made by transactions that had committed when the serializable transaction began. To make this determination efficiently, Oracle uses control information stored in the data block that indicates which rows in the block contain committed and uncommitted changes. In a sense, the block contains a recent history of transactions that affected each row in the block. The amount of history that is retained is controlled by the INITRANS parameter of CREATE TABLE and ALTER TABLE. Under some circumstances, Oracle may have insufficient history information to determine whether a row has been updated by a "too recent" transaction. This can occur when many transactions concurrently modify the same data block, or do so in a very short period. You can avoid this situation by setting higher values of INITRANS for tables that will experience many transactions updating the same blocks. Doing so will enable Oracle to allocate sufficient storage in each block to record the history of recent transactions that accessed the block. ¡¤ The INITRANS Parameter£º Oracle stores control information in each data block to manage access by concurrent transactions. Therefore, if you set the transaction isolation level to serializable, you must use the ALTER TABLE command to set INITRANS to at least 3. This parameter will cause Oracle to allocate sufficient storage in each block to record the history of recent transactions that accessed the block. Higher values should be used for tables that will undergo many transactions updating the same blocks. ¡¤ read-only£º ¡¤×ñ´ÓÊÂÎñ¼¶µÄ¶ÁÒ»ÖÂÐÔ £¬½ö½öÄÜ¿´¼ûÔÚ±¾ÊÂÎñ¿ªÊ¼Ç°ÓÉÆäËüÊÂÎñÌá½»µÄ¸ü¸Ä ¡¤²»ÔÊÐíÔÚ±¾ÊÂÎñÖнøÐÐ DML ²Ù×÷¡£ ¡¤ read only ÊÇ serializable µÄ×Ó¼¯¡£ËüÃǶ¼±ÜÃâÁË·ÇÖظ´¶ÁºÍ»ÃÏñ¡£Çø±ðÊÇÔÚ read only ÖÐÊÇÖ»¶Á£»¶øÔÚ serializable ÖпÉÒÔ½øÐÐ ²Ù×÷¡£ DML HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 39. ITPUB µç×ÓÔÓÖ¾ ORACLE µÄ¸ôÀ뼶±ð Export with CONSISTENT = Y sets the transaction to read-only. ¡¤ ¡¤read committed ºÍ serializable µÄÇø±ðºÍÁªÏµ£º ¡¤ÊÂÎñ 1 ÏÈÓÚÊÂÎñ 2 ¿ªÊ¼£¬²¢±£³ÖδÌύ״̬¡£ÊÂÎñ 2 ÏëÒªÐÞ¸ÄÕý 1 ÐÞ¸ÄµÄ ±»ÊÂÎñ ÐС 2 µÈ´ý¡ £ ÊÂÎñ £Èç¹ûÊÂÎñ ¬ 1 »Ø¹ö£ ÔòÊÂÎñ 2 ¨²»ÂÛÊÇ committed »¹ÊÇ £ read serializable ·½Ê½£©½øÐÐËüÏëÒª×öµÄÐ޸ġ£Èç¹ûÊÂÎñ2 ÊÇ 1 Ìá½»£¬Ôòµ±ÊÂÎñ committed ·½Ê½ read ʱ£¬½øÐÐËüÏëÒª×öµÄÐ޸ģ»µ±ÊÂÎñ ·½Ê½Ê±£¬Ê§°Ü²¢±¨´í¡° 2 ÊÇserializable Cannot serialize access¡¬ÒòΪÊÂÎñ ± £ 2 ¿´²»¼ûÊÂÎñ 1 Ìá½»µÄÐ޸ģ¬ÇÒÊÂÎñ 2 ÏëÔÚÊÂÎñÒ»ÐÞ ¸ Ä µ Ä » ù ´ ¡ É Ï Ô Ù × ö Ð Þ ¸ Ä û Ó Both read committed and serializable ¡£¾ßÌå¼ ¢ÎÄ£º transactions use row-level locking, and both will wait if they try to change a row updated by an uncommitted concurrent transaction. The second transaction that tries to update a given row waits for the other transaction to commit or roll back and release its lock. If that other transaction rolls back, the waiting transaction (regardless of its isolation mode) can proceed to change the previously locked row, as if the other transaction had not existed. However, if the other (blocking) transaction commits and releases its locks, a read committed transaction proceeds with its intended update. A serializable transaction, however, fails with the error "Cannot serialize access", because the other transaction has committed a change that was made since the serializable transaction began. ¡¤ read committed ºÍ serializable ¿ÉÒÔÔÚORACLE ²¢ÐзþÎñÆ÷ÖÐʹÓᣠ¡¤¹ØÓÚ TRANSACTION READ WRITE£º SET read write ºÍ read committed Ó¦¸ÃÊÇÒ» ÑùµÄ¡ £ÔÚ¶Á·½Ãæ£ ¬ËüÃǶ¼±ÜÃâÁËÔà¶Á£ ¬µ«¶¼ÎÞ·¨ÊµÏÖÖظ´¶Á¡ read write £ ËäȻûÓÐÎĵµË ÔÚд·½ÃæÓë committed Ò»Ö£¬µ«ÏÔÈ»ËüÔÚдµÄʱºò»á¼ÓÅÅËûËøÒÔ±ÜÃâ¸üж read ÔÚ¼ÓËøµÄ¹ý³ÌÖУ¬Èç¹ûÓöµ½´ýËø¶¨×ÊÔ´ÎÞ·¨Ëø¶¨£¬Ó¦¸ÃÊǵȴý¶ø²»ÊÇ·Å read committed Ò»Ö¡£ ¡¤Óï¾ä¼¶µÄ¶ÁÒ»ÖÂÐÔ ¡¤ORACLE ±£Ö¤Óï¾ä¼¶ µÄ¶ÁÒ»ÖÂÐÔ£¬¼´Ò»¸öÓï¾äËù´¦ÀíµÄÊý¾Ý¼¯ÊÇÔÚµ¥Ò»Ê±¼ä Êý¾Ý¼¯£¬Õâ¸öʱ¼äµãÊÇÕâ¸öÓï¾ä¿ªÊ¼µÄʱ¼ä¡£ ¡¤Ò»¸öÓï¾ä¿´²»¼ûÔÚËü¿ªÊ¼Ö´ÐкóÌá½»µÄÐ޸ġ£ ¡¤¶ÔÓÚ Óï¾ä£¬Ëü¿´²»¼ûÓÉ×Ô¼ºËù×öµÄÐ޸ģ¬¼´ DML DML Óï¾ä¿´¼ûµÄÊÇËü±¾Éí¿ªÊ¼Ö´ ÐÐÒÔÇ°´æÔÚµÄÊý¾Ý¡£ ¡¤ÊÂÎñ¼¶µÄ¶ÁÒ»ÖÂÐÔ ¡¤ÊÂÎñ¼¶µÄ¶ÁÒ»ÖÂÐÔ±£Ö¤ÁË¿ÉÖظ´¶Á£¬²¢±£Ö¤²»»á³öÏÖ»ÃÏñ¡£ ¡¤ÉèÖøôÀ뼶±ð ¡¤ÉèÖÃÒ»¸öÊÂÎñµÄ¸ôÀ뼶±ð ¡¤ SET TRANSACTION ISOLATION LEVEL READ COMMITTED; ¡¤ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; ¡¤ SET TRANSACTION READ ONLY; ¡¤ÉèÖÃÔö¸ö»á»°µÄ¸ôÀ뼶±ð ¡¤ ALTER SESSION SET ISOLATION_LEVEL SERIALIZABLE; ¡¤ ALTER SESSION SET ISOLATION_LEVEL READ COMMITTED; ================================== HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 40. ITPUB µç×ÓÔÓÖ¾ BANN ϵͳµÄ²úÆ·ÅäÖà BAAN ϵͳµÄ²úÆ·ÅäÖà ×÷Õß : ITPUB κÖÎ (W39) Ò»¡¢ºÎν²úÆ·ÅäÖà ¹«Ë¾µÄ¾ºÕùÁ¦Ô½À´Ô½ÌåÏÖÔÚËûÄܲ»ÄÜÔÚ×î¶ÌµÄʱ¼ä ˾µÄ²úÆ·ÐòÁÐÖÐÒ²½«³öÏÖÔ½À´Ô½¶àµÄ¡°±ê×¼²úÆ·¡±µÄ± -----¼´Õë¶Ô²»Í¬¿Í»§×öÊʵ±µÄÐ޸ġ£ BAAN ϵͳµÄ PCF£¨ Product Configuration£©Ä£¿é¾ÍÊÇÕâÀàÆóÒµ×î¼ÑµÄ½â¾ö·½°¸¡£ ²úÆ·ÅäÖÃÊÇÖ¸ÔÚ±ê×¼²úÆ·½á¹¹ÉÏÅäÖóö¶àÖÖ±äÐβúÆ·¡£ 1¡¢Ìص㣺 A¡¢´ó²¿·ÖµÄ×é¼þÏàͬ¡£ B¡¢Õë¶Ô²»Í¬µÄ¿Í»§¿ÉÄÜÓв»Í¬µÄÒªÇó¡£ C¡¢²úÆ·½á¹¹³Êµ¹Èý½ÇÐÍ£¬Ô-ÁÏ /²¿¼þÏà¶Ô ½ÏÉÙ£¬µ«²úÆ·Æ·ÖÖ£¨±äÐÎÆ·ÖÖ£©ºÜ¶à¡£ 2¡¢ÊÊÓ÷¶Î§£º ²úÆ·±äÐÎÆ·Öֽ϶à»òÐèÒªÕë¶Ô²»Í¬¿Í»§½øÐвúÆ·ÅäÖõÄÆóÒµ¡£ 3¡¢ PCF ÓëBAAN ϵͳÖÐÆäËûÄ£¿éµÄ¹Øϵ £¨Í¼Ò»£© HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 41. ITPUB µç×ÓÔÓÖ¾ BANN ϵͳµÄ²úÆ·ÅäÖà £¨Í¼¶þ£© PCF ¶þ¡¢Ê¹Óà Èý¡¢Óë±ê×¼Á÷³ÌµÄ²îÒì ¶Ô±ÈÄÚÈÝ ±ê×¼Á÷³Ì ʹÓÃCF Ä£¿é P ¹¤ÒÕÁ÷³ÌʹÓñê×¼¹¤ÒÕÁ÷³Ì»òͨÓù¤ÒÕÁ÷³Ì ʹÓÃͨÓù¤ÒÕÁ÷³Ì HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 42. ITPUB µç×ÓÔÓÖ¾ BANN ϵͳµÄ²úÆ·ÅäÖà BOM ½á¹¹ ÊÊÓÃÓÚ±ê×¼ ½á¹¹£¨ÕýÈý½ÇÐÍ£© BOM ÊÊÓÃÓÚ²úÆ·±äÐ쫶àµÄ²ú Æ·½á ¹¹£¨µ¹Èý½ÇÐÍ£© Ïà¹ØÄ£¿éROU¡¢ BOM¡¢CRP¡¢PUR¡¢INV£¨ LTC¡¢ ROU¡¢OM¡¢RP¡¢UR¡¢ B C P INV ILC£¢SLS¡¢ ©¡ PCS£¨¿ÉÑ¡£©µÈ £¨ LTC¡¢ © ILC£¢SLS¡¢ ¡ PCS£¨±Ø Ð룩µÈ »ù±¾Á÷³ÌÉèÖÃÁϼþÖ÷×ÊÁÏ ÉèÖÃÁϼþÖ÷×ÊÁÏ ÉèÖÃÁϼþ¹¤ÒÕÁ÷³Ì ÉèÖÃͨÓù¤ÒÕÁ÷³Ì ÉèÖÃÁϼþ ×ÊÁÏ BOM ÉèÖÃͨÓà ×ÊÁÏ BOM ÉèÖòúÆ·ÌØÐÔÓëÏÞÖÆ ²úÉú²úÆ·±äÐΠά»¤ÏúÊÛ¶©µ¥ ά»¤ÏúÊÛ¶©µ¥ ½¨Á¢ÏúÊÛ¶©µ¥µÄÏîÄ¿ Ö´ÐÐ RP ²úÉúÎïÁÏÐèÇó M Ö´ÐÐPRP ²úÉúÏîÄ¿µÄÎïÁÏÐè Çó ת»» RP Éú²ú¡¢²É M ¹º¶©µ¥ ת»»RP Éú²ú¡¢²É¹º¶©µ¥ P ²É¹º/ÊÕ»õ ²É¹º /ÊÕ»õ ·¢·Å/Íê³ÉÉú²ú¶©µ¥ ·¢·Å /Íê³ÉÏîÄ¿Éú²ú¶©µ¥ Ö´ÐгöÈë¿â²Ù×÷ Ö´ÐгöÈë¿â²Ù×÷ ÐèÇó °´×ܵÄÐèÇó°²ÅÅÉú²ú /²É¹º °´ÏîÄ¿£¨ÏúÊÛ¶©µ¥£©°²ÅÅÉú²ú / ²É¹º ËùÓÐÏà¹ØÐèÇóÖ»²úÉúÒ»ÕÅÉú²ú¶©µ¥¡£ Ä ¿ ½ « ² ú É ú Ò » Õ Å É ú ² ú ¶ © ÿ¸öÏî µ¥£¬±¨¸æÉú²úÍê³ÉʱÐè·Ö±ð±¨ ¸æ¡£ Å̵ã Ö´Ðбê×¼µÄÅ̵ã³ÌÐò ÎÞ·¨ÔÚÏîÄ¿ÖнøÐÐÅ̵㠹«ÓÃÁϼþÁϼþÏ໥¼ä¿ÉÒÔÖ±½ÓתÒÆ£¨Å²Óã© Ò»¸öÏîÄ¿µÄ²ÄÁÏÖ»ÄÜÓÃÓÚ¸ÃÏî Ä¿£¬²»ÄÜÖ±½ÓΪÆäËûÏîÄ¿Ëùʹ Óá£Èç¹ûÆäËûÏîÄ¿ÐèҪŲÓÃÔò ÐèÒªÖ´ÐÐ ²Ö¿â¶©µ¥¡£ PRP ʹÓÃAAN ϵͳCF Ä£¿éÐèҪΪÁϼþÉèÖòúÆ·µÄ±äÐÎÓëÏÞÖÆ£¨¼´¹æ¶¨²úÆ·¿ÉÄ B P ±äÐÎÆ·ÖÖ£© £¬ÐèÆôÓà PCS£¨ÏîÄ¿¿ØÖÆ£©Ä£¿é¡£ËùÓвúÆ·±äÐÎÆ·ÖÖµÄ BOM ºÍ¹¤ÒÕÁ÷³Ì×ÊÁÏÓÉ ÏîÄ¿¿ØÖÆÄ£¿é¿ØÖÆ¡ÊôÓÚijһÏîĿϵĶ¨ÖÆÁϼþ²»ÄÜÓë±ê×¼Áϼþ»òÆäËûÏîÄ¿ £ »ìÏý¡£ ˵Ã÷£ºÔÚʵ¼ÊµÄÉú²ú¹ý³ÌÖУ¬ÏîÄ¿£¨ÏúÊÛ¶©µ¥£© A ºÍ ¿ÉÄÜͬʱÐèҪʹÓõ½²ÄÁÏ B 111£¬ µ«Èç¹û¸ÃÁϼþÒѾ-ÉèÖÃΪ¶¨ÖÆÁϼþ£¬ÄÇôÏîÄ¿ µÄ²ÄÁÏ ÔÚϵͳÖÐ A µÄ111 ²ÄÁϺÍÏîÄ¿ B 111 ½«±»ÊÓΪÁ½¸ö²»Í¬µÄÁϼþ£¬ÔÚʵ¼ÊµÄ¹ÜÀíÖÐÐèÒª¼ÓÒÔÑϸñÇø·Ö¡£ ËÄ¡¢ÊµÀý˵Ã÷ ÏÂÃæÒÔÒ»¼ÒµçÀ¹¤³§ ij¸öµçÀ²úÆ·µÄ²Ù×÷Á÷³ÌΪÀý½øÐмòµ¥µÄ˵Ã÷¡£ µçÀµÄÉú²úÏúÊÛÓÐÈçÏÂÌØÕ÷£º 1¡¢ÏȽ«Í-Ïß°üÆá¼Ó¹¤³ÉÍ-о¡£ 2¡¢½«Í-о°´²»Í¬µÄÖ§Êý¾íÈëµçÀÂÖУ¬²¢°ü¹üËܽº¡¢ÆÁ±ÎÍø¡£ 3¡¢²úÆ·ÏúÊÛʱ¿ÉÒÔ°´¾í¡¢Ãס¢ÖØÁ¿ÈýÖÖµ¥Î»¼ÆÁ¿¡£ 4¡¢²»Í¬¿Í»§¶ÔµçÀµÄÖ§Êý¡¢³¤¶È¡¢°ü×°²ÄÁÏ¡¢°ü×°·½·¨Óв»Í¬µÄÒªÇó¡ 1 ºÁÃ×µÄÍ-о¿ÉÄܼӹ¤³öÐí¶à²»Í¬µÄ²úÆ·¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 43. ITPUB µç×ÓÔÓÖ¾ BANN ϵͳµÄ²úÆ·ÅäÖà ³ÉÆ· ¶©ÖÆÁϼþ °ë³ÉÆ· Ëܽº £¨Í-о£© ±ê×¼Áϼþ Í-Ïß Ëܽº ½«³ÉÆ·ÉèÖÃΪ¶¨ÖÆÁϼþ£¬½«°ë³ÉÆ·ºÍËܽºÁϼþµÈÉèÖÃΪ±ê×¼Áϼþ¡£ÕâÑù ERP ϵͳ ÖУ¬·²ÒªÉú²úÏàͬ°ë³ÉÆ·µÄÉú²ú¶©µ¥£¬¿ÉÒԺϲ¢¡£ ±ê×¼Á÷³Ì ¸ÄPCF Ä£¿éʵʩµÄ²½Ö裺 1¡¢ÉèÖÃϵͳ²ÎÊýΪʹÓà ģ¿é¡£ PCF ºÍPCS 2¡¢ÐÞ¸ÄÁϼþ×ÊÁÏ£¨ DATA£ MASTER © £¬½«³ÉÆ·ºÍ²¿·Ö°ë³ÉÆ·Áϼþ¼Æ»®ÊôÐÔ¸ü¸ÄΪ¡°°´¶ 3¡¢ÉèÖÃͨÓÃ;³Ì£¨¹¤ÒÕÁ÷³Ì£¢ BOM ½á¹¹µÈ£¨¸Ã²½ÖèÒÑÍê³É££ © ¡ ©¡ 4¡¢ÉèÖòúÆ·ÌØÉ«ºÍ²úÆ·ÏÞÖÆ¡£ ÒÔÉϲ½ÖèΪϵͳʹÓóõÆÚµÄÉèÖñä¸ü£¬ºÍ±ØÒªµÄÊý¾Ý×¼±¸¡£ 5¡¢²úÉú²úÆ·±äÌ壬²¢ÔÚÏúÊÛ¶¨µ¥ÖÐά»¤¡£ 6¡¢Ö´ÐÐ PCS£¨ÏîÄ¿¿ØÖÆÄ£¿é£ ©£¬°²ÅÅÉú²ú¡£ 7¡¢Íê³É°ë³ÉÆ·Éú²ú¡£ 8¡¢Íê³É³ÉÆ·Éú²ú£¬²¢Èë¿â¡£ 9¡¢Ö´ÐÐÏúÊÛ³ö»õ¹¤×÷¡£ 10¡¢Èç¸ÃÅú²úÆ·ÐèÒª¸ü¸ÄÏúÊÛ¶¨µ¥ÔòÖ´ÐÐ PRP ²Ö¿â¶¨µ¥½øÐÐתÒÆ¡£ ˵Ã÷£ ºÓÉÓÚ¹¤³§µÄ°ë³ÉÆ·²»ÐèÒª½øÐÐÏîÄ¿¿ØÖÆ£ ¬ÒÔ¼°²É¹º°´Ô-Áϵļ۸ñ°²Å ÁÏÍ-µÄ²É¹ºµ¥¼Û¼«¸ß£¬¼Û¸ñ²¨¶¯½Ï´ó£© £¬¹ÊÕ⼸²¿·ÖµÄ¹¤×÷¿ÉÒÔ¼ò»¯¡£ Îå¡¢ÓÅȱµã·ÖÎö ʹÓÃCF£¨²úÆ·ÅäÖã©Ä£¿é¾ßÓÐÈçÏÂÓŵ㣺 P 1¡¢·ûºÏ¹¤³§µÄʵ¼ÊÔË×÷Á÷³Ì¡£ ¹¤³§ÓÐ 10000 ¶àÖÖ³ÉÆ·£¬ÔÙ×éºÏ N ÖÖ°ü×°·½·¨ºÍ²»Í¬µÄÑÕÉ«£¬²úÆ·Ì«¶à£¬Ê¹Óñ ×¼µÄRP Á÷³Ì¸ù±¾ÎÞ·¨Âú×㹤³§µÄÐèÒª¡£ E 2¡¢Ê¹ÓÃÏîÄ¿¿ØÖÆÄ£¿éÓÐÀûÓë¶Ô³ÉÆ·½øÐпØÖÆ¡£ ¶¨ÖÆÁϼþÖ»ÄÜÓÃÓÚijһ¸öÏîÄ¿£¬²»Í¬ÏîÄ¿µÄÁϼþ²»ÄÜÖ±½ÓŲÓᣠʹÓÃCF£¨²úÆ·ÅäÖã©Ä£ P ¿é¾ßÓÐÈçÏÂȱµã£º 1¡¢ÐèÒª¶ÔÏà¹ØÊý¾Ý½øÐе÷Õû¡£ ÓÉÓÚʹÓÃÁËеÄÄ£¿éºÍ²Ù×÷·½·¨£¬ÐèÒª¶ÔÏà¹ØÈËÔ±½øÐÐÖØÐÂÅàѵÓëÖ¸ ¶ÔÐÂÄ£¿éÓиöÊÊÓ¦¹ý³Ì£¬ÐèÒªÒ»¶¨µÄʱ¼ä¡£ 2¡¢³ÉÆ·²¿·ÖµÄ¿ØÖƱȽÏÂé·³¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 44. ITPUB µç×ÓÔÓÖ¾ BANN ϵͳµÄ²úÆ·ÅäÖà ÊôÓÚ²»Í¬ÏúÊÛ¶¨µ¥µÄ³ÉÆ·¼´Ê¹ÊÇͬʱ½øÐбíÃæ´¦Àí£¬Ò²ÐèÒª·Ö±ð±¨¸æÉú²ú¶ ³É¡£¼ÓÖرíÃæ´¦Àí¹¤Ðò³µ¼äµÄ¹¤×÷¡£ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 45. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) ×÷Õß : Kevon_zeng ÔÚITPUB µÚÒ»ÆÚÎÒÔø¾-·¢±íһƪÃû¡¶ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸¡ · £¬·¢ ±íÍêÖ®ºó£¬ºÜ¶àÍøÓÑÏà¼ÌдÐÅÀ´Ñ¯ÎÊһЩÓÐ¹Ø Oracle Applications ʹÓõÄÎÊÌ⣬ÓÐЩÎÊÌâ ÓÉÓÚÕû¸öÓ¦Óû·¾³µÄÏÞÖƺÍ×ÔÉíÄÜÁ¦µÄ²»×㣬ºÜÄÑΪ´ó¼Ò×ö´ð£¬ÌØÇë´ó¼Ò¼û Ô£¬ÎÒÏë´ó¼Ò¿Ï¶¨¶¼»ýÀÛÁ˲»Éٵľ-Ñ飬µ±È»ÎÒÒ²³¤½øÁ˲»ÉÙ£¬ÎÒÔ¸Òâ°ÑÎÒ Ïí£¬ÒòΪºÜ¶à¾-Ñ鶼ÊÇÔÚ¸ú´ó¼Ò½»Á÷ÖлñµÃ£¬ Òò ´ËÏ£Íû´ó¼Ò¾-³£°ÑһЩÎÊÌâ·´À¡µ½ÂÛ̳ÉÏ£ µ±È»ÎÒÃǸüÏ£Íû´ó¼ÒÄܹ»°ÑÎÊÌâµÄ½â¾ö°ì·¨·´À¡µ½ÂÛ̳ÉÏ»òÕßÖ±½ÓÏò ITPUB Ͷ¸å£¬ÎÒÃÇ·Ç ³£»¶Ó-´ó¼Ò¼ÓÈëÎÒÃÇ¡°·ÖÏí¼´¿ìÀÖ¡±¾ãÀÖ²¿£¡ ÕâÒ»´Î£¬ÎÒ½«Êµ¼ùÉÏƪÎÄÕµÄŵÑÔ·ÖÄ£¿éΪ´ó¼Ò×ö¸üÏêϸµÄ½éÉÜ£¬µ±È»Õ ºÜ¶àµÄ»ù±¾²Ù×÷£¬ËäÈ»¿ÉÄÜ»á±È½ÏdzÏÔ£¬µ«ÎÒ¾õµÃ¶Ô¸Õ¿ªÊ¼½Ó´¥ Oracle Applications µÄÈË À´ËµÊÇÒ»¸ö²»´íÈëÃŶÁÎµ±È»ÎÒҲϣÍû¸ü¶àµÄ¸ßÊÖÌá³öÖ¸Õý¡£ºÃÁË£¬·Ï»° ÈÆϵͳ¹ÜÀíÔÚ AD Ä£¿é¸ú´ó¼Ò½»Á÷£¡ FND ºÍ 1£®ÈçºÎ»ñµÃ Applications ¿ì½Ý Oracle ¼üµÄ¶¨Ò壿 ½â´ð£º CTRL+K£¬Í¨¹ýËü£¬Äã¿ÉÒÔÁ˽⵽ Oracle Applications ¿ì½Ý¼üµÄ¶¨Ò壬´Ó¶ø¼Ó¿ì²Ù×÷ µÄËÙ¶È 2£®Oracle Applications ±íºÍÊÓͼµÄһЩÃüÃû¹æÔò£¿ ½â´ð£ºÒ»°ãÀ´Ëµ£¬ÔÚ Applications ÖÐËùÓеıíµÄÃüÃû¶¼ÊÇÏ൱¹æ·¶£¬Í¨¹ýÃû×Ö£¬Ò»°ãÄ ÒÔÖªµÀÕâ¸ö±íÊÇ×öʲôÓã¶øÇÒÄ㻹¿ÉÒÔͨ¹ý²é¿´ ¬ FND_TABLES ºÍ FND_COLUMNS À´»ñ µÃ±íµÄÏêϸÐÅÏ¢¡£³ý´ËÖ®Í⣬»¹ÓÐһЩ¹æÔò£¬ÀýÈçÒÔ TL ½áβ±íʾ´øÓÐÓïÑÔÐÅÏ¢µÄ±í£¬ V ½á β±íʾһ°ãµÄÊÓͼ£¬ VL ±íʾ´øÓÐÓïÑÔÐÅÏ¢µÄÊÓͼ£¬ÒÔV$¿ªÍ·´ú ±í¶¯Ì¬ÐÔÄÜÊÔͼ£¬ÒÔFND ¿ªÍ·ÊÇÊôÓÚ Application Object Library Ä£¿éµÄ£¬ÒÔ ¿ªÍ·ÊÇÊôÓÚ Receivables AR,RA Oracle Ä£¿éµÄ£¬ÒÔ ¿ªÍ·ÊÇÊôÓÚ¿â´æÄ£¿éµÄ£¬ÒÔ MTL AP ¿ªÍ·ÊÇÊôÓÚÓ¦ÊÕÄ£¿éµÄ£¬ÒÔ GL ¿ªÍ·ÊÇÊô ÓÚ×ÜÕÊÄ£¿éµÄ£¬ÒÔ FA ¿ªÍ·ÊÇÊôÓÚ×ʲúÄ£¿éµÄ£¬ÒÔ OE ¿ªÍ·µÄÊÇÊôÓÚ¶©µ¥Ä£¿éµÄ£¬ÒÔ WSH ¿ªÍ·ÊÇÊôÓÚ·¢ÔËÄ£¿éµÄ£¬ÒÔ WIP ¿ªÍ·ÊÇÊôÓÚÔÚÖƳµ¼äÄ£¿éµÄ£¬ÒÔ IBE ¿ªÍ·ÊÇÊôÓÚÍøÉÏÉÌµê µÄ£¬ etc 3£®ÈçºÎ»ñµÃÓйص±Ç° FORM µÄÃû¡¢°æ±¾¼°ÆäÆäËûÏà¹ØÐÅÏ¢£¿ ½â´ð£º°ïÖú racle Applications£¨Õâ¶ÔÓÚ¸ü¸Ä ºÍÏò etalink Ìá½»AR ʱÌرð ->¹ØÓÚ O FORM m T ÓÐÓã © £¬µ±È»ÄãÒ²¿ÉÒÔͨ¹ý unix ÃüÁîÀ´»ñµÃ µÄÍ·ÐÅÏ¢£¬ÀýÈ磨 FORM ÒÔAIX ΪÀý£º ©£ $strings FNDSCAUS | grep Header 4£®ÈçºÎ»ñµÃµ±Ç° ÏàÓ¦µÄ±í»òÕßÊÓͼÐÅÏ¢£¿ FORM ½â´ð£º°ïÖú ->ÀúÊ·¼Í¼£¬µ±È»ÓпÉÄÜ´æÔÚ¡°ÎÞÀúÊ·¼Í¼¡±»òÕß¡°ÀúÊ·¼Í¼¡±²Ëµ¥ ¿ÉÒÔͨ¹ýCTRL+F11 ½øÐвéѯ£¬È»ºóÔÙ½øÐв鿴£»ÓÐʱÕâÖÖ·½·¨Ò²²»¿ÉÐУ¬Äã¿É ÓÃÕâÖÖ·½·¨£¬Í¬Ñù°´ CTRL+F11,È»ºó°ïÖú ->¼ì²é£¬ÔÚ¡°¿é¡±ÖÐÊäÈë ->Õï¶Ï SYSTEM£¬ÔÚ×Ö ¶ÎÊäÈë LAST_QUERY£¬Äã¾Í¿ÉÒÔ»ñµÃÓйزéѯµÄÐÅÏ¢£»Èç¹ûʵÔÚû°ì·¨µÄ»°£¬Äã TRACE À´»ñµÃ£¬°ïÖú->¸ú×Ù£¬È»ºó½øÐбØÒªµÄ²Ù×÷£¬ÔÚ ->Õï¶Ï UNIX ²Ù×÷ϵͳÏÂÒÔÊý¾Ý¿â Óû§µÇ¼£¬ÀýÈç oraprod£¬È»ºóÖ´ÐÐÏÂÁеÄÓï¾ä£º $cd $ORACLE_HOME/admin/udump HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 46. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) $ll –lt|head ²é¿´Ê±¼ä×î½Ó½üµÄÓï¾ä $tkprof filename out_filename explain=apps/apps sys=no 5£®ÈçºÎ»ñµÃ¿Í»§¶Ë¸ú·þÎñÆ÷¶ËÖ®¼äÍøÂçµÄ×´¿ö£¿ ½â´ð£ºÒÔϵͳ ¹ÜÀíÔ±Éí·ÝµÇ¼£¬Ó¦Óà ->ÍøÂç²âÊÔ£¨ Ò²ÐíÄã»á¾-³£Ìýµ½¿Í»§µÄÔ¹ÑÔ£¬ËµÎªÊ² ôËÙ¶ÈÌ«Âý£¬ÕâÒ²Ðí²»ÊÇ·þÎñÆ÷¶ËµÄÎÊÌ⣬¾-³£µÄÇé¿öÊÇÍøÂç×´¿ö²»ºÃ£¬Äã ·¨À´ÑéÖ¤£© 6£®ÈçºÎÐÞÕý¼à¿ØÓû§µÄ²»×¼È·µÄÊý¾ÝÄØ£¿ ½â´ð£ºÒÔϵͳ¹ÜÀíÔ±Éí·ÝµÇ¼£¬ÇëÇó ->ÔËÐУ¬Ìá½»¡°Çå³ýµÇ¼Éó¼ÆÊý¾Ý¡ ±£¬²ÎÊý¿ÉÒÔÉè¶ µ±Ì죬ȻºóÔڼƻ®Ñ¡ÏîÖÐÉ趨¡°¶¨ÆÚ¡± £¬¿ªÊ¼ÈÕÆÚÉ趨ΪÍíÉÏ 11 µã×óÓÒ£¬Í¬Ê±Ê¹¡°ÉèÖÃÿ´Î ÔËÐеÄÈÕÆÚÔöÁ¿²ÎÊý¡±ÓÐЧ£¬ÕâÑù²ÎÊý¾Í»áÿÌì×Ô¶¯Ôö¼Ó£¨Ò²Ðíϵͳ¹ÜÀíÔ±Ó Ëµ¼à¿ØÓû§Ê±£¬ºÜ¶àÓû§¶¼ÒѾ-Õý³£Í˳ö£¬µ«ÊÇÈÔÈ»ÔÚϵͳÖдæÔÚ£¬¶øÇÒÒÑ ¾-´æÔںܳ¤Ò»¶Î ʱ¼ä¡£ÆäʵÕⲿ·ÖÊý¾ÝÊDz»×¼È·£¬Äã±ØÐ붨ÆÚµÄÇå³ýÕâЩÉó¼ÆµÄÊý¾Ý£¬²ÅÄÜ· 7£®ÈçºÎ¶¨ÆÚÇåÀí²¢·¢ÇëÇó²úÉúµÄÊý¾Ý£¨°üÀ¨ log ºÍ Îļþ£©ÄØ£¿ out ·½·¨£ºÌá½»²¢·¢ÇëÇó¡°Çå³ý²¢·¢ÇëÇóºÍ£¨»ò£©¹ÜÀíÆ÷Êý¾Ý¡ £ É趨ʵ ±¬ ÓÃÆÚÏÞ¡£¬Ä£Ê½ÖµÎª¡° ± 7¡ ±£¬±¨±íΪ¡°ÊÇ¡ ±£¬Çå³ýÆäËûΪ¡°ÊÇ¡ ±£¬ÕâÑùµÄÒâ˼ÊÇ£ºÇå³ý 7 ÌìÒÔÇ° ²¢·¢ÇëÇóºÍ¹ÜÀíÊý¾ÝµÄ±¨±íºÍÈÕÖ¾£¨ÓÉÓÚ²¢·¢ÇëÇóËù²úÉúµÄ±¨±íÎļþÕ¼ÓÃµÄ ÆÚ×öÕâÑùµÄÇåÀíÊǺÜÓбØÒªµÄ£© 8£®ÈçºÎ¶¨ÒåÖ»¶ÁµÄ FORMS£¿ ½â´ð£º¶ÔijЩ FORMS£¬ÓÐʱÐèÒªÏÞÖÆÓû§ µÄ·ÃÎÊ£¬±ÈÈç˵²»ÔÊÐíÐÞ¸Ä FORMS¡£ÎÒÃÇ¿ÉÒÔ ²ÉÓÃÕâÖÖ·½·¨À´½â¾ö£¬ÒÔϵͳ¹ÜÀíÔ±Ö°ÔðµÇ¼£¬Ó¦Óà ->¹¦ÄÜ£¬ÈçÏÂͼÊäÈ룺 µã»÷¡°±íµ¥¡ ±£¬ÔÚ²ÎÊýÖÐÊäÈë¡° QUERY_ONLY=YES¡ ±£¬ÆäËûÊäÈëÈçÏÂͼËùʾ£º HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 47. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) ÕâÑùÄã¾Í¿ÉÒÔÔڲ˵¥ÖÐÌí¼ÓÕâ¸ö¡°Ö»¶ÁÓû§¡±µÄ¹¦ÄÜ±íµ¥ 9£®ÈçºÎ¸ü¸Ä APPLSYS Óû§µÄÃÜÂ룿 ½â´ð£ºÔÚÒÔÇ°°æ±¾ÖУ¬¸ü¸Ä APPLSYS µÄÃÜÂëÏ൱µÄÂé·³£¬¼ÈÒª¸ü¸Ä Applications ²ãµÄÃÜÂ룬 ÓÖÒª¸ü¸ÄÊý¾Ý¿âµÄÃÜÂ룬¶øÇÒ˳Ðò»¹²»ÄÜÂÒ£¬Í¦Âé·³¡£ 11i °æ±¾ÒýÈëÐµĹ¤¾ß FNDCPASS £¨Î»ÓÚ $FND_TOP/bin£¬Äã¿ÉÒÔÇáËɸü¸Ä ©£ APPLSYS µÄÃÜÂ룺 $FNDCPASS apps/apps 0 Y system/manager SYSTEM APPLSYS WELCOME ÉÏÊöÓï¾ä°Ñ APPLSYS µÄÃÜÂë¸ÄΪ WELCOME,µ±È»Äã¿ÉÒÔÀûÓÃËü¸ü¸Ä¸÷¸öÄ£¿éÊý¾Ý¿âµÄà Â룬ÀýÈ磺 $FNDCPASS apps/apps 0 Y system/manager ORACLE GL GL1 ÉÏÊöÓï¾ä°Ñ GL µÄÃÜÂë¸ÄΪ GL1,ͬʱ£¬ÄãÒ²¿ÉÒÔ¸ü¸Ä Applications ²ãÓû§µÄÃÜÂ룺 $FNDCPASS apps/apps 0 Y system/manager USER VISION WELCOME ÉÏÊöÓï¾ä°Ñ Óû§µÄÃÜÂë¸ÄΪ VISION WELCOME 10£® ÈçºÎжÔØ Applications µÄ²¿·ÖÄ£¿é£¿ Oracle ½â´ð£º ¹âÇý£¬°ÑµÄ¹âÅÌ·ÅÈ룬ÔËÐÐ mount 11i adunload£¨Î»ÓÚ $AD_TOP/bin Ï£ ©£¬ÀýÈ磺 $ adunload.sh product=ar жÔØR Ä£¿é A $ adunload.sh product=gl directory=forms/ZHS filename=GLSTUOM.fmx 11£® ÔõÑùÍù ÒѾ-°²×°ºÃµÄϵͳÌí¼ÓеÄÄ£¿é£¿ ½â´ð£ºÈç¹ûÄãÓÐͼÐÎÖնˣ¬Äã¿ÉÒÔÖ±½ÓÔËÐÐ x windows£¬·ñÔòÄã¿ÉÒÔÓà XWIN-32¡¢eflection R Ö®ÀàÖն˷ÂÕæµÇ¼£¬ÉèÖÃdisplay ÊôÐԺͷÃÎÊȨÏÞ£¬ÀýÈ磺 $ export DISPLAY=192.168.42.88:0.0 $ xhost + ÔÊÐíËùÓеÄÖ÷»ú·ÃÎÊ È»ºóÔËÐÐadlicmgr.sh£¬°²×°ÄãÒª°²×°µÄÐÂÄ£¿é£¬È»ºó¸üРAPPLFULL ºÍAPPLSHAR µÄ· ¾¶£¬½Ó×ÅÖØÐÂÓ¦ÓÃ×îеÄÏà¹Ø²¹¶¡£¬ÖØÐÂʵʩа²×°Ä£¿é 12£® ÈçºÎ·ÂÕæ Applications µÄÓû§£¿ Oracle ½ â ´ ð £ º fnd_global.apps_initialize(user_id,resp_id,resp_appl_id), Æ ä Ö Ð Ê ¹ Ó Ã user_id,resp_id,resp_appl_id ¿ÉÒÔͨ¹ýÕâÖÖ·½·¨»ñµÃ£º°ïÖú ->Õï¶Ï ->¼ì²é£¬ÔÚ¿éÖÐÑ¡Ôñ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 48. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) $PROFILES £ ¬ Ô Ú × Ö ¶ Î Ñ ¡ Ô ñ ¿ É Ò Ô » ñ µ à USER_ID USER_ID, Í ¬ Ñ ù · ½ · ¨ ¿ É Ò Ô » ñ µ à RESP_ID,RESP_APPL_ID£¨¿ÉÄÜÓÐʱÄãÐèÒªÔÚ Oracle Applications »·¾³ÍâÔËÐÐһЩ PL/SQL Óï¾ä£¬µ«ÊÇÕâЩÓï¾äÖÐÐèÒª·ÃÎÊϵͳÏà¹ØµÄ»·¾³±äÁ¿£¬ÀýÈç view£¬ÕâÑùÄã¿ÉÒÔʹÓà ÉÏÊö·½·¨´ïµ½ÄãµÄÄ¿µÄ£© 13£® ÔõÑù ÔÚ¼à¿ØÓû§ÁбíÖд¦ÓÚ kill inactive µÄÓû§£¿ ½â´ð£ºÖ´ÐÐÏÂÁÐÓï¾ä SELECT SUBSTR(d.user_name,1,30) "User Name" , a.pid , b.sid , b.serial# FROM v$process a, v$session b, fnd_logins c, fnd_user d WHERE a.pid = c.pid AND c.pid = &PID AND d.user_name = UPPER('&USER_NAME') AND d.user_id = c.user_id AND a.addr = b.paddr AND c.end_time IS NULL ÆäÖÐ &PID ÊäÈ¡ ë° Oracle ½ø³Ì¡ &USER_NAME ÊäÈ ±ÁУ¬ ë¡°Óû§Ãû¡ ± ¬ À¸£¸ù¾Ý»ñµÃµÄ SID ºÍSERIAL#£¬ ÊÇÓÃÒÔÏÂÓï¾äÀ´ KILL SESSION: ALTER SYSTEM KILL SESSION ‘ [SID],[SERIAL#]’ 14£® ÈçºÎ×Ô¶¨Òå²¢·¢ÇëÇó£¿ ½â´ð£ºÈç¹ûÄãΪһЩģ¿éд SQL ÀàÐ͵IJ¢·¢ÇëÇó£¬Äã¾Í±ØÐëÖªµÀÈçºÎΪËü¶¨Òå²¢·¢Ç ÏÂÃæÒÔtest.sql ΪÀý£¬Ì¸Ì¸ÈçºÎ¶¨Òå OM Ä£¿éµÄ²¢·¢ÇëÇó¡£Ê×ÏÈ£¬°Ñ test.sql ·Åµ½ $ONT_TOP/sql Ŀ¼Ï£»È»ºóÒÔϵͳ¹ÜÀíÔ±Ö°ÔðµÇ¼£¬²¢·¢ ->³ÌÐò ->¿ÉÖ´ÐÐ £¬ÔÚ´°ÌåÉÏÊäÈë ¿ÉÖ´ÐÐΪ¡° Test only¡ ±£¬¼ò³ÆΪ¡° tst¡ ±£¬Ó¦ÓÃÑ¡Ôñ¡° Order Management¡ Oracle ±£¬Ö´Ðз½·¨ Ñ¡Ôñ¡° SQL*Plus¡ ± £¬ÔÚ¿ÉÖ´ÐÐÃûÊäÈë¡° test¡ ± £¨ÕâÀïµÄÃû³Æ¾ÍÊÇÈ¥µô © test.sql .sql££¬±£´æ¹Ø±Õ£¬ ÈçÏÂͼËùʾ£º ²¢·¢ ->³ÌÐò ->¶¨Ò壬ÊäÈë³ÌÐòÃû³ÆΪ¡° ± Test Report¡£¬¼ò³Æ¡° ± tstr¡£¬Ó¦ÓÃÑ¡Ôñ¡° Order Oracle Management¡ ±£¬¿ÉÖ´ÐÐÀ¸ÖУ¬ÔÚÃû³ÆÑ¡Ôñ¡° tst¡ ±£¬±£´æ¼´ OK£¬ÈçÏÂͼËùʾ£º HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 49. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) ÕâÑùÄã¾Í¿ÉÒÔÔÚ OM Ä£¿éÏà¹ØÖ°ÔðÖУ¬Ìá½»¡° Test Report¡±Õâ¸ö±¨±íÁË¡£ 15£® ÈçºÎ½«¶þ´Î¿ª·¢µÄ ÈںϽø FORMS Applications ϵͳÄØ£¿ ½â´ð£ºÊ×ÏÈΪ¶þ´Î¿ª·¢µÄϵͳ½¨Á¢Êý¾Ý¿â±í¿Õ¼ä£¬È»ºó´´½¨·ÃÎÊÓ CUX,ΪCUX Óû§·Ö ÅäȨÏÞ£¬ÔÚ ÏµÍ³ÏÂÖ¸¶¨ unix CUX_TOP µÄĿ¼£¬²¢ÔÚCUX_TOP Ŀ¼´´½¨¸úÆäËûÄ£¿éÏàͬ µÄĿ¼½á¹¹£¬Í¬Ê±ÔÚ»·¾³±äÁ¿ÎļþÖÐÉ趨 CUX_TOP »·¾³±äÁ¿£¨¼ÇµÃ±ØÐëÔÚÖØÆôϵͳǰÔË Ðл·¾³±äÁ¿Îļþ£ TEST.fmb ·ÅÔÚ © £¬°Ñ AU_TOP/forms/ZHS Ŀ¼Ï£¬½øÈëÕâ¸öĿ¼£¬Ê¹Óà f60gen ½øÐбàÒ룺 $ f60gen module=TESt.fmb userid=apps/apps output_file=$CUX_TOP/forms/ZHS/TEST.fmx È»ºóÒÔϵͳ¹ÜÀíÔ±µÄÉí·ÝµÇ¼ϵͳ£¬°²È«ÐÔ->ORACLE->×¢²á£¬ÊäÈëÐÅÏ¢ÈçÏÂͼËùʾ£º ±£´æÍ˳ö£¬È»ºóÒÔÓ¦Óÿª·¢ÕßµÄÖ°Ôð½øÈëϵͳ£¬Ó¦Óà ->×¢²á£¬ÊäÈëÈçÏÂͼËùʾ£º HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 50. ITPUB µç×ÓÔÓÖ¾ Oracle Applications 11i ¼¼ÊõÖ§³Ö¾-ÑéÔÓ̸ (¶þ ) È»ºó´æÅÌÍ˳ö£¬È»ºó Ó¦Óà ->±íµ¥£¬ÆäÖÐ±íµ¥ÊäÈëµÄÊÇ TEST.fmx È¥µô .fmx£¬ÊäÈëÈçÏÂͼËù ʾ£º ´æÅÌÍ˳ö£¬È»ºó¿ÉÒÔÔÚÓ¦Óà ->¹¦ÄÜ£¬Îª±íµ¥ÉèÖù¦Äܲ˵¥£¨ÉÏÃæÒѾ-ÓнéÉÜ£ ©£¬×îºóÄ ÒÔÍù²Ëµ¥ÖÐÌí¼Ó±íµ¥¹¦ÄÜ ºÃ ¬ ÁË£Õâ¸öÄ£¿éµÄ½éÉܾ͵½ÕâÁË£´ó¼ÒÈç¹ûÓÐʲôÎÊÌâ¿ÉÒÔ·¢ ¬ EMAIL ¸øÎÒ£ÎÒµÄ ¬ EMAIL ÊÇFASTEST2000@21CN.COM£¬ÎÒÃÇ¿ÉÒÔ»¥Ïà̽ÌÖ¡£ Ï£Íû´ó¼Ò¼ÌÐø¹Ø×¢£¬ÏÂÆÚÔٻᣠ¡£¨Î´Íê´ýÐø£© HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 51. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Åàѵ£º 023 Lesson 1-10 ×÷Õß : easyfree 1 Oracle Architectural Components * In this lesson, you should have learned how to: Explain database files: data files, control files, online redo logs Explain SGA memory structures: DB buffer cache, shared SQL pool, and redo log buffer Explain primary background processes: DBW0, LGWR, CKPT, PMON, SMON, and ARC0 Explain SQL processing steps: parse, execute, fetch * Oracle Server Instance -- a set of memory structures and a group of background processes -- Ò»×éÄÚ´æ½á¹¹ ºÍºǫ́½ø³Ì SGA -- Shared Global Area or System Global Area¹²ÏíÈ«¾ÖÇø »òϵͳȫ¾ÖÇø Shared pool: Is sized by SHARED_POOL_SIZE ȱʡ =3,500,000 bytes Library cache SQL statement text -- SQL Îı¾ Parsed code -- ·ÖÎöºóµÄ´úÂë -- Öصã Execution plan -- Ö´Ðмƻ® Data dictionary cache Table, column, and other object definitions and privileges -- ¶ÔÏó¶¨ÒåºÍȨ ÏÞ User Global Area ¶àÏß³ÌÁ¬½ÓʱʹÓà Data buffer cache Stores the most recently used blocks Size of a buffer based on DB_BLOCK_SIZE µ¥Î»Îª£ºByte Number of buffers defined by DB_BLOCK_BUFFERS Redo log buffer Size defined by LOG_BUFFER µ¥Î»Îª£º Byte Records changes made through the instance ¼Ç¼ʵÀýÖеÄÊý¾Ý¸ü¸Ä --Öصã Used sequentially Is a circular bufferÐèÒª½« BUFFER ÖеÄÄÚÈݶ¼Ð´ÈëLOGO FILE ÖÐÖ®ºóÔÙ REDO ¸´Óà Java pool(optional): Is used to store Java code Large pool(optional): Is used to store large memory structures that are not specific to SQL statement processing. Data blocks that are copied during backup and restore operations HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 52. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 can use this large pool to help reduce the I/O and fragmentation of the database buffer cache. Background Processes Five required process -- Öصã,Á˽âÿ¸ö½ø³ÌÍê³ÉµÄ¹¦ÄÜ 1. SMON(System Monitor): Performs automatic instance recovery -- µ±Oracle ʵÀýʧ°Ü ,ÖØÆô¶¯Ê±Ö´ÐÐ×Ô ¶¯ÊµÀý»Ö¸´ 1. Rolls forward transactions (txns) in the online redo log that have not been recorded on disk 2. Open database and make unlocked data available 3. Rollback uncommitted txns Reclaims (de-allocates) space used by temporary segments no longer in use Merges contiguous areas of free space in the datafiles. Known as defragging or coalescing. -- Öصã (SMON coalesces the contiguous free space in a tablespace only if its default PCTINCREASE value = 0) 2. PMON(Process Monitor): Cleans up abnormally terminated user sessions -- ÇåÀí ·ÇÕý³£ÖÐÖ¹µÄÓû§ SESSION Rolls back any uncommitted transactions -- »Ø¹öδÌá½»ÊÂÎñ Releases locks held by a terminated process -- Ê Í · Å Ò ò ½ ø ³ Ì Ö Ð Ö ¹ ¶ ø ² ú É ú µ Ä Ëø ???ʱ¼ä¼ä¸ô ??? Frees SGA resources allocated to the failed process -- ÊÍ·Å·ÖÅä¸øʧ°Ü½ø³ÌµÄ SGA ×ÊÔ´ Restarts failed shared server and dispatcher processes -- ÖØÆôʧ°ÜµÄ¹²Ïí·þ ÎñºÍµ÷¶È½ø³Ì 3. DBWn(Database Writer): Writes all changed (i.e. dirty) buffers to datafiles.-- ½«¸ü еÄuffer дÈëÊý¾ÝÎļþ b Uses a LRU (least recently used) algorithm to keep the most recently used blocks in memory. Defers writes for I/O optimization. Will write dirty blocks when one of the following occurs: -- Ö Ø µ × ¢ Ò â Ë ü Ó ë ,ã COMMIT ûÓбØÈ»¹Øϵ 1. The dirty list reaches a threshold value 2. A process scans a specified number of buffers in the LRU list without finding a free buffer 3. A time-out occurs -- How many time???? 4. A checkpoint occurs Note that it is the server process that records changes to rollback segments and data blocks in the buffer cache! 4. LGWR(Log Writer): Writes information from the redo log buffer to the redo log files. -- ½« redo log buffer ÄÚÈÝдÈëÎļþ Will write redo log buffer entries to the redo log files when:-- Öصã 1. A commit occurs. 2. The redo log buffer pool becomes one-third full. 3. The redo log buffer has more than 1MB of recorded changes in it. HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 53. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 -- ?????Óë redo log buffer ´óСÎÞ¹Ø ? 4. Before the DBW0 completes cleaning the buffer blocks as during a checkpoint. -- ÔÚ DBWn ֮ǰÍê³É LGWR confirms the COMMIT only after the redo is written to disk. -- LGWR Íê³Éºó²ÅÄÜÈ·ÈÏ Íê³É COMMIT 5. CKPT(Checkpoint Process): Improves the performance of databases with many database files. Takes over LGWR's tasks of updating files at a checkpoint. Headers of datafiles and control files are updated at the end of a checkpoint.-- Öصã More frequent checkpoints will reduce the time required for instance recovery, but potentially at the cost of reduced system performance Other optional process 6. ARC0(Archiver Process): Copies online redo log files to a designated storage device when LGWR switches to a new group. Copies redo log files to tape or disk for media failure recovery. Operates only when a log switch occurs. -- ¿ É Ò Ô × Ô ¶É Ò Ô Ê Ö ¶ ¯ ,¿ ¯ switch: ALTER SYSTEM SWITCH LOGFILE; Is only needed when the database is running in ARCHIVELOG mode and automatic archiving is enabled (parameter LOG_ARCHIVE_START = TRUE) 7. RECO (Recover Process) resolves failures involving distributed transactions. 8. LCKn (Lock Process) performs inter-instance locking in a parallel server system. 9. Pnnn (Parallel Query Process) performs: parallel query, parallel index creation, parallel data loading, and parallel 'CREATE TABLE AS SELECT...'. 10.SNPn (Snapshot Process) automatically refreshes snapshots (read only replicated tables). It is also responsible for the server job queues and replication queues. 11.S000...S999 (Server Processes) Parses and executes SQL statements. Reads data blocks from disk into the database buffer cache of the SGA. Returns the results of SQL statements to the user process. When a server process needs to read a data block from disk into the buffer cache it will: 1. Search the LRU list. 2. Look for a free buffer. 3. Move dirty buffers to the dirty buffer list. 12.D001...D999 (Dispatcher Process) Used with MTS. SQL*Net Listener determines if each user process can use a shared server process. SQL*Net Listener gives the user process the address of a dispatcher process. The dispatcher process connects a user process to a shared server process. HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 54. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 When the user process requests it, the listener will create a dedicated server process and connect the user process to it. Database -- a set of files£¬ it must have at least:1 datafile+1 control file+2 redo log and file Data files -- Ò»¸öATAFILE Ö»ÄÜÓëÒ»¸öÊý¾Ý¿â¹ØÁª£¬ D DATAFILE ¿ÉÒÔÉèÖÃΪ×Ô¶¯ À©Õ¹ Store the data dictionary User objects Before image data of current transactions -- ?????buffer ÖдæÖü image????? after Control files A binary file that describes the structure of the database. Required to mount, open, and access the database. Synchronization info needed for recovery is stored in the control file Recommended configuration is a min of two control files on separate disks. -- ½¨Òé ÔÚ²»Í¬´ÅÅÌÉÏÓÐÖÁÉÙÁ½¸ö Redo log files Record all changes made to the database and use them for data recovery. Written in a circular fashion. There must be at least two redo log groups. Each redo log group should contain the same number of members.-- ½¨Òé×é¼äÿ¸ö member ³ß´çÏàͬ Parameter file Used to size the SGA and locate the control files at instance start up. Contains all the database initialization parameters. Password file Stores passwords for users with admin privileges. Used only with database authentication, not OS level authentication. Archived redo log files Offline versions of the redo log files. Used for database recovery from media failure Alert file -- Öصã ,×¢ÒâËü¼Ç¼µÄÄÚÈÝ Logs all internal (ORA-600), block corruption (ORA-1578), and deadlock (ORA-60) errors. Logs all DDL and Server Manager commands such as STARTUP, SHUTDOWN, ARCHIVE LOG and RECOVER. Logs the values of all non-default initialization parameters at the time of database and instance startup. Located in destination specified by BACKGROUND_DUMP_DEST. -- Ó ë º ó Ì ¨ ½ ø ³ Ì TRACE FILE ´æÖü·¾¶¶¨Òå²ÎÊýÏàͬ Should be checked at least daily. Trace files Contains internal errors detected by server or background processes. If dumped by a background process the file is located in a destination specified by HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 55. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 initialization parameter BACKGROUND_DUMP_DEST. If dumped by a server process the file is located in the destination specified by the initialization parameter USER_DUMP_DEST. -- Öصã ,ÓëÁíÒ»¸ö²ÎÊýµÄÇø±ð Are created if SQL_TRACE parameter is TRUE. -- ×¢Òâºǫ́½ø³Ì²úÉúµÄ : TRACE ÐÅÏ¢ÓÚ SQL_TRACE µÄÖµÎÞ¹Ø Are created if SQL_TRACE is enabled for a session. -- ALTER SESSION SET SQL_TRACE = TRUE; User Process - User excute an application or tool or issue a query/DML command Server Process - PGA(Program Global Area) - Used by a single server or background process -- Öصã ,×¢ÒâGA µÄÌØÐÔ P Not shared ·þÎñÆ÷½ø³Ì¶ÀÕ¼ Writable only by the server process Contains: Area for sorting rows before returning them to a user process µ±Ê¹Óà ORDER BY Óï¾äʱ The user session data, privileges and performance info for the current user's session Óû§È¨ÏÞ£¬ SESSION ÐÔÄÜͳ¼ÆµÈ Stages of cursor states for current session µ±Ç°ESSION ´¦ÀíQL Óï¾äµÄ½×¶Î S S Stores real variables instead of bind variables for executing SQL statements² Î Ê ý ± ä Á¿Ìæ»» The stack space is memory allocated to hold session variables and arrays Æ ä Ë û µ Ä SESSION ±äÁ¿µÈ * Query Processing -- Öصã ,Á˽âÈý¸ö²½ÖèµÄÖ´ÐÐÄÚÈÝ 1. Parse SQL statement passed from user process to the server process. -- SQL Óï¾äÓÉÓà »§½ø³Ì´«µÝ¸ø·þÎñÆ÷½ø³Ì Check for existing copy of SQL statement in the shared pool. -- ¼ ì ² é Ô Ú Shared Pool ÖÐÊÇ·ñ´æÔÚÍêÈ«ÏàͬµÄ SQL Óï¾ä Check SQL syntax. -- ¼ì²éÓï·¨ Verify table and column definitions. -- УÑé±í ,ÁеĶ¨Òå Obtain parse locks. -- »ñÈ¡·ÖÎöËø Validates user access to schema objects. -- È·ÈÏÓû§¿É·ÃÎÊ ¶Ô schema Ïó Derive optimal execution plan. -- È¡µÃÀíÏëµÄÖ´Ðмƻ® Load SQL and execution plan into shared SQL area. -- ½«SQL Óï¾äºÍÖ´ÐÐ¼Æ »®¼ÓÔص½ shared SQL ÇøÖÐ 2. Execute Parsed code is executed. -- Ö´ÐзÖÎöºóµÄ´úÂë Applies parse tree to data buffers. -- ÔÚ data buffer ÖÐÉêÇë·ÖÎöÊ÷ Performs physical reads. -- Ö´ÐÐÎïÀí¶ÁÈ¡ Performs constraint checking. -- Ö´ÐÐÔ¼Êø¼ì²é Changes data if needed. -- Èç¹ûÐèÒªµÄ»°¸ü¸ÄÊý¾Ý For SELECT queries the server process gets ready to fetch the data. -- ¶ Ô Ó Ú SELECT ²éѯ ,·þÎñÆ÷½ø³Ì×¼±¸¶ÁÈ¡Êý¾Ý HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 56. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 3. Fetch For SELECT only. -- ½öSELECT Óï¾äÐèÒª Returns dataset into BIND variables. -- ·µ»ØÊý¾Ý¼¯¸ø BIND ±äÁ¿ * DML Processing Parse and execute only, no fetch. 1. Server process acquires data and rollback blocks into the buffer cache (maybe from the Data files). 2. Place exclusive row locks on rows that are about to change. -- ÉèÖÃÅÅËûÐÐËø 3. Store record in the redo log buffer for before and after image. -- ????? 4. Save rollback data into a rollback segment block buffer. Applies changes to the database block buffer£¬ changed blocks in the buffer cache Any are marked as dirty buffers¡ª is, buffers that are not the same as the corresponding blocks that on the disk. The before-image for a DELETE contains the column values in the deleted row The before-image of an INSERT contains the row location information. * Commit processing Fast Commit Mechanism - guarantees committed changes can be recovered (redo log files) SCN - System Change Number. An SCN is assigned to each transaction. The SCN is unique within the entire database. Used as an internal time-stamp to synchronize data and provide read consistency. Is independent of the O/S date and time.-- Öصã Commit Processing Steps : -- Öصã,×¢Òâ¹ý³ÌµÄ˳Ðò 1. The server puts the commit record and SCN into the redo log buffer. 2. LGWR does contiguous write of all redo log buffer data up to and including the commit record to the redo log file. 3. User is notified of commit completion. 4. Server process indicates to Oracle that the transaction is complete and that locks can be released. Advantages of fast commit -- ¿ìËÙÌá½»µÄÓÅ Öصãµã -- 1. Sequential writes are faster than block writes to the data files. 2. Less data is required to write committed info to log files than writing to data files. Data files require whole data base blocks to be written. 3. Piggybacks log records from multiple transactions into a single log file write. 4. Usually only a single synchronous write is required per transaction, can be less. 5. Transaction size does not affect the length of the commit operation processing. * New Database Limits -- ·Ç¿¼ÊÔÄÚÈÝ Maximum database size: 512 petabytes (petabyte is 2 to the 50th power of bytes) Maximum number of tablespaces: ~2 billion Maximum number of datafiles per tablespace: 1022 Maximum number of partitions per table or index: 64,000 Maximum number of columns per table: 1000 Maximum columns per index: 32 New maximum size for CHAR: 2000 bytes New maximum size for VARCHAR2: 4000 bytes HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 57. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 NCHAR and NVARCHAR2 are new multibyte national language support character equivalents of CHAR and VARCHAR2 and store the same amount of data respectively. Size of Oracle 8 extended ROWID: 10 bytes Size of Oracle 7 restricted ROWID: 6 bytes Size of BLOB (binary large object type): 4GB Size of CLOB (character large object type): 4GB Size of NCLOB (NLS character large object type): 4GB HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 58. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 2 Getting Started With the Oracle Server * In this lesson, you should have learned how to: Describe features of the Universal Installer Based on a Java engine Supports multiple Oracle homes Runs in silent mode Explain setup of operating system and password file authentication Describe main components of Oracle Enterprise Manager Three-tier architecure Java-based console and applications Multiuser system with shared repositories Single point of control * Oracle Universal Installer: Features Based on a Java engine Automatic dependency resolution and complex logic handling Installation from the Web - can be used to point to a URL Component and suite installations Implicit deinstallation Support for multiple Oracle homes NLS/globalization support - detects and use the language of the operating system Can runs in silent mode - [-silent] * NT: setup.exe -responsefile filename [-silent] [-nowelcome] located in the Program FilesOracleouiinstall directory. Unix: runInstaller -responsefile filename [-silent] [-nowelcome] located in the INSTALLinstallsolaris directory. * Optimal Flexible Architecture (OFA) * The two default database administrator users SYS and SYSTEM are: Created automatically Granted the DBA role * SYS SYSTEM Password: change_on_install Password: manager Owner of the database data dictionary Owner of additional internal tables and views used by Oracle tools * Remote database Local database administration administration | | | | Do you Yes Do you want Yes have a secure -----> to use OS---->Use OS HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 59. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 connection? authentication? authentication | | | No | No Use a ------------------------------------> password file ×¢: 1. OS ÑéÖ¤±È PASSWORD FILE ÑéÖ¤ÓÅÏÈ , ¼´ :¼´Ê¹²ÉÓà PASSWORD FILE ÑéÖ¤ ,Èô¿É ÒԵǼOS,Ò²¿ÉÒÔÒÔ OCNNECT / AS SYSDBA Éí·ÝµÇ¼ 2. REMOTE_LOGIN_PASSWORDFILEûÓÐÉèÖÃΪ ʱ NONE ,±ØÐë´æÔÚ PASSWORD FILE ²ÅÄÜÆô¶¯Êý¾Ý¿â * Set up DBA Operating System Authentication On UNIX Platform On UNIX user must be a member of the UNIX dba group. - View the /etc/group and /etc/passwd files Set REMOTE_LOGIN_PASSWORDFILE parameter to NONE. In version 8.1.x or later the default for this parameter is EXCLUSIVE. Before 8.1.x is was NONE. EXCLUSIVE ±íʾ½öÒ»¸ö INSTANCE ¿ÉÒÔʹÓà PASSWORD FILE, SHARE ±íʾ ¶à INSTANCE ¿ÉÒÔʹÓà PASSWORD FILE CONNECT / AS (SYSDBA or SYSOPER) On NT Platform Create a local users group called ORA_<SID>_DBA and ORA_<SID>_OPER for a specific instance or ORA_DBA and ORA_OPER that is not specific to an instance. (for all sids) Add NT userid to this new group Add following line to sqlnet.ora file if not already there: SQLNET.AUITHENTICATION_SERVICES=(NTS) Set REMOTE_LOGIN_PASSWORDFILE parameter to NONE. CONNECT / AS (SYSDBA or SYSOPER) -- ¿ÉÒÔÁ¬½Óµ½ÒѹرյÄÊý¾Ý¿â ? Notes: 1. ´Ó CLIENT Á¬½Óʱ ,NET8 ±ØÐë°²×°ÔÚ CLIENT ¶Ë»òÔ¶³Ì SERVER ¶Ë µ«Ê¹Óà , JDBC Á¬½Óʱ²»Óà -- ????Ϊʲô ???? 2. CONNECT INTERNAL/pw AS SYSDBA, Ô-ÓÐµÄ CONNECT INTERNAL ±£Áô ÖÐ (9i ½«ÍêÈ«È¡Ïû ) * Using Password File Authentication Create the password file using the password utility: $orapwd file=$ORACLE_HOME/dbs/orapwSID password=admin entries=10 Set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE or SHARED. Use the following command to connect to a database:-- NT È ± Ê ¡ ORACLE, Ê Ç internal=sys as sysdba CONNECT INTERNAL/ORACLE ×¢ 1. ȱʡÏ : PASSWORD FILE µÄλÖà -- ȱʡµÄÃû³Æ : ȱʡ¿ÚÁî UNIX: $ORACLE_HOME/dbs orapw<SID>.ora change_on_install NT: %ORACLE_HOME%DATABASE pwd<SID>.ora oracle HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 60. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 2. Öؽ¨ASSWORD FILE ±ØÐëÊ×ÏÈɾ³ý¾ÉÎļþÈ»ºóʹÓà P ORAPWD ÃüÁî´´½¨Ð嵀 (²» ÄÜÓø²¸ÇµÄ·½Ê½ :OPW-00005) -- Öصã ,·ñÔò±¨´í 3. ORAPWD Ö´ÐÐÓëÊý¾Ý¿âÊÇ·ñÆô¶¯ºÍ¹Ø±ÕÎÞ¹Ø . 4. NT Ï ,Êý¾Ý¿âÆô¶¯Ê±¸ù¾Ý×¢²á±íÖÐ×Ö´®Öµ Ö¸¶¨ :ORA_sid_PWFILE PASSWD FILE Îļþ,ÈôÎ޴˲ÎÊýÔòÕÒÉÏÊöȱʡλÖà PWD<sid>.ora -- ×¢Òâ: ÐèÒªÖØÆðÊý¾Ý¿â²ÅÉúЧ UNIX Ï ÉèÖû·¾³±äÁ¿ , ORA_<sid>_PWFILE ????? 5. SYSDBA ÊǸöȨÏÞ GRANT TO ÆäËûÓû§ ,¿ÉÒÔ , V$PWFILE_USERS tells what users are in the password file. 6. ¾ ß ± SYSDBA µ Ä Ó Ã » § ¿ É Ò Ô µ Ç Â ¼ ¹ Ø ± Õ Ô ¶ ³ Ì Ê ý ¾ Ý ¿ â µ ¸ %ORACLE_HOME%DATABASE ±ØÐëÓÐ Îļþ²Å¿ÉÒÔ PFILE) INIT (»òÖ¸¶¨ 7. Connect to the database by using SYSDBA privilege, you are connected to the SYS schema, Connect to the database by using SYSOPER privilege, you are connected to the PUBLIC schema 8. Èç¹ûʹÓà ALTER USER SYS IDENTIFIED BY newpass ÐÞ¸ÄYS Óû§µÄ¿ÚÁîºó£¬ S ×Ô¶¯ÐÞ¸ÄÁË password file 9. Ö»ÄÜÕë¶Ô SVRMGRL ÓÐЧ ,±¾µØsqlplus ÎÞЧ,Ô¶¶ËQLPLUS ÓÐЧ -- S Î ª Ê ² ô????²âÊÔ·¢ÏÖÓÐʱ´æÔÚÕâÖÖÇé¿ö * ×¢Òâ , NT ÉÏÁ¬½Ó SYSDBA ʱºòÈç¹û²ÉÓõ¥¶À¼Èë¿ÚÁîµÄ·½Ê½·¢ÏÖÓÐÒÔÏ AS (O816+Win2000Pro): 1. INTERNAL ÎÞ·¨Ê¹Óõ¥¶À¼Èë¿ÚÁîµÄ·½Ê½ 2. SYS ÐèÒªÓÃÕâÑùµÄ·½Ê½ : ÔÚ¼Èë¿ÚÁîʱ¼üÈë SYSDBA : pass AS 15:55:48 SQL> connect sys@ocp as sysdba ÇëÊäÈë¿ÚÁî : ****** -- oracle ERROR£º ORA-01017: invalid username/password; logon denied 16:01:01 SQL> connect sys@ocp as sysdba -- ÕâÀïÃæ sysdba Ò²¿ÉÒÔ²»Â¼Èë as ÇëÊäÈë¿ÚÁî : **************** -- oracle as sysdba ÒÑÁ¬½Ó¡£ 16:01:22 SQL> * Oracle Enterprise Manager Architecture (three-tier model) 1. ÓÉ Java-based console,¿ÉÔÚ EB ÉÏä¯ÀÀÔËÐÐµÄµÄ W integrated applications ×é³É . 2. Oracle Management Server (OMS): uses the Oracle Enterprise Manager repository as its persistent back-end store. 3. ÓÉ databases, nodes, or other managed services µÈ×é³É * Shared Repository Multiple administrators share information in one central repository Administrator access controls: Superusers Regular users One default superuser: sysman/oem_temp Administrators are maintained from the console HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 61. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 * Common Services in middle tier Discovery Service Job Scheduling Service Event Service Security Service * Specialized applications include: DBA Management Pack Advanced Management Pack. Includes Tuning Pack, Diagnostics Pack and Change Management Pack. Application Management Pack. Includes support for Oracle Applications Concurrent Manager, WebForm Servers and Workflow subsystems. * Enterprise Manager console: Four panes Navigator pane Group pane Jobs pane Events pane DBA Studio pack has four parts Instance Manager Schema Manager Storage Manager Security Manager --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 62. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 3 Managing an Oracle Instance * In this lesson, you should have learned how to: Create the parameter file Start up and shut down an instance Access dynamic performance views Manage sessions Describe the use of the ALERT file and the trace files * OPEN STAGES: SHUTDOWN STEPS: 1 Start an instance. 1 Close the database. 2 Mount the database. 2 Dismount the database. 3 Open the database. 3 Shut down the instance. * Parameter File: the init<SID>.ora file 1. ÿ´ÎTARTUP µÄʱºòÉúЧ S 2. ȱʡλÖà = $ORACLE_HOME/dbs. :UNIX NT = %ORACLE_HOME%database (point to: %ORACLE_HOME%admin<sid>pfileinit.ora) 3. Using OEM you can view and modify init parms. ÐèҪͨ¹ý ʹÓà OEM °æ±¾ ´æ OMS . 2 ÔÚ repository, ÒÔÇ°µÄÔÚ registry. 4. Ö÷ÒªÓÃ; Size the System Global Area (SGA) components to optimize performance. Set database and instance defaults. Set user or process limits. Set limits on database resources. Define (on database creation only) various physical attributes of the database, such as the database block size. Specify control files, archived log files, ALERT file, and trace file locations. 5. Rules for Specifying Parameters format: keyword=value. All parameters are optional. -- ¶¼ÊÇ¿ÉÑ¡µÄ Each parameter has default value and depend on the version of the Oracle server. -- ¶¼ÓÐȱʡֵµ«»áËæ°æ±¾²»Í¬±ä»¯ Parameters can be specified in any order. -- Óë´ÎÐòÎÞ¹Ø Comment lines begin with the # symbol. -- ÒÔ# ×÷ΪעÊÍ OS ÎÞ¹Ø (Óë ) Enclose parameters in double quotation marks to include character literals. -- °üº¬ Ìض¨×Ö·ûʱÓà "" Additional files can be included with the keyword IFILE. -- ¿ÉÓà IFILE Ö¸¶¨ÆäËû°ü º¬²ÎÊýµÄÎļþ If case is significant for the operating system, then it is also significant in filenames. -- ´óСдËæ¶ø¶¨ OS Multiple values are enclosed in parentheses and separated by commas.-- ¶à²ÎÊýÓà ()À¨ÆðÓà ,·Ö¿ª HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 63. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 The continuation character is the backslash character(). -- ÓÃÓÚ²ÎÊýÖµÁбí±ØÐëÔÚ ²»Í¬µÄÐÐÑÓÐø "" 6. ÖØÒªµÄ²ÎÊý -- Öصã : BACKGROUND_DUMP_DEST LGWR, DBWn µÈµÈд trace files µÄλÖà ,ͬʱҲÊÇ alert log ÎļþµÄλÖà . COMPATIBLE ʵÀý¼æÈÝµÄ ORACLE SERVER °æ±¾ , ȱʡΪ : 8.1.0 (»¹ÓÐ plsql_v2_compatibility - TRUE/FALSE) CONTROL_FILES Names of the control files. DB_BLOCK_BUFFERS Number of blocks cached in the SGA. DB_NAME Database identifier, 8 ¸ö×Ö·ûÒÔÄÚ ÐÂµÄ Ê±±ØÐëÖ¸¶¨¸Ã , ½¨Á¢ DB ²ÎÊý -- ? Óë SID ºÍ SERVICE_NAME Çø±ð ? SHARED_POOL_SIZE Size in bytes of the shared pool. USER_DUMP_DEST Ϊ user process ½¨Á¢µÄ debugging trace files µÄλÖà user IFILE Ö¸¶¨ÆäËû°üº¬²ÎÊýµÄÎļþ (ÔÊÐí×î¶àÈý²ãǶÌ× ) LOG_BUFFER Number of bytes allocated to the redo log buffer in the SGA. MAX_DUMP_FILE_SIZE Maximum size of the Óû§ trace files, µ¥Î»Îª µÄ OS BLOCK ÊýÁ¿ ? NT ϵ¥Î» -- ? PROCESSES ͬʱÁ¬½Ó(connect simultaneously)Ò»¸ö INSTANCE µÄ×î´ó½ø³Ì Êý SQL_TRACE TRUE/FALSE, Enables or disables Óû§QL trace -- × ¢ Ò â S : ½ö ¶Ô User Trace ÓÐЧ TIMED_STATISTICS TRUE/FALSE, Enables or disables timing in trace files and in monitor screens. CORE_DUMP_DEST Ö¸¶¨Ð´ CORE DUMP(SESSION »òINSTANCE Òò´íÎó·Ç Õý³£ÖÐֹʱ²úÉú )ÎļþµÄλÖà , Ö÷ÒªÓÃÓÚ Æ½Ì¨ ƽ̨ÎÞЧ UNIX ,NT * STARTUP Stages -- Öصã ,×¢Òâ¸÷¸ö¹ý³Ì¶ÁÈ¡µÄÎļþºÍ¿ÉÒԲ鿴µÄÊÓͼ 1. Starting an instance includes the following tasks: (NOMOUNT read INIT<sid>.ora file) Reading the parameter file init<sid>.ora -- ¶ÁÈ¡ INIT.ORA ³õʼ»¯²ÎÊýÎļþ Allocating the SGA -- ·ÖÅäGA ¿Õ¼ä S Starting the background processes -- Æô¶¯ºǫ́½ø³Ì Opening the ALERT file and the trace files -- ´ò¿ªLERT ºÍA TRACE Îļþ ÔÚ NOMOUNT ״̬ ,ÄãÖ»ÄÜ·ÃÎÊ´Ó SGA ¶ÁÈ¡Êý¾ÝµÄÊÓͼ : V$PARAMETER ³õʼ»¯²ÎÊýÐÅÏ¢ V$SGA SGA ¸ Å Ò ª Ð (FIXED ¢ SIZE/VARIABLE SIZE/DATABASE Å Ï BUFFERS/REDO BUFFERS) V$OPTION ORACLE SERVER ÉÏ°²×°µÄ²úÆ·Ñ¡ÏîÁбí (²úÆ·Ãû³Æ /ÊÇ·ñ°²×°) V$PROCESS µ ± Ç ° » î ¶ ¯ ½ ø (USERNAME/TERMINAL/PROGRAME/BACKGROUND...) V$SESSION µ±Ç°ESSION ÐÅÏ¢ S V$VERSION ÏÔʾ²úÆ·°æ ±¾ (OEM/PLSQL/CORE/TNS/NLSRTL) V$INSTANCE Ï Ô Ê ¾ µ ± Ç ° Ê µ À (NAME/HOST/VERSION/ARCH ý µ Ä × ´ Ì ¬ LOG/STARTUP TIME/DB STATUS/INSTANCE ROLE) 2. The database must be mounted but not open during the following tasks: (MOUNT read Control file) HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 64. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Renaming data files -- ÓÃÓÚÐÞ¸ÄÊý¾ÝÎļþ Ãû Enabling and disabling redo log archiving options-- ÓÃÓÚ´ò¿ª /¹Ø±Õ¹éµµÈÕÖ¾ Performing full database recovery -- ÓÃÓÚÖ´ÐÐÍêÈ«Êý¾Ý¿â»Ö¸´ Mounting a database includes the following tasks: Associating a database with a previously started instance -- DATABASE ÓëNOMOUNT ´ò ¿ªµÄʵÀý¹ØÁª Locating and opening the control files specified in the parameter file -- ´ò¿ª²ÎÊýÎļþ ÖÐÖ¸¶¨µÄ CONTROL Îļþ Reading the control files to obtain the names and status of the data files and redo log files -- ½ö»ñµÃÊý¾ÝÎļþÃûµ«²»ÑéÖ¤Æä´æÔÚ (However, no checks are performed to verify the existence of the data files and online redo log files at this time.) ÔÚ MOUNT ״̬ ,Äã¿ÉÒÔ·ÃÎÊ´Ó CONTROL FILE ÖжÁÈ¡Êý¾ÝµÄÊÓͼÐÅÏ¢ : V$THREAD thread information; for example, about the redo log groups-- Ïß³Ì ÐÅÏ¢ V$CONTROLFILE Control file Ãû³Æ״̬(NOMOUNT MODE ʱ ,Êý¾ÝΪ¿Õ ) V$DATABASE DATABASE ÐÅÏ¢ /´´½¨Ê±¼ä (Ãû³Æ /¹éµµ·½Ê½ /´ò¿ªÄ£Ê½µÈµÈ ) V$DATAFILE Êý¾ÝÎļþÐÅÏ¢ CONTROL FILE) (FROM V$DATAFILE_HEADER Êý¾ÝÎļþÍ·ÐÅÏ¢CONTROL FILE) (FROM V$LOGFILE ÔÚÏßEDO LOG ÎļþÐÅÏ¢ R 3. Opening the database includes the following tasks: (OPEN read datafiles and redolog files and other files) Opening the online data files -- ´ò¿ªÔÚÏßÊý¾ÝÎļþ Opening the online redo log files -- ´ò¿ªÔÚÏß LOG Îļþ REDO Oracle server УÑéËùÓÐ files and online redo log files Äܹ»pen ²¢¼ì²éÆäÒ»ÖÂÐÔ data o , Èç¹û K, SMON initiates instance recovery. O 4. Instance Recovery -- ·¢Éú INSTANCE ÎÞ·¨¼ÌÐø¹¤×÷ʱ CRASH),SMON×Ô¶¯ (SYSTEM ÔÚ REOPEN ʱ½øÐÐ RECORVERY (1). »Ø¹öÊý¾Ý : ÒѼǼÔÚ ONLINE REDO LOG Öе«Î´¼Ç¼ÔÚ FILE ÖеÄÊý¾Ý DATA (2). Opening the database instead of waiting for all transactions to be rolled back before making the database available (Any data that is not locked by unrecovered transactions is immediately available.) (3). Rolling back uncommitted transactions by SMON and by the individual server processes as they access locked data * STARTUP [FORCE] [RESTRICT] [PFILE= filename] [OPEN [RECOVER][ database] |MOUNT |NOMOUNT] FORCE ÈôÊý¾Ý¿âÔÚÔËÐÐÔòÏÈ SHUTDOWN ABORT ÔÙ performing a normal startup Similar to SHUTDOWN ABORT. Should always issue SHUTDOWN NORMAL and STARTUP NORMAL afterwards RESTRICT enables only users with RESTRICTED SESSION privilege to access the database Ò²¿ÉÒÔʹÓà : ALTER SYSTEM [ENABLE/DISABLE] RESTRICTED SESSION to enable or disable restricted access ÓÃÓÚ: ¶ÔÈκÎÖ÷Òª½á¹¹µÄÐ޸ĻòÖ´ÐÐÒ»¸ö -- ±ÜÃâconsistent export export ¹ý³ÌÖÐ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 65. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Êý¾Ý¸ü¸Ä¶ø²»Ò»Ö PFILE Ö¸¶¨Ê¹Ó÷ÇȱʡµÄ²ÎÊýÎļþ OPEN All files opened as described by the control file for this instance. Used for database access for all users. RECOVER For complete and incomplete recovery at instance start time. MOUNT Control file opened for this instance NOMOUNT Æô¶¯Àý³Ì ,¶ÁÈ¡²ÎÊýÎļþ GA,Æô¶¯ºǫ́½ø³Ì ,´´½¨ S ,´ò¿ª trace ºÍalter Îļþ PARALLEL µ ± Ê ¹ Ó Ã ORACLE ² ¢ Ð Ð · þ Î ñ Æ ÷ Ê ± Ò Ô MODE ´ ò ¿ ª Ê ý ¾ ² Î Ê ý SHARE , Ý¿â PARALLER_SERVERS=TRUE,ȱʡΪ EXCLUSIVE MODE,¼´½öÒ»¸ö INSTANCE ¿ÉÓà EXCLUSIVE Only the current instance can access the database. * SHUTDOWN Stages 1. Closing the Database Oracle server writes the buffer cache changes --> data files redo log buffer cache --> online redo log files. Closes all online data files and online redo log files. Control files remain open while a database is closed but still mounted. 2. Dismounting the Database Oracle server closes its control files. Only an instance remains. 3. Shutting Down the Instance Close the ALERT file and the trace files SGA is deallocated Background processes are terminated. * With Oracle8i, all Server Manager commands, such as STARTUP and SHUTDOWN, have been merged into SQL*Plus. * Automating Database Startup Oracle8i Ò Ô Ç ° µ Ä ° NT: ± control panel --> Service --> Set the æ ¾ OracleService<sid>/OracleStart<sid> = automatic startup type. Oracle8i NT: ORA_SID_AUTOSTART is set to True in the registry. OracleService<SID> UNIX: oratab file Solaris : /var/opt/oracle Linux: /etc/oratab * Changing Database Availability ALTER DATABASE { MOUNT | OPEN } -- ²»Äܽ« NOMOUNT Æô¶¯µÄÊý¾Ý¿âÖ±½Ó¸Ä Ϊ OPEN ALTER DATABASE OPEN [READ WRITE| READ ONLY] -- READ WRITE Ϊȱʡֵ , Á½ ÕßÇø±ðÊÇ :ÊÇ·ñ²úÉú LOG FILE REDO Any database can be opened as a read-only database A read-only database can be used to: Execute queries Execute disk sorts using locally managed tablespaces Take data files offline and online, not tablespaces HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 66. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Perform recovery of offline data files and tablespaces ÔÚ READ-ONLY MODE Ï ,±ØÐëÓµÓб¾µØ¿É¹ÜÀíµÄ±í¿Õ¼ä×÷ΪÁÙʱ±í¿Õ¼äʹÓà ,·ñÔòʹ ÓÃÅÅÐòµÄ¼ìË÷²éѯ¿ÉÄÜʧ°Ü . ÔÚ READ-ONLY MODE Ï ,ÒÔϲ»²úÉú LOG µÄ¹¦ÄÜÊÇ¿ÉÒÔÖ´ÐÐµÄ REDO : Data files can be taken offline and online Recovery of offline data files and tablespaces can be performed Disk writes to other files, such as control files, operating system audit trails, trace files,and ALERT files. * ________________________________________________________________ Shutdown Mode A I T N -- Öصã ,×¢ÒâÖÖ 4 mode µÄÖ´ÐÐÄÚÈݺÍÊÇ·ñ ÐèÒª recovery ________________________________________________________________ Allow new connections x x x x Wait until current sessions end x x x o Wait until current transactions end x x o o Force a checkpoint and close files x o o o ________________________________________________________________ Shutdown mode: A Abort I Immediate x NO T Transactional N Normal o YES SHUTDOWN [NORMAL | TRANSACTIONAL | IMMEDIATE | ABORT ] ȱʡΪ : NORMAL ½öABORT ʱ The next startup will require instance recovery. All txns are terminated, no : txns are rolled back Oracle8i ÒÔÇ°µÄ°æ±¾ stopping the following two services: OracleServiceSID and NT: OracleStartSID. Oracle8i NT: stopping the OracleServiceSID service and setting the ORA_SID_SHUTDOWN parameter to True in the registry. ×¢Òâ: ORA_SID_SHUTDOWNTYPE, a/i/t/n UNIX: oratab file Solaris : /var/opt/oracle Linux: /etc/oratab * Getting and Setting Parameter Values Characteristic Are maintained by the Oracle server and continuously updated Contain data about disk and memory structures Contain data that is useful for performance tuning Are identified by the prefix V_$ and have public synonyms with the prefix V$ The V$FIXED_TABLE view displays all dynamic performance views. -- V$FIXED_TABLE ÏÔʾËùÓÐ V$»ùÓÚµÄ VIRTUAL TABLES X$ V$FIXED_VIEW_DEFINITION ÃèÊöÁË V$½¨Á¢µÄÊÓͼÎı¾ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 67. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ²Î¼ûTARTUP Stages Öв»Í¬ S MODE ¿É¿´µ½²»Í¬µÄÊÓͼµÄÃèÊö Once a database has been started use the following methods to see current parameter setting values: 1. SHOW PARAMETER(s) - Displays all parameters and associated values in alpha order. 2. SHOW PARAMETER(s) <value> - Displays all parameters containing <value> in their name. 3. Query the V$PARAMETER view using SQLPlus. 4. Use Instance Manager in OEM Change Initialization Parameters Dynamically -- Öصã ALTER SESSION -- ½ö¶Ôµ±Ç° SESSION ÓÐЧ ALTER SYSTEM -- Á¢¼´È«¾ÖÓÐЧ ,Ö±ÖÁÔٴθü¸Ä»ò SHUTDOWN ALTER SYSTEM DEFERRED -- ¶ÔÐ嵀 SESSION ÓÐЧ Query the V$PARAMETER or V$SYSTEM_PARAMETER ² é ¿ ´ Ð Þ ¸ Ä ¹ ý µ Ä parameter(WHERE ismodified != 'FALSE') V$PARAMETER shows the current session values V$SYSTEM_PARAMETER shows the current system values independent of the session. The ALTER SYSTEM or ALTER SYSTEM DEFERRED command that modifies a parameter is recorded in the trace file called the ALERT file. -- Alter session ² » ¼ Ç Â¼????? ISSES_MODIFIABLE: can be modified by ALTER SESSION -- ¼´Ê¹ FALSE, µ«Ö´ÐÐÃüÁî²»»á±¨´í ,Öµ²»±ä ISSYS_MODIFIABLE: can be modified by ALTER SYSTEM FALSE -- ÎÞ·¨Óà ALTER SYSTEM ¸ü¸Ä IMMEDIATE -- ¿ÉÒÔÁ¢¼´¸ü¸ÄÉúЧ DEFERRED -- ¿ÉÒÔ¸ü¸Ä¶ÔÒÔºóµÄ ÉúЧ SESSION ISMODIFIED: had been modified by ALTER SESSION = 'MODIFIED' had been modified by ALTER SYSTEM = 'SYS_MODIFIED' * Enable and Disable Restricted Session Use: perform structure maintenance or a database export and import. Ô¼Êø available only to users with the RESTRICTED SESSION privilege. : is ALTER SYSTEM {ENABLE|DISABLE}RESTRICTED SESSION -- ½ö¶ÔδµÇ¼µÄ Óû§ÓÐÏÞÖÆ×÷Óà SQL> SELECT logins FROM v$instance; LOGINS ---------- RESTRICTED 1 row selected. * How to Terminate Sessions -- Öصã ALTER SYSTEM KILL SESSION 'SID,SERIAL#' [POST_TRANSACTION/IMMEDIATE] -- ²ÎÊý²éѯ V$SESSION, POST_TRANSACTION: ÓÃÓÚ²¢ÐзþÎñÆ÷»·¾³ , µ±Ç°ÊÂÎñ½áÊøºóÍ˳ö SESSION ALTER SYSTEM DISCONNECT SESSION 'SID,SERIAL#' HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 68. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 [POST_TRANSACTION/IMMEDIATE] ¸ÃÃüÁîÒý·¢ Ö´ÐÐ PMON : Roll back the user current transaction -- »Ø¹öÓû§µ±Ç°ÊÂÎñ Release all currently held table or row locks -- ÊÍ·ÅËùÓе±Ç°±í¼¶»òÐм¶Ëø Free all resources currently reserved by the user-- ÊÍ·ÅËùÓе±Ç°Óû§Õ¼ÓÃ×ÊÔ´ ¶ÔÓÚ ACTIVE SESSION, ÊÕµ½ : ORA-00028 ERROR, Èç¹û ÃëÄÚ 60 ORACLE ÎÞ·¨ÊÍ·Å SESSION Õ¼ÓõÄ×ÊÔ´ ,֪ͨÓû§²¢ÉèÖÃΪ 'KILLED' ¶ÔÓÚ INACTIVE SESSION, ±ê¼Ç$SESSION.STATUS='KILLED',¸Ã V SESSION Ôٻʱ ±¨´í ,Í˳öºó SESSION ɾ³ý . * The ALERT File and the Trace Files ORACLE ʹÓÃÒÔÏ 3 ¸ö²ÎÊýÖ¸¶¨µÄλÖÃд²»Í¬µÄÐÅÏ¢ºÍ¾¯¸æÄÚÈÝ : BACKGROUD_DUMP_DEST ALERT ÎļþºÍºǫ́½ø³Ì Îļþ´æ·ÅλÖà TRACE USER_DUMP_DEST Óû§RACE Îļþ´æ·ÅλÖà T CORE_DUMP_DEST Òò´íÎóʹ SESSION»ò INSTANCE ·ÇÕý³£ÖÐÖ¹µÄÐÅÏ¢´æ·Å λÖà (ÓÃÓÚNIX ƽ̨ ƽ̨ÎÞЧ U ,NT ) ALERT File Alert file contains -- Öصã internal error(ORA-00600) and data block corruption errors(ORA-01578) monitor database startup and shutdown operations(STARTUP, SHUTDOWN, ARCHIVE LOG, and RECOVER) non-default values of other initialization parameters -- ·ÇȱʡֵµÄ³õʼ»¯²ÎÊý Alert file written while the Oracle instance is running Oracle will create an Alert file upon db startup if one does not exist The location is defined by the BACKGROUND_DUMP_DEST parameter Unix ÏÂȱʡΪ : $ORACLE_HOME/rdbms/log/alert_<SID>.log NT+ORACLE8 Ï Â È ± Ê: ¡ %ORACLE_HOME%RDBMS80TRACE<SID>alrt.log NT+ORACLE8i Ï Â È ± Ê: ¡ %ORACLE_HOME%ADMIN<SID>BDUMP<SID>alrt.log A chronological log of messages and errors. -- °´Ê±¼äÅÅÐòµÄ LOG ÐÅÏ¢ TRACE Files Trace files contains -- Öصã "dumps" created by background processes due to errors that occur during database processing. session process information dumped at the request of the user (set SQL_TRACE='TRUE') ±»ºǫ́½ø³Ì¼ì²â³öÀ´µÄ dumped into a trace file. error ½«±» The locations are defined by the BACKGROUND_DUMP_DEST(ºǫ́½ø³Ì TRACE) parameter and USER_DUMP_DEST(Óû§RACE) parameter. T MAX_DUMP_FILE_SIZE ÏÞÖÆÓû§ TRACE( ·Çºǫ́½ø³ÌTRACE) Îļþ´óС : ,µ¥Î»Îª O/S blocks. -- Öص㠿ÉÒÔÓÃÃüÁî¸Ä±äÓû§µÄ״̬ TRACE : ALTER SESSION SET sql_trace=TRUE or FALSE; --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 69. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 70. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 4 Creating a Database * In this lesson, you should have learned how to: Plan the database structure Prepare the operating system environment Prepare the parameter file Create the database * CREATE DATABASE command ³õʼ»¯´´½¨ : control files, redo log files, and the data dictionary structure * Creation Prerequisites A privileged account authenticated in one of the following ways: By the operating system Using a password file Memory to start the instance -- ÄÚ´æ´óСԼÊø SGA µÄ´´½¨ ÒÔÏÂÊÇ ÏµÄÄں˲ÎÊý -- ·Ç¿¼ÊÔÄÚ UNIX : ÈÝ SHMMAX -- ¹²ÏíÄÚ´æ¶ÎµÄ×î´ó SIZE SHMMNI -- IDENTIFIERS IN ϵͳµÄ¹²ÏíÄÚ´æ×î´óÖµ SHMSEG -- Óû§¿É·ÃÎʵĹ²ÏíÄÚ´æ¶ÎµÄ×î´óÖµ SEMMNI SHMMAX*SHMSEG -- ÓÃÓÚ½¨Á¢ µÄÈ«²¿µÄ×î´ó¹²ÏíÄÚ´æ SGA ×îºÃʹÓà MEMORY,¶ø²»Óà REAL VIRTUAL MEMORY,±ÜÃâAGING P Sufficient disk space for the planned database -- ×ã¹»µÄÓ²ÅÌ¿Õ¼äÒªÒÀ¾ÝÄã¼Æ»®´´ ½¨µÄÊý¾Ý ¿â´óС * Planning Database File Locations Keep at least two active copies of a database control file on at least two different devices. -- ÔÚÆäËûÉ豸Éϱ¸·ÝÒ»¸ö¿ØÖÆÎļþ Multiplex the redo log files and put group members on different disks. -- ½« REDO LOG FILE ·Ö×é·ÅÔÚ²»Í¬´ÅÅÌÉÏ Separate data files whose data: -- Êý¾ÝÎļþ·ÅÖÃÒªÒÀ¾Ý²»Í¬µÄÓÃ; Will participate in disk resource contention across different physical disk resources Have different life spans Have different administrative characteristics To ensure well-balanced I/O loads -- ½« TABLE ºÍ INDEX ·Ö¿ª·ÅÖÃÔÚ²»Í¬´ÅÅÌÉϼõ ÉÙ ¾ºÕù I/O * Optimal Flexible Architecture (OFA) -- Öصã ,×¢Òâ FA µÄ¶¨ÒåºÍĿ¼²ã´Î½á¹¹ O Ô-Ôò : A consistent naming convention -- Ò»ÖµÄÃüÃû¹æÔò Separating Oracle software from the database -- ·ÖÀëÈí¼þºÍÊý¾Ý¿â Separating the Oracle software versions -- ·ÖÀ벻ͬ°æ±¾µÄÈí¼þ oracle Separating the data files belonging to different databases -- ·ÖÀ벻ͬÊý¾Ý¿âµÄÊý¾Ý Îļþ Separating parameter files and database creation scripts from the database files and HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 71. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 software -- ²ÎÊýÎļþºÍÊý¾Ý¿â´´½¨½Å±¾ÓëÊý¾Ý¿âÎļþºÍÈí¼þ·ÖÀë Separating trace files, log files, and dump files from the database and software -- Trace Îļþ Îļþ /Log /Dump ÎļþÓëÊý¾Ý¿âÎļþºÍÈí¼þ·ÖÀë ½á¹¹: ORACLE_BASE is the root of the directory tree. -- ÊÇ ORACLE ¸ùĿ¼ ADMIN -- Êý¾Ý¿â´´½¨ SCRIPTS ºÍ¸ú×ÙÎļþµÈ <SID> adhoc -- administrative scripts ¹ÜÀí½Å±¾ bdump -- background dump files and the alert log file cdump -- core dump files create -- database creation scripts Êý¾Ý¿â´´½¨½Å±¾ exp -- export files pfile -- parameter files udump -- user dump directory , ÎÊýSER_DUMP_DEST ¶¨Òå ² U ,´æÖü backup control file µÈÄÚÈÝ utl -- ʹÓÃÊý¾Ý¿â¹¤¾ßʱ ??? ²úÉúµÄÎļþ ORACLE_HOME -- ÊÇ ORACLE_BASE µÄ×ÓĿ¼ ,°üº¬Èí¼þºÍÊý¾Ý ,ÿ¸ö°æ±¾Óи÷ ×ÔµÄOME Ŀ¼ H <Release> -- °æ±¾ :ORA81 ,Èç BIN -- ´æ·Å racle ²úÆ·¹¤¾ßµÄÖ´ÐгÌÐò O ,Ò»°ã¼ÓÈëËÑË÷·¾¶ PATH ÖÐ DATABASE -- ´æ·Å init<SID>.ora/pwd<SID>.ora ÎļþµÈ jdbc network ADMIN -- ´æ·Å listener.ora / sqlnet.ora / tnsnames.ora ODBC oo4o RDBMS ADMIN -- ´æ·ÅÄÚÖðü /ʵÓù¤¾ßµÈµÄ½Å±¾ demo EXTPROC jlib mesg -- ORACLE ´íÎóÐÅÏ¢¿â trace -- ¼Ç¼ȱʡµÄ¸ú×ÙÐÅÏ¢ standby Êý¾Ý¿âµÄ ,Èç ±¾»ú : alert log ÐÅÏ¢ XA svrmgr sysman -- OEM admin config dbastudio doc ifiles log HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 72. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 system temp ORADATA <SID> ´æ·Å RACLE Êý¾ÝÎļþ O /¿ØÖÆÎļþ /ÈÕÖ¾Îļþ archive -- ¹éµµÈÕÖ¾ LOCAL -- ±¾µØ»¯Èí¼þ ???? * Created using the Database Configuration Assistant * Manual Database Creation 1. Decide on a unique instance and database name and database character set. 2. Set the operating system variables. On UNIX, set the following environment variables: ORACLE_HOME ORACLE_SID -- СÓÚ¸ö×Ö·ûµÄ (8.1 Ç° ÉϱØÐëСÓÚµÈÓÚ ) 8 ID ±êʶ NT 4 ¸ö×Ö·û ORACLE_BASE -- ¿ÉÒÔȱʡ ÍƼö ,OFA ,×÷Ϊ RACLE_HOME µÄÉÏÒ»²ãÖ÷Ŀ¼ O ORA_NLS33 -- Êý¾Ý¿â×Ö·û¼¯ <>US7ASCII ʱÐèÒªÖ¸¶¨ -- Öصã PATH -- ËÑË÷·¾¶ ,±ØÐë°üÀ¨ : $ORACLE_HOME/bin On NT, ¿ÉÒÔÔÚ×¢²á±íÖж¨Òå»òÔÚ DOS ÔËÐÐʱÓÃÃüÁî SET ORACLE_SID=... Ö¸¶¨ÉÏÊö±äÁ¿ Create the service and the password file with ORADIM: ORADIM -NEW -SID sid [-INTPWD internal_pwd][SRVC svrcname] [MAXUSERS number] [STARTMODE auto,manual][-PFILE filename] %ORACLE_HOME%DATABASEORADIM.LOG ¼Ç¼ËùÓÐ ORADIM Ö´ÐÐµÄ ²Ù×÷ 3. Prepare the parameter file. ±¸·Ýȱʡ )²ÎÊýÎļþ (ʾÀý ʹÓñà¼-Æ÷±à¼-²ÎÊýÎļþ ¿ªÊ¼Ò»¸öʵÀýÇ°ÖÁÉÙ¶¨ÒåÏÂÁвÎÊý : DB_NAME -- Ψһ±êʶÊý¾Ý¿â¸ö×Ö·û-- NT ÉÏ °æ²»Äܳ¬¹ý ,С 8 ÓÚ 7 4 ¸ö??? -- ¿ÉÓëID ²»Í¬µ«±ØÐëÓë DATABASE Ö¸¶¨Ãû×ÖÏàͬ S CREATE ,·ñÔò¿ÉÒÔÆô¶¯ INSTANCE µ«ÎÞ·¨ MOUNT -- ´´½¨ÐµÄÊý¾Ý¿âʱΨһ±ØÐëÖ¸¶¨µÄ²ÎÊý -- Êý¾Ý¿â´´½¨ºó´æÔÚÓÚ FILEÖÐ CONTROL ,¿ÉʹÓÃCREATE CONTROLFILE ÃüÁîÐÞ¸Ä CONTROL_FILES -- ×îºÃÁ½¸ö ,×Ô¶¯´´½¨ DB_BLOCK_SIZE -- Êý¾Ý¿â´´½¨ºó²»¿É¸ü¸Ä 4. Create a password file (recommended). ORAPWD 5. Start the instance. Connect as SYSDBA. Start the instance in NOMOUNT stage. HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 73. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 STARTUP NOMOUNT PFILE=.... 6. Create the database. CREATE DATABASE [database] -- ȱʡΪ DB_NAME ²ÎÊýÖµ [CONTROLFILE REUSE] -- ÖØÓÃÒÑ´æÔڵĿØÖÆÎļþ (Îļþ±ØÐëÒÑ´æ ÔÚ), ÕâÀï²»ÄÜÖ±½ÓÖ¸¶¨¿ØÖÆÎļþÃû [LOGFILE [GROUP integer] filespec -- ȱʡ½¨Á¢ LOG Îļþ 2 ¸ö , Ö¸¶¨ [, [GROUP integer] filespec]...] [MAXLOGFILES integer] -- Ö¸¶¨Ã¿×é LOG FILE µÄ×î´ó¸ö REDO Êý [MAXLOGMEMBERS integer] -- Ö¸¶¨Ã¿ ×é LOG ÎļþµÄ×î´ó¸öÊý [MAXLOGHISTORY integer] -- Ö¸¶¨ ORACLE ²¢ÐзþÎñÆ÷ÖÐ×Ô¶¯ media recovery µÄ×î´ó¹éµµÈÕÖ¾Îļþ¸öÊý [MAXDATAFILES integer] -- [MAXINSTANCES integer] -- ¿ÉÒÔͬʱ MOUNT ºÍ OPENÊý¾Ý¿âµÄ INSTANCE ×î´óÊýÁ¿ [ARCHIVELOG|NOARCHIVELOG] [CHARACTER SET charset] [NATIONAL CHARACTER SET charset] -- NCHAR, NCLOB, or NVARCHAR2 ´æÖüÊý¾ÝµÄ×Ö·û¼¯ ,ȱʡÓëÊý¾Ý¿â×Ö·û¼¯Ïàͬ [DATAFILE filespec [autoextend_clause] [, filespec [autoextend_clause]...]] filespec :== 'filename' [SIZE integer][K|M] [REUSE] autoextend_clause :== [AUTOEXTEND {OFF |ON [NEXT integer[K|M]] [MAXSIZE {UNLIMITED|integer[K|M]}] } ] MAXLOGMEMBERS, MAXLOGFILES, MAXDATAFILES,MAXLOGHISTORY, MAXINSTANCES ÔÚ´´½¨Êý¾Ý¿âʱдÈëÁË FILE CONTROL ûÓÐROP DATABASE ÃüÁî D ,±ØÐëÊÖ¹¤É¾³ý OS ÉϵÄÊý¾Ý¿âÎļþ Ö¸¶¨EUSE ÔòÔ-Îļþ±ØÐë´æÔÚ R ,·ñÔò±ØÐëÖ¸¶¨ SIZE -- Öصã ,×¢Òâ Control file ºÍ Logfile 7. Run scripts to generate the data dictionary and accomplish postcreation steps. NT Ï ÔËÐÐ : %ORACLE_HOME%RDBMSADMINbuild_db.sql NT ÏÂȱʡÊý¾Ý¿âÓÉ×¢²á±íÖÐµÄ Ö¸¶¨ -- ????? ORACLE_SID ´´½¨Êý¾Ý¿âºó×Ö·û¼¯²»ÄÜÐÞ¸Ä set ºÍ (°üÀ¨:character national character set) -- ? props$ ? * When you issue a CREATE DATABASE command that fails, you should: 1. Shut down the instance. 2. Delete any files created by the failed CREATE DATABASE command. 3. Correct the error in the CREATE DATABASE command. 4. Restart an instance. * After Creating the Database HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 74. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 sql.bsq Íê³É½¨Á¢»ù±¾µÄÊý¾Ý×Öµä±í ¿ÉÒÔ²éѯ : V$LOGFILE, V$CONTROLFILE, V$DATAFILE The database contains: Data files that make up the SYSTEM tablespace Control files and redo log files The user SYS with the password CHANGE_ON_INSTALL The user SYSTEM with the password MANAGER The rollback segment SYSTEM Internal tables (but no data dictionary views) -- ÄÚ²¿±íµ«Ã»Óн¨Á¢Êý¾Ý×ÖµäÊÓͼ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 75. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 5 Creating Data Dictionary Views and Standard Packages * In this lesson, you should have learned how to: Use the data dictionary views to get information about the database and instance Obtain information about data dictionary views from DICTIONARY and DICT_COLUMNS Use the administrative scripts to create data dictionary views and Oracle-supplied packages Obtain information about stored PL/SQL from DBA_SOURCE Use database event triggers * Êý¾Ý¿â½¨Á¢ºóÐèÒª´´½¨ : 1. Êý¾Ý×Öµä ÌØÐÔ : Central to every Oracle database -- Êý¾Ý¿âÖÐÐÄÄÚÈÝ Describes the database and its objects -- ÃèÊöÊý¾Ý¿âºÍÆä¶ÔÏó Contains read-only tables and views -- °üº¬Ö»¶Á±íºÍÊÓͼ Updated by SQL commands: DDL Some DML Owned by the user SYS -- SYS ËùÓÐ Stored in the SYSTEM tablespace -- ´æÖüÔÚ SYSTEM ±í¿Õ¼ä Accessed with SELECT statements -- ʹÓÃELECT Óï¾ä·ÃÎÊ S ÄÚÈÝ (ÌṩµÄÐÅÏ¢ ): Logical and physical database structure -- Âß¼-ºÍÎïÀíÊý¾Ý¿â½á¹¹ Definitions and space allocations of objects -- ¶ÔÏó¶¨ÒåºÍ·ÖÅä¿Õ¼ä Integrity constraints -- ÍêÕûÐÔÔ¼Êø Users -- Óû§ÐÅÏ¢ Roles -- ½ÇÉ«ÐÅÏ¢ Privileges -- ȨÏÞÐÅÏ¢ Auditing -- Éó¼ÆÐÅÏ¢ Other information -- ÆäËûÐÅÏ¢ The SYSTEM tablespace contains the data dictionary in two parts Base tables -- »ù±¾±í normalized ¹æ¸ñ»¯ Óɽű¾ : sql.bsq ´´½¨ -- Öصã Views -- Êý¾Ý×ÖµäÊÓͼ »ù±¾±íÐÅÏ¢µÄ¼òµ¥ÊÓͼ Óɽű¾ catalog.sql ´´½¨ -- Öص㠾-Óɹ«¹²Í¬Òå´Ê (public synonym)·ÃÎÊ ¼¸ÀàÖ÷ÒªÊÓͼ Öصã : -- USER_ Objects owned by the current user, ÊÇ ALL_ ÊÓͼµÄÒ»¸ö×Ó¼¯ , ÎÞ OWNER ×ֶΠ,Òþº¬Îªµ±Ç°Óû§ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 76. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ALL_ ÓÐ OWNER ×ֶΠ, Objects accessible by the current user DBA_ ÓÐOWNER ×ֶΠof the objects in the database,database , All administrator's views, ¿É·ÃÎʵİüÀ¨ : ½ÇÉ«BA µÄ³ÉÔ± D ¾ß±¸ select any table ȨÏÞ -- È ç ¹ û ² Î O7_DICTIONARY_ACCESSIBILITY=TRUE ½ÇÉ«ELECT_CATALOG_ROLE µÄ³ÉÔ± S ÒÔSYSDBA/SYSOPER ȨÏ޵ǼµÄÓû§ ×ÖµäÐÅÏ¢ÊÓͼ: DICTIONARY Êý¾Ý×ÖµäÐÅÏ¢ : DICT) (ͬÒå´Ê DICT_COLUMNS Êý¾Ý×Öµä°üº¬µÄ×ֶΠÓÃ; ORACLE SERVER ʹÓÃËü²éѯ /Schema objects/´æÖü½á¹¹ : Óû§ ORACLE SERVER ʹÓÃDL ÐÞ¸ÄÆäÄÚÈÝ D USER ºÍ DBA ½«Æä×÷ΪÊý¾Ý¿âÐÅÏ¢µÄÖ»¶Á²Î¿¼ Êý¾Ý×ÖµäʾÀý General overview DICTIONARY/DICT DICT_COLUMNS Schema objects DBA_TABLES DBA_TAB_COLUMNS DBA_OBJECTS DBA_CONSTRAINTS Space allocation DBA_ SEGMENTS DBA_EXTENTS DBA_FREE_SPACE Database structure DBA_DATA_FILES DBA_ROLLBACK_SEGS DBA_TABLESPACES Database version PRODUCT_COMPONENT_VERSION V$VERSION ORACLE ²úÆ·°æ±¾ÓÐ 5 ¸öÊý×Ö : 8.1.6.0.0 µÚÒ»¸öÊÇ°æ±¾ºÅ (version) µÚ¶þ¸öÊÇÐÂÌØÕ÷·¢²¼°æ±¾ release) (new features' µÚÈý¸öÊÇά»¤·¢²¼°æ±¾ release) (maintenance µÚËĸöÊÇÆÕͨ²¹¶¡¼¯ºÅÂë set number) (generic patch µÚÎå¸öÊÇƽ̨ÌØÊâ²¹¶¡¼¯ºÅÂë (platform-specific patch set number) Èç: SQL> select * from product_component_version PRODUCT VERSION STATUS ------------------------------ -------------------- ------------ NLSRTL 3.4.1.0.0 Production Oracle8i Enterprise Edition 8.1.6.0.0 Production HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 77. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 PL/SQL 8.1.6.0.0 Production TNS for 32-bit Windows: 8.1.6.0.0 Production SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production PL/SQL Release 8.1.6.0.0 - Production CORE 8.1.6.0.0 Production TNS for 32-bit Windows: Version 8.1.6.0.0 - Production NLSRTL Version 3.4.1.0.0 - Production 2. ¶¯Ì¬ÐÔÄܱí Dynamic performance tables "Virtual" tables -- »ò "FIXED VIEWS"· Ç Ê µ ¼ Ê ± í ,Êý¾Ý¿â¹ÜÀíÔ±¿ÉÒÔ·ÃÎÊ /½¨Á¢ÊÓͼ /ÊÚ SELECT ȨµÈ ,µ«²»ÄÜ ALTER »ò DROP Information accessed from: Memory -- SGA Control file Public Synonyms begin with V$ DBA uses to monitor and tune the database Listed in V$FIXED_TABLE Example: V$DATAFILE for data file information V$ ¶¯Ì¬ÐÔÄÜÊÓͼÊÇ V_$ÊÓͼµÄ PUBLIC ͬÒå´Ê GV$ ¶ÔÓÚ¼¸ºõËùÓÐµÄ V$,È«¾Ö¶¯Ì¬ÐÔÄÜÊÓͼ ,ÔÚORACLE ²¢ÐзþÎñÆ÷ÔËÐÐʱÓÐЧ ???? 3. ÄÚÖÃL/SQL °ü Built-in PL/SQL packages P Stored Program Units PL/SQL Oracle's procedural language extension to SQL Stored in the data dictionary Java Stored in the data dictionary To execute, publish its call specification ±ØÐë°²×° JSERVER External procedures Written in C Stored in a shared library To execute, publish the call specification ÄÚÖðüµÄºÃ´¦ : Ô¤±àÒë , ¼õÉÙ±àÒëʱ¼ä JAVA ºÍ ¿ÉÒÔʹÓà »ò C SQL PL/SQL µ÷Óà HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 78. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ´æ·ÅÔÚ SHARED POOL,¼õÉÙ´ÅÅÌ·ÃÎÊ Êý¾Ý°²È«¿ØÖÆ ,¿ÉÁîÓû§½ö¿Éͨ¹ýº¯Êý»ò¹ý³Ì·ÃÎÊÌض¨Êý¾Ý ÔÚÖ´Ðйý³ÌÖÐ ,¶àÓû§¿ÉÒÔ¹²Ïíµ¥Ò»¹ý³Ìµ¥Ôª ´æÖüº¯Êý¿ÉÒÔÔÚ SQL ÖÐͬÄÚÖú¯ÊýÒ»Ñùµ÷Óà Stored PL/SQL Program Units A procedure, function, package, or trigger Can accept and return parameters Functions can be called from SQL A set of SQL and PL/SQL commands Stored in the data dictionary Loaded into the shared pool -- ×°Ôص½SHARED POOL Ö´ÐÐ Stored PL/SQL Packages Groups logically related PL/SQL types, items, and subprograms Has two parts: A specification describes its components A body implements the logic ÒÔÏÂÊÇ ORACLE ÌṩµÄһЩÄÚÖðüµÄʾÀý : DBMS_SESSION: Generates SQL commands such as ALTER SESSION or SET ROLE SET_ROLE SET_SQL_TRACE DBMS_UTILITY: Provides various utility routines ANALYZE_SCHEMA COMPILE_SCHEMA DB_VERSION DBMS_SPACE: Provides segment space availability information UNUSED_SPACE FREE_BLOCKS DBMS_ROWID: Provides ROWID information ROWID_INFO DBMS_SHARED_POOL: Keeps and unkeeps packages in the shared pool KEEP UNKEEP DBMS_LOB: Provides routines for operations on BLOB and CLOB data types ÄÚÖðüµÄÏà¹Ø²Ù×÷ ʹÓà RANT, REVOKE EXECUTE ȨÏÞ G ʹÓÃ: ALTER PROCEDURE/PACKAGE COMPILE [BODY]ÖØбàÒë¹ý³Ì»ò°ü Èç¹ûÐèÒª±àÒëÆäËûËùÓÐÓû§µÄ¹ý³Ì ALTER ANY PROCEDURE Ȩ /º¯Êý , ±ØÐë¾ßÓÐ /°ü ÏÞ »ñÈ¡ÄÚÖðüÐÅÏ¢µÄÏà¹Ø×Öµä DBA_SOURCE ³ýÓÃÁË WRAP ÒÔÍâ ,¿ÉÒÔÔÚ _SOURCE ×ÖµäÖв鵽 CODE ALL_SOURCE USER_SOURCE DBA_OBJECTS ÔÚ _OBJECTS ×ÖµäÖвéѯ´æÖü¹ý³Ì /º¯Êý /ÄÚÖðüµÄ״̬ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 79. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ALL_OBJECTS USER_OBJECTS 4. Êý¾Ý¿âʼþ´¥·¢Æ÷ event triggers Database Written in PL/SQL, Java, or C Fire: Automatically Implicitly Stored in the database Managed like other stored program units ´¥·¢Æ÷¿ÉÒÔÓÃÓÚ : Automatically generate derived column values -- ×Ô¶¯Éú³É×ֶεÄÖµ Prevent invalid transactions -- ·ÀÖ¹ÎÞЧµÄ´¦Àí Enforce complex security authorizations -- Ö´Ðи´Ôӵݲȫ¿ØÖÆ Enforce referential integrity across nodes in a distributed database-- Ö´Ðзֲ¼Ê½Êý ¾Ý¿âÖеÄÒ»ÖÂÐÔ¼ì²é Enforce complex business rules that cannot be coded in constraints-- Ö´ÐÐÔ¼ÊøÖÐÎÞ ·¨¶¨ÒåµÄ¸´ÔÓ¹æÔò Provide transparent event logging -- ÌṩµÇ¼ÐÅÏ¢ Provide sophisticated auditing -- ÌṩÉó¼Æ Maintain synchronous table replicates -- ¹ÜÀíͬ²½±íµÄ¸´ÖÆ Gather statistics on table access -- ͳ¼Æ±íµÄ·ÃÎÊ Modify table data when DML statements are issued against views -- µ±¶ÔÊÓͼ ʹÓÃML ʱÐÞ¸ÄÏà¹Ø±íÊý¾Ý D Publish information about database events, user events, and SQL statements to subscribing applications Parts of a Trigger ´¥·¢Æ÷µÄ×é³É²¿·Ö Triggering event -- ´¥·¢Ê¼þ , À¨ºÅÖдóдÊÇ´¥·¢Æ÷ʼþÃû³Æ , ã ¢ Ò â Á ½ -- Ö Ø µ × Ààʼþ°üÀ¨µÄ ÄÚÈÝ 1. Database(system) event-- Êý¾Ý¿â )ʼþ (ϵͳ , Ò»°ãÓÉÊý¾Ý¿â¹ÜÀíԱʹÓà (8i ÖÐ ÐÂÔö¼Ó) Instance startup(STARTUP) or shutdown(SHUTDOWN) A specific error message or any error message (SERVERERROR) 2. User event -- Óû§Ê¼þ, Èç¶Ô×Ö¶ÎÊý¾ÝµÄ´¦Àí /УÑéµÈµÈ User logon(LOGON) or logoff(LOGOFF) DDL statement on any schema -- BEFORE »òAFTER CREATE, ALTER, DROP, TRUNCATE ASSOCIATE STATISTICS, DISASSOCIATE STATISTICS ANALYZE, COMMENT, RENAME AUDIT, NOAUDIT GRANT, REVOKE DDL -- µ±ÈκÎÇ°ÃæËùÊöµÄ DDL Óï¾ä·¢³öµÄʱºò´¥·¢ ???? DML statement -- ¶Ô±íµÄһЩ²Ù×÷µÈDML , (INSERT, DELETE, UPDATE) Restriction -- ´¥·¢Ô¼ÊøÌõ¼þ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 80. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Optional boolean clause in a WHEN statement -- ÔÚWHEN Óï¾äÖж¨ÒåÔ¼Êø Ìõ¼þ Trigger only fires if clause is TRUE -- FALSE »òUNKNOWN ʱ²»´¥·¢ Action -- ´¥·¢¶¯×÷ Program unit block -- PL/SQL block, Java program, or C callout »ñÈ¡´¥·¢Æ÷ÐÅÏ¢µÄÏà¹Ø×Öµä DBA_TRIGGERS -- STATUS ÏÔʾ¸Ã TRIGGER µÄµ±Ç°×´Ì¬ ,¿ÉʹÓÃÃüÁî ALTER TRIGGER trigger_name DISABLE/ENABLE; ALL_TRIGGERS USER_TRIGGERS * ÔËÐнű¾´´½¨Êý¾Ý¿â×ÖµäºÍÄÚÖðü ʹÓÃYS Óû§Á¬½ÓÊý¾Ý¿â S ÔËÐнű¾·ÅÔÚÏÂÁÐĿ¼Ï : UNIX: $ORACLE_HOME/rdbms/admin NT: %ORACLE_HOME%rdbmsadmin ÔËÐÐsql.bsq: ½¨Á¢±í¿Õ¼ä , Êý¾Ý×Öµä»ù´¡±íµÈ DATABASE µ÷Óà Ëü½¨Á¢ (CREATE ), : SYSTEM ±í¿Õ¼ä ÔÚ SYSTEM ±í¿Õ¼äÉ쵀 SYSTEM »Ø¹ö¶Î SYS ºÍ SYSTEM ÕÊ»§ Êý¾Ý×Öµä»ù±íºÍ¾Û´Ø Êý¾Ý×Öµä±íµÄË÷ÒýºÍÆäʹÓõÄÐòÁÐ ½ Ç É: PUBLIC,CONNECT,RESOURCE,DBA,DELETE_CATALOG_ROLE,EXECUTE_CATALOG_R OLE,SELECT_CATALOG_ROLE DUAL ±í ÔËÐÐcatalog.sql: ½¨Á¢¹«¹²µÄÊý¾Ý×Öµä (»ù±íºÍ¶¯Ì¬ÐÔÄÜÊÓͼ )ÊÓͼºÍͬÒå´Ê -- Öصã Ëüµ÷ÓõĽű¾ÓÐ : standard.sql ´´½¨ STANDARD ÄÚÖðü (°üÀ¨Êý¾ÝÀàÐÍ EXCEPTION/ÄÚÖà /Ô¤¶¨Òå ¹ý³ÌºÍº¯Êý ²Ù×÷·û /SQL ) cataudit.sql ´´½¨Ö§³ÖÉó¼Æ (audit)¹¦ÄܵÄÊý¾Ý×ÖµäÊÓͼ catexp.sql ´´½¨Ö§³Ö import/export ¹¦ÄܵÄÊý¾Ý×ÖµäÊÓͼ catldr.sql´´½¨Ö§³Ö SQL*Loader ÖÐ direct-path load ¹¦ÄܵÄÊý¾Ý×ÖµäÊÓͼ catpart.sql ´´½¨Ö§³Ö·ÖÇø (partitioning)¹¦ÄܵÄÊý¾Ý×ÖµäÊÓͼ catadt.sql ´´½¨Ö§³ÖORACLE ¶ÔÏó (object)ºÍÀàÐÍ (type)µÄÊý¾Ý×ÖµäÊÓͼ catsum.sql ´´½¨Ö§³Ö summary ¹ÜÀí¹¦ÄܵÄÊý¾Ý×ÖµäÊÓͼ Ëü´´½¨ : »ù±¾µÄ PL/SQL »·¾³ Auditing Import/export SQL*Loader Installed options ÔËÐÐcatproc.sql: ½¨Á¢ÓÃÓÚÀ©Õ¹ºÍÔö ¹¦ÄÜµÄ Ç¿ RDBMS PL/SQL ¹ý³Ì°ü ,µ÷ÓÃÆäËû½Å±¾´´½¨ : Alerts -- DBMS_ALERT HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 81. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Pipes -- DBMS_PIPE Logminer Large objects-- DBMS_LOB Objects Advanced queuing Replication option Other built-ins and options ÔËÐнű¾µÄÃüÃûÔ¼¶¨ : -- Öصã ,×¢Òâbms*.sql ºÍ d prvt*.plb µÄÓÃ; cat*.sql Catalog and data dictionary information -- Êý¾Ý×ÖµäÐÅÏ¢ dbms*.sql Database package specifications -- Ê ý ¾ Ý ° ü à èÃ Ó Ú ,Ó Ê ö À©Õ¹Êý¾Ý¿â¹¦Äܵİü prvt*.plb Wrapped database package code -- Êý¾Ý°üÌå ), (Ô¤°ü×° ÓÃÓÚÀ©Õ¹Êý¾Ý¿â¹¦Äܵİü utl*.sql Views and tables for database utilities -- ijЩ¹¦ÄÜÐèÒªµÄ¶îÍâµÄ ±íºÍÊÓͼ uNNNNNN.sql Database upgrade/migration scripts -- Êý¾Ý¿âÉý¼¶/ÒÆÖ²½Å±¾ dNNNNNN.sql Database downgrade scripts -- Êý¾Ý¿â½µ¼¶½Å±¾ * »ñÈ¡´æÖü¶ÔÏóµÄÐÅÏ¢ : Data dictionary view DBA_OBJECTS: OWNER OBJECT_NAME OBJECT_TYPE STATUS: VALID -- ÒѱàÒë , ¿ÉÒÔÁ¢¿ÌʹÓà INVALID -- ¶Ô VIEW,ÐèÒªÖØзÖÎöÓï¾ä ;¶ÔÓÚ¹ý³Ìº¯ÊýµÈ ,ÐèÒªÖØбàÒë DESCRIBE command * The status of dependent objects may be INVALID: When DDL commands are executed on referenced objects-- ²ÎÕÕ¶ÔÏóµÄ×ֶα䶯 (ÀàÐÍ µÈ ) After creating the objects using the IMPORT utility -- ÒÀÀµµÄ ¶ÔÏóÔÚ±»ÒÀÀµ¶ÔÏóµ¼ÈëÖ® Ç°´´½¨ When a dependent object is modified -- Ïà¹Ø¶ÔÏóÐÞ¸ÄÁË * For program units with an INVALID status: The Oracle server automatically recompiles -- ʹÓÃÇ°×Ô¶¯ÖØбàÒë The user can recompile manually -- ʹÓÃÃüÁî ALTER ... COMPILE * Íê³É DATABASE µÄ´´½¨¹ý³Ì ,»¹±ØÐëÒª½¨Á¢ :SYSTEM ±í¿Õ¼äÖ®ÍâµÄ¸½¼Ó¿Õ¼äºÍ»Ø¹ö¶Î , ORACLE ÍƼö´´½¨ÏÂÁбí¿Õ¼ä : RBS ±ØÐëÖÁÉÙÓÐÒ»¸ö·Ç µÄ»Ø¹ö¶ÎÒÔʹ SYSTEM DATABASE ¿ÉÒÔ²Ù×÷ TEMP ÓÃÓÚÅÅÐò»òÈκÎÖмä²Ù×÷ -- ???? SORT_AREA_SIZE ??? USERS INDX TOOLS ´æÖü RACLE ¹ÜÀí¹¤¾ß½¨Á¢µÄ±íºÍË÷Òý O ÔÚ´´½¨±í¿Õ¼äÖ®ºó ,»¹±ØÐ뽨Á¢Ò»¸ö¸½¼ÓµÄÓû§ ,ͬʱ½« SYSTEM Óû§µÄȱʡ±í¿Õ¼ä¸ÄΪ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 82. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 TOOLS,½«SYS ºÍSYSTEM Óû§µÄÁÙʱ±í¿Õ¼ä¸ÄΪ TEMP,È»ºó×öÊý¾Ý¿â±¸·Ý --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 83. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 6 Maintaining the Control File * In this lesson, you should have learned how to: Explain that the control file is required to mount and operate the database Multiplex the control file to avoid a single point of database failure Back up the control file after making changes to the physical database structure * ÌØÐÔ Small, binary file -- СµÄ¶þ½øÖÆÎļþ Required: At mount -- MOUNT Êý¾Ý¿âʱÐèÒª To operate Linked to a single database -- ½ö¶ÔÓ¦µ¥¸öÊý¾Ý¿â Should be multiplexed Loss may require recovery-- Èç¹û¶ªÊ§ ,Êý¾Ý¿âÐèÒª»Ö¸´ Initialization parameters: CONTROL_FILES -- ²»³¬¹ý 8 ¸ö * °üº¬ÄÚÈÝ -- Öصã : Database name and identifier -- Êý¾Ý¿âÃû (DB_NAME)ºÍ±êʶ (?) Database creation date -- Êý¾Ý¿â½¨Á¢Ê±¼ä´Á Data file and redo log locations-- Êý¾ÝÎļþºÍÁª»úÈÕÖ¾ÎļþµÄλÖà Èç¹ûÍÑ»ú²¢ÐÞ¸ÄÒ»¸ö datafile µÄÃû×Ö,Äã±ØÐëʹÓÃÃüÁî DATABASE RENAME :ALTER FILE ÐÞ¸Ä control file ʹµÃ¸Ãdatafile back online. Tablespace names -- ±í¿Õ¼äÃû³Æ Log history -- LOG ÀúÊ·¼Ç¼ LOG SWITCH ʱ¼Ç¼ , ÔÚ Backup information -- ÓÃRECOVERY MANAGER UTILITY±¸·ÝµÄλÖúÍ״̬ Current log sequence number -- µ±Ç°OG µÄ˳ÐòºÅ L Checkpoint information -- ¼ì²éµãÐÅÏ¢ * ʹÓÃÔ-Ôò Multiplex the control file -- ÔÚ´´½¨Êý¾Ý¿âʱָ¶¨¶à¸ö ͬDISK ÉÏ (×îºÃ·Ö²¼ÔÚ²» ),»òÊý¾Ý ¿â½¨Á¢ºóÔö¼Ó Öصã -- ÈçºÎÔö¼Ó CONTROL FILE »ò¸Ä±ä¿ØÖÆÎļþµÄÊýÁ¿ºÍλÖà 1 Shut down the database. 2 Copy the current control file using an operating system command. 3 Add the new control file names to the CONTROL_FILES parameter. 4 Start up the database. Include the full pathname in CONTROL_FILES -- ±êÃ÷ CONTROL FILE ʱ°üÀ¨È«Â·¾¶ (¾ø¶Ô·¾¶ ) Back up the control file after the database structure changes -- Êý¾Ý¿â½á¹¹¸ü¸Äʱ±¸·Ý -- Öصã Are sized by CREATE DATABASE keywords -- ÔÚCREATE DATABASE Öж¨Òå´óС Ó°ÏìÆä³ß´çµÄ²ÎÊý¼Ç¼ÔÚ : V$CONTROLFILE_RECORD_SECTION ÖÐ -- Öصã ,×¢Òâ²ÎÊýºÍÊÓͼ MAXLOGFILES HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 84. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 MAXLOGMEMBERS MAXLOGHISTORY MAXDATAFILES MAXINSTANCES REUSABLE SECTION -- ¸Ã²¿·ÖµÄÀ©³ä½«Ó°Ïì¿ØÖÆÎļþ³ß´ç Have a reusable section that can expand due to Recovery Manager updates -- °üº¬ Á½²¿·Ö : REUSABLE ºÍNON REUSABLE REUSE ¼Ç¼ÁË »Ö¸´¹ÜÀíÐÅÏ¢ (±¸·ÝÊý¾ÝÎļþºÍÈÕÖ¾ÎļþÃûµÈÀàËÆ ), ¿ÉÒÔÑ-»·Ð´ , REDO LOG µÄд·½Ê½ * Ïà¹ØÐÅÏ¢µÄÊý¾Ý×Öµä (ºÍÃüÁî -- Öصã ) V$PARAMETER -- ¼Ç¼¿ØÖÆÎļþÃû³Æ ), ¿ÉÓà (¾ø¶Ô·¾¶ SHOW PARAMETER(s) CONTROL_FILE ²éѯ V$CONTROLFILE -- ¼Ç¼¿ØÖÆÎļþÃû³Æ )ºÍ״̬ (¾ø¶Ô·¾¶ V$CONTROLFILE_RECORD_SECTION -- ¼Ç¼¿ØÖÆÎļþ²ÎÊýµÄÐÅÏ¢ Performance views from the control file: V$BACKUP -- ÔÚÏßÊý¾Ý¿âµÄ±¸·Ý״̬ V$DATAFILE V$TEMPFILE V$TABLESPACE V$ARCHIVE V$LOG V$LOGFILE V$LOGHIST V$ARCHIVED_LOG V$DATEBASE Others --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 85. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 7 Maintaining Redo Log Files * In this lesson, you should have learned how to: Explain the use of online redo log files Obtain log and archive information Control log switches and checkpoints Multiplex and maintain online redo log files Plan online redo log files Troubleshoot common redo log file problems Analyze online and archived redo logs * ÌØÐÔ 1. ¼Ç¼ÔÚ DATABASE BUFFER ÖжÔÊý¾ÝµÄËùÓиıä : direct writes ???) (¸ö±ðÀýÍâÊÇ 2. LGWR ÕýÔÚдµÄ LOG GROUP ³ÆΪ REDO : current online redo log group -- µ±Ç°Áª»ú ÖØ×öÈÕÖ¾Îļþ 3. LGWR µ±ÏÂÁÐÇé¿ö·¢ÉúʱдÈë current online redo log group ÊÂÎñÌá½» REDO LOG BUFFER ÒÑÈý·ÖÖ®Ò»Âú REDO LOG BUFFER °üº¬³¬¹ýµÄ¸üмǼ 1M ÿ¼ä¸ôÒ»¸öʱ¼ä¶Î (ÈýÃë ) -- ???ÊÇ·ñÓвÎÊýÉèÖà ??? ÔÚ DBWn ½«¸üеÄÊý¾Ý´Ó DB BUFFER дÈëB FILE ÖÐ֮ǰ D 4. LGWR ˳ÐòµØ¶Ôÿ¸öÁª»ú REDO LOG ×é½øÐÐд , ²¢Ñ-»·Ê¹Óà 5. LGWR ´ÓÒ»¸ö ONLINE REDO LOG GROUP µ½ÁíÒ»¸ö GROUP µÄʼþ³ÆΪ : LOG SWITCH, ͬʱHECKPOINT ·¢Éú C 6. µ± CHECKPOINT ·¢Éúʱ DBWn ½ « ² ¿ DIRTY DB BUFFER Ð ´ È DB FILES, ² Î Ê ý · Ö ë FAST_START_IO_TARGET(8.1 °æ±¾ºóÆóÒµ°æ )¶¨ÒåÁËдÈëµÄÊýÁ¿ µÄвÎÊý CKPT ¸üÐÂËùÓÐÊý¾ÝÎļþºÍ¿ØÖÆÎļþµÄÍ· ,±íÃ÷¼ì²éµãÍê³É 7. CHECKPOINT ¿ÉÒÔ·¢ÉúÔÚËùÓÐÊý¾ÝÎļþÒ²¿ÉÒÔ½ö·¢ÉúÔÚÖ¸¶¨Êý¾ÝÎļþ -- ??ÈçºÎÖ¸¶¨?? 8. ÒÔÏÂÇé¿öµ¼Ö CHECKPOINT ·¢Éú -- Öصã (1) ÿһ¸ö SWITCH LOG (2) SHUTDOWN -- ABORT ³ýÍâ (3) µ±ÉèÖÃÁËÏÂÁÐÇ¿ÖƼì²éµã·¢ÉúµÄ³õʼ»¯²ÎÊý : -- Öصã ,×¢ÒâÈý¸ö²ÎÊýµÄ×÷Óà LOG_CHECKPOINT_INTERVAL µ¥Î» ¿éÊý : OS 8.1 ÒÔÇ° : ÈôÈÕÖ¾ÎļþÖÐдÈëµÄÊý³¬¹ý´ËÖµÔò¼ì²éµã·¢Éú BLOCK (Ò»°ãСÓÚ REDO LOG FILE SIZE) 8.1 ÒÔºó : ¼ì²éµãλÖà <=REDO LOG FILE SIZE-¸ÃÖµ (Èô¸ÃÖµ»ò =0 >REDO LOG FILE SIZE ÔòÎÞЧ ,¼´½öÔÚ SWITCH ·¢Éú LOG ) LOG_CHECKPOINT_TIMEOUT µ¥Î» 0 ±íʾ½ûÖ¹ : Ãë 8.1 ÒÔÇ° : Á½¸ö¼ì²éµãÖ®¼ä¼ä¸ôµÄ×î´óÊýÁ¿ (Ãë ) 8.1 ÒÔºó : REDO LOG FILE дÍê֮ǰ OF)Ö¸¶¨µÄʱ¼ä (END (Ãë)·¢Éú¼ì²éµã ???? FAST_START_IO_TARGET µ¥Î» : BLCOK 8.1 Æ ó Ò µ ° æ µ Ä Ð Â Ô ö ² Î Ê ý =0 HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 86. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 DISABLE, ȱʡ=BUFFER CACHE µÄ BLOCK Êý Ó Ã Ó Ú ¿ ØINSTANCE RECOVERY TIME, ÏÞÖÆ ² Ù × ÷ µ Ä Ê ý Á ¿ ÖÆ I/O , ÏÞÖÆ BUFFER CACHE ÖÐ DIRTY BUFFER µÄÊýÁ¿ Èç¹ûÐèÒª»Ö¸´²Ù×÷¶ø DATA BLOCK ³¬¹ý¸ÃÖµ I/O ¶ÁÈ¡µÄ ,ORACLE ½«ÔàÊý¾Ý дÈëISK Ö±ÖÁ£¿£¿£¿£¿ D (4) µ±Êý¾Ý¿â¹ÜÀíԱǿÖƼì²éµãʱ ALTER SYSTEM SWITCH LOGFILE; ALTER SYSTEM CHECKPOINT; 9. ÉèÖòÎÊýLOG_CHECKPOINTS_TO_ALERT=TRUE Ôòÿ´Î¼ì²éµã½«¼Ç¼ÔÚ ALERT ÎÄ ¼þÖÐ(DEFAULT=FALSE) * ÓÃ; ½öÓÃÓÚʵÀýʧ°Üʱ»Ö¸´Êý¾Ý (Ìá½»µÄµ«ÉÐδдÈëÊý¾ÝÎļþµÄÊý¾Ý ) * Àà±ð 1. NOARCHIVELOG mode Áª»úEDO LOG FILE дÂúʱ switches ·¢Éú R ,log LGWR will not overwrite a redo log group until the checkpoint for that group is completed. 2. ARCHIVELOG mode дÂúEDO LOG FILE µÄ·Ç»î¶¯µÄ R GROUPS ½«±»¹éµµ ARCHIVELOG FILE ¿ÉÒÔ±¸·Ý×ö»Ö¸´Êý¾ÝʹÓà (ÓÈÆäÊÇ·ÇÍêÈ«»Ö¸´) Á½ÖÖ·½Ê½¹éµµ ÒªÃ÷È·²ÎÊý -- LOG_ARCHIVE_START ²»Äܾö¶¨Êý¾Ý¿âÊÇ·ñ´¦ÓÚ¹é µµ×´Ì¬ ,¶øÊǵ±Êý¾Ý¿â´¦Óڹ鵵״̬ʱִÐй鵵µÄ·½Ê½ ÊÖ¹¤ LOG_ARCHIVE_START=FALSE(ȱʡֵ Òª¹ÜÀíÔ±ÊÖ¹¤¹éµµ ),Ðè -- Èôδ Ö´ÐÐ,дÂúºóϵͳ½«Í£Ö¹ ???? ÊÖ¹¤¹éµµALTER SYSTEM SWITCH LOGFILE; : -- ????δȷÈÏ ×Ô¶¯ LOG_ARCHIVE_START=TRUE, ARCn ×Ô¶¯Ö´Ðй鵵 ARCHIVE LOG START/STOP -- ºÍ CREATE DATABASE »ò ALTER DATABASE ARCHIVELOG/NOARCHIVELOG µÄÇø±ð ????? * ʹÓà A. ½á¹¹ Online Redo Log Groups Ò»¸öÁª»ú LOG ×éÖаüº¬Ò»×éÏàͬµÄÁª»ú Îļþ REDO REDO LOG LGWR ͬʱ¶ÔÒ»¸ö×éÖÐËùÓеÄÁª»úÎļþдÈëͬÑùµÄÐÅÏ¢ REDO LOG Oracle server ÐèÒªÖÁÉÙÁ½¸öÁª»ú REDO LOG GROUP Online Redo Log Members ³ÉÔ±Ö¸ÔÚÒ»¸öÁª»ú REDO LOG ×éÖеÄÿһ¸öÁª»ú REDO LOG Îļþ ÿ¸ö³ÉÔ±¾ßÓÐÏàͬµÄÈÕÖ¾ÐòÁкźÍÏàͬµÄ³ß´ç´óС ÈÕÖ¾ÐòÁкÅÊÇÿ´ÎдÈë×éÖÐÎļþʱµÄΨһ±êʶ ºÍËùÓÐÊý¾Ý ,´æÔÚONTROL FILE C ÎļþÍ·ÖÐ-- SCN ??? ×é¼ä³ÉÔ±ÎļþµÄ³ß´ç¿ÉÒÔ²»Í¬ ,×éÄÚ±ØÐëÏàͬ ÿ¸ö×éµÄ³ÉÔ±¸öÊý²»±ØÏàͬ>=1 (µ«²»ÍƼö ),Òª B. ¹ÜÀíEDO LOG Îļþ R 1. ½¨Á¢³õʼ REDO LOG ÎļþÔÚCREATE DATABASE ʱ½¨Á¢ : , ÏÂÃæµÄ²ÎÊýÔ¼Êø HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 87. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 REDO LOG ÎļþÊýÁ¿ MAXLOGFILES online redo log groups µÄ×î´óÊýÁ¿ MAXLOGMEMBERS ÿ¸önline redo log groups ÖгÉÔ±µÄµÄ×î´óÊýÁ¿ o LOG_FILES µ±Ç°Êý¾Ý¿âÔÊÐíÔËÐеÄ×î´ó×éÊýÁ¿ , ±ØÐë <=MAXLOGFILES (8.1 ÒÔ ºóÈ¡Ïû¸Ã²ÎÊý ) 2. Adding Online Redo Log Groups Ôö¼ÓÁª»ú LOG ×é REDO ALTER DATABASE [database] ADD LOGFILE [GROUP integer] filespec [, [GROUP integer] filespec]...] GOURP Èô²»Ö¸¶¨ ,ORACLE ×Ô¶¯½¨Á¢ ???ȱʡ½¨Á¢µÄÃû×Ö -- ??? 3. Adding Redo Log Members Ôö¼ÓÁª»ú LOG ×éÖеijÉÔ± REDO ALTER DATABASE [database] ADD LOGFILE MEMBER [ 'filename' [REUSE] [, 'filename' [REUSE]]... TO {GROUP integer|('filename'[, 'filename']...)}]... ÎļþÃûÈô²»Ö¸¶¨Íêȫ·¾¶ , Ôò×Ô¶¯½¨Á¢ÔÚȱʡ·¾¶Ï ??? --ȱʡֵ -- ȱʡ %ORACLE_BASE%oradata<SID> NT: -- ȱʡ UNIX: $ORACLE -- ???? Èç¹ûÎļþÒÑ´æÔÚ REUSE ºÍÖ¸¶¨ÓÚÔ-ÎļþÏàͬµÄ-- Öصã ,±ØÐëʹÓà SIZE ¿ÉÒÔʹÓà >DBA Management Pack¡ª OEM¡ª >Storage Manager ´´½¨Áª»ú LOG REDO ×éºÍ³ÉÔ± 4. Relocate or Rename Redo Log Members Öض¨Î»»òÖØÃüÃûLOG Îļþ REDO ORACLE SERVER ½ö½öÊÇÐÞ¸ÄÁË LOG ÎļþµÄÖ¸Ïò REDO ,¶ø²»ÊÇÎïÀíµØÐÞ¸ÄÆäÃû ³Æ Ê×ÏÈÈ·ÈÏÐèÒª RELOCATE »ò RENAME µÄ REDO LOG Îļþ±ØÐë´æÔÚ °´ÏÂÃæ²½ÖèÖ´ÐÐ : shutdown database perform O/S copy of redo log files to new location (»ò½¨Á¢ÁËÐ嵀 REDO LOG Îļþ ) startup mount ALTER DATABASE [database] RENAME FILE 'filename'[, 'filename']...TO 'filename'[, 'filename']... open database (alter database open) ¿ÉÒÔʹÓà OEM¡ª >DBA Management Pack¡ª >Storage Manager 5. Dropping a Redo Log Group ɾ³ýÁª»ú LOG ×é REDO REDO LOG ÎļþµÄ ²»Äܸıä SIZE ,±ØÐëɾ³ýºóÖØн¨Á¢ ALTER DATABASE [database] DROP LOGFILE {GROUP integer|('filename'[, 'filename']...)} [,{GROUP integer|('filename'[, 'filename']...)}]... Ô¼ÊøÌõ¼þ: An instance ÐèÒªÖÁÉÙÁ½×é LOG REDO »î¶¯µÄºÍµ±Ç°×é²»ÄÜɾ³ý Èç¹ûÊý¾Ý¿âΪ ARCHIVELOG mode ÇÒ¸Ã×éÉÐδ¹éµµ ,Ôò²»ÔÊÐíɾ³ý ¸ÃÃüÁδɾ³ýÎïÀíÎļþ) (ÐèÊÖ¹¤É¾³ý 6. Dropping a Redo Log Member ɾ³ýÁª»ú LOG ×éÖеijÉÔ± REDO ¿ÉÒÔɾ³ýÒ»¸ö ״̬µÄ INVALID REDO LOG FILE HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 88. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ALTER DATABASE [database] DROP LOGFILE MEMBER 'filename'[, 'filename']... Ô¼ÊøÌõ¼þ : ²»ÄÜɾ³ý×éÖеÄ×îºóÒ»¸öÓÐЧ MEMBER Èç¹ûɾ³ýµ±Ç°×éÖеijÉÔ± LOG FILE SWITCH(ʹÓÃÃüÁî ,±ØÐëÊ×ÏÈÇ¿ÖÆ :) Èç¹ûÊý¾Ý¿âΪ ARCHIVELOG mode ÇÒ¸ÃÎļþËùÊôµÄ×éÉÐδ¹éµµ ,Ôò²»ÔÊÐíɾ ³ý ¸ÃÃüÁδɾ³ýÎïÀíÎļþ) (ÐèÊÖ¹¤É¾³ý 7. Clearing Online Redo Log Files Èç¹ûÒ»¸ö LOG FILE Ë𻵠REDO ,Êý¾Ý¿â¹ÜÀíÔ±¿ÉÒÔÓÃÖØгõʼ»¯ÈÕÖ¾ÎļþµÄ ÐÞ¸´ , Ï൱ÓÚɾ³ýºóÖؽ¨ ALTER DATABASE [database] CLEAR [UNARCHIVED] LOGFILE {GROUP integer|('filename'[, 'filename']...)} [,{GROUP integer|('filename'[, 'filename']...)}]... Ô¼ÊøÌõ¼þ : ÈôΪ·Ç¹éµµÄ£Ê½ ,ÔòUNARCHIVED ±ØÐëÖ¸¶¨ Ëü½«Ê¹µÃÎļþ ±¸·ÝÎÞ·¨Ê¹Óà REDO LOG ÎļþÐèÒª»Ö¸´Ê± (µ±Áª»ú ) ???? Ò»°ãÊÇ°´×é CLEAR, Íê³ÉºóÆä״̬Ϊ : UNUSED C. Áª»úEDO LOG FILE µÄ¹æ»® R 1. Number of Online Redo Log Files ¼ì²é LGWR TRACE Îļþ»ò ALERT ÎļþÖÐÏÔʾ ÓÉÓÚHECKPOINT ûÓÐ LGWR C Íê³É»òÒ»¸öÈÕÖ¾×éûÓÐ ¶øƵ·±µØµÈ´ýÒ»¸ö ȥд ARCHIVED GROUP ,´ËʱÐèÒªÔö¼ÓÈÕÖ¾×é ORACLE Ö§³Ö¸÷×é³ÉÔ±ÊýÁ¿²»Í¬ ,µ«½¨ÒéÉèÖÃͬÑùµÄ Êý MEMBER 2. Location of Online Redo Log Files ½«Í¬Ò»×éÖеijÉÔ±·ÅÔÚ²»Í¬ DISK ÉÏ ½«Áª»ú REDO LOG ÎļþºÍ ARCHIV ÈÕÖ¾Îļþ·ÅÔÚ²»Í¬ DISK ÉÏ¿ÉÒÔ¼õÉÙ ARCn ºÍLGWR µÄ´ÅÅÌÕùÓà ½«Áª»ú REDO LOG ÎļþºÍÊý¾ÝÎļþ·ÅÔÚ²»Í¬ DISK ÉÏ¿ÉÒÔ¼õÉÙ ºÍ DBWn LGWR µÄ´ÅÅÌÕùÓò¢¼õÉÙÒò´ÅÅÌË𻵶øͬʱ¶ªÊ§Êý¾ÝÎļþºÍÁª»ú REDO LOG ÎļþµÄ·çÏÕ 3. Sizing Online Redo Log Files ×îС³ß´çΪ 50K ×éÄÚ³ÉÔ±Îļþ³ß´ç±ØÐëÏàͬµ«×é¼ä¿É ÒÔ²»Í¬,µ«²»½¨ÒéÕâÑùÉèÖà 4. Ó°ÏìÅäÖõļ¸¸öÒòËØ : Number of log switches and checkpoints Number and amount of redo entries Amount of space on the storage medium; --´æÖü½éÖʵÄÈÝÁ¿´óС ,Èç :±¸·ÝÓõĴŠ´øÈÝÁ¿ D. ¹ÊÕϽâ¾ö 1. One member of a group of two or more is not available. Ö»Òª»¹ÓÐÒ»¸ö¿ÉÒÔʹÓÃµÄ MEMBER,LGWR ºöÂÔÆäËûÎÞЧµÄ MEMBER,µ±¸Ã×é²» »î¶¯ (CHECKPOINT Íê³É ,ɾ³ý²¢Öؽ¨ LOG MEMBER )ʱ REDO ÉÏÊö½â¾ö¹ý³Ì¿ÉÄÜÐèÒª switch. force a log 2. All members of the next group are not available. INSTANCE SHUTDOWN HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 89. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Èô¸Ã ROUP Ϊ G INACTIVE,Ôòɾ³ýºóÖؽ¨ Èô¸Ã ROUP ·Ç G INACTIVE,Ôò¿ÉÄÜÐèÒªÊ×ÏȻָ´Êý¾Ý δÍê³É (CHECKPOINT ) 3. All members of the current group are not available INSTANCE SHUTDOWN ÐèÒªÊý¾Ý»Ö¸´ -- ??? HOW TO DO ??? E. Analyzing the Redo Log Files ·ÖÎöÄÚÈÝ Track changes: To the database To a specific table To a specific user Map data access patterns Undo changes to the database Use archived data to perform tuning and capacity planning Using LogMiner ¸ÅÊö LogMiner Ìṩһ¸ö¹ý³Ì½« LOG µÄÄÚÈÝת»»³ÉÃè»æ¶ÔÊý¾Ý¿âµÄÂß¼-² REDO ×÷µÄQL STATEMENTS S LogMiner ±ØÐëÔËÐÐÔÚ 8.1 °æ±¾ÒÔºó,¿É·ÖÎö °æ±¾ºóµÄ LOG Îļþ 8.0 REDO LogMiner ¿ÉÒÔÔÚÊý¾Ý¿â »ò MOUNT NOMOUNT ״̬Ï ÔËÐÐ ×¼±¸ É趨²ÎÊý UTL_FILE_DIR Ö¸¶¨L/SQL ¿É½øÐÐ ²Ù×÷µÄĿ¼ P I/O (¸ÃĿ¼±ØÐë´æ ÔÚÇÒ¾ßÓжÁдȨÏÞ ) Ö´ÐÐ DBMS_LOGMNR_D.BUILD ´ ´ ½ ¨ × Ö µ ä(Î Ä ¼ þ µ « ² » Ê Ç ±Èô è µ Ä ÍƼö , ØÐ ÎÞ ,ORACLE ʹÓÃÄÚ²¿ ID ±êʶÇÒ×Ö¶ÎֵΪ HEX DATA ???) Ö´ÐзÖÎö DBMS_LOGMNR_D.BUILD('orc1dict.ora','/oracle/database'); -- ºóÃæ µÄ²ÎÊý¼´ UTL_FILE_DIR Ö¸¶¨µÄĿ¼ 1. Ö¸¶¨ÐèÒª·ÖÎöµÄ LOG FILE -- Set up the V$LOGMNR_CONTENTS view (1) Initialize a new list and specify the first log file. DBMS_LOGMNR.ADD_LOGFILE(LOG Î Ä ¼ Ãû ,DBMS_LOGMNR.NEW) (2) Add additional log files to the list. DBMS_LOGMNR.ADD_LOGFILE(LOG Î Ä ¼ Ãû ,DBMS_LOGMNR.ADDFILE) (3) Remove a redo log file from the list DBMS_LOGMNR.ADD_LOGFILE(LOG Î Ä ¼ Ãû ,DBMS_LOGMNR.REMOVEFILE) 2. ¿ªÊ¼·ÖÎö -- Initialize a LogMiner session EXECUTE DBMS_LOGMNR.START_LOGMNR(DICTFILENAME=>'LogMiner ×ÖµäÎļþ -- ') Ê ¹ Ó Ã BUILD ½¨Á¢µÄ ,Íêȫ·¾¶ ¿ÉÑ¡²ÎÊý (¶¼ÓÐȱʡֵ ): HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 90. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 StartScn The beginning of a system change number (SCN) range EndScn The termination of an SCN range StartTime The beginning of a time interval EndTime The end of a time interval DictFileName The name of the dictionary file Options Use the column map specified in logmnr.opt file; the value is USE_COLMAP ???? 3. ¼ì²é·ÖÎö½á¹ûÄÚÈÝ ²é¿´ÊÓͼ : V$LOGMNR_CONTENTS SCN System change number (SCN) TIMESTAMP Timestamp -- ÓÃÓÚoint-in-time »Ö¸´ p THREAD# Thread number LOG_ID Log ID XIDUSN Transaction ID undo segment number XIDSLOT Transaction ID slot number XIDSQN Transaction ID sequence number ABS_FILE# Data block absolute file number REL_FILE# Data block relative file number DATA_BLK# Data block number DATA_OBJ# Data block object number DATA_OBJD# Data block data object number SEG_OWNER Owner name of segment SEG_NAME Segment name -- ±êʶ·¢Éú ²Ù×÷µÄ DML object SEG_TYPE_NAME Type of segment TABLE_SPACE Tablespace name of segment ROW_ID Row ID SESSION# Session number SERIAL# Serial number USERNAME Username -- Ö´ÐÐÓï¾äµÄÓû§ ROLLBACK Rollback request OPERATION Operation SQL_REDO ÕýÔÚ´¦ÀíµÄ Óï¾äSQL SQL_UNDO δ COMMIT ÔòÎÞQL_UNDO,¿É»Ö¸´ÎóɾµÄÊý¾Ý S , ¼Ç¼ÈçºÎ»Ø¹ö µÄ²Ù×÷ REDO INFO Informational message STATUS Status REDO LOG Ö Ð ¶ Ô ¶ à ¼ Ç Â ¼ µ Ä DML ²Ù×÷ÊÇÃ÷ϸµ½Ã¿Ìõ¼Ç¼µÄ ,Óà ROWID????? ûÓÐÖ´ÐÐDBMS_LOGMNR.START_LOGMNR() Ö ® Ç ° ² » Ä Ü · Ã Î Ê V$LOGMNR_CONTENTS,·ñÔò±¨´í ORA-01306 ½öÔÊÐíÖ´ÐÐÁË·ÖÎöµÄ ¿ÉÒԲ鿴ÐÅÏ¢ SESSION ,Èç¹ûÐèÒªÆäËû SESSION ²é¿´ ,¿É½«ÆäÄÚÈÝ´æÔÚÆäËû±íÖÐ ÆäËûÏà¹ØµÄÊÓͼ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 91. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 V$LOGMNR_DICTIONARY The dictionary file in use TIMESTAMP DATE DB_ID NUMBER DB_NAME VARCHAR2(8) FILENAME VARCHAR2(513) DICTIONARY_SCN NUMBER RESET_SCN NUMBER RESET_SCN_TIME DATE ENABLED_THREAD_MAP RAW(16) INFO VARCHAR2(32) STATUS NUMBER V$LOGMNR_LOGS LOG_ID NUMBER FILENAME VARCHAR2(513) LOW_TIME DATE HIGH_TIME DATE DB_ID NUMBER DB_NAME VARCHAR2(8) RESET_SCN NUMBER RESET_SCN_TIME DATE THREAD_ID NUMBER THREAD_SQN NUMBER LOW_SCN NUMBER NEXT_SCN NUMBER INFO VARCHAR2(32) STATUS NUMBER V$LOGMNR_PARAMETERS Current parameter settings for the LogMiner START_DATE DATE END_DATE DATE START_SCN NUMBER END_SCN NUMBER INFO VARCHAR2(32) STATUS NUMBER 4. ½áÊø·ÖÎö EXECUTE DBMS_LOGMNR.END_LOGMNR; * »ñÈ¡Ïà¹ØÐÅÏ¢µÄÊý¾Ý×Öµä(ºÍÃüÁî ) 1. Archiving -- ¹éµµÐÅÏ¢ SQL command: ARCHIVE LOG LIST; Èç SQL> ARCHIVE LOG LIST : Êý¾Ý¿âÈÕ־ģʽ ·Ç´æµµÄ£Ê½ Database log mode No Archive Mode ×Ô¶¯´æµµ ½ûÓà Automatic archival HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 92. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 Disabled ´æµµÖÕµã D:OracleOra81RDBMS Archive destination ?/dbs/arch ×îÔçµÄ¸ÅÒªÐÅÏ¢ÈÕÖ¾ÐòÁÐ 22 Oldest online log sequence 688 µ±Ç°ÈÕÖ¾ÐòÁÐ 24 Current log sequence 689 V$DATABASE: NAME Êý¾Ý¿âÃû DB_NAME LOG_MODE NOARCHIVELOG/ARCHIVELOG V$INSTANCE: ARCHIVER STOPPED/STARTED ʹÓà EM¡ª O >DBA Management Pack¡ª >Instance Manager 2. Groups -- Áª»úÈÕÖ¾×éÐÅÏ¢ V$THREAD: GROUPS Áª»úEDO LOG GROUP µÄÊýÁ¿ R CURRENT_GROUP# µ±Ç°OG GROUP NUMBER L SEQUENCE# SEQUENCE NUMBER 3. Groups and Members -- Áª»úÈÕÖ¾×é¼°Æä³ÉÔ±ÐÅÏ¢ -- Öصã V$LOG: -- ¿ØÖÆÎļþ ÖмǼµÄÁª»ú LOG FILE ÐÅÏ¢ REDO GROUP# MEMBERS STATUS -- Öصã UNUSED never been written to, ¸Õ¸ÕÔö¼ÓµÄÎļþ (×é??) CURRENT µ±Ç°µÄ ACTIVE) (Òþº¬ ACTIVE »î¶¯µ«·Çµ±Ç°µÄ Áª»ú²¢ÐèÒª ,GROUP instance recovery INACTIVE group is online, but no longer needed for instance recovery. CLEARING ÕýÔÚ±» ALTER DATABASE CLEAR LOGFILE ÖØд´½¨Îª¿ÕµÄ LOG FILE,CLEAR Íê³Éºó״̬Ϊ UNUSED CLEARING_CURRENT µ±Ç°ÈÕÖ¾ÎļþÔÚ±»Ò»¸ö CLOSE THREAD(¹Ø±ÕµÄ ÏßË÷ ) CLEARED The log can stay in this status if there is some failure in the switch, such as an I/O error writing the new log header. ????? SEQUENCE# BYTES V$LOGFILE: GROUP# STATUS -- Öصã INVALID Inaccessible ²»Äܱ»·ÃÎÊ STALE contents of the file are incomplete; Èç Ôö¼ÓÒ»¸öÈÕÖ¾Îļþ : DELETED No longer used ²»ÔÙ±»Ê¹Óà Blank Is in use ÕýÔÚ±»Ê¹Óà MEMBER HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 93. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ------ --------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 94. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 8 Managing Tablespaces and Data Files * After completing this lesson, you should be able to do the following: Describe the logical structure of the database Distinguish the different types of temporary segments Create tablespaces Change the size of tablespaces Allocate space for temporary segments Change the status of tablespaces Change the storage settings of tablespaces Relocate tablespaces * Database Storage Hierarchy Êý¾Ý¿â´æÖü²ã´Î½á¹¹Öصã -- ,×¢Òâ²ã´ÎºÍʹÓ÷¶Î§ Database --< Tablespace ------------------------------< Datafile --< Segment | | --< Extent >--------------------------- ^ Oracle Block --< OS Block TABLESPACE ORACLE Êý¾Ý¿â ¿ÉÒÔ±»Âß¼-µØ»®·Ö³É±í¿Õ¼ä Ò»¸ö±í¿Õ¼äÖ»ÄÜÊôÓÚÒ»¸öÊý¾Ý¿â ÿ¸ö±í¿Õ¼äÓÉÒ»¸ö»ò¶à¸öÊý¾ÝÎļþ×é³É Ò»¸ö±í¿Õ¼ä¿ÉÒÔÓÐÒ»¸ö»ò¶à¸ö SEGMENT ×é³É ±í¿Õ¼ä¿ÉÒÔµ¥¶À OFFLINE(SYSTEM ±í¿Õ¼äºÍ°üº¬»î¶¯»Ø¹ö¶ÎµÄ±í¿Õ¼ä³ýÍâ ) ±í¿Õ¼ä¿ÉÒÔÔÚ READ-WRITE ºÍ READ-ONLY ״̬¼äÇл» DATA FILES Ò»¸öÊý¾ÝÎļþÖ»ÄÜÊôÓÚÒ»¸öÊý¾Ý¿â Êý¾ÝÎļþ¿ÉÒÔÔÚ´´½¨ºóÓÐÊý¾Ý¿â¹ÜÀíÔ±ÊÖ¹¤¸Ä±ä»òÉèÖÃΪËæ±í¿Õ¼äµÄ SEGMENTS ¶ÎÊDZí¿Õ¼äÖÐÂß¼-·ÖÅäµÄ¿Õ¼ä½á¹¹·ÖÅäµÄËùÓпռä¾ÍÊÇÒ»¸ö¶Î , ÈçÒ»¸ö TABLE Ò»¸ö¶Î²»ÄÜ¿çÔ½±í¿Õ¼äµ«¿ÉÒÔ¿çÔ½ÊôÓÚͬ¸ö±í¿Õ¼äµÄ DATA FILES -- Öصã ÿ¸ö¶ÎÓÐÒ»¸ö»ò¶à¸ö×é³ÉEXTENT EXTENTS µ±¶Î½¨Á¢Ê± ,ÖÁÉÙ°üº¬Ò»¸ö EXTENT,¶ÎÔö³¤Ê±»á¼ÓÈë¸ü¶àµÄ EXTENTS,DBA ¿ÉÒÔÊÖ¹¤ ÔÚ¶ÎÖÐÔö¼Ó EXTENTS EXTENT ÊÇÒ»×éÁ¬ÐøµÄ ORACLE BLOCKS EXTENT ±ØÐë´æÔÚÒ»¸ö FILE ÖÐ DATA ,²»ÄÜ¿çÎļþ -- Öصã DATA BLOCKS Êý¾Ý¿éÊÇ ORACLE SERVER ÄÜ·ÖÅä /¶ÁдµÄ×îСµ¥Ôª Ò»¸öÊý¾Ý¿éÏ൱ÓÚ·ÖÅä¸øÊý¾ÝÎļþµÄÒ»¸ö»ò¶à¸ö OS ¿é DB_BLOCK_SIZE ¶¨Ò彨Á¢Êý¾Ý¿âʱµÄÊý¾Ý¿â³ß´ç ,²¢Ó¦ÊÇ ¿éµÄ±¶ÊýÒÔ¼õÉÙ OS I/O,Æä ×î´óÖµÊÜÏÞÖÆ OS * ±í¿Õ¼äÀà±ð HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 95. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 SYSTEM ±í¿Õ¼ä Êý¾Ý¿â½¨Á¢Ê±½¨Á¢ ËùÓÐÊý¾Ý¿â¶¼±ØÐëÓÐ °üº¬:Êý¾Ý×Öµä /´æÖü¹ý³Ì /SYSTEM »Ø¹ö¶Î ²»Òª°üº¬Óû§Êý¾Ý (¾¡¹ÜÊÇÔÊÐí½¨Á¢µÄ ) ·ÇSYSTEM ±í¿Õ¼ä ·Ö¿ª¹ÜÀí :ROLLBACK/TEMPORARY/Ó¦ÓÃÊý¾Ý /Ó¦ÓÃË÷Òý¶Î ·Ö¿ª¹ÜÀí :±¸·ÝÊý¾ÝºÍÔËÐÐÊý¾Ý ·Ö¿ª¹ÜÀí :¶¯Ì¬ºÍ¾²Ì¬Êý¾Ý ¿ØÖÆΪÓà »§¶ÔÏó·ÖÅäµÄʹÓÿռä * ±í¿Õ¼ä¹ÜÀí ´´½¨±í¿Õ¼ä Creating Tablespaces ÃüÁî: CREATE TABLESPACE tablespace -- СÓÚ ¸ö×Ö·û 30 ,×Öĸ¿ªÍ· ,¿É°üÀ¨×Öĸ Êý×Ö#_$ DATAFILE datafile_clause] -- ¿Éͬʱָ¶¨¶à¸öÊý¾ÝÎļþ {SIZE integer[K|M] [REUSE] | REUSE } -- size Óà »ò Ö¸¶¨ K M [ autoextend_clause ] ON OFF [, datafile_clause]... [MINIMUM EXTENT integer[K|M]] -- ¸ø½¨Á¢ÆäÖÐµÄ Ò»¸öȱʡµÄ×îСµÄ object EXTENT,ÒÔ¼õÉÙËéƬ -- ±£Ö¤ËùÓбí¿Õ¼äÖÐËùÓÐÒÑʹÓûòδʹÓõĿé´óС²»» Öµ -- STORAGE ÖÐ INITIAL ºÍ NEXT µÄÖµÉèÖÃÓ¦µ±ÊǸÃÖµµÄÕûÊý ±¶ -- Öصã [LOGGING|NOLOGGING] -- È ± Ê ¡ LOGGING, ½ « Ë ù Ó Ð Î ª TABLE/INDEXES/PARTITIONS µÄ¸Ä±äдÈë LOG REDO -- NOLOGGING Ö¸¶¨²¿·Ö DDL/DML Óï¾äµÄÖ´Ðв»Ð´Èë REDO LOG(Èç :DIRECT LOAD) [DEFAULT storage_clause ] -- ±í¿Õ¼äÖÐ OBJECTS µÄȱʡ´æÖü²ÎÊý -- Öصã INITIAL -- K/M, ȱʡΪ¸öDB BLOCKS,×îС ¸öDB 5 2 BLOCKS NEXT -- K/M, ȱʡΪ DB BLOCKS,×îС¸ö BLOCK 5 ¸ö 1 DB MINIEXTENTS -- ¸öÊý /UNLIMITED, × î Ð ¡ È ± Ê ¡ Ö µ Ò DB µ =1, ÀÀ BLOCK SIZE PCTINCREASE -- Ôö³¤°Ù·Ö±È =50%,×îС ±íʾ³ýµÚÒ»¸ö , ȱʡ =0 EXTENT Ö®ÍâµÄʹÓÃÏàͬ SIZE MAXEXTENTS [ONLINE|OFFLINE] -- ´´½¨ºóÁ¢¼´ÔÚÏß /ÀëÏß(DEFAULT=ONLINE) [PERMANENT|TEMPORARY] -- ȱʡΪ :PERMANENT, ´æ·Åʵ¼ÊÊý¾Ý±í , ÁÙʱ±í¿Õ¼äÓÃÓÚÅÅÐòµÈ -- µ ± Ó Ã » § Ó ï ¾ ä Ð è Ò ª Å Å Ð ò ¿ Õ ¼ ä ³ ¬ ¹ ý Ä Ú ´ æ · Ö PERMANENT ±í ¿Õ¼äÉÏ´´½¨ÁÙʱ¶Î -- Öصã HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 96. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 [extent_management_clause] -- Ö¸¶¨ÈçºÎ¹ÜÀí±í¿Õ¼äµÄ ÔÚ´´½¨Êý EXTENTS, ¾Ý¿âʱָ¶¨ , ÒÔºó²»Äܸü¸Ä EXTENT MANAGEMENT { DICTIONARY | LOCAL { AUTOALLOCATE | UNIFORM [SIZE integer[K|M]] } } ] DICTIONARY -- ȱʡ ,×Öµä¹ÜÀí ÒÔÇ°°æ±¾¿ÉÒÔʹÓà , 8.0 LOCAL -- ±¾µØ»¯¹ÜÀí , Ò²³ÆΪλ bitmap, 8.1 ÒÔºó°æ±¾ ͼ¹ÜÀí Ò»¸ö±í¿Õ¼äÒ»¸öλͼ λͼ¸ú×ټǼ used status of blocks free or Each bit in the bitmap corresponds to a block or a group of blocks. -- ??? λͼ¹ÜÀíµÄÓŵãÊÇ : 1. ±ÜÃâ¿Õ¼ä¹ÜÀíµÄµÝ¹é²Ù×÷ ,Èçij¸ö OBJECT ¿Õ¼äµÄÀ©Õ¹ºÍÊÍ ·Å¿ÉÄÜͬʱÒýÆðÊý¾Ý×Öµä±íµÄÀ©Õ¹ºÍÊÍ·Å 2. ÔÚÊý¾Ý×ÖµäÖÐ ²»¼Ç¼¿Õ¼äÐÅÏ¢ ,¼õÉÙÕâЩ±íµÄÕùÓà 3. ¿ÉÒÔ×Ô¶¯Á¬½ÓÏàÁÚµÄ FREE BLOCK,ÎÞÐè½ÓºÏ²Ù×÷ (SMON) 4. ¼ ´ ¿ É Ó É Ï µ Í ³ × Ô EXTENT¶ ´ ó Ð ¡ Ò ² ¿ É Ò Ô ² É Ó Ã Ë ù Ó Ð ¶¯¾ö ¨ EXTENT ÏàͬµÄ´óС 5. ²»²úÉú»Ø¹öÐÅÏ¢ (Òò²»Ð´Êý¾Ý×Öµä :tablespace quota ),ÀýÍâÊÇ information -- Ö ¸ ¶ ¨ Á Ë ¸ à ² Î Ê ý ² » Ä Ü Ô Ù Ö ¸ ¶ ¨ DEFAULT storage,MINIMUM EXTENT,TEMPORARY AUTOALLOCATE -- ϵͳ¹ÜÀí ÄÜÖ¸¶¨ ,Óû§²» EXTENT ´óС UNIFORM -- Ö¸¶¨ÏµÍ³²ÉÓÃÏàͬµÄ EXTENT SIZE(K/M),ȱʡ =1M ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ´´½¨±í¿Õ¼ä ´´½¨ÁÙʱ±í¿Õ¼ä ÃüÁîÒ» : CREATE TEMPORARY TABLESPACE temp -- ORACLE ÍƼö·½Ê½ TEMPFILE '/DISK2/temp_01.dbf' -- × ¢ Ò â : TEMPFILE Ì æ ´ ú Á Ë DATAFILE SIZE 500M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M; ÃüÁî¶þ : CREATE/ALTER TABLESPACE ... TEMPORARY; ÁÙʱ±í¿Õ¼äÌØÐÔ Öصã : -- 1. Tempfiles are always set to NOLOGGING mode. 2. You cannot make a tempfile read-only. -- ʹÓÃÃüÁî¶þµÄ¿ÉÒÔÖÃΪֻ¶Á ??? ²âÊÔ ??? 3. You cannot rename a tempfile. 4. You cannot create a tempfile with the ALTER DATABASE command. -- ¿ÉÓà ALTER TABLESPACE ADD 5. Media recovery does not recover tempfiles. 6. BACKUP CONTROLFILE does not generate any information for tempfiles. 7. CREATE CONTROLFILE cannot specify any information about tempfiles. 8. ʹÓÃÃüÁîÒ»´´½¨µÄÁÙʱ±í¿Õ¼ä²»ÄÜ ???û²âÊÔ OFFLINE ??? HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 97. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 9. µ±TEMPORARY ±í¿Õ¼äÓÃÓÚÁÙʱ sort segments ʱ ,ÿ¸öinstance ´´½¨Ò»¸ö sort segment,¶à¸öÊÂÎñ¿ÉÒÔʹÓÃͬһ¸ö sort segment,µ«Ã¿¸ö extent Ö»Äܱ»Ò»¸öÊÂÎñʹÓà ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ´´½¨ºÍ¹ÜÀíÁÙʱ±í¿Õ¼ä Ð޸ıí¿Õ¼ä´æ´¢²ÎÊýÉèÖà à ü Á îALTER TABLESPACE tablespace { MINIMUM EXTENT integer[K|M]| : DEFAULT storage_clause } ¶ÔÓÚEMPORARY TABLESPACE, ´æÖü²ÎÊýÍƼöΪ T : 1. INITIAL = NEXT 2. INITIAL ºÍ NEXT ÉèÖÃΪ : N*SORT_AREA_SIZE+DB_BLOCK_SIZE -- ¼õÉÙ¿ÉÄܵÄËéƬ -- Öصã 3. PCTINCREASE = 0 ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager Ð޸ıí¿Õ¼ä´æ´¢²ÎÊýÉèÖà Ð޸ıí¿Õ¼ä״̬ (ONLINE/OFFLINE/READ-ONLY) OFFLINE ÓÃ; 1. ÊÇÊý¾Ý¿âµÄÒ»²¿·Ö²»¿É·ÃÎʶø²»Ó°ÏìÆäËû²¿·Ö 2. Ö´Ðбí¿Õ¼ä OFFLINE ±¸·Ý (¾¡¹Ü±í¿Õ¼ä¿ÉÒÔÔÚʹÓÃʱ ) ONLINE ±¸·Ý 3. ÔÚÊý¾Ý¿â´ò¿ª×´Ì¬Ï»ָ´±í¿Õ¼ä»òÊý¾ÝÎļþ 4. ÔÚÊý¾Ý¿â´ò¿ª×´Ì¬ÏÂÒƶ¯Êý¾ÝÎļþ ״̬ÃèÊö 1. ²»ÔÊÐí·ÃÎʸñí¿Õ¼ä°üº¬µÄ¶ÔÏó (²»ÄÜ ALTER/CREAT E,µ«¿ÉÒÔ DROP) -- Öصã 2. ±í¿Õ¼äÖÃΪ OFFLINE »ò»Ö¸´ ONLINE µÄʼþ»á¼Ç¼ÔÚÊý¾Ý×ÖµäºÍ¿ØÖÆÎÄ ¼þÖÐ 3. È ô Ò » ¸ ö ± í ¿ Õ ¼ ä OFFLINE Ê ± Ê ý ¾ Ý ¿ â,¹ Ø ± Õ ¾ Ý ¿ â ´ ò ¿ ª Ê ± Æ ä È Ô ´ ¦ Ó Ú ÔòÊý OFFLINE ״̬ ,ϵͳ²»¼ì²éËüËæºóµÄ״̬ ??? 4. ijЩ´íÎó (Èç DBW0 дÊý¾Ýʧ°Üʱ )½«×Ô¶¯½«±í¿Õ¼äÖÃΪ OFFLINE à ü Á î : ALTER TABLESPACE tablespace {ONLINE|OFFLINE [NORMAL|TEMPORARY|IMMEDIATE|FOR RECOVER]} NORMAL ȱʡֵ ,Çå³ý¸Ã±í¿Õ¼äµÄËùÓÐÊý¾ÝÎļþµÄËùÓв»ÔÚ SGA ÖÐ µÄ BLOCK -- ÓÐ CHECKPOINT TEMPORARY ¶ÔËùÓиıí¿Õ¼äµÄÊý¾ÝÎļþÖ´ÐÐÒ»´Î¼ì²éµã (ÓÐʱÐèÒª»Ö ¸´) IMMEDIATE ²»Ö´Ðмì²éµã , ÐèÒª»Ö¸´ FOR RECOVER Ê ¹ Ê ý ¾ Ý ¿ â OFFLINE ² ¢ Ð è Ò ª Ê ± ¼ ä µ ã » Ö ¸ ´ (point-in-time recovery) ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ¸Ä±ä±í¿Õ¼ä×´ ̬Ϊ : OFFLINE ²âÊÔ -- Ë µ à ÷ ¸ Ä ± ä Ê ÇREDO ÚLOG BUFFER ÖÐ ¼ ´ Ê ¹ ·ÅÔ , TABLESPACE OFFLINE Ò²²»Ó°Ïì½á¹û ,µ«Êý¾ÝÁ¿´óµÄÇé¿öÓ¦µ±²»Í¬ ,ûÓвâÊÔ ? SESSION1 SESSION2 --------------------------------------------------------- SQL> delete t1; 1 row deleted. HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 98. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 SQL> select * from t1; no rows selected SQL> alter tablespace users offline; Tablespace altered. SQL> rollback; Rollback complete. SQL> select * from t1; select * from t1 * ERROR at line 1: ORA-00376: file 3 cannot be read at this time ORA-01110: data file 3: 'D:ORACLEORADATAOCPUSERS01.DBF' SQL> alter tablespace users online; Tablespace altered. SQL> select * from t1; A ---------- 1 READ-ONLY ÓÃ; 1. ·ÀÖ¹¶Ô±í¿Õ¼äд²Ù×÷ 2. ¿ÉÒÔ´ò¿ª¶ÁȡλÓÚÖ»¶Á½éÖÊÉÏ (ÈçCD-ROM)»òwrite-once(WORM)µÄÊý¾Ý Îļþ 3. ¶ÔÊý¾Ý¿â´óµÄ¾²Ì¬µÄÊý¾Ý²¿·Ö½øÐб¸·Ý -- ???? ״̬ÃèÊö-- Öصã ,×¢ÒâÒªÇóµÄ״̬ÔÊÐíºÍ½ûÖ¹µÄ²Ù×÷µÈµÈ 1. ²»ÔÊÐíÐ޸ĸñí¿Õ¼ä°üº¬µÄ¶ÔÏó (²»ÄÜLTER/CREATE,µ«¿ÉÒÔ A DROP--Òò Ëü½öÓ°ÏìÊý¾Ý×Öµä) ¶ÔÓÚ±¾µØ»¯¹ÜÀí )µÄ±í¿Õ¼ä (λͼ¹ÜÀí ,dropped segment ÐÞ¸ÄÁËÁÙʱ¶Î , ÒÔ ·Àֹλͼ±»¸Ä±ä. --???? 2. ORACLE8i ÖÐʹÓÃÃüÁî TABLESPACE tablespace READ ONLY ÊÇ ALTER ½«±í¿Õ¼äÖÃÓÚ¹ý¶ÉµÄÖ»¶Á״̬,¼´: ÈôÓÐδÍê³ÉµÄÊÂÎñ ,ϵͳµÈ´ý ÔÊÐí¸ü¸Ä״̬ǰµÄÊÂÎñµÄÌá½»»ò»Ø¹ö ²»ÔÊÐí¸ü¸Ä״̬ºóµÄ¶Ô¸Ã±í¿Õ¼ä¶ÔÏóµÄд²Ù×÷ ËùÓиü¸Ä״̬ǰµÄÊÂÎñµÄÌá½»»ò»Ø¹öÍê³Éºó ,±í¿Õ¼äÖÃΪREAD-ONLY ×´ ̬ 3. ORACLE8i ֮ǰ ,ϵͳÔÚ´æÔÚδÍê³ÉÊÂÎñÇ°²»ÔÊÐíÖÃΪREAD-ONLY,½¨Òé ʹÓà restricted mode Æô¶¯ INSTANCE 4. READ ONLY ÒýÆðÒ»¸ö CHECKPOINT ·¢Éú 5. ÉèÖÃEAD ONLY ÒªÇó¸Ã±í¿Õ¼äµÄËùÓÐÊý¾ÝÎļþ±ØÐëÊÇ R ONLINE ״̬ ,ÇÒ ²»´æÔÚ pending ÊÂÎñ ÃüÁî: ALTER TABLESPACE tablespace READ [ONLY | WRITE] -- Öص㣬ע Òâ²»ÄÜʹÓà DATABASE ALTER ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ¸Ä±ä±í¿Õ¼ä×´ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 99. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 READ ONLY ̬Ϊ ɾ³ý±í¿Õ¼ä ÃüÁî : DROP TABLESPACE tablespace [INCLUDING CONTENTS [CASCADE CONSTRAINTS]] INCLUDING CONTENTS drops all the segments in the tablespace CASCADE CONSTRAINTS ɾ³ýËùÓÐ :ÒÀÀµ¸Ã±í¿Õ¼äÉϱí (PK,UNIQUE) É쵀 ÆäËû±í¿Õ¼ä±íÉϵIJÎÕÕÍêÕûÐÔÔ¼Êø ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ɾ ³ý±í¿Õ¼ä Guidelines: -- Öصã ,×¢Òâ±í¿Õ¼äÔÚÈκÎ״̬ (ONLINE/OFFLINE/READ-ONLY) ϶¼ ¿Éɾ³ý 1. ´æÔÚÄÚÈݵıØÐë¼Ó INCLUDING CONTENTS ×Ó¾ä ,Ëü²úÉú ROLLBACK 2. ´æÔÚÏà¹ØÔ¼ÊøʱÐèÒª¼ÓÉÏ CASCADE CONSTRAINTS ×Ó¾ä ,·ñÔòÎÞ·¨É¾³ý 3. ɾ³ý¿ØÖÆÎļþÖÐÏàÓ¦Êý¾ÝÎļþµÄÖ¸Õë ,µ«²»É¾³ýʵ¼ÊÎïÀíÎļþ 4. ½¨Òé OFFLINE ״̬ÏÂɾ³ý±í¿Õ¼ä ,ÒÔÈ·±£Ã»ÓÐÊÂÎñÔÚ·ÃÎʴ˱í¿Õ¼ä (¾¡¹Ü READ-ONLY ״̬ÏÂÒ²¿ÉÒÔɾ³ý ) ¸Ä ±ä±í¿Õ¼ä³ß´ç a Tablespace Resizing ·½Ê½Ò»: ¸Ä±äÊý¾ÝÎļþµÄ´óС,×¢ÒâÁ½¸ö -- Öصã ALTER µÄÇø±ðÒÔ¼°ÔÚ Ê±±ØÐë resize ʹÓÃLTER DATABASE A ×Ô¶¯ ALTER TABLESPACE tablespace -- Specifying AUTOEXTEND for a New Data File ADD DATAFILE filespec [autoextend_clause][, filespec [autoextend_clause]]... ALTER DATABASE [database] -- Specifying AUTOEXTEND for an Existing Data File DATAFILE 'filename' [, 'filename']...autoextend_clause autoextend_clause :== [ AUTOEXTEND { OFF|ON[NEXT integer[K|M]] [MAXSIZE UNLIMITED | integer[K|M]] } ] ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager->Enable Auto Extend check box. ÊÖ¹¤ ALTER DATABASE [database] DATAFILE 'filename'[, 'filename']... RESIZE integer[K|M] È ç ¹ û ¸ ü ¸ Ä º ó µ Ä ³ ß ´ ç ý ¾ Ý Î Ä ¼ þ« ¼ õ É Ù µ ½ Ê ý ¾ Ý Î Ä ¼ þ Ö Ð × î º ó Ò » ¸ <Ô-ÓÐÊ ,½ ³ ß ´ ç OBJECT µÄ×îºóÒ»¸ö ´óС BLOCK Èç¹û³ß´ç¹ýСÔò : ORA-03297: file contains used data beyond requested RESIZE value -- ¶à´ó²»»á´í ???²»ÄÜСÓÚ HWM? ·½Ê½¶þ: Ôö¼ÓÊý¾ÝÎļþ ALTER TABLESPACE tablespace ADD DATAFILE filespec [autoextend_clause][, filespec [autoextend_clause]]... ʹÓà OEM ¡ª >DBA Management Pack ¡ª >Storage Manager-->Tablespace ¡ª >Add Datafile. Òƶ¯Êý¾ÝÎļþ Data Files Moving -- Öصã,×¢ÒâÁ½¸ö ALTER µÄÇø±ð ,×¢ÒâÖ´ÐеIJ½Öè HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 100. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ´ÎÐò à ü Á î:Ò ALTER TABESPACE tablespace RENAME DATAFILE 'filename' [, » 'filename']...TO 'filename'[, 'filename']... 1 Take the tablespace offline. 2 Use an operating system command to move or copy the files. 3 Execute the ALTER TABLESPACE RENAME DATAFILE command. 4 Bring the tablespace online. 5 Use an operating system command to delete the file if necessary. ×¢ Ô´Îļþ±ØÐë´æÔÚ : CONTROL FILE ÖÐ ÃüÁî¶þ : ALTER DATABASE [database] RENAME FILE 'filename'[, 'filename']...TO 'filename'[, 'filename']... 1 Shut down the database. 2 Use an operating system command to move the files. 3 Mount the database. -- ÐèÒª´ò¿ª¿ØÖÆÎļþ ,ËäÈ»Ô-ÎļþÒѾ-Òƶ¯ ,µ«¿Ø ÖÆÎļþ²»Ð£ÑéÆä´æÔÚ 4 Execute the ALTER DATABASE RENAME FILE command. 5 Open the database. ×¢ SYSTEM ±í¿Õ¼ä²»ÄÜ : OFFLINE,ËùÒÔÆäÊý¾ÝÎļþµÄÒƶ¯±ØÐëʹÓÃÕâ¸öÃüÁ ²»ÄÜÓà ALTER TABLESPACE RENAME ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ÐÞ¸ÄÊý¾ÝÎļþÃû * »ñÈ¡Ïà¹Ø±í¿Õ¼äÐÅÏ¢µÄÊý¾Ý×ÖµäºÍÊÓͼ Tablespace information: DBA_TABLESPACES V$TABLESPACE TS# tablespace number NAME tablespace name Data file information: DBA_DATA_FILES V$DATAFILE TS# tablespace number FILE# Êý¾ÝÎļþ±àºÅ CREATION_TIME STATUS SYSTEM/ONLINE ENABLED READ WRITE/READ ONLY Tempfile information: DBA_TEMP_FILES V$TEMPFILE TS# tablespace number FILE# STATUS ENABLED NAME V$SORT_SEGMENT ÏÔʾ TEMPORARY tablespaces µÄsort segments ÐÅÏ¢ /µ±Ç° instance ÖÐ sort extent pool µÄ״̬ instance /for HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 101. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 V$SORT_USAGE Ï Ô Ê session address/tablespace/contents/extents/ µ ± Ç ° ¾ instance Öл µÄ sorts blocks ÊýÁ¿ each user /for * ±í¿Õ¼äʹÓõÄÔ-Ôò 1. Use multiple tablespaces Separate user data from data dictionary data. Separate data segments from index segments Separate application data from each other. Store the data files of different tablespaces on separate disk drives to reduce I/O contention. Separate the rollback segment from data segments, to prevent a single disk failure from causing permanent loss of data. Take individual tablespaces offline while others remain online. Reserve tablespaces for a particular type of database use, such as high-update activity, read-only activity, or temporary segment storage. Back up individual tablespaces. 2. Specify default storage parameters for tablespaces-- Ö ¸ ¶ ¨ ³ £ Ó Ã µ Ä ´ æ½ ¨ Á ¢ Ê ý , Öü²Î OBJECTS ʱ¿ÉÒÔ¼õÉÙµ¥¶ÀÖ¸¶¨ 3. Assign tablespace quotas to users -- ÉèÖÃÓû§Ê¹Óñí¿Õ¼ä µÄÏÞ¶î 4. Include directory path in filenames -- °üº¬Íêȫ·¾¶ 5. Use MINIMUM EXTENTS to Control Fragmentation -- ʹÓÃMINIMUM EXTENTS ¿ØÖƱí¿Õ¼äËéƬ 6. Use locally managed extents -- ²ÉÓÃλͼ¹ÜÀí¶ÎµÄģʽ 7. Limits ÿ¸öÊý¾Ý¿â×î´óµÄ tablespaces ¸öÊýΪ KB. 64 ²Ù×÷ϵͳ¶Ô±í¿Õ¼äÔÊÐí°üÀ¨µÄÊý¾ÝÎļþ¸öÊýÏÞÖÆ : Ò»°ãΪ ¸ö µ«Ëæϵͳ²»Í¬Óбä 1023 , »¯ --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 102. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 9 Storage Structure and Relationships * In this lesson, you should have learned how to: Use tablespaces to: Separate segments to ease administration Control users space allocation Categorize segments by the type of information stored in the segment Determine extent sizes using the storage clause Control block space utilization * SEGMENT ÀàÐÍ space-occupying objects in a database. -- 1. TABLE: ·Ç·ÖÇø»ò¾Û´Ø ,ûÓÐÌض¨´æÖü´ÎÐò ,Êý¾Ý±ØÐë´æÔÚÒ»¸ö±í¿Õ¼äÖÐ -- ??? 2. Table Partition: ±íÊý¾Ý·ÅÔÚ²»Í¬±í¿Õ¼äµÄ²»Í¬·ÖÇøÖÐ º¯Êý·ÖÇø ,Ö§³Ö°´ÖµÓò»òHASH , ÿ ¸ö·ÖÇøÊÇÒ»¸ö SEGEMENT,¿ÉÓи÷×ԵĴæÖü²ÎÊý 3. Cluster: ÆäÖÐµÄ ROW »ùÓÚ¼üÖµ´æÖü¿É¾-ÓÉË÷Òý»ò , °üº¬Ò»¸ö»ò¶à¸ö±í HASH Ëã·¨·ÃÎÊ , ÕâЩ±íÊôÓÚͬһ SEGMENT ²¢¹²ÏíÏàͬµÄ´æÖüÌØÐÔ , 4. Index: Ò»¸öË÷Òý¾ÍÊÇÒ»¸ö SEGEMENT, ´æ·ÅABLE »ùÓÚÖ¸¶¨¼üÖµµÄλÖà T 5. Index-Organized Table: Êý¾ÝºÍË÷ÒýÒ»Æð´æ·Å ,Ö±½Óͨ¹ýË÷ÒýÊ÷ËÑË÷Êý¾Ý 6. Index Partition: Ë÷Òý¿ÉÒÔ·ÖÇø²¢¿çÔ½¶à¸ö±í¿Õ¼ä , Ö÷ÒªÓÃÓÚ·ÖÉ¢Ë÷Òý I/O ¼õÉÙ¾ºÕù -- Öصã 7. Rollback Segment: ´æÖüÊÂÎñ¸ü¸ÄµÄÔ-Êý¾Ý CHANGES MADE ,ÓÃÓÚNDOU 8. Temporary Segment: CREATE INDEX, SELECT DISTINCT, SELECT GROUP BY, Ö´ ÐÐÅÅÐò ,ÔÚÄÚ´æ (SORT_AREA_SIZE)²»¹»ÓÃʱʹÓøà SEGMENTS 9. LOB Segment: ´æ·ÅOB µÄרÃÅ L SEGMENT,±íÖÐ×Ö ¶Î½ö¼Ç¼ÏàÓ¦µÄλÖûòÖ¸Õë 10.LOB Index: LOB SEGMENT ´´½¨Ê± INDEX Òþº¬´´½¨ ,LOB 11.Nested Table: ǶÌ×±í ô ± í µ Ä Ä ³ Á Ð Ê Ç Ó Ã » § ´ ´ ½ ¨ µ Ä ± í , È ,ÔòÕâ¸öÄÚ²¿±íΪǶÌ×±í ,´æÔÚ NESTED TABLE SEGMENT ÖÐ 12.Bootstrap Segment: Ò²½ÐAHE SEGMENT, ÓÉ C sql.bsq ´´½¨,ÔÚÊý¾Ý¿â´ò¿ªÊ±°ïÖú³õʼ »¯Êý¾Ý×ֵ仺´æ ,¸Ã¶ÎÎÞ·¨²éѯ¸üР,ÓÉϵͳ×ÔÐÐά»¤ * ´æÖüÊôÐÔµÄÓÅÏȼ¶ Parameters Storage 1. SEGMENT -> TABLESPACE -> ORACLE DEFAULT 2. ±í¿Õ¼ä²ÎÊý :MINIMUM EXTENT ºÍ UNIFORM SIZE ÌØÊâ ,ËüÔ¼ÊøSEGMENT -- ??? Èç¹ûEGMENT ¶¨ÒåµÄ S INITIAL,NEXT СÓÚ INIMUM EXTENT ??? M 3. ¸Ä±ä´æÖü²ÎÊý¶ÔÒÑ·ÖÅäµÄ²»Æð×÷Óà ,¶Ôδ·ÖÅäµÄ EXTENT Æð×÷Óà 4. ×¢Òⲿ·Ö²ÎÊý²»ÄÜÔÚ TABLESPACE ¼¶±ð¶¨Òå ,½ö¿ÉÔÚ SEGMENT ¼¶±ð¶¨Òå Ä Ð © ² Î -- Ä Êý ???? * EXTENT ·ÖÅäºÍÊÍ·Å 1. ·ÖÅä ¨C Created ¨C Extended ¨C Altered 2. ÊÍ·Å ¨C Dropped HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 103. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ¨CAltered ¨CTruncated ¨CAutomatically resized (rollback segments only) * When a tablespace is created, the data files in the tablespace contain the following elements: A header block, which is the first block in the file One free extent consisting of the remaining part of the data file * DATABASE BLOCK ÌØÐÔ Minimum unit of I/O : -- ×îСµÄ µ¥Ôª I/O Consists of one or more OS blocks -- Ò»°ãΪ BLOCK µÄÕûÊý±¶ OS Set by DB_BLOCK_SIZE -- ³õʼ²ÎÊýÉ趨 Set at database creation -- Ò»µ©Êý¾Ý¿â½¨Á¢²»Äܸü¸Ä ½á¹¹ Block header: Block headers grow from the top down.-- Êý¾Ý¿éÍ·×ÔÉÏÏòÏÂÔö³¤ : data block address table directory row directory transaction slots -- ±êʶLOCK ÊÇ·ñÔÚÊÂÎñÖз¢Éú¸Ä±ä B Data space: Row data is inserted into the block from the bottom up.-- Êý¾Ý×Ôµ×ÏòÉÏ ²åÈë Free space: ÔÚÖв¿ ,³õʼÊÇÁ¬ÐøµÄ ,ËæƵ·±µÄ DELETE »ò UPDATE ²úÉúËéƬ,ORACLE SERVER ÔÚ±ØÒªµÄʱºò½ÓºÏÊý¾Ý¿éÖÐµÄ FREE SPACE Ïà¹Ø²ÎÊý-- Öصã ,×¢ÒâCTFREE ºÍ P PCTUSED Block Space Utilization Parameters INITRANS: ÔÊÐí¸ü¸Ä¿éÖмǼµÄ³õʼ²¢·¢ transaction slots Êý ,ȱʡֵ =1(DATA SEGMENT),=2(INDEX SEGMENT) MAXTRANS: ȱʡ =255,ÏÞÖÆ transaction slots µÄ¿Õ¼äʹÓÃÒÔ±£ÕÏÓÃÓÚÊý¾Ý»òË÷Òý µÄ¿Õ¼ä Parameters Controlling the Use of Data Space -- ° Ù · Ö ± È Ò À ¾ BLOCK Ê Ç Ý µ Ä SIZE-BLOCK HEAD SIZE PCTFREE: ȱʡ =10(10%),ÓÃÓÚPDATE Êý¾ÝʹÓà U ,²åÈëÊý¾Ý<90%Êý¾Ý¿é¿Õ¼ä PCTUSED: È ± Ê ¡ =40(40%), Ô Ê Ð í ² å È ë Ð Â ¼ Ç Â ¼ µ Ä ×¼´´ ó Ê ¹ Ó Ã Â Ê , î :FREE SPACE>60%(ʹÓÃÂÊ <40%)ʱ ,ÔÊÐí¸Ã BLOCK ²åÈëмǼ FREELISTS: ȱʡ =1,Ò»¸ö SEGMENT ÖÐÿ×é FREELIST ÖÐFREE LIST µÄ¸ö Êý,FREE LIST Ϊ´ËEGMENT ÖпɲåÈë¼Ç¼¿éµÄÁбí S ??? »ù±¾¹æÔò Èô TABLE UPDATE ±È½ÏƵ·± , PCTFREE Éè´óһЩ Èô²¢·¢ÐÔ²Ù×÷±È½Ï¶à Éè´óһЩ , INITRANS , FREELISTS Éè´óһЩ * ±í¿Õ¼äËéƬ Öصã -- ------------------------------------------------------ Tablespace Usage Fragmentation ---------- ------------------------------- SYSTEM Data dictionary Zero TOOLS Applications Very low DATAn Data segments Low INDEXn Index segments Low HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 104. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 RBSn Rollback segments High TEMPn Temporary segments Very high* ------------------------------------------------------ * Relevant only if tablespace PERMANENT * ×éÖ¯¹ÜÀí±í¿Õ¼äµÄÒ»°ã±ê×¼ 1. Control space allocation and assign space usage limits to users -- ¿ØÖÆ¿Õ¼ä·ÖÅäºÏÏÞ ÖÆÓû§Ê¹ÓÃÏÞ¶î 2. Control availability of data by taking individual tablespaces online or offline-- ʹÓñí¿Õ ¼äÔÚÏß /ÀëÏßÀ´¿ØÖÆÊý¾Ý·ÃÎÊ 3. Distribute data storage across devices to improve I/O performance and to reduce contention against a single disk -- ½«Êý¾Ý·ÖÉ¢´æÖüÔÚ²»Í¬É豸ÉÏÒÔÌá¸ß I/O Ö´ÐÐЧÂʺͼõÉÙµ¥¸ö´ÅÅÌÕùÓà 4. Perform partial backup and partial recovery operations -- Ö´Ðв¿·Ö±¸·ÝºÍ²¿·Ö»Ö¸´ 5. Keep large amounts of static data on read-only devices-- ´óÁ¿µÄ¾²Ì¬Êý¾Ý·ÅÔÚÖ»¶ÁÉè ±¸ÉÏ * Ïà¹ØÊý¾Ý×ÖµäºÍÊÓͼ DBA_TABLESPACES ±í¿Õ¼ä¼°Æä²ÎÊý DBA_DATA_FILES ±í¿Õ¼ä¶ÔÓ¦µÄÊý¾ÝÎļþ¼°Æä²ÎÊý DBA_FREE_SPACE ±í¿Õ¼äµÄÊ£Óà¿Õ¼ä Location TABLESPACE_NAME RELATIVE_FNO Relative number of the file containing the extent FILE_ID ID number of the file containing the extent BLOCK_ID Starting block number of the extent Size BYTES BLOCKS Size of the extent in ORACLE blocks DBA_FREE_SPACE_COALESCED ±í¿Õ¼ä×ÔÓÉ¿Õ¼ä½ÓºÏÐÅÏ¢ TABLESPACE_NAME Name of Tablespace TOTAL_EXTENTS Total Number of Free Extents in Tablespace EXTENTS_COALESCED Total Number of Coalesced Free Extents in Tablespace PERCENT_EXTENTS_COALESCED Percentage of Coalesced Free Extents in Tablespace TOTAL_BYTES Total Number of Free Bytes in Tablespace BYTES_COALESCED Total Number of Coalesced Free Bytes in Tablespace TOTAL_BLOCKS Total Number of Free Oracle Blocks in Tablespace BLOCKS_COALESCED Total Number of Coalesced Free Oracle Blocks in Tablespace PERCENT_BLOCKS_COALESCED Percentage of Coalesced Free Oracle Blocks in Tablespace DBA_SEGMENTS SEGMENTS Ïà¹ØÐÅÏ¢ /´óС :±í¿Õ¼ä /²ÎÊýµÈµÈ -- Ö Ø µ ã ¢ Ò â Ë ü ,× °üÀ¨Á˱í header block information HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 105. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 General information OWNER SEGMENT_NAME SEGMENT_TYPE Type of segment: "TABLE", "CLUSTER", "INDEX", "ROLLBACK", "DEFERRED ROLLBACK", "TEMPORARY","SPACE HEADER", or "CACHE" TABLESPACE_NAME Size EXTENTS BLOCKS BYTES Storage settings INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE Other information Location Tuning DBA_EXTENTS SEGMENTS ¶ Ô Ó ¦ µ Ä EXTENTS Ð Å Ï ¢ í ¿ Õ/¼ ä Ð ¡ ý ¾ Ý Î Ä ¼ þ : ± ´ó / Ê ID/EXTENTS ID(0 ¿ªÊ¼ µÈ)µÈ Identification OWNER SEGMENT_NAME EXTENT_ID Size BLOCKS BYTES Location TABLESPACE_NAME RELATIVE_FNO Relative number of the file containing the segment header FILE_ID Name of the file containing the extent BLOCK_ID Starting block number of the extent Ò»¸öÊý¾ÝÎļþµÄËùÓпռä¼ÆËã´Ó :DBA_FREE_SPACE or DBA_EXTENTS ÖмÆËã»ñµÃ V$SORT_SEGMENT will display information about TEMPORARY tablespaces with sort segments. DBA_CLUSTERS Description of all clusters in the database DBA_CLUSTER_HASH_EXPRESSIONS Hash functions for all clusters --------------------------------------------------------- HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 106. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 10 Managing Rollback Segments * After completing this lesson, you should be able to do the following: Create rollback segments using appropriate storage settings Maintain rollback segments Plan the number and size of rollback segments Obtain rollback segment information from the data dictionary Troubleshoot common rollback segment problems * Ä¿±ê 1. Transaction Rollback ÊÂÎñ»Ø¹ö 2. Transaction Recovery ÊÂÎñ»Ö¸´ 3. Read Consistency ¶ÁÒ»ÖÂÐÔ Ö´ÐÐELECT STATEMENT ʱȷ¶¨ S SCN(system change number), ±£Ö¤ SCN ǰδÌá ½»µÄ¸ü¸Ä²»ÔÚÕâ¸ö STATEMENT Öд¦Àí ¹ ¹ ½ ¨ Ò » ¸ ö ¶ Á Ò » Ö ´Ó ROLLBACK SEGMENTS Ö Ð È ¡ » Ø ¸ ü ¸ Ä Ç ° µ Ä , ÂÐÔÓ³Ïñ BEFORE-IMAGE ÔÚÄÚ´æÖб£ÁôÒ»¸ö¸ü¸ÄµÄ COPY SET TRANSACTION READ ONLY; -- Ï µ Í ³ ± £ Á ô µ ± Ç ° Ò Ñ Ì á ½ » Ê ý ¾ ÔÚ Ä Ò » ¸ ö ¿ ì , ݵ COMMIT ºÍ ROLLBACK ºóÖÐÖ¹ ,²»ÔÊÐíдÊý¾Ý (ÓÃÓÚÉú³É±¨±í ) SET TRANSACTION SERIALIZABLE; -- ͬÉÏ,µ«ÔÊÐí¸ü¸ÄÓëÆäËûÓû§Î´Ìá½»µÄ¸ ¸ÄÎÞ³åÍ»µÄÊý¾Ý * ÀàÐÍ -- Öصã,×¢ÒâÈýÖÖÀàÐ͵ÄÓÃ; 1. SYSTEM: Used for objects in the SYSTEM tablespace 2. Non-SYSTEM: Used for objects in other tablespaces Private: Acquired by a single instance -- ½öΪһ¸ö INSTANCE ÆôÓà INIT ²ÎÊýÎÄ ,ÔÚ ¼þÖÐÃèÊö, ALTER ROLLBACK SEGMENT Public: Acquired by any instance -- ¶à INSTANCE ¿ÉÓà ,ÓÃÓÚ²¢ÐзþÎñÆ÷ 3. Deferred: Used when tablespaces are taken offline with the immediate option -- ϵͳ ×ÔÐÐά»¤,²»ÐèҪʱ×Ô¶¯É¾³ý * ʹÓà ·ÖÅä 1. SET TRANSACTION USE ROLLBACK SEGMENT rollback_segment 2. ORACLE ×Ô¶¯·ÖÅäÒ»¸öÊÂÎñ×îÉٵĻعö¶Î -- ÔÚÊÂÎñ¸öÊýÏàͬµÄÇé¿öÏÂÔ-Ôò ? Using Extents 1. ˳Ðòд ,Ñ-»·Ð´,Ò»¸öÊÂÎñÔڻعö¶ÎÖÐдһ¸öÈë¿Ú ,ͬʱÒƶ¯Ö¸Õë 2. ¶à¸öÊÂÎñ¿ÉÒÔдÈëÒ»¸ö»Ø¹ö¶ÎÖеÄͬһ¸ö EXTENT, µ«Ã¿¸ö BLOCK Ö»ÄÜ°üº¬Ò»¸öÊ Îñ 3. µ±Ò»¸ö EXTENT ÉϵÄÊÂÎñ¶¼ÒÑ COMMIT »òROLLBACK ºó ,Õâ¸öEGMENT ±ê¼Ç S Ϊ FREE »ò INACTIVE,±íʾ¿ÉÒÔ¸´Óà Ôö³¤ rowth of Rollback Segments G µ±ËùÓзǻµÄ ¶¼Ê¹ÓÃÍêÁË EXTENT , »Ø¹ö¶Î½«»ñµÃÒ»¸öеÄÀ©Õ¹¶Î , Ö±µ½´ïµ½ HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 107. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 MAXEXTENTS ²ÎÊýÖµ ÊÕËõhrinkage of Rollback Segments S OPTIMAL ²ÎÊý (×Ö½ÚÊý)Ö¸¶¨Á˻عö¶ÎÊÍ·ÅÒÑÍê³ÉÊÂÎñÕ¼ÓõÄÔö³¤µÄ¿Õ¼ä µ±Ö¸Õë´ÓÒ»¸ö ÒÆÏòÁíÒ»¸ö EXTENT EXTENT ʱ²¢Âú×ãÏÂÁÐÌõ¼þʱ ,ÊÕËõ·¢Éú : µ±Ç°OLLBACK SEGMENT ³¬¹ýÁË R OPTIMAL µÄÖµ ´æÔÚÁ¬ÐøµÄ·Ç»î¶¯ EXTENT ×ÜÊÇÊÍ·Å×îÔçµÄ·Ç»î¶¯ EXTENT ´´½¨ -- Öصã ,×¢Òâ²ÎÊýµÄÏÞÖƺÍȱʡֵ ÃüÁî CREATE [PUBLIC] ROLLBACK SEGMENT rollback_segment : -- ȱʡ Ϊ PRIVATE,´´½¨ºó²»Äܸü¸ÄÀàÐÍ [TABLESPACE tablespace] -- ȱʡ =SYSTEM TABLESPACE [STORAGE ([INITIAL integer[K|M]] -- [NEXT integer[K|M]] [MINEXTENTS integer] -- ÖÁÉÙ ¸ö2 ,ORACLE ½¨Òé0 ¸ö 2 [MAXEXTENTS {integer|UNLIMITED}] [OPTIMAL {integer[K|M]|NULL}] -- Ö Á É =INITIAL+NEXT*(MINEXTENTS-1) ) -- PCTINCREASE ×ÜÊÇ,²»ÄÜÖ¸¶¨ 0 ] ¹æÔò 1. ͨ³£ÉèÖà : INITIAL = NEXT 2. ÉèÖà PTIMAL ²ÎÊý O 3. ±ÜÃâÉèÖà MAXEXTENTS = UNLIMITED,±ÜÃâ¿ÉÄÜ·¢ÉúµÄÎÞÏÞÔö³¤ 4. »Ø¹ö¶Î·ÅÖÃÔÚ¶ÀÁ¢±í¿Õ¼äÖÐ ,¼õÉÙÕùÓà /ËéƬ ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ´´½¨»Ø¹ö¶Î Áª»ú /ÍÑ»ú ONLINE/OFFLINE ÃüÁî ALTER ROLLBACK SEGMENT rollback_segment ONLINE/OFFLINE; : Æô¶¯Ê±Áª»ú : ÔÚ INIT ²ÎÊýÖÐÉ趨 : ROLLBACK_SEGMENTS=(rbs01, rbs02 ...) ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ʹ»Ø¹ö¶ÎÁª»ú /ÍÑ»ú ¹æÔò Ò » ¸ INSTANCE Ô Ê Ð í Á ª » ú µ Ä × î ´ ó » Ø²¹ÎöʶýÎ ¸ ö Ê : ö <= MAX_ROLLBACK_SEGMENTS -- ²ÎÊýȱʡֵ =30(816NT) ÍÑ»úʱÈôÓÐ ACTIVE ÊÂÎñ ,Ôò״̬±äΪ PENDING OFFLINE(V$ROLLSTAT),²»ÔÊ ÐíеÄÊÂÎñʹÓà ,Ò»µ©¸Ã»î¶¯ÊÂÎñ½áÊø ,»Ø¹ö¶ÎÍÑ»ú Êý¾Ý¿â´ò¿ªÊ± INSTANCE »ñÈ¡»Ø¹ö¶ÎµÄ¹ý³Ì : Acquire named Compute required YES private RBS ---> number of RBS ---> ¼ì²éÊÇ·ñ´óÓÚ²ÎÊýÖ¸¶¨µÄ¸öÊý ------------------------> ʹËù ÓлñµÃµÄ ---> Ñ°ÕÒ PUBLIC »Ø¹ö¶Î »Ø¹ö¶Î---> Áª»ú NO ²ÎÊýÖ¸¶¨ =CEIL(TRANSACTIONS/TRANSACTIONS_PER_ROLLBACK_SEGMENTS) -- Èô²» ×㽫ÈçºÎ ? HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 108. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 ¸ü¸Ä´æÖü²ÎÊý ALTER ROLLBACK SEGMENT rollback_segment -- INITIAL ²»Äܸü¸Ä [STORAGE ( [NEXT integer[K|M]] [MINEXTENTS integer] -- ±ØÐëСÓÚµ±Ç°ËùÓÐ µÄÖµ EXTENT [MAXEXTENTS {integer|UNLIMITED}] [OPTIMAL {integer[K|M]|NULL}] ) ] ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ¸ü¸Ä»Ø¹ö¶Î´æÖü²ÎÊý ÊͷŻعö¶Î ¿Õ¼ä -- ÊÕËõʱÓöµ½ ACTIVE ¶ÎÔòÖÐÖ¹ ×Ô¶¯ ÉèÖà PTIMAL ²ÎÊý : O ÊÖ¹¤ ALTER ROLLBACK SEGMENT rollback_segment SHRINK [ TO integer : [ K|M ]]; -- ²»Ö¸¶¨ÊÕËõ³ß´ç OPTIMAL Öµ ,ÔòȱʡΪ ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ÊÕËõ»Ø¹ö¶Î ɾ³ý ÃüÁî DROP ROLLBACK SEGMENT rollback_segment; : ʹÓà EM¡ª O >DBA Management Pack¡ª >Storage Manager ɾ³ý»Ø¹ö¶Î ¹æÔò ±ØÐëÏÈ : OFFLINE * Ïà¹ØÊý¾Ý×ÖµäºÍÊÓͼ DBA_ROLLBACK_SEGS -- ȱÉÙ PTIMAL Öµ O ,Ðè²éѯ V$ROLLSTAT SEGMENT_NAME OWNER PUBLIC/SYS TABLESPACE_NAME SEGMENT_ID FILE_ID BLOCK_ID INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE STATUS ONLINE/OFFLINE -- PENDING OFFLINE Çé¿öÏÂÈÔΪ ONLINE,Ðè²é ѯ V$ROLLSTAT INSTANCE_NUM RELATIVE_FNO V$ROLLNAME V$ROLLSTAT -- µ±Ç° INSTANCE ʹÓûعö¶ÎµÄ ͳ¼ÆÖµ USN <---------> USN -- »Ø¹ö¶ÎÐòºÅ NAME EXTENTS -- ¸Ã¶ÎµÄ×Ü EXTENTS Êý RSSIZE -- µ ± Ç SEGMENT ´ ó Ð ¡ Ö ½ Ú ° ( × ), Óë DBA_SEGMENTS Öнá¹û²»Í¬ ???? WRITES -- дÈëµÄ×Ö½ÚÊý HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 109. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 XACTS -- ʹÓõ±Ç°»Ø¹ö¶ÎµÄÊÂÎñÊý GETS -- WAITS -- ÉêÇë¸Ä»Ø¹ö¶Îµ«µÈ´ýµÄ´ÎÊý OPTSIZE -- OPTIMAL Öµ HWMSIZE -- High-water mark; ¸Ã»Ø¹ö¶ÎÆô¶¯ºóµÄ×î´ó Ôö³¤×Ö½ÚÊý SHRINKS -- ÊÕËõ´ÎÊý WRAPS -- »»Ò³´ÎÊý EXTENDS -- À©Õ¹´ÎÊý AVESHRINK -- ƽ¾ùÊÕËõ´óС AVEACTIVE -- »î¶¯XTENTS µÄƽ¾ù×Ö½ÚÊý E ??? STATUS -- ONLINE/PENDING OFFLINE/OFFLINE CUREXT -- µ±Ç°XTENT Ö¸ÕëλÖà E CURBLK -- µ±Ç°LOCK Ö¸ÕëλÖà B V$SESSION V$TRANSACTION -- ²éѯµ±Ç°»î¶¯ÊÂÎñʹÓûعö¶ÎµÄ Çé¿ö SADDR <---------> SES_ADDR -- SESSION µØÖ· USERNAME XIDUSN -- ÊÂÎñʹÓõĻعö¶ÎÊý , ÊÂÎñ µÄÒ»²¿·Ö ID SID UBAFIL -- ÊÂÎñд»Ø¹ö¶ÎµÄλÖà FILE ID SERIAL# UBABLK -- Undo Block AddressBLOCK ID UBASQN -- SEQUENCE ID UBAREC -- RECORD ID USED_UBLK -- ÊÂÎñ²úÉúµÄ BLOCK Êý UNDO START_UEXT -- ÊÂÎñ¿ªÊ¼Ð´µÄ EXTENTS ºÅ START_UBAFIL -- ÊÂÎñ¿ªÊ¼Ê±µÄ UBA FILE ID START_UBABLK -- BLOCK ID START_UBASQN -- SEQUENCE ID START_UBAREC -- RECORD ID STATUS -- USED_UBLK -- ÒÑʹÓõĿéÊý USED_UREC -- ÒÑʹÓõļǼÊý * ¹æ»® -- »Ø¹ö¶ÎµÄÍ·¿é°üº¬ÃèÊöÊÂÎñ״̬µÄÊÂÎñ±íÈë¿Ú ,ÿ¸öʹÓøûعö¶ÎµÄÊÂÎñ¶¼»áºÜƵ ·±µØÐÞ¸ÄÊÂÎñ±í ,ÕâÑùÔì³É»Ø¹ö¶ÎÍ·µÄÕùÓà »Ø¹ö¶ÎÊýÁ¿¹æ»® OLTP -- Online Transaction Processing ÊÂÎñ½ÏС ,µ«ºÜ¶à Many small rollback segments -- ½¨Á¢ºÜ¶àСµÄ»Ø¹ö¶Î Four transactions per rollback segment -- ƽ¾ù ¸öÊÂÎñ 4 /»Ø¹ö¶Î-- Öصã Up to ten transactions per rollback segment -- ²»³¬¹ý ¸öÊÂÎñ 10 /»Ø¹ö¶Î Batch -- ÅúÁ¿Êý¾ÝÔËÐÐ Few large rollback segments -- һЩºÜ´óµÄ»Ø¹ö¶Î One per transaction -- Ò»¸öÊÂÎñʹÓÃÒ»¸ö»Ø¹ö¶Î »Ø¹ö¶ÎÖÐ EXTENTS ÊýÁ¿¹æ»® Ó°Ïì»Ø¹öÐÅÏ¢ÈÝÁ¿´óСµÄÁ½¸öÒòËØ : HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 110. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 1. ÊÂÎñÀà±ð : INSERT, UPDATE,DELETE; INSERT ½ö¼Ç¼ ROWID ¶øDELETE ¼Ç ¼Õû¸öÐÐ 2. ´¦ÀíµÄʵ¼ÊÊý¾ÝÁ¿ Ô Ë Ð Ð Ò » ¸ ö È ß ³ ¤ µ Ä Ê Â Î ñ ² ¢ ¼ ì ² é » Ø ¹ ö ¶ ÎÉ ú ³ É µ Ä Ê ý Á ¿ ¹ ö (UNDO) µ Ä ³ ß ´ ç » ò » Ø (V$TRANSACTION ÖÐ ),À´¾ö¶¨»Ø¹ö¶ÎµÄ×î´óÖµ ½¨Ò齫 MINEXTENTS=0,ÒÔ¼õÉٻعö¶ÎÀ©Õ¹ * ½â¾ö»Ø¹ö¶ÎÎÊÌâ Troubleshooting Rollback Segment Problems -- Öصã ,×¢ÒâÎÊÌâµÄ½â¾ö ·½·¨ 1. Insufficient space for transactions -- ÊÂÎñ´¦Àí¿Õ¼ä²»×ã ÏÖÏó ORA-01562, ORA-01560, ORA-01628 : Ô-Òò No space in tablespace : -- ±í¿Õ¼ä²»×ã ORA-01560 MAXEXTENTS reached for segment -- ´ïµ½ MAXEXTENTS,ÇÒÕÒ²»µ½¿É·ÖÅä µÄ EXTENT ORA-01628 ½â¾ö No space in tablespace : Increasing the size of the tablespace -- À©Õ¹Êý¾ÝÎļþ ,Ôö¼ÓÊý¾ÝÎļþ ,ÔÊ ÐíÊý¾ÝÎļþ×Ô¶¯À©Õ¹ ÉèÖà PTIMAL ²ÎÊý O ,±£Ö¤µ¥¸ö»Ø¹ö¶Î²»»áÓÃÍêËùÓÐ FREE SPACE ÊÕËõ»Ø¹ö¶Îµ½ OPTIMAL ³ß´ç MAXEXTENTS reached for segment Increase MAXEXTENTS -- Ôö¼Ó AXEXTENTSM Re-create segments with larger extent sizes -- Ö Ø ½ SEGMENTS, Ô ö ´ ó ¨ EXTENT SIZE 2. Read-consistency error -- ¶ÁÒ»ÖÂÐÔ´íÎó ÏÖÏó ORA-01555 SNAPSHOT TOO OLD : Ô-Òò The transaction slot in the rollback header has been reused -- Ôڻعö¶Î : Í·ÖеÄÊÂÎñ±»ÖØÓÃÁË The before-image in the rollback segment has been overwritten by another transaction -- before-image ±»¸²¸Ç ½â¾ö Ìá¸ß INEXTENT Öµ : M -- ??? ¶ Ô ´ Ë Î Ê Ì â Î Þ Ó Ã À © Õ ¹ Ç ° × Ü Ê Ç Ï È Ê ¹ Ó Ã ,ÒòΪ INACTIVE µÄÖµ ???? Ôö´óXTENT ´óС E Ìá¸ß PTIMAL µÄÖµ O 3. Blocking session -- ×èÈûESSION S ÏÖÏó »Ø¹ö¶Î³ÖÐøÔö³¤ : Ô-Òò µ±ÊÂÎñдÂúÒ»¸ö»Ø¹ö¶ÎµÄ : EXTENT ºó£¬ÊÔͼдµÄÏÂÒ»¸ö Èô´æÔÚEXTENT ACTIVE ENTRY£ ¬ ´Ëʱ ORACLE²»ÄÜ¿çÔ½Ëü¶øȥʹÓÃÏÂÒ»¸ö EXTENT £ ¬Ö»ÄÜÀ©Õ¹Ð嵀 £¬ EXTENT Èç¹û²»¶ÏÓÐÐÂÊÂÎñʹÓøûعö¶Î£¬½«Ôì³É²»¶ÏµØÀ©Õ¹£¬Ò»¸ö¿ÕÏеÄÊÂÎñ»á ¿ÕÓà¿Õ¼äÎÞ·¨ ʹÓã¬ÐèÒª ¸ÉÔ¤ DBA ½â¾ö Query the V$ROLLSTAT, V$SESSION, and V$TRANSACTION views to : find any blocking transactions. SELECT s.sid, s.serial#, t.start_time, t.xidusn, s.username FROM v$session s, v$transaction t, v$rollstat r WHERE s.saddr = t.ses_addr AND t.xidusn = r.usn HOME: http://www.itpub.net MAIL: epub@itpub.net
  • 111. ITPUB µç×ÓÔÓÖ¾ 023 Lesson 1-10 AND ((r.curext = t.start_uext-1) OR ((r.curext = r.extents-1) AND t.start_uext=0)); 4. Error in taking tablespace offline -- ±í¿Õ¼äÍÑ»ú ÏÖÏó ORA-01546 : Ô-Òò °üº¬»î¶¯»Ø¹ö¶ÎµÄ±í¿Õ¼ä²»ÔÊÐíÍÑ»ú : ½â¾ö ²éѯBA_ROLLBACK_SEGS ÕÒ³öÐèÍÑ»ú±í¿Õ¼äÉϵĻعö¶Î : D Ê×ÏÈʹ¸Ã±í¿Õ¼äÉϵÄËùÓлعö¶ÎÍÑ»ú ¼ì²é$TRANSACTION ÕÒ³öʹÓÃÕâЩ»Ø¹ö¶ÎµÄÊÂÎñ V ʹÓÃ$SESSION ÏÔʾÕâЩÊÂÎñµÄÓû§ V ID ºÍSESSION ºÅ (SID,SERIAL#) ÈÃÓû§ÖÐÖ¹»ò DBA KILL µôÕâЩ SESSION ½«¸Ã±í¿Õ¼äÍÑ»ú HOME: http://www.itpub.net MAIL: epub@itpub.net