现在想做Oracle数据库的备份和恢复    最后能给个实例代码 能直接运行的

解决方案 »

  1.   

    exp username/password@sid file='' owner=username
      

  2.   


    --------物理备份的例子
    SQL> set time on;  
    17:25:16 SQL> select count(*) from tiny.ftest;  
      
      COUNT(*)  
    ----------  
             0  
      
      
    17:26:19 SQL> alter tablespace tiny begin backup;  
      
    表空间已更改。  
      
    17:26:38 SQL> alter tablespace tiny end backup;  
      
    表空间已更改。  
      
    17:27:02 SQL> insert into tiny.ftest select rownum from dual where rownum<=1000;  
      
    已创建 1 行。  
      
    17:27:40 SQL> insert into tiny.ftest select rownum from dual connect by rownum<=1000;  
      
    已创建1000行。  
      
    17:27:47 SQL> commit;  
      
    提交完成。  
      
    17:27:52 SQL> select count(*) from tiny.ftest;  
      
      COUNT(*)  
    ----------  
          1001  
      
    17:28:16 SQL> select log_mode from v$database;  
      
    LOG_MODE  
    ------------------------  
    ARCHIVELOG  
      
    17:29:15 SQL> shutdown immediate;  
    数据库已经关闭。  
    已经卸载数据库。  
    ORACLE 例程已经关闭。  
    17:29:45 SQL> startup;  
    ORACLE 例程已经启动。  
      
    Total System Global Area  192937984 bytes  
    Fixed Size                  1248044 bytes  
    Variable Size             138413268 bytes  
    Database Buffers           50331648 bytes  
    Redo Buffers                2945024 bytes  
    数据库装载完毕。  
    ORA-01157: 无法标识/锁定数据文件 5 - 请参阅 DBWR 跟踪文件  
    ORA-01110: 数据文件 5: 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\MYORCL\TINY01.DBF'  
      
      
    17:30:33 SQL> shutdown immediate;  
    ORA-01109: 数据库未打开  
      
      
    已经卸载数据库。  
    ORACLE 例程已经关闭。  
    17:30:51 SQL> startup mount;  
    ORACLE 例程已经启动。  
      
    Total System Global Area  192937984 bytes  
    Fixed Size                  1248044 bytes  
    Variable Size             138413268 bytes  
    Database Buffers           50331648 bytes  
    Redo Buffers                2945024 bytes  
    数据库装载完毕。  
      
    17:36:09 SQL> recover datafile 'E:\oracle\product\10.2.0\oradata\myorcl\tiny01.dbf';  
    完成介质恢复。  
    17:37:17 SQL> alter database open;  
      

  3.   

    对备份不用啊  
    C:\Documents and Settings\Administrator>exp system/123@pda file='c\pda.dmp' ;Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    EXP-00028: failed to open c\pda.dmp for write  //这个报的什么错啊  
    Export file: EXPDAT.DMP > 
      

  4.   

    exp system/123@pda file=c:\pda.dmp log=pda.log full=y
      

  5.   

    文件名少了个冒号啊。。
    'c\pda.dmp' --->''c:\pda.dmp' '
      

  6.   

    谢谢 啦  现在 我要到将刚才导出的数据 导入到数据库中   怎么弄imp  怎么弄啊
      

  7.   

    imp user/pass@实例 file=c:\pda.dmp log=pda.log full=y ignore=y
      

  8.   

    谢谢 各位的指点啊 
    自己总结下 :Oracle 数据库基本的备份  首先要进入我们系统的【运行】 输入cmd  进入一个命令的cmd.exe程序 
    备份:exp username/password@database file=path  tables=table 
    例子:exp system/123@pda tables=picture,pic file=d:\123\test1.dmp;恢复:Imp username/password@database file=path  tables=table 
          Imp system/123@pda tables=pic,picture file=d:\123\test1.dmp;简单的备份