我想在win2000下自动备份oracle数据库,怎么做?

解决方案 »

  1.   

    创建一个bat文件,内容如下set rq=%date:~-10%
    exp fmu37/fmu37@orcl file=fmu37_%rq%.dmp
    pause然后在计划任务里加上这个bat就ok了。
      

  2.   

    给你一个热备份的脚本,热备份最大的好处就是可以进行数据的完全或非完全恢复,如0点备份,23点崩溃,数据库可以恢复到23点,也可以选择性的恢复到12点。关于恢复的资料,最好自己看书,很多。  
    rem          script:hotbak.sql  
    rem          creater:chenjiping  
    rem          date:4.4.2002  
    rem          desc:backup  database  datafile  in  archive  
     
    --connect  database  
    connect  internal/virpure;  
     
    --archive  
    alter  system  checkpoint;  
    alter  system  archive  log  all;  
    alter  system  switch  logfile;  
    --start  
    alter  tablespace  afis_remote  begin  backup;  
    !xcopy  e:\orant\database\remote_data1.ora  e:\databak/H/R;  
    !xcopy  e:\orant\database\remote_data2.ora  e:\databak/H/R;    
    alter  tablespace  afis_remote  end  backup;  
     
    alter  tablespace  afis_rmtafis  begin  backup;  
    !xcopy  e:\orant\database\rmtafis_data1.ora  e:\databak/H/R;  
    !xcopy  e:\orant\database\rmtafis_data2.ora  e:\databak/H/R;    
    alter  tablespace  afis_rmtafis  end  backup;  
     
    alter  tablespace  afis_lquser  begin  backup;  
    !xcopy  e:\orant\database\lquser_data.ora  e:\databak/H/R;  
    alter  tablespace  afis_lquser  end  backup;  
     
    alter  tablespace  afis_transf  begin  backup;  
    !xcopy  e:\orant\database\transf1_data.ora  e:\databak/H/R;  
    !xcopy  e:\orant\database\transf2_data.ora  e:\databak/H/R;    
    alter  tablespace  afis_transf  end  backup;  
     
    alter  tablespace  system  begin  backup;  
    !xcopy  e:\orant\database\sys1afis.ora  e:\databak/H/R;  
    alter  tablespace  system  end  backup;  
     
    alter  tablespace  rbs  begin  backup;  
    !xcopy  e:\orant\database\rbs1afis.ora  e:\databak/H/R;  
    alter  tablespace  rbs  end  backup;  
     
    alter  tablespace  usr  begin  backup;  
    !xcopy  e:\orant\database\usr1afis.ora  e:\databak/H/R;  
    alter  tablespace  usr  end  backup;  
     
     
    alter  tablespace  temporary  begin  backup;  
    !xcopy  e:\orant\database\tmp1afis.ora  e:\databak/H/R;  
    alter  tablespace  temporary  end  backup;  
    --end  
     
    --bak  control  file  
    --bin  
    alter  database  backup  controlfile  to  'e:\databak\controlbinbak.000';  
    --ascii  
    alter  database  backup  controlfile  to  trace;  
     
    alter  system  switch  logfile;  
    alter  system  switch  logfile;  
    以下是调用以上脚本的bat,照样可以加到任务计划中,一般热备份每周备份一次就够了,主要看情况不同而定。  
    rem          script:hotbak.bat  
    rem          creater:chenjiping  
    rem          date:4.4.2002  
    rem          desc:backup  database  datafile  in  archive  
     
    echo  del  old  temp  backup  file  
    del    f:\datatmp\*.*/q  
    del    e:\datatmp\*.*/q  
    echo  bak  backup  file  to  temp  
    move  e:\databak\*.*  e:\datatmp\  
    move  f:\Archive\*.*  f:\datatmp\  
    echo  start  new  bak  to  e:\databak  
    svrmgrl  @e:\sql\hotbak.sql  
     
    ---------------------------------------------------------------  
     
    1.在d:盘中建立备份文件夹,如:d:\数据库备份;再建立5个(最多7个)子目录,如d:\数据库备份\星期一,d:\数据库备份\星期二,......,如此可保证每周的备份;  
    2.在d:\数据库备份目录下建立5个批处理文件,如:星期一.bat(可为7个);  
    3.编辑星期一.bat,写入:  
    exp  system/manager  owner=(test1)  file=d:\数据库备份\星期一\test1.dmp  
    log=d:\数据库备份\星期一\test1.log  buffer=655000;  
    (注意有几个库写几个)  
     
    4.将批理文件加入“控制面板”、“任务计划”、“备份”、“每天”,时间可为凌晨1-3点,OK!  
      

  3.   

    认为只备份需要的用户,或表就可以了
    用Exp命令就可以.
    或者自己写应用程序对表备份.
      

  4.   

    创建一个bat文件,内容如下set rq=%date:~-10%
    exp fmu37/fmu37@orcl file=fmu37_%rq%.dmp
    pause然后在计划任务里加上这个bat就ok了。支持上面的做法
    我们就是这样用的
      

  5.   

    备份最好还是去研究RMAN(recover manager)