ITPub博客

首页 > 数据库 > Oracle > UNDO redo.log损坏!

UNDO redo.log损坏!

原创 Oracle 作者:penglele2009 时间:2011-03-11 09:39:28 0 删除 编辑

1:redo.log损坏,或者UNDO 表空间损坏,数据库肯定会DOWN.

2:创建pifle,修改pfile undo_management=manual

3:startup pfile='....'

4:open以后,create spfile from pfile

5:修改undo_management=auto

6:重启

解决思路:将UNDO_MANAGEMENT修改为manul,下次启动数据库时,则系统使用的是system表空间的回滚段(rollback segment)。

1、 模拟undo表空间出错的情况,将该表空间名字修改为一个错误的名字。则下次启动使用spfile时,会因为无法找到该表空间而报错。

SQL> alter system set undo_tablespace=undotbs11 scope=spfile;

System altered.

2、重启数据库实例,果然出现了错误(老师所述的错误是由于undo表空间出现了坏块,不过解决这种问题的办法都是相同的):

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.

ORA-01092: ORACLE instance terminated. Disconnection forced

3、这种情况下,由于数据库无法变成open状态,因此是无法打开spfile的,我们只能通过pfile来打开数据库。

3.1、新建pfile

SQL> create pfile from spfile;

File created.

3.2、编辑pfile,我们将undo_management的值由AUTO修改为manual。

[oracle@localhost dbs]$ cd $ORACLE_HOME/dbs

[oracle@localhost dbs]$ vi initorcl.ora

*.undo_management='AUTO' à *.undo_management='manual'

4、下面,我们采用pfile来启动数据库:

SQL> shutdown immediate

ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist

Linux Error: 2: No such file or directory

SQL> startup pfile=/opt/ora10g/product/10.2.0/db_1/dbs/initorcl.ora

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.

SQL>

5、现在数据库实例打开了,我们再创建spfile,让数据库下次启动时,自动读取spfile。

SQL> show parameter spfile

NAME TYPE VALUE

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

spfile string

SQL> create spfile from pfile;

File created.

SQL> startup force

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.

SQL> show parameter spfile

NAME TYPE VALUE

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

spfile string /opt/ora10g/product/10.2.0/db_1/dbs/spfileorcl.ora

6、现在我们再将相应的参数修改回去,系统表空间的资源是有限的,我们最好不要使用回滚段。

SQL> show parameter undo

NAME TYPE VALUE

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

undo_management string MANUAL

undo_retention integer 900

undo_tablespace string UNDOTBS11

SQL> alter system set undo_management=auto scope=spfile;

System altered.

SQL> alter system set undo_tablespace=UNDOTBS1 scope=spfile;

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218992 bytes

Variable Size 125830736 bytes

Database Buffers 155189248 bytes

Redo Buffers 2973696 bytes

Database mounted.

Database opened.

SQL> show parameter undo

NAME TYPE VALUE

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

undo_management string AUTO

undo_retention integer 900

undo_tablespace string UNDOTBS1

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22934571/viewspace-1047125/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-11-26

  • 博文量
    199
  • 访问量
    677245