歸檔日誌恢復文件

[root@aa ~]# su - oracle
[oracle@aa ~]$ echo $ORACLE_SID
orcl
[oracle@aa ~]$ sqlplus / as sysdbasql

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

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

Connected to an idle instance.spa

SQL> startup
ORACLE instance started.orm

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;it

Tablespace created.io

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

User created.form

SQL> grant connect,resource to t;class

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> select * from t1;

        ID
----------
         1


SQL> conn / as sysdba
Connected.
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
ORACLE instance started.

Total System Global Area  838860800 bytes
Fixed Size                  1222192 bytes
Variable Size             394267088 bytes
Database Buffers          436207616 bytes
Redo Buffers                7163904 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
ORA-01110: data file 9: '/oracle/oradata/orcl/text1.dbf'


SQL> alter database datafile 9 offline;

Database altered.

SQL> alter database create datafile 9;

Database altered.

SQL> set autorecovery on;

SQL> recover datafile 9;
Media recovery complete.

SQL> alter database open;

Database altered.

SQL> alter database datafile 9 online;

Database altered.

SQL> conn t/t
Connected.
SQL> select * from t1;

        ID ----------          1

相關文章
相關標籤/搜索