新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 软件开发 > 数据库 > Oracle教程 > 正文:带你深入了解回滚表空间丢失的解决方法

带你深入了解回滚表空间丢失的解决方法

新客网 XKER.COM 2008-01-28 来源:赛迪网 10533 收藏本文

问题:Oracle数据库的undotbs01.dbf文件损坏?

解决方法如下:

首先,我们需要模拟这个错误,方法是将undotbs01.dbf移到其它目录下,然后再来进行修正,过程如下:

SQL> startup
ORACLE instance started.

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: ''D:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF''


SQL> alter system set undo_management=''MANUAL'' scope=spfile;

System altered.

SQL> alter database datafile ''d:\oracle\oradata\orcl\undotbs01.dbf'' offline drop
;

Database altered.

SQL> alter database open;

Database altered.

SQL>

现在,此数据库已经能正常启动,但是还是没有达到我们的要求,因为在Oracle9i以后的版本建议用undo表空间来代替回滚段,现在我们需要将其设置为undo表空间。

SQL>
create undo tablespace undotbs2 datafile '
'd:\oracle\oradata\orcl\undotbs02.dbf'' size 100M;
Tablespace created.
SQL> select * from v$tablespace;

       TS# NAME                           INC
---------- ------------------------------ ---
         3 CWMLITE                        YES
         4 DRSYS                          YES
         5 EXAMPLE                        YES
         6 INDX                           YES
         7 ODM                            YES
         0 SYSTEM                         YES
         8 TOOLS                          YES
         1 UNDOTBS1                       YES
         9 USERS                          YES
        10 XDB                            YES
         2 TEMP                           YES

       TS# NAME                           INC
---------- ------------------------------ ---
        11 UNDOTBS2                       YES

12 rows selected.


SQL> alter system set undo_management=''AUTO'' scope=spfile;

System altered.

SQL> alter system set undo_tablespace=''UNDOTBS2'' scope=spfile;

System altered.

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

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> show parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----
undo_management                      string      AUTO
undo_retention                       integer     10800
undo_suppress_errors                 boolean     FALSE
undo_tablespace                      string      UNDOTBS2
SQL>

此时,数据库成功启动。

收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
阅读排行
随机推荐
实用信息推荐