ORACLE数据文件名导致的奇怪问题 (51天)

今天创建了一些表空间,准备做data guard来看看效果。

为了方便起见,我用gridcontrol来做,主库也开了Omf,省去了好多步骤。

一路点下来,就等gc的那个状态变成对号了,结果装了近20分钟,alert日志开始报错。

******************** WARNING *************************** The errors during Server autobackup are not fatal, as it is attempted after sucessful completion of the command. However, it is recomended to take an RMAN control file backup as soon as possible because the Autobackup failed with the following error: ORA-19583: conversation terminated due to error ORA-19914: unable to encrypt backup ORA-28365: wallet is not open 我一看,主库的钱包是没开,然后开了钱包

alter system set encryption wallet open identified by oracle123;

然后行这次应该没问题了吧,第二遍

简单清理了一下,继续

但是过了一会,还是同样的错误,还是大红叉。

Database mounted.
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_4/system01.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_system_88z23chp_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_4/system01.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_4/sysaux01.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_sysaux_88z24s8m_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_4/sysaux01.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_1/tbs01.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_tbs1_88z25q3r_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_1/tbs01.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_2/tbs02.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_tbs1_88z265gd_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_2/tbs02.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_3/tbs03.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_tbs1_88z26o67_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_3/tbs03.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_3/tbs3.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_tbs3_88z274k8_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_3/tbs3.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_4/undotbs2.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_undotbs2_88z27mbc_.dbf'
dgcreate.DGrenameFiles: SELECT STATUS FROM V$DATAFILE WHERE NAME = '/u01/app/oracle/oradata/disk_4/undotbs2.dbf'
dgcreate.DGrenameFiles: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/disk_5/indx.dbf' to '/u01/app/db/oradata/STDBY/datafile/o1_mf_indx_88z282wc_.dbf'
SQL Error: ORA-01511: error in renaming log/data files
ORA-01516: nonexistent log file, datafile, or tempfile "/u01/app/oracle/oradata/disk_5/indx.dbf" (DBD ERROR: OCIStmtExecute)

然后我看到后台再反复重启有关共享服务器的进程,我想是不是也有一定的影响,

我先没关共享。看看这个数据文件先,

来到相应的目录

[oracle@oel1 disk_5]$ cd indx.dbf
bash: cd: indx.dbf: No such file or directory
[oracle@oel1 disk_5]$ ls
indx.dbf   PODD  temp01.dbf  tools.dbf
[oracle@oel1 disk_5]$ ll indx*
-rw-r----- 1 oracle dba 41951232 Oct 30 16:06 indx.dbf 
[oracle@oel1 disk_5]$ ll indx.dbf
ls: indx.dbf: No such file or directory
[oracle@oel1 disk_5]$

奇怪的事情就发生了,我是眼睁睁的看着那个文件,但是就是ll不出来,

我想这还蹊跷,如果是drop tablespace xxx 没有including contents and datafiles cascade constraint 可能数据文件还不会立即删除,会保留相应的句柄,但是这个表空间我没做drop操作啊。

我查了下状态

SQL> select tablespace_name,status from dba_data_files;
TABLESPACE_NAME                STATUS
------------------------------ ---------
TBS3                           AVAILABLE
TBS1                           AVAILABLE
TBS1                           AVAILABLE
TBS1                           AVAILABLE
SYSAUX                         AVAILABLE
SYSTEM                         AVAILABLE
UNDOTBS2                       AVAILABLE
INDX                           AVAILABLE

查看datafile也看不出什么蹊跷。

可能是什么其他的地方吧。

我用如下的sql导处数据文件的状态。

select f.tablespace_name||'|'||f.file_name||'|'||f.autoextensible||'|'||f.bytes/1024/1024||'M' ||'|'|| t.initial_extent||'|'||t.next_extent||'|'||t.extent_management||'|'||t.segment_space_management||'|'||t.bigfile from dba_tablespaces t,dba_data_files f where t.tablespace_name=f.tablespace_name;

结果如下:

TBS1|/u01/app/oracle/oradata/disk_1/tbs01.dbf|NO|5M|1048576|1048576|LOCAL|AUTO|N
O
SYSAUX|/u01/app/oracle/oradata/disk_4/sysaux01.dbf|NO|325M|65536||LOCAL|AUTO|NO
UNDOTBS|/u01/app/oracle/oradata/disk_5/undotbs01.dbf|YES|200M|65536||LOCAL|MANUAL|NO
SYSTEM|/u01/app/oracle/oradata/disk_4/system01.dbf|NO|325M|65536||LOCAL|MANUAL|NO
EXAMPLE|/u01/app/oracle/oradata/disk_5/example.dbf|YES|400M|1048576|1048576|LOCAL|AUTO|NO
INDX|/u01/app/oracle/oradata/disk_5/indx.dbf |NO|40M|65536||LOCAL|AUTO|NO

最后一行的 indx.dbf后面还有个空格,原来是这个文件导致的!!!

我有个好习惯,之前执行的语句都保留了下来,一翻,验证了我的想法。

create tablespace example datafile '/u01/app/oracle/oradata/disk_5/example.dbf' size 400M autoextend on maxsize 4g extent management local uniform. size 1M;
create tablespace indx datafile '/u01/app/oracle/oradata/disk_5/indx.dbf 'size 40M;

接下来该处理这个问题了。

        10--文件号是10
/u01/app/oracle/oradata/disk_5/indx.dbf
SQL> alter database datafile 10 offline;
Database altered.
SQL> alter database rename file '/u01/app/oracle/oradata/disk_5/indx.dbf ' to '/u01/app/oracle/oradata/disk_5/indx.dbf'
  2  ;
alter database rename file '/u01/app/oracle/oradata/disk_5/indx.dbf ' to '/u01/app/oracle/oradata/disk_5/indx.dbf'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01141: error renaming data file 10 - new file
'/u01/app/oracle/oradata/disk_5/indx.dbf' not found
ORA-01110: data file 10: '/u01/app/oracle/oradata/disk_5/indx.dbf '
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

貌似我写的文件空格不够标准???

SQL> select '|'||file_name||'|' from dba_data_files where file_id=10;
'|'||FILE_NAME||'|'
--------------------------------------------------------------------------------
|/u01/app/oracle/oradata/disk_5/indx.dbf |
SQL> alter database rename file '/u01/app/oracle/oradata/disk_5/indx.dbf 'to '/u01/app/oracle/oradata/disk_5/indx.dbf1';
alter database rename file '/u01/app/oracle/oradata/disk_5/indx.dbf 'to '/u01/app/oracle/oradata/disk_5/indx.dbf1'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01141: error renaming data file 10 - new file
'/u01/app/oracle/oradata/disk_5/indx.dbf1' not found
ORA-01110: data file 10: '/u01/app/oracle/oradata/disk_5/indx.dbf '
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

还是不行,晕了,这个问题还真是费劲啊。

这样做,

[oracle@oel1 disk_5]$ ll
total 54856
-rw-r----- 1 oracle dba  5251072 Oct 30 18:01 indx.dbf 
drwxr-x--- 4 oracle dba     4096 Oct 30 10:27 PODD
-rw-r----- 1 oracle dba 20979712 Oct 30 08:34 temp01.dbf
-rw-r----- 1 oracle dba 50339840 Oct 30 18:01 tools.dbf
[oracle@oel1 disk_5]$ mv indx* indx.dbf1

SQL> alter database datafile 10 offline;
Database altered.
SQL> alter database rename file '/u01/app/oracle/oradata/disk_5/indx.dbf ' to '/u01/app/oracle/oradata/disk_5/indx.dbf1'
  2  ;
Database altered.

终于搞定了。

第5遍开始做dg

这次很快。中途抛了几个ORA错误提提神,影响不啊,最后终于看到了一个对号。

查看后台,正常了。

MRP0: Background Managed Standby Recovery process started (STDBY)
Managed Standby Recovery not using Real Time Apply
Media Recovery Waiting for thread 1 sequence 235
Tue Oct 30 17:57:22 2012
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE  THROUGH ALL SWITCHOVER DISCONNECT  NODELAY

原文发布于微信公众号 - 杨建荣的学习笔记(jianrong-notes)

原文发表时间:2014-04-23

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏我和未来有约会

Silverlight第三方控件专题

这里我收集整理了目前网上silverlight第三方控件的专题,若果有所遗漏请告知我一下。 名称 简介 截图 telerik 商 RadC...

4055
来自专栏C#

DotNet加密方式解析--非对称加密

    新年新气象,也希望新年可以挣大钱。不管今年年底会不会跟去年一样,满怀抱负却又壮志未酬。(不过没事,我已为各位卜上一卦,卦象显示各位都能挣钱...)...

4948
来自专栏张善友的专栏

LINQ via C# 系列文章

LINQ via C# Recently I am giving a series of talk on LINQ. the name “LINQ via C...

2665
来自专栏落花落雨不落叶

canvas画简单电路图

64411
来自专栏转载gongluck的CSDN博客

cocos2dx 打灰机

#include "GamePlane.h" #include "PlaneSprite.h" #include "BulletNode.h" #include...

5656
来自专栏hbbliyong

WPF Trigger for IsSelected in a DataTemplate for ListBox items

<DataTemplate DataType="{x:Type vm:HeaderSlugViewModel}"> <vw:HeaderSlug...

4074
来自专栏一个爱瞎折腾的程序猿

sqlserver使用存储过程跟踪SQL

USE [master] GO /****** Object: StoredProcedure [dbo].[sp_perfworkload_trace_s...

2110
来自专栏一个会写诗的程序员的博客

Spring Reactor 项目核心库Reactor Core

Non-Blocking Reactive Streams Foundation for the JVM both implementing a Reactiv...

2222
来自专栏张善友的专栏

Silverlight + Model-View-ViewModel (MVVM)

     早在2005年,John Gossman写了一篇关于Model-View-ViewModel模式的博文,这种模式被他所在的微软的项目组用来创建Expr...

3008
来自专栏闻道于事

js登录滑动验证,不滑动无法登陆

js的判断这里是根据滑块的位置进行判断,应该是用一个flag判断 <%@ page language="java" contentType="text/html...

7068

扫码关注云+社区