oracleデータベースのバックアップとインポート


    
    (          ) 
  : 
   ->  ->  CMD->  DOS   
EXP    /  @      GRANTS=Y TABLES=(stu) file=C:\   .DMP 
  : 
   ->  ->  CMD->  DOS   
IMP    /  @      IGNORE=Y TABLES=(stu) FULL=N file=C:\   .DMP 

  stu       

    
  : 
   ->  ->  CMD->  DOS   
EXP    /  @      FULL=Y file=C:\   .DMP 
  : 
   ->  ->  CMD->  DOS   
IMP    /  @      FULL=Y file=C:\   .DMP 


    
   : 
      、      ORACLE EXP    ,          ORACLE    ,     ORACLE    。: 
1,     backup.bat\. 
exp system/manager file=d:\backup\oracle\oracle%date:~0,10%.dmp owner=system log=d:\backup\oracle\oracle%date:~0,10%.log 
   oracle2006-01-09.dmp   
exp system/manager file=d:\backup\oracle\oracle%date:~11,3%.dmp owner=system log=d:\backup\oracle\oracle%date:~11,3%.log 
   oracle   .dmp  ,             , 7        
2,         
        ,                   (      ),  d:\oracle\backup.bat 
3、             “oracle2005-08-31.dmp oracle2005-08-31.log”        。 
  : 
1、%date%        、            ,                 %date%  。          echo %date%     。%date:~4,10%        ,~                ( 0  ),            ,          ,       。 
2、             ,  %time%  ,    。 
   : 
@echo off 
set filename=e:\data_bak\%date:~8,2%  
exp userid=user/pass@esdata file=%filename%.dmp owner=user INDEXES=y grants=y constraints=y compress=y log=%filename%.log 
rar a %filename%.rar %filename%.* 
del %filename%.dmp 
del %filename%.log 
           , 
       day      
     rar     
               
  :   program files/winrar    rar.exe     system32    
        ,    set filename=e:\data_bak\%date:~8,2%     
set filename=e:\data_bak\%date:~0,3% 
   : 
   ORACLE            ,          

@ECHO OFF 
SET BACKPATH=d:\ 
ECHO         
REM 7      
IF EXIST %BACKPATH%\ONE GOTO ONE 
IF EXIST %BACKPATH%\TWO GOTO TWO 
IF EXIST %BACKPATH%\THREE GOTO THREE 
IF EXIST %BACKPATH%\FOUR GOTO FOUR 
IF EXIST %BACKPATH%\FIVE GOTO FIVE 
IF EXIST %BACKPATH%\SIX GOTO SIX 
IF EXIST %BACKPATH%\SEVEN GOTO SEVEN 
ECHO E > %BACKPATH%\ONE 
:ONE 
SET BACKPATH_FULL=%BACKPATH%\ONE 
REN %BACKPATH%\ONE TWO 
GOTO BACK 
:TWO 
SET BACKPATH_FULL=%BACKPATH%\TWO 
REN %BACKPATH%\TWO THREE 
GOTO BACK 
:THREE 
SET BACKPATH_FULL=%BACKPATH%\THREE 
REN %BACKPATH%\THREE FOUR 
GOTO BACK 
:FOUR 
SET BACKPATH_FULL=%BACKPATH%\FOUR 
REN %BACKPATH%\FOUR FIVE 
GOTO BACK 
:FIVE 
SET BACKPATH_FULL=%BACKPATH%\FIVE 
REN %BACKPATH%\FIVE SIX 
GOTO BACK 
:SIX 
SET BACKPATH_FULL=%BACKPATH%\SIX 
REN %BACKPATH%\SIX SEVEN 
GOTO BACK 
:SEVEN 
SET BACKPATH_FULL=%BACKPATH%\SEVEN 
REN %BACKPATH%\SEVEN ONE 
GOTO BACK 
:BACK 
EXP TESTUSER/TEST FILE=%BACKPATH_FULL%.DMP 
SET BACKPATH= 
SET BACKPATH_FULL= 
EXIT 
   : 
RMAN TARGET=RMAN/RMAN@ORCL < C:\RMAN.TXT 
   : 
      cmd  。     bat  。 windows       ,  
       。 
 : 
       
del c:\exp\*.dmp 
exp userid=cw/cw@db file='c:\exp\*.dmp' tables=(student) 
   bat   
   : 
              : 
  : 
@echo off                   
     
echo      .....                           
D: DOS   D:   
cd oracle\ora92\bin          cd oracle\ora92\bin   
exp    /  @    file=d:\config_bak.dmp tables=(table1,table2)        d:\config_bak.dmp 
echo     ! 
  : 
@echo off            
     
echo      .....                      
D: 
cd oracle\ora92\bin 
imp    /  @    file=d:\config_bak.dmp tables=(table1,table2) ignore=y 
sqlplus /nolog @oraStartup.sql>>oraStartup.log   sql   
pause    sql      ,    
echo     ! 
  oraStartup.sql 
conn    /  @    as sysdba 
select * from table1; 
quit; 
       
       

     :   SQLPLUS.EXE  DOS(   )   , 
  DOS          oracle 8i       \ora81\BIN        , 
       EXP.EXE IMP.EXE           。 
  oracle java  ,  SQLPLUS.EXE、EXP.EXE、IMP.EXE              。 
  SQLPLUS.EXE  EXP.EXE、IMP.EXE       ,        。 
               ,                ,         。 
      : 
  1     TEST    ,   system   manager    D:\daochu.dmp  
  exp system/manager@TEST file=d:\daochu.dmp full=y 
  2      system   sys       
  exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys) 
  3        table1 、table2   
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2) 
  4        table1    filed1 "00"        
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\" 
   
          ,         , winzip dmp         。 
               compress=y      
        
  1  D:\daochu.dmp        TEST    。 
  imp system/manager@TEST file=d:\daochu.dmp 
          ,         ,      ,         。 
        ignore=y     。 
  2  d:\daochu.dmp   table1    
  imp system/manager@TEST file=d:\daochu.dmp tables=(table1) 
   
               。            ,    。
a.          
select   log_mode   from   v$database; 
          :NOARCHIVELOG 
        (Archive)                
b.       
1.SQL>   shutdown   immediate; 
2.SQL>   startup   mount; 
3.SQL> alter   database   archivelog; 
4.SQL> alter   database   open; 
            

  
 1.    “svrmgrl”          ;

  2.    “connect internal”,      “startup mount’;

  3.    “recover database;”

  4.  ENTER,     。

  5.      “alter database open;”       。