ºìÁªLinuxÃÅ»§
Linux°ïÖú

Oracle±¸·ÝÓë»Ö¸´

·¢²¼Ê±¼ä:2006-02-19 10:54:46À´Ô´:ºìÁª×÷Õß:ºãÉÆϲ
OracleµÄ±¸·ÝÓë»Ö¸´ÓÐÈýÖÖ±ê×¼µÄģʽ£¬´óÖ·ÖΪÁ½´óÀ࣬±¸·Ý»Ö¸´(ÎïÀíÉϵÄ)ÒÔ¼°µ¼Èëµ¼³ö(Âß¼­ÉϵÄ)£¬¶ø±¸·Ý»Ö¸´ÓÖ¿ÉÒÔ¸ù¾ÝÊý¾Ý¿âµÄ¹¤×÷ģʽ·ÖΪ·Ç¹éµµÄ£Ê½(Nonarchivelog-style)ºÍ¹éµµÄ£Ê½(Archivelog-style),ͨ³££¬ÎÒÃǰѷǹ鵵ģʽ³ÆΪÀ䱸·Ý£¬¶øÏàÓ¦µÄ°Ñ¹éµµÄ£Ê½³ÆΪÈȱ¸·Ý£¬ÈýÖÖ·½Ê½¸÷ÓÐÓŵ㣬ÎÒÃÇ×ö¸ö±È½Ï(Õâ¸öÊÇÓÃFireworks»­µÄ£¬Óеã²Ú)£º

$A: ÏÖÔÚÏÈÀ´½éÉÜÒ»ÏÂÂß¼­±¸·Ý·½Ê½µÄ·½·¨£¬ÀûÓÃExport¿É½«Êý¾Ý´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´£¬ÀûÓÃImportÔò¿É½«ÌáÈ¡³öÀ´µÄÊý¾ÝËͻص½OracleÊý¾Ý¿âÖÐÈ¥¡£ÀíÂÛ»ù´¡£ºOracleÌṩµÄExportºÍImport¾ßÓÐÈýÖÖ²»Í¬µÄ²Ù×÷·½Ê½(¾ÍÊDZ¸·ÝµÄÊý¾ÝÊä³ö(Èë)ÀàÐÍ)£º

1£¬±í·½Ê½(T) ¿ÉÒÔ½«Ö¸¶¨µÄ±íµ¼³ö±¸·Ý£»

2£¬È«¿â·½Ê½(Full) ½«Êý¾Ý¿âÖеÄËùÓжÔÏóµ¼³ö£»

3£¬Óû§·½Ê½(U) ¿ÉÒÔ½«Ö¸¶¨µÄÓû§ÏàÓ¦µÄËùÓÐÊý¾Ý¶ÔÏóµ¼³ö£»

*ÔÚµ¼Èëµ¼³ö±¸·Ý·½Ê½ÖУ¬ÌṩÁ˺ÜÇ¿´óµÄÒ»ÖÖ·½·¨£¬¾ÍÊÇÔöÁ¿µ¼³ö/µ¼È룬µ«ÊÇËü±ØÐë×÷ΪSystemÀ´Íê³ÉÔöÁ¿µÄµ¼Èëµ¼³ö£¬¶øÇÒÖ»ÄÜÊǶÔÕû¸öÊý¾Ý¿â½øÐÐʵʩ¡£ÔöÁ¿µ¼³öÓÖ¿ÉÒÔ·ÖΪÈýÖÖÀà±ð£º

1£¬ÍêÈ«ÔöÁ¿µ¼³ö(Complete Export) ÕâÖÖ·½Ê½½«°ÑÕû¸öÊý¾Ý¿âÎļþµ¼³ö±¸·Ý£»exp system/manager inctype=complete file=20041125.dmp£¨ÎªÁË·½±ã¼ìË÷ºÍʺóµÄ²éѯ£¬Í¨³£ÎÒÃǽ«±¸·ÝÎļþÒÔÈÕÆÚ»òÕßÆäËûÓÐÃ÷È·º¬ÒåµÄ×Ö·ûÃüÃû£©

2£¬ÔöÁ¿ÐÍÔöÁ¿µ¼³ö(Incremental Export) ÕâÖÖ·½Ê½½«Ö»»á±¸·ÝÉÏÒ»´Î±¸·Ýºó¸Ä±äµÄ½á¹û£»exp system/manager inctype=incremental file=20041125.dmp

3£¬ÀÛ»ýÐÍÔöÁ¿µ¼³ö(Cumulate Export) ÕâÖÖ·½Ê½µÄ»°£¬Êǵ¼³ö×ÔÉÏ´ÎÍêÈ«ÔöÁ¿µ¼³öºóÊý¾Ý¿â±ä»¯µÄÐÅÏ¢¡£exp system/manager inctype=cumulative file=20041125.dmp

ͨ³£Çé¿öÏ£¬DBAÃÇËùÒª×öµÄ£¬¾ÍÊÇ°´ÕÕÆóÒµÖ¸¶¨»òÕßÊÇ×Ô¼ºÏ°¹ßµÄ±ê×¼(Èç¹ûÊÇ×Ô¼ºÖ¸¶¨µÄ±ê×¼£¬½¨ÒéдºÃ¼Æ»®ËµÃ÷)£¬Ò»°ã£¬ÎÒÃDzÉÓÃÆÕ±éÈϿɵÄÏÂÃæµÄ·½Ê½½øÐÐÿÌìµÄÔöÁ¿±¸·Ý£º

Mon£º ÍêÈ«±¸·Ý£¨A£©
Tue£º ÔöÁ¿µ¼³ö£¨B£©
Wed£ºÔöÁ¿µ¼³ö£¨C£©
Thu£º ÔöÁ¿µ¼³ö£¨D£©
Fri£º ÀۼƵ¼³ö£¨E£©
Sat£º ÔöÁ¿µ¼³ö£¨F£©
Sun£º ÔöÁ¿µ¼³ö£¨G£©

ÕâÑù£¬ÎÒÃÇ¿ÉÒÔ±£Ö¤Ã¿ÖÜÊý¾ÝµÄÍêÕûÐÔ£¬ÒÔ¼°»Ö¸´Ê±µÄ¿ì½ÝºÍ×î´óÏ޶ȵÄÊý¾ÝËðʧ¡£»Ö¸´µÄʱºò£¬¼ÙÉèʹʷ¢ÉúÔÚÖÜÄ©£¬DBA¿É°´ÕâÑùµÄ²½ÖèÀ´»Ö¸´Êý¾Ý¿â£º
µÚÒ»²½£ºÓÃÃüÁîCREATE DATABASEÖØÐÂÉú³ÉÊý¾Ý¿â½á¹¹£»
µÚ¶þ²½£º´´½¨Ò»¸ö×ã¹»´óµÄ¸½¼Ó»Ø¹ö¡£
µÚÈý²½£ºÍêÈ«ÔöÁ¿µ¼ÈëA£º
imp system/manager inctype=RESTORE FULL=y FILE=A
µÚËIJ½£ºÀÛ¼ÆÔöÁ¿µ¼ÈëE£º
imp system/manager inctype=RESTORE FULL=Y FILE=E
µÚÎå²½£º×î½üÔöÁ¿µ¼ÈëF£º
imp system/manager inctype=RESTORE FULL=Y FILE=F

ͨ³£Çé¿öÏ£¬DBAËùÒª×öµÄµ¼Èëµ¼³ö±¸·Ý¾ÍËãÍê³É£¬Ö»Òª¿ÆѧµÄ°´ÕÕ¹æÂÉ×÷³ö±¸·Ý£¬¾Í¿ÉÒÔ½«Êý¾ÝµÄËðʧ½µµÍµ½×îС£¬Ìṩ¸ü¿É¿¿µÄ·þÎñ¡£ÁíÍ⣬DBA×îºÃ¶Ôÿ´ÎµÄ±¸·Ý×öÒ»¸ö±È½ÏÏêϸµÄ˵Ã÷Îĵµ£¬Ê¹µÃÊý¾Ý¿âµÄ»Ö¸´¸ü¼Ó¿É¿¿¡£

$B ÎïÀí±¸·ÝÖ®À䱸·Ý(Ìõ¼þ£­NonArchiveLog)£º

µ±Êý¾Ý¿â¿ÉÒÔÔÝʱ´¦ÓڹرÕ״̬ʱ£¬ÎÒÃÇÐèÒª½«ËüÔÚÕâÒ»Îȶ¨Ê±¿ÌµÄÊý¾ÝÏà¹ØÎļþתÒƵ½°²È«µÄÇøÓò£¬µ±Êý¾Ý¿âÔâµ½ÆÆ»µ£¬ÔÙ´Ó°²È«ÇøÓò½«±¸·ÝµÄÊý¾Ý¿âÏà¹ØÎļþ¿½±´»ØÔ­À´µÄλÖã¬ÕâÑù£¬¾ÍÍê³ÉÁËÒ»´Î¿ì½Ý°²È«µÈÊý¾ÝתÒÆ¡£ÓÉÓÚÊÇÔÚÊý¾Ý¿â²»Ìṩ·þÎñµÄ¹Ø±Õ״̬£¬ËùÒÔ³ÆΪÀ䱸·Ý¡£À䱸·Ý¾ßÓкܶàÓÅÁ¼ÌØÐÔ£¬±ÈÈçÉÏÃæͼÖÐÎÒÃÇÌáµ½µÄ£¬¿ìËÙ£¬·½±ã£¬ÒÔ¼°¸ßЧ¡£Ò»´ÎÍêÕûµÄÀ䱸·Ý²½ÖèÓ¦¸ÃÊÇ£º

1£¬Ê×ÏȹرÕÊý¾Ý¿â£¨shutdown normal£©

2£¬¿½±´Ïà¹ØÎļþµ½°²È«ÇøÓò£¨ÀûÓòÙ×÷ϵͳÃüÁ±´Êý¾Ý¿âµÄËùÓеÄÊý¾ÝÎļþ¡¢ÈÕÖ¾Îļþ¡¢¿ØÖÆÎļþ¡¢²ÎÊýÎļþ¡¢¿ÚÁîÎļþµÈ£¨°üÀ¨Â·¾¶£©£©

3£¬ÖØÐÂÆô¶¯Êý¾Ý¿â£¨startup£©

ÒÔÉϵIJ½ÖèÎÒÃÇ¿ÉÒÔÓÃÒ»¸ö½Å±¾À´Íê³É²Ù×÷£º

su - oracle < sqlplus /nolog
connect / as sysdba
shutdown immediate;
!cp Îļþ ±¸·ÝλÖã¨ËùÓеÄÈÕÖ¾¡¢Êý¾Ý¡¢¿ØÖƼ°²ÎÊýÎļþ£©;
startup;
exit;
ÕâÑù£¬ÎÒÃǾÍÍê³ÉÁËÒ»´ÎÀ䱸·Ý£¬ÇëÈ·¶¨Äã¶ÔÕâЩÏàÓ¦µÄĿ¼£¨°üÀ¨Ð´ÈëµÄÄ¿±êÎļþ¼Ð£©ÓÐÏàÓ¦µÄȨÏÞ¡£

»Ö¸´µÄʱºò£¬Ïà¶Ô±È½Ï¼òµ¥ÁË£¬ÎÒÃÇÍ£µôÊý¾Ý¿â£¬½«Îļþ¿½±´»ØÏàӦλÖã¬ÖØÆôÊý¾Ý¿â¾Í¿ÉÒÔÁË£¬µ±È»Ò²¿ÉÒÔÓýű¾À´Íê³É¡£

$C ÎïÀí±¸·ÝÖ®Èȱ¸·Ý£º(Ìõ¼þ£­ArchiveLog)

µ±ÎÒÃÇÐèÒª×öÒ»¸ö¾«¶È±È½Ï¸ßµÄ±¸·Ý£¬¶øÇÒÎÒÃǵÄÊý¾Ý¿â²»¿ÉÄÜÍ£µô£¨ÉÙÐí·ÃÎÊÁ¿£©Ê±£¬Õâ¸öÇé¿öÏ£¬ÎÒÃǾÍÐèÒª¹éµµ·½Ê½Ïµı¸·Ý£¬¾ÍÊÇÏÂÃæÌÖÂÛµÄÈȱ¸·Ý¡£Èȱ¸·Ý¿ÉÒԷdz£¾«È·µÄ±¸·Ý±í¿Õ¼ä¼¶ºÍÓû§¼¶µÄÊý¾Ý£¬ÓÉÓÚËüÊǸù¾Ý¹éµµÈÕÖ¾µÄʱ¼äÖáÀ´±¸·Ý»Ö¸´µÄ£¬ÀíÂÛÉÏ¿ÉÒÔ»Ö¸´µ½Ç°Ò»¸ö²Ù×÷£¬ÉõÖÁ¾ÍÊÇÇ°Ò»ÃëµÄ²Ù×÷¡£¾ßÌå²½ÖèÈçÏ£º

1£¬Í¨¹ýÊÓͼv$database,²é¿´Êý¾Ý¿âÊÇ·ñÔÚArchiveģʽÏÂ: SQL> select log_mode from v$database;
Èç¹û²»ÊÇArchiveģʽ

ÔòÉ趨Êý¾Ý¿âÔËÐÐÓڹ鵵ģʽÏ£ºSQL>shutdown immediate
SQL>startup mount
SQL> alter database archivelog;
SQL> alter database open;
Èç¹ûAutomaticarchivalÏÔʾΪ¡°Enabled¡±£¬ÔòÊý¾Ý¿â¹éµµ·½Ê½Îª×Ô¶¯¹éµµ¡£·ñÔòÐèÒªÊÖ¹¤¹éµµ£¬»òÕß½«¹éµµ·½Ê½ÐÞ¸ÄΪ×Ô¶¯¹éµµ£¬È磺
Õý³£shutdownÊý¾Ý¿â£¬ÔÚ²ÎÊýÎļþÖÐinit.oraÖмÓÈëÈçϲÎÊý
SQL>shutdown immediate
ÐÞ¸Äinit.ora£º
LOG_ARCHIVE_START=TRUE
LOG_ARCHIVE_DEST1=ORACLE_HOME/admin/o816/arch(¹éµµÈÕÖµ´æ·ÅλÖÿÉÒÔ×Ô¼º¶¨Òå)
SQL>startup
È»ºó£¬ÖØÐÂÆô¶¯Êý¾Ý¿â£¬´ËʱOracleÊý¾Ý¿â½«ÒÔ×Ô¶¯¹éµµµÄ·½Ê½¹¤×÷ÔÚArchiveģʽÏ¡£ÆäÖвÎÊýLOG_ARCHIVE_DEST1ÊÇÖ¸¶¨µÄ¹éµµÈÕÖ¾ÎļþµÄ·¾¶£¬½¨ÒéÓëOracleÊý¾Ý¿âÎļþ´æÔÚ²»Í¬µÄÓ²ÅÌ£¬Ò»·½Ãæ¼õÉÙ´ÅÅÌI/O¾ºÕù£¬ÁíÍâÒ»·½ÃæÒ²¿ÉÒÔ±ÜÃâÊý¾Ý¿âÎļþËùÔÚÓ²Å̻ٻµÖ®ºóµÄÎļþ¶ªÊ§¡£¹éµµÂ·¾¶Ò²¿ÉÒÔÖ±½ÓÖ¸¶¨Îª´Å´øµÈÆäËüÎïÀí´æ´¢É豸£¬µ«¿ÉÄÜÒª¿¼ÂǶÁдËٶȡ¢¿ÉдÌõ¼þºÍÐÔÄܵÈÒòËØ¡£

×¢Ò⣺µ±Êý¾Ý¿â´¦ÔÚARCHIVEģʽÏÂʱ£¬Ò»¶¨Òª±£Ö¤Ö¸¶¨µÄ¹éµµÂ·¾¶¿Éд£¬·ñÔòÊý¾Ý¿â¾Í»á¹ÒÆð£¬Ö±µ½Äܹ»¹éµµËùÓй鵵ÐÅÏ¢ºó²Å¿ÉÒÔʹÓá£ÁíÍ⣬Ϊ´´½¨Ò»¸öÓÐЧµÄ±¸·Ý,µ±Êý¾Ý¿âÔÚ´´½¨Ê±,±ØÐëÂÄÐÐÒ»¸öÈ«Êý¾Ý¿âµÄÀ䱸·Ý,¾ÍÊÇ˵Êý¾Ý¿âÐèÒªÔËÐÐÔڹ鵵·½Ê½,È»ºóÕý³£¹Ø±ÕÊý¾Ý¿â,±¸·ÝËùÓеÄÊý¾Ý¿â×é³ÉÎļþ¡£ÕâÒ»±¸·ÝÊÇÕû¸ö±¸·ÝµÄ»ù´¡,ÒòΪ¸Ã±¸·ÝÌṩÁËÒ»¸öËùÓÐÊý¾Ý¿âÎļþµÄ¿½±´¡££¨ÌåÏÖÁËÀ䱸·ÝÓëÈȱ¸·ÝµÄºÏ×÷¹Øϵ£¬ÒÔ¼°Ç¿´óµÄÄÜÁ¦£©

2£¬±¸·Ý±í¿Õ¼äÎļþ£º

a,Ê×ÏÈ£¬Ð޸ıí¿Õ¼äÎļþΪ±¸·Ýģʽ ALTER TABLESPACE tablespace_name BEGIN BACKUP;

b,È»ºó£¬¿½±´±í¿Õ¼äÎļþµ½°²È«ÇøÓò !CP tablespace_name D_PATH;

c,×îºó£¬½«±í¿Õ¼äµÄ±¸·Ýģʽ¹Ø±Õ ALTER TABLESPACE tablespace_name END BACKUP;

3£¬¶Ô¹éµµÈÕÖ¾ÎļþµÄ±¸·Ý£º

Í£Ö¹¹éµµ½ø³Ì£­£­>±¸·Ý¹éµµÈÕÖ¾Îļþ£­£­>Æô¶¯¹éµµ½ø³Ì

Èç¹ûÈÕÖ¾Îĵµ±È½Ï¶à£¬ÎÒÃǽ«ËüÃÇдÈëÒ»¸öÎļþ³ÉΪһ¸ö»Ö¸´µÄ²Î¿¼£º$ files `ls <¹éµµÎļþ·¾¶>/arch*.dbf`;export files

4£¬±¸·Ý¿ØÖÆÎļþ:
SQL> alter database backup controlfile to 'controlfile_back_name£¨Ò»°ãÓÃ2004-11-20µÄ·½Ê½£©' reuse;

µ±È»£¬ÎÒÃÇÒ²¿ÉÒÔ½«ÉÏÃæµÄ¶«¶«Ð´ÎªÒ»¸ö½Å±¾£¬ÔÚÐèÒªµÄʱºòÖ´ÐоͿÉÒÔÁË:

½Å±¾·¶Àý£º

su - oracle < sqlplus /nolog
connect / as sysdba
ALTER TABLESPACE tablespace_name BEGIN BACKUP

!CP tablespace_name D_PATH

ALTER TABLESPACE tablespace_name END BACKUP


alter database backup controlfile to 'controlfile_back_name£¨Ò»°ãÓÃ2004-11-20µÄ·½Ê½£©' reuse;

!files `ls <¹éµµÎļþ·¾¶>/arch*.dbf`;export files

Èȱ¸·ÝµÄ»Ö¸´£¬¶ÔÓڹ鵵·½Ê½Êý¾Ý¿âµÄ»Ö¸´ÒªÇó²»µ«ÓÐÓÐЧµÄÈÕÖ¾±¸·Ý»¹ÒªÇóÓÐÒ»¸öÔڹ鵵·½Ê½ÏÂ×÷µÄÓÐЧµÄÈ«¿â±¸·Ý¡£¹éµµ±¸·ÝÔÚÀíÂÛÉÏ¿ÉÒÔÎÞÊý¾Ý¶ªÊ§£¬µ«ÊǶÔÓÚÓ²¼þÒÔ¼°²Ù×÷ÈËÔ±µÄÒªÇ󶼱Ƚϸߡ£ÔÚÎÒÃÇʹÓù鵵·½Ê½±¸·ÝµÄʱºò£¬È«¿âÎïÀí±¸·ÝÒ²ÊǷdz£ÖØÒªµÄ¡£¹éµµ·½Ê½ÏÂÊý¾Ý¿âµÄ»Ö¸´ÒªÇó´ÓÈ«±¸·Ýµ½Ê§°ÜµãËùÓеÄÈÕÖ¾¶¼ÒªÍêºÃÎÞȱ¡£
»Ö¸´²½Ö裺LOG_ARCHIVE_DEST_1
shutdownÊý¾Ý¿â¡£
½«È«±¸·ÝµÄÊý¾ÝÎļþ·Åµ½Ô­À´ÏµÍ³µÄĿ¼ÖС£
½«È«±¸·Ýµ½Ê§°ÜµãµÄËùÓй鵵ÈÕÖ¾·Åµ½²ÎÊýLOG_ARCHIVE_DEST_1ËùÖ¸¶¨µÄλÖá£
ÀûÓÃsqlplusµÇ½µ½¿ÕʵÀý¡££¨connect / as sysdba£©
È»ºó startup mount
set autorecovery on
recover database;
alter database open;

ÕâÑù£¬ÎÒÃǵÄÈȻָ´¾ÍËãÍ깤ÁË£¬Ð´Á˺þã¬ÖÕÓÚдºÃ£¬´ó¼ÒÓÐʲô²¹³ä¾ÍдÉÏÀ´£¬²»Òª¿ÍÆø£¬ÕâÊÇÕâÁ½ÌìѧϰµÄһЩÐĵã¬Ï£Íû´ó¼Ò¶à¶à½»Á÷£¬Ð»Ð»
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 17 ÌõÆÀÂÛ

  1. kaka_425644 ÓÚ 2012-01-29 16:23:20·¢±í:

    {:2_92:}

  2. kaka_425644 ÓÚ 2012-01-29 16:23:08·¢±í:

    ºÃ¶«¶«£¬Ñ§Ï°Ñ§Ï°

  3. xjw8025 ÓÚ 2012-01-29 13:01:43·¢±í:

    ²»´íºÜºÃ

  4. xjw8025 ÓÚ 2012-01-29 12:51:42·¢±í:

    ËäÈ»ÏÖÔÚ²»¶® µ«ÊÇ»¹ÊÇÖ§³Ö

  5. tuerqi8 ÓÚ 2011-12-26 14:14:31·¢±í:

    Â¥Ö÷ µÄÁ¼ÐÄ´ó´óµÄºÃ°¡

  6. jeraini ÓÚ 2011-12-05 09:11:06·¢±í:

    ²»´íŶ£¡ÏÂÔØÏ¿´¿´£¡

  7. rzg813 ÓÚ 2011-12-03 14:19:20·¢±í:

    ѧϰÏÂ

  8. xinour ÓÚ 2011-12-03 09:14:47·¢±í:

    ²»´íÇ¿soft.tlte.com

  9. wuzhg888 ÓÚ 2011-10-23 17:49:58·¢±í:

    ºÜºÃ£¬Èç¹ûÓи½¼þÏÂÔؾ͸üºÃÁË

  10. http2010 ÓÚ 2011-10-16 01:22:52·¢±í:

    okokokokokokok

  11. lbjventure1 ÓÚ 2011-09-17 17:41:56·¢±í:

    °¾²»ÓÌÔ¥µÄÊÕ²ØÁË¡¢:987w(1

  12. ̧ͷµÎº¹ ÓÚ 2011-09-13 14:15:37·¢±í:

    Ū²»¶®

  13. ̧ͷµÎº¹ ÓÚ 2011-09-13 14:14:47·¢±í:

    ºÃרҵ°¡

  14. ̧ͷµÎº¹ ÓÚ 2011-09-13 14:14:42·¢±í:

    ºÃרҵ°¡

  15. hooqee ÓÚ 2011-08-15 23:42:23·¢±í:

    ·Ç³£ÓÐÓã¡

  16. dongyichen ÓÚ 2011-08-05 09:01:34·¢±í:

    ¹û¶ÏÊÕ²Øѧϰ£¡

  17. ztonline ÓÚ 2006-07-17 16:21:40·¢±í:

    ºÃ¶«Î÷