oracle在非归档模式下丢失数据文件恢复
数据库在非归档模式下丢失数据文件恢复
在非归档模式下,保证归档没有切换过就可以恢复
具体如下:
SQL> create tablespace test datafile '/app/oracle/oradata/ORCL/test01.dbf' size 50M;
Tablespace created.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /app/oracle/arch1
Oldest online log sequence 9
Current log sequence 11
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> create table test1(a int) tablespace test;
Table created.
SQL> insert into test1 values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test1;
A
----------
1
SQL> select table_name,tablespace_name from dba_tables where table_name='TEST1';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
TEST1 TEST
SQL> shutdown abort
ORACLE instance shut down.
SQL> !mv /app/oracle/oradata/ORCL/test01.dbf /app/oracle/oradata/ORCL/test01.dbf1111
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220360 bytes
Variable Size 159383800 bytes
Database Buffers 360710144 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/app/oracle/oradata/ORCL/test01.dbf'
SQL> alter database create datafile '/app/oracle/oradata/ORCL/test01.dbf' as '/app/oracle/oradata/ORCL/test01.dbf';
Database altered.
SQL> recover datafile 5;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select * from test1;
A
----------
1
目录 返回
首页