数据库不一致也能打开

[复制链接]
查看11 | 回复9 | 2005-11-1 10:49:02 | 显示全部楼层 |阅读模式
使用rman copy system表空间后,在sqlplus 中 建表 ,shutdown abort 关闭后 拷贝备份的数据文件覆盖。
发现此时数据库不需要recover 但刚刚创建的表查询不到,但可以drop 掉。
O:\>sqlplus "sys/pass as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Oct 27 15:55:50 2008
Copyright (c) 1982, 2006, Oracle.All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> create table cj as select * from dualDisconnected from Oracle Database 10g
Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
O:\>
O:\>rman target sys/pass
Recovery Manager: Release 10.2.0.3.0 - Production on Mon Oct 27 15:56:06 2008
Copyright (c) 1982, 2005, Oracle.All rights reserved.
connected to target database: CJ (DBID=819428294)
RMAN> copy datafile 1 to 'F:\oracle\product\10.2.0\oradata\SYSTEM01.DBF';
Starting backup at 27-OCT-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=F:\ORACLE\PRODUCT\10.2.0\ORADATA\CJ\SYSTEM01.DBF
output filename=F:\ORACLE\PRODUCT\10.2.0\ORADATA\SYSTEM01.DBF tag=TAG20081027T15
5616 recid=18 stamp=669225396
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
Finished backup at 27-OCT-08
RMAN> exit

Recovery Manager complete.
O:\>sqlplus "sys/pass as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Oct 27 15:56:49 2008
Copyright (c) 1982, 2006, Oracle.All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> create table aa as select * from dual;
Table created.
SQL> shutdown abort
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options

O:\>copy F:\oracle\product\10.2.0\oradata\SYSTEM01.DBF F:\oracle\product\10.2.0\
oradata\CJ
Overwrite F:\oracle\product\10.2.0\oradata\CJ\SYSTEM01.DBF? (Yes/No/All): Y
1 file(s) copied.
O:\>sqlplus "sys/pass as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Mon Oct 27 15:58:29 2008
Copyright (c) 1982, 2006, Oracle.All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area289406976 bytes
Fixed Size
1290184 bytes
Variable Size
234881080 bytes
Database Buffers 46137344 bytes
Redo Buffers
7098368 bytes
Database mounted.
Database opened.
SQL> select *From aa;
select *From aa

*
ERROR at line 1:
ORA-08103: object no longer exists

SQL>
SQL> drop table aa;
Table dropped.
SQL>
[ 本帖最后由 ignu 于 2008-10-27 16:20 编辑 ]
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
帮看看是不是哪一步有问题
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
表空间是offline的吗?
select file#,checkpoint_chang# from v$datafile;
这个如果不一致,才说明问题
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
在其它表空间创建表试试。
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
不是不一致,而是你打开数据库时,系统利用日志自动进行了恢复?
因为shutdown abort可能使aa处于一种异常状态:即元数据在数据库中存在,但无法查询。
可能是因为ddl自动提交,所以导致aa在abort后某些元数据已经保存在数据库里。
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
ORA-08103 object no longer exists
Cause: The object has been deleted by another user since the operation began.
Action: Remove references to the object.
再设想一下,drop里的aa和查询的aa引用的并非完全一样的数据库object?
以上仅是瞎猜,未经验证,呵呵。
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
原帖由 oldv 于 2008-10-28 11:39 发表
不是不一致,而是你打开数据库时,系统利用日志自动进行了恢复?
因为shutdown abort可能使aa处于一种异常状态:即元数据在数据库中存在,但无法查询。
可能是因为ddl自动提交,所以导致aa在abort后某些元数据已经保存在数据库里。


如果我在之前switch logfile了那么就需要recover了。但是这个试验数据库确实有问题啊。提下SR问问


回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
这样恢复出来的system表空间有问题。
需要遵循rman的规则,在rman中备的还要用rman中恢复。
SQL> CREATE TABLE aa112 NOLOGGING TABLESPACE SYSTEMAS SELECT * FROM Dba_Objects
2;
CREATE TABLE aa112 NOLOGGING TABLESPACE SYSTEMAS SELECT * FROM Dba_Objects

*
ERROR at line 1:
ORA-01114: IO error writing block to file 1 (block # 69129)
ORA-27069: attempt to do I/O beyond the range of the file
OSD-04026: Invalid parameter passed. (OS 69144)
ORA-01114: IO error writing block to file 1 (block # 69129)
ORA-27069: attempt to do I/O beyond the range of the file
OSD-04026: Invalid parameter passed. (OS 69144)
ORA-01114: IO error writing block to file 1 (block # 69129)
ORA-27069: attempt to do I/O beyond the range of the file
OSD-04026: Invalid parameter passed. (OS 69144)

SQL>
[ 本帖最后由 ignu 于 2008-11-12 11:18 编辑 ]
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
学习了
回复

使用道具 举报

千问 | 2005-11-1 10:49:02 | 显示全部楼层
alter system switch logfile;
多执行几次,然后shutdown,然后再复制回来
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行