Oracle 10G 报错 ORA-00604 ORA-00376 ORA-01110

如果在做数据库迁移,由于你删除undotbs01.dbf 导致报如下错误:ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: '/u01/app/oracle/oradata/orcl/undotbs01.dbf'
 

解决方案如下:

1.删除表空间文件与创建表空间文件

SQL> alter database datafile '/u01/app/oracle/oradata/orcl/undotbs01.dbf' offline drop;

Database altered.

SQL> alter database open
  2  ;

Database altered.

SQL> create undo tablespace undotbs02 datafile '/u01/app/oracle/oradata/orcl/undotbs02.dbf' size 10M;

Tablespace created.

SQL> alter system set undo_tablespace='undotbs02';

System altered

2.查询介质恢复文件状态SQL> select * from v$recover_file;

     FILE# ONLINE         ONLINE_STATUS
---------- -------------- --------------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
--------------
         2 OFFLINE        OFFLINE
FILE NOT FOUND                                                             0


         7 OFFLINE        OFFLINE
                                                                      838945
08-6?  -11

     FILE# ONLINE         ONLINE_STATUS
---------- -------------- --------------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
--------------
 

红色表示已经被删除的表空间,现在处理不在线状态,这情况属于undo表空间不正常

蓝色表示已经创建了的表空间,没法使用

3.先介质恢复datafile 7 (7 OFFLINE)(最好是在mount状态下恢复,在此是open)

     SQL> recover datafile 7;
Media recovery complete.

4.查询介质恢复文件状态
 SQL> select * from v$recover_file;

     FILE# ONLINE         ONLINE_STATUS
---------- -------------- --------------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
--------------
         2 OFFLINE        OFFLINE
FILE NOT FOUND                                                             0

5.执行删除datafile 2(2 OFFLINE)

SQL> alter database datafile 2 offline drop;

Database altered.
发现数据库还是不正常,此时查询表空间,看看是否在线

6.查询表空间状态

SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                                              STATUS
------------------------------------------------------------ ------------------
SYSTEM                                                       ONLINE
UNDOTBS1                                                     ONLINE
SYSAUX                                                       ONLINE
TEMP                                                         ONLINE
USERS                                                        ONLINE
EXAMPLE                                                      ONLINE
EYGLE                                                        ONLINE
EYGLE_TEMP                                                   ONLINE
UNDOTBS02                                                    ONLINE
ETENTEST                                                     ONLINE
ETENTEST_TEMP                                                ONLINE

11 rows selected.

发现表空间UNDOTBS1还在线,此时要drop

7.在open状态下drop表空间UNDOTBS1

SQL> drop tablespace undotbs1             
  2  ;

Tablespace dropped.

8.查询表空间状态

SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME                                              STATUS
------------------------------------------------------------ ------------------
SYSTEM                                                       ONLINE
SYSAUX                                                       ONLINE
TEMP                                                         ONLINE
USERS                                                        ONLINE
EXAMPLE                                                      ONLINE
EYGLE                                                        ONLINE
EYGLE_TEMP                                                   ONLINE
UNDOTBS02                                                    ONLINE
ETENTEST                                                     ONLINE
ETENTEST_TEMP                                                ONLINE

10 rows selected.
已经没有表空间UNDOTBS1

9.查询介质恢复文件状态
SQL> select * from v$recover_file;

no rows selected
一切正常,

10.关闭数据库与启动数据库

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size             121636432 bytes
Database Buffers          159383552 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

 

你可能感兴趣的:(oracle,休闲,ORA-00604,ORA-01110,ORA-00376)