天天看點

歸檔日志恢複檔案

[root@aa ~]# su - oracle

[oracle@aa ~]$ echo $ORACLE_SID

orcl

[oracle@aa ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 7 19:45:34 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area  838860800 bytes

Fixed Size                  1222192 bytes

Variable Size             390072784 bytes

Database Buffers          440401920 bytes

Redo Buffers                7163904 bytes

Database mounted.

Database opened.

SQL> create tablespace text1 datafile '/oracle/oradata/orcl/text1.dbf' size 10m;

Tablespace created.

SQL> create user t identified by t default tablespace text1;

User created.

SQL> grant connect,resource to t;

Grant succeeded.

SQL> conn t/t

Connected.

SQL> create table t1 (id number);

Table created.

SQL> insert into t1 values (1);

1 row created.

SQL> select * from t1;

        ID

----------

         1

SQL> commit;

Commit complete.

----------------------------------------------------

[oracle@aa ~]$ cd /oracle/oradata/orcl/

[oracle@aa orcl]$ ls

abctbs.dbf     example01.dbf  sysaux01.dbf  undotbs01.dbf

control01.ctl  redo01.log     system01.dbf  undotbs02_1.dbf

control02.ctl  redo02.log     temp01.dbf    undotbs02.dbf

control03.ctl  redo03.log     text1.dbf     users01.dbf

[oracle@aa orcl]$ rm text1.dbf

[oracle@aa orcl]$

-------------------------------------------------------

SQL> conn / as sysdba

SQL> shutdown immediate

ORA-01116: error in opening database file 9

ORA-01110: data file 9: '/oracle/oradata/orcl/text1.dbf'

ORA-27041: unable to open file

Linux Error: 2: No such file or directory

Additional information: 3

SQL> shutdown abort

ORACLE instance shut down.

SQL> startup nomount

Variable Size             394267088 bytes

Database Buffers          436207616 bytes

SQL> alter database mount;

Database altered.

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01157: cannot identify/lock data file 9 - see DBWR trace file

SQL> alter database datafile 9 offline;

SQL> alter database create datafile 9;

SQL> set autorecovery on;

SQL> recover datafile 9;

Media recovery complete.

SQL> alter database datafile 9 online;

下一篇: