欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle非归档模式Media Recovery错误之--ORA-26040

程序员文章站 2024-01-21 18:44:46
...

Oracle非归档模式MediaRecovery错误之--ORA-26040系统环境:操作系统:LinuxRH55Oracle:Oracle11gR2模拟案例:1、查看数据库模式18:12:36SYS@prodarchiveloglis

Oracle非归档模式Media Recovery错误之--ORA-26040

系统环境:

操作系统:Linux RH55

Oracle: Oracle 11gR2

模拟案例:

1、查看数据库模式

18:12:36 SYS@ prod>archive log list;

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination /dsk4/arch1

Oldest online log sequence 1

Current log sequence 3

2、创建新的Tablespace

18:13:19 SYS@ prod>create tablespace tbs2 18:13:30 2 datafile '/u01/app/oracle/oradata/prod/tbs2.dbf' size 10m; Tablespace created.

3、对数据库进行冷备

[oracle@rh6 ~]$ rman target / Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 24 18:14:30 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (DBID=239333010) RMAN> run { 2> shutdown immediate; 3> startup mount; 4> backup database format '/dsk3/bak/%s_%d.bak'; 5> alter database open; 6> }

4、备份完成在新的Tablesapce上创建Object

18:19:40 SYS@ prod>conn scott/tiger Connected. 18:30:13 SCOTT@ prod>create table t1 tablespace tbs2 as select * from emp; Table created. Elapsed: 00:00:01.00 18:30:45 SCOTT@ prod>select count(*) from t1; COUNT(*) ---------- 14 Elapsed: 00:00:00.02 18:30:56 SCOTT@ prod>insert into t1 select * from t1 where rownum=1; 1 row created. Elapsed: 00:00:00.02 18:31:16 SCOTT@ prod>commit; Commit complete. Elapsed: 00:00:00.04 18:31:18 SCOTT@ prod>insert into t1 select * from t1 where rownum=1; 1 row created. Elapsed: 00:00:00.01 18:31:23 SCOTT@ prod>select count(*) from t1; COUNT(*) ---------- 16

5、查看Redo Log信息

18:32:14 SYS@ prod>select group#,sequence# ,status from v$log; GROUP# SEQUENCE# STATUS ---------- ---------- ---------------- 1 4 CURRENT 2 2 INACTIVE 3 3 INACTIVE Elapsed: 00:00:00.05

6、模拟数据文件被破坏

[oracle@rh6 ~]$ rm /u01/app/oracle/oradata/prod/tbs2.dbf

18:32:28 SYS@ prod>shutdown abort

ORACLE instance shut down.

重新启动Instance到mount,查看redo log,日志没有发生switch

18:33:06 SYS@ prod>startup mount; ORACLE instance started. Total System Global Area 835104768 bytes Fixed Size 2217952 bytes Variable Size 775948320 bytes Database Buffers 54525952 bytes Redo Buffers 2412544 bytes Database mounted. 18:33:42 SYS@ prod>select group#,sequence# ,status from v$log; GROUP# SEQUENCE# STATUS ---------- ---------- ---------------- 1 4 CURRENT 3 3 INACTIVE 2 2 INACTIVE

Open database出现数据文件丢失错误:

18:34:17 SYS@ prod>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: '/u01/app/oracle/oradata/prod/tbs2.dbf'