|
--开库状态删除文件 [oracle@S1011:/u01/app/oracle/oradata/TestDB11]$ rm /u01/app/oracle/oradata/TestDB11/users01.dbf
--数据仍然可查(因为data base buffer中已经存在了相应的数据) scott@TESTDB11>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 1800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 19-APR-87 6000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 2600 10
14 rows selected.
--退出会话 scott@TESTDB11>exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options --清理一下缓存区 sys@TESTDB11>alter system flush buffer_cache;
System altered.
--再查登录查看 [oracle@S1011:/backup/inconsistent_backup]$ sqlplus scott/scott
SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 10 11:37:51 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
scott@TESTDB11>select * from emp; select * from emp * ERROR at line 1: ORA-01116: error in opening database file 4 ORA-01110: data file 4: '/u01/app/oracle/oradata/TestDB11/users01.dbf' ORA-27041: unable to open file Solaris-AMD64 Error: 2: No such file or directory Additional information: 3
--目前实例是open状态 sys@TESTDB11>select status from v$instance;
STATUS ------------ OPEN
--使文件脱机 sys@TESTDB11>alter database datafile 4 offline;
Database altered.
--还原文件 [oracle@S1011:/u01/app/oracle/oradata/TestDB11]$ cp /backup/inconsistent_backup/users01.dbf /u01/app/oracle/oradata/TestDB11 --执行介质恢复 sys@TESTDB11>recover datafile 4; ORA-00279: change 2654911 generated at 08/09/2013 21:27:27 needed for thread 1 ORA-00289: suggestion : /archive2/1_98_813665348.dbf ORA-00280: change 2654911 for thread 1 is in sequence #98
Specify log: {<RET>=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 2660981 generated at 08/09/2013 22:19:48 needed for thread 1 ORA-00289: suggestion : /archive2/1_99_813665348.dbf ORA-00280: change 2660981 for thread 1 is in sequence #99
ORA-00279: change 2667783 generated at 08/10/2013 00:00:55 needed for thread 1 ORA-00289: suggestion : /archive2/1_100_813665348.dbf ORA-00280: change 2667783 for thread 1 is in sequence #100
ORA-00279: change 2679804 generated at 08/10/2013 03:00:28 needed for thread 1 ORA-00289: suggestion : /archive2/1_101_813665348.dbf ORA-00280: change 2679804 for thread 1 is in sequence #101
ORA-00279: change 2699110 generated at 08/10/2013 08:29:58 needed for thread 1 ORA-00289: suggestion : /archive2/1_102_813665348.dbf ORA-00280: change 2699110 for thread 1 is in sequence #102
ORA-00279: change 2725650 generated at 08/10/2013 10:27:18 needed for thread 1 ORA-00289: suggestion : /archive2/1_103_813665348.dbf ORA-00280: change 2725650 for thread 1 is in sequence #103
ORA-00279: change 2726122 generated at 08/10/2013 10:29:03 needed for thread 1 ORA-00289: suggestion : /archive2/1_104_813665348.dbf ORA-00280: change 2726122 for thread 1 is in sequence #104
Log applied. Media recovery complete.
--使数据文件联机 sys@TESTDB11>alter database datafile 4 online;
Database altered.
--可以查看数据了 scott@TESTDB11>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 1800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 19-APR-87 6000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 2600 10
14 rows selected. |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17013648/viewspace-1151910/ ,如需转载,请注明出处,否则将追究法律责任。