【案例】ORA-01157 ORA-01110 ORA-06512: at "WMSYS.WM_CONCAT_IMPL", line 31

 

数据库版本:Oracle11.2.0.4

架构:2节点RAC、单实例DG

问题描述:在RAC节点新增视图,可进行正常查询;但是在DG库查询视图是报错:

查询DG状态是正常的,但是执行SQL的时候报出ORA-06512

SQL>
SQL> select count(*) from prod.VIEW_BI;
select count(*) from prod.VIEW_BI
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+DATA'
ORA-06512: at "WMSYS.WM_CONCAT_IMPL", line 31

分析问题:

主库信息:

SYS@orcl1>select FILE_ID,FILE_NAME from dba_data_files;

FILE_ID共计41

SYS@orcl1> show parameter convert

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string /u01/app/oracle/oradata/orcl/,+DATA/orcl/datafile/
log_file_name_convert string /u01/app/oracle/archivelog/, +FRA/orcl/onlinelog/, /u01/app/oracle/archivelog/, +DATA/orcl/onlinelog/

SYS@orcl1> select * from v$controlfile;

STATUS NAME IS_ BLOCK_SIZE FILE_SIZE_BLKS
------- ---------------------------------------------------------------------- --- ---------- --------------
+DATA/orcl/controlfile/current.258.1038497671 NO 16384 2330
+FRA/orcl/controlfile/current.256.1038497671 YES 16384 2330

SYS@orcl1> select name from v$tempfile;

NAME
----------------------------------------------------------------------
+DATA/orcl/tempfile/temp.264.1038497679
+DATA/orcl/tempfile/temp_interface01.dbf

备库信息:

SYS@orcl1> select name from v$tempfile;

NAME
----------------------------------------------------------------------

+DATA

+DATA/orcl/tempfile/temp.264.1038497679
+DATA/orcl/tempfile/temp_interface01.dbf

备库在执行SELECT查询的时候,排序会占用临时表空间,所以报出ORA-01157  ORA-01110  ORA-06512

处理方式:

对Oracle RAC、DG新增控制文件、临时表空间数据文件的目录转换关系
SYS@orcl1> alter system set db_file_name_convert='/u01/app/oracle/oradata/orcl/','+DATA/orcl/datafile/','/u01/app/oracle/oradata/orcl/','+FRA/orcl/onlinelog/','+DATA/orcl/tempfile/','/u01/app/oracle/oradata/orcl/' scope=spfile;

System altered.

而在RAC两个节点修改db_file_name_convert参数之后,需要重启数据库,否则如果采用依次重启实例的话,两个节点参数不一致,实例不能启动。

 

!!!!线上环境,不能重启主库,如何处理?

只在备库操作:

1、修改db_file_name_convert

SYS@orcldg> alter system set db_file_name_convert='/u01/app/oracle/oradata/orcl/','+DATA/orcl/datafile/','/u01/app/oracle/oradata/orcl/','+FRA/orcl/onlinelog/','+DATA/orcl/tempfile/','/u01/app/oracle/oradata/orcl/' scope=spfile;

System altered.

重启备库,使得参数生效 。

2、备库为read only,不能新增表空间,可以在原数据库临时表空间基础上,新增数据文件

 

ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/tempfile/temp1.dbf' size 1g autoextend on ;

 

SQL> 
SQL> select count(*) from prod.VIEW_BI;

SQL> 20200321

 

 

 

 

 

 

 

posted on 2020-07-17 15:13  HelonTian  阅读(956)  评论(0编辑  收藏  举报