ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 利用归档来做数据文件的恢复

利用归档来做数据文件的恢复

原创 Linux操作系统 作者:super_sky 时间:2014-02-26 17:13:14 0 删除 编辑

数据库是归档状态,但是没有做过全库备份。归档文件全部都在。利用归档文件来进行恢复操作,操作过程如下:

启库时,提示如下错误信息

SYS@testdb>alter database open;
alter database open
*
ERROR at line 1:
ORA-01147: SYSTEM tablespace file 8 is offline
ORA-01110: data file 8: '/oracle/ora10g/oradata/users02.dbf'

检查数据文件,发现datafile 8 丢失。

SYS@testdb>select ts#,file#,name,status from v$datafile;

       TS#      FILE# NAME                                     STATUS
---------- ---------- ---------------------------------------- -------
         0          1 /oracle/ora10g/oradata/system01.dbf      SYSTEM
         1          2 /oracle/ora10g/oradata/undotbs01.dbf     ONLINE
         2          3 /oracle/ora10g/oradata/sysaux01.dbf      ONLINE
         4          4 /oracle/ora10g/oradata/users01.dbf       ONLINE
         5          5 /oracle/ora10g/oradata/leo1_01.dbf       ONLINE
         6          6 /oracle/ora10g/oradata/mssm01.dbf        ONLINE
         7          7 /oracle/ora10g/oradata/assm01.dbf        ONLINE
         0          8 /oracle/ora10g/oradata/users02.dbf       SYSOFF
         8          9 /oracle/ora10g/product/10.2.0/db_1/dbs/o ONLINE
                      racleora10goradatatest01.dbf

       TS#      FILE# NAME                                     STATUS
---------- ---------- ---------------------------------------- -------
         9         10 /oracle/ora10g/product/10.2.0/db_1/dbs/w ONLINE
                      angche.bdf

        10         11 /ora_data/wangche1.bdf                   ONLINE

11 rows selected.

我们使用下面的SQL进行数据文件的重建

alter">SYS@testdb>alter database create datafile '/oracle/ora10g/oradata/users02.dbf';

Database altered.

SYS@testdb>select ts#,file#,name,status from v$datafile;

       TS#      FILE# NAME                                               STATUS
---------- ---------- -------------------------------------------------- -------
         0          1 /oracle/ora10g/oradata/system01.dbf                SYSTEM
         1          2 /oracle/ora10g/oradata/undotbs01.dbf               ONLINE
         2          3 /oracle/ora10g/oradata/sysaux01.dbf                ONLINE
         4          4 /oracle/ora10g/oradata/users01.dbf                 ONLINE
         5          5 /oracle/ora10g/oradata/leo1_01.dbf                 ONLINE
         6          6 /oracle/ora10g/oradata/mssm01.dbf                  ONLINE
         7          7 /oracle/ora10g/oradata/assm01.dbf                  ONLINE
         0          8 /oracle/ora10g/oradata/users02.dbf                 SYSOFF
         8          9 /oracle/ora10g/product/10.2.0/db_1/dbs/oracleora10 ONLINE
                      goradatatest01.dbf

       TS#      FILE# NAME                                               STATUS
---------- ---------- -------------------------------------------------- -------
         9         10 /oracle/ora10g/product/10.2.0/db_1/dbs/wangche.bdf ONLINE
        10         11 /ora_data/wangche1.bdf                             ONLINE

11 rows selected.

利用归档恢复数据文件

SYS@testdb>recover datafile 8;
Media recovery complete.
SYS@testdb>

将数据文件状态修改为online
SYS@testdb>alter database datafile 8 online;

Database altered.

SYS@testdb>select ts#,file#,name,status from v$datafile;

       TS#      FILE# NAME                                               STATUS
---------- ---------- -------------------------------------------------- -------
         0          1 /oracle/ora10g/oradata/system01.dbf                SYSTEM
         1          2 /oracle/ora10g/oradata/undotbs01.dbf               ONLINE
         2          3 /oracle/ora10g/oradata/sysaux01.dbf                ONLINE
         4          4 /oracle/ora10g/oradata/users01.dbf                 ONLINE
         5          5 /oracle/ora10g/oradata/leo1_01.dbf                 ONLINE
         6          6 /oracle/ora10g/oradata/mssm01.dbf                  ONLINE
         7          7 /oracle/ora10g/oradata/assm01.dbf                  ONLINE
         0          8 /oracle/ora10g/oradata/users02.dbf                 SYSTEM
         8          9 /oracle/ora10g/product/10.2.0/db_1/dbs/oracleora10 ONLINE
                      goradatatest01.dbf

       TS#      FILE# NAME                                               STATUS
---------- ---------- -------------------------------------------------- -------
         9         10 /oracle/ora10g/product/10.2.0/db_1/dbs/wangche.bdf ONLINE
        10         11 /ora_data/wangche1.bdf                             ONLINE

11 rows selected.

再次打开数据库。

SYS@testdb>alter database open;

Database altered.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11590946/viewspace-1092571/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-01-11

  • 博文量
    77
  • 访问量
    764508