Chinaunix首页 | 论坛 | 博客
  • 博客访问: 254801
  • 博文数量: 59
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 698
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-19 21:17
文章分类

全部博文(59)

文章存档

2009年(14)

2008年(45)

我的朋友

分类: Oracle

2008-11-22 11:26:46

原来asm的数据库,我使用rman做了备份,然后在文件系统中,我恢复了该数据库,但是重新启动数据库后,
发现数据库无法打开了。具体过程如下:
我重新启动数据库后,发现数据库无法open,在alert.log发现如下错误:ora-38760具体出错如下:
ALTER DATABASE   MOUNT
Fri Aug 15 23:42:08 2008
Setting recovery target incarnation to 1
Fri Aug 15 23:42:08 2008
Successful mount of redo thread 1, with mount id 1128950988
Fri Aug 15 23:42:08 2008
Allocated 3981204 bytes in shared pool for flashback generation buffer
Starting background process RVWR
RVWR started with pid=14, OS id=11702
Fri Aug 15 23:42:09 2008
Errors in file /oracle/admin/antiper/bdump/antiper_rvwr_11702.trc:
ORA-38701: Message 38701 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1] [1] [/oracle/recv/ANTIPER/flashback/o1_mf_4bby739w_.flb]
ORA-27037: Message 27037 not found; No message file for product=RDBMS, facility=ORA
Linux Error: 2: No such file or directory
Additional information: 3
Fri Aug 15 23:42:09 2008
Database mounted in Exclusive Mode
Completed: ALTER DATABASE   MOUNT
Fri Aug 15 23:42:09 2008
ALTER DATABASE OPEN
ORA-38760 signalled during: ALTER DATABASE OPEN...
从错误的内容中可以发现,闪回数据库能够mount,但是在mount过程中出现错误,估计是闪回日志的路径指定不正确,而在打开数据库的时候可能需要写闪回日志,因此数据库只能mount而无法打开数据库。
[oracle@ora10g bdump]$ oerr ora 38760
38760, 00000, "This database instance failed to turn on flashback database"
// *Cause: Database flashback is on but this instance failed to
//         start generating flashback data. Look in alert log for more
//         specific errors.
// *Action: Correct the error or turn off database flashback.
这个时候我立即检查闪回的数据库相关参数:
SQL> show parameter db_re
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /oracle/recv
db_recovery_file_dest_size           big integer 3G
db_recycle_cache_size                big integer 0
数据库参数是好的呀。
我实在没办法了,将闪回功能关闭吧,然后看是否可以打开数据库呢?
SQL> alter database flashback off;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs
  2  ;
alter database open resetlogs
     *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DISKGP1/antiper/datafile/system.260.662520081'
这种情况下我是没有办法了,oracle真的是很不智能啊,因为这个数据库我是使用rman进行备份与恢复的,而在rman恢复之后,数据库也是打开了,记得使用rman恢复时,因为原来数据库是使用asm的存储结构,而现在使用的是普通的文件系统,因此使用了类似如下的方式进行恢复:
RUN

  ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; 
  ALLOCATE CHANNEL dev2 DEVICE TYPE sbt; 
  SQL "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE"; 
  SET NEWNAME FOR DATAFILE '/disk7/oracle/tbs11.f'
    TO '/disk9/oracle/tbs11.f'; 
  RESTORE TABLESPACE tbs_1;
  SWITCH DATAFILE ALL; 
  RECOVER TABLESPACE tbs_1; 
  SQL "ALTER TABLESPACE tbs_1 ONLINE"; 
}
但是在数据库打开后,使用上述方式还原数据库后,控制文件没有修改,因此在重新启动数据库后,控制文件与实际数据库文件不一致,因此出现本次的数据库故障。
当我使用命令修改了控制文件的路径后,打开数据库仍然出现错误。
alter database rename file '+DISKGP1/antiper/onlinelog/group_1.257.662520073' to '/oracle/oradata/redo01.log';
alter database rename file '+DISKGP1/antiper/onlinelog/group_2.258.662520073' to '/oracle/oradata/redo02.log';
alter database rename file '+DISKGP1/antiper/onlinelog/group_3.259.662520075' to '/oracle/oradata/redo03.log';
alter database rename file '+DISKGP1/antiper/datafile/system.260.662520081' to '/oracle/oradata/system01.dbf';
alter database rename file '+DISKGP1/antiper/datafile/users03.dbf' to '/oracle/oradata/users03.dbf';
alter database rename file '+DISKGP1/antiper/datafile/sysaux.262.662520107' to '/oracle/oradata/sysaux01.dbf';
alter database rename file '+DISKGP1/antiper/datafile/users.264.662520137' to '/oracle/oradata/users01.dbf';
alter database rename file '+DISKGP1/antiper/datafile/undotbs201.dbf' to '/oracle/oradata/undotbs01.dbf';
alter database rename file '+DISKGP1/antiper/datafile/user02.dbf' to '/oracle/oradata/users02.dbf';
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/oracle/oradata/system01.dbf'
----于是我想到了重新建立控制文件吧。哈哈
再次trace控制文件吧
SQL> alter database backup controlfile to trace as '/oracle/aa.txt';
----截取创建控制文件的脚本。
CREATE CONTROLFILE REUSE DATABASE "ANTIPER" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/oradata/redo01.log'  SIZE 50M,
  GROUP 2 '/oracle/oradata/redo02.log'  SIZE 50M,
  GROUP 3 '/oracle/oradata/redo03.log'  SIZE 50M
DATAFILE
  '/oracle/oradata/system01.dbf',
  '/oracle/oradata/users03.dbf',
  '/oracle/oradata/sysaux01.dbf',
  '/oracle/oradata/users01.dbf',
  '/oracle/oradata/undotbs01.dbf',
  '/oracle/oradata/users02.dbf'
CHARACTER SET ZHS16GBK;
执行后出现如下错误:
CREATE CONTROLFILE REUSE DATABASE "ANTIPER" NORESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01565: error in identifying file '/oracle/oradata/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
仔细推敲下是因为日志文件不存在,而使用noresetlogs方式去创建控制文件的时候,会检查日志文件,因此需要使用
noresetlogs的方式去创建控制文件。
CREATE CONTROLFILE REUSE DATABASE "ANTIPER" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/oradata/redo01.log'  SIZE 50M,
  GROUP 2 '/oracle/oradata/redo02.log'  SIZE 50M,
  GROUP 3 '/oracle/oradata/redo03.log'  SIZE 50M
DATAFILE
  '/oracle/oradata/system01.dbf',
  '/oracle/oradata/users03.dbf',
  '/oracle/oradata/sysaux01.dbf',
  '/oracle/oradata/users01.dbf',
  '/oracle/oradata/undotbs01.dbf',
  '/oracle/oradata/users02.dbf'
CHARACTER SET ZHS16GBK;
---显示创建控制文件成功。然后打开数据库
SQL> alter database open resetlogs;
Database altered.
至此本次数据库的故障处理完毕了。
下面我们重新打开数据库的闪回功能。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  146800640 bytes
Fixed Size                  1218196 bytes
Variable Size              75499884 bytes
Database Buffers           67108864 bytes
Redo Buffers                2973696 bytes
Database mounted.
----设置数据库闪回的步骤:
rvwr进程定时将flashback logs写进闪回日志。包含设置参数的先后顺序,需要在mount状态下执行如下脚本。
设置闪回日志顺序:
设置恢复目录
alter system set db_recovery_file_dest=
设置恢复目录大小
alter system set db_recovery_file_dest_size=
设置恢复目录保存时间
alter system set db_flashback_retention=
启用恢复目录
alter database flashback on
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
---因为重新创建过控制文件,因此需要重新增加临时表空间的数据文件
SQL> alter tablespace temp add tempfile '/oracle/oradata/temp01.dbf' size 100M autoextend off;
Tablespace altered。
阅读(1241) | 评论(0) | 转发(0) |
0

上一篇:oracle10g之shrink

下一篇:通过10g OCP了

给主人留下些什么吧!~~