一个表空间offline后alert日志报ORA-01135 和ORA-01110的问题

本文通过实验展示了在Oracle 11g中将表空间设置为离线后,系统如何持续生成错误日志,并提供了相应的解决办法。通过设置特定事件追踪错误来源,最终确定离线的数据文件。

本文是原创文章,转载请注明出处:http://blog.csdn.net/msdnchina/article/details/44336789

最近遇到一个案例,是将一个表空间offline之后,alert日志中不断的报错,最初该报错是在11.2.0.2被发现的。后来我在11.2.0.4的linux x86-64 bit下试验了一下,也发现了相同的现象。
如下是我的实验步骤:

[oracle@rhel63single ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 13 09:11:24 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$dbfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/users01.dbf
/u01/app/oracle/oradata/test/undotbs01.dbf
/u01/app/oracle/oradata/test/sysaux01.dbf
/u01/app/oracle/oradata/test/system01.dbf
/u01/app/oracle/oradata/test/ten01.dbf
/u01/app/oracle/oradata/test/tb_test_01.dbf
/u01/app/oracle/oradata/test/ts1.dbf
/u01/app/oracle/oradata/test/ts2.dbf
/u01/app/oracle/oradata/test/test01.dbf
/u01/app/oracle/oradata/test/test_uni_sz_2m_01.dbf
/u01/app/oracle/oradata/test/test_uni_sz_1m_01.dbf

11 rows selected.

SQL> create tablespace testtbs datafile '/u01/app/oracle/oradata/test/test.dbf' size 10M;

Tablespace created.

SQL> create table testtab tablespace testtbs as select * from dual;

Table created.

SQL> select * from testtab;

D
-
X

SQL> alter database datafile '/u01/app/oracle/oradata/test/test.dbf' offline;

Database altered.

SQL> select * from testtab;
select * from testtab
              *
ERROR at line 1:
ORA-00376: file 12 cannot be read at this time
ORA-01110: data file 12: '/u01/app/oracle/oradata/test/test.dbf'


SQL> ! date
Fri Mar 13 09:17:12 CST 2015

SQL> 


 


从alert日志中看到:

Fri Mar 13 09:15:38 2015
create tablespace test datafile '/u01/app/oracle/oradata/test/test.dbf' size 10M
ORA-1543 signalled during: create tablespace test datafile '/u01/app/oracle/oradata/test/test.dbf' size 10M...
Fri Mar 13 09:15:57 2015
create tablespace testtbs datafile '/u01/app/oracle/oradata/test/test.dbf' size 10M
Completed: create tablespace testtbs datafile '/u01/app/oracle/oradata/test/test.dbf' size 10M
Fri Mar 13 09:16:46 2015
alter database datafile '/u01/app/oracle/oradata/test/test.dbf' offline
Completed: alter database datafile '/u01/app/oracle/oradata/test/test.dbf' offline
Fri Mar 13 09:17:01 2015
Checker run found 1 new persistent data failures
Fri Mar 13 09:20:28 2015
Errors in file /u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3186.trc:
ORA-01135: file 12 accessed for DML/query is offline
ORA-01110: data file 12: '/u01/app/oracle/oradata/test/test.dbf'
Fri Mar 13 09:30:29 2015
Errors in file /u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3217.trc:
ORA-01135: file 12 accessed for DML/query is offline
ORA-01110: data file 12: '/u01/app/oracle/oradata/test/test.dbf'
Fri Mar 13 09:40:30 2015
Errors in file /u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3250.trc:
ORA-01135: file 12 accessed for DML/query is offline
ORA-01110: data file 12: '/u01/app/oracle/oradata/test/test.dbf'


 

查看/u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3250.trc文件的内容如下:

[oracle@rhel63single trace]$ cat /u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3250.trc
Trace file /u01/app/oracle/diag/rdbms/test/test/trace/test_m000_3250.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u02/app/oracle/product/11.2.0.4/db_1
System name:    Linux
Node name:      rhel63single
Release:        2.6.32-279.el6.x86_64
Version:        #1 SMP Wed Jun 13 18:24:36 EDT 2012
Machine:        x86_64
VM name:        VMWare Version: 6
Instance name: test
Redo thread mounted by this instance: 1
Oracle process number: 22
Unix process pid: 3250, image: oracle@rhel63single (M000)


*** 2015-03-13 09:40:30.195
*** SESSION ID:(130.7) 2015-03-13 09:40:30.195
*** CLIENT ID:() 2015-03-13 09:40:30.195
*** SERVICE NAME:(SYS$BACKGROUND) 2015-03-13 09:40:30.195
*** MODULE NAME:(MMON_SLAVE) 2015-03-13 09:40:30.195
*** ACTION NAME:(Monitor Tablespace Thresholds) 2015-03-13 09:40:30.195
 
DDE rules only execution for: ORA 1110
----- START Event Driven Actions Dump ----
---- END Event Driven Actions Dump ----
----- START DDE Actions Dump -----
Executing SYNC actions
----- START DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (Async) -----
Successfully dispatched
----- END DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (SUCCESS, 0 csec) -----
Executing ASYNC actions
----- END DDE Actions Dump (total 0 csec) -----
ORA-01135: file 12 accessed for DML/query is offline
ORA-01110: data file 12: '/u01/app/oracle/oradata/test/test.dbf'
[oracle@rhel63single trace]$ 


 

后来在mos中搜索了一下:
Getting Trace Files With DB_STRUCTURE_INTEGRITY_CHECK And An ORA-01110. (文档 ID 1252614.1)
该文章与本现象相符。

该文章给出原因是:

These files are generated by the Health Check Monitor and specifically, the DB Structure Integrity Check.


http://docs.oracle.com/cd/B28359_01/server.111/b28310/diag007.htm#ADMIN11269
这个hcm(health check monitor)是从11.1就有的。

 

如下来自:Checker Run Found xx New Persistent Data Failures. (文档 ID 1391202.1)

By default the database runs the Health Check on a regular basis.During the course of these health check executions if any failures are detected then these kind of messages are logged to the alert log.

Health Monitor checks (also known as checkers, health checks, or checks) examine various layers and components of the database. Health checks detect file corruptions, physical and logical block corruptions, undo and redo corruptions, data dictionary corruptions, and more. The health checks generate reports of their findings and, in many cases, recommendations for resolving problems.


拓展一下:与health check相关的视图(其实是synonym)有:

V$HM_CHECK
V$HM_CHECK_PARAM
V$HM_FINDING
V$HM_INFO
V$HM_RECOMMENDATION
V$HM_RUN

以上视图的查询结果可以用到客户db的巡检中。

 

解决方案见下:

 

Solution

 The ORA-01110 is not seen in the alert log, but if you set an Error Stack for it, you would see it. So, we need to set an Error Stack for the ORA-01110 to get the name of the offline data file.

 1) Set the following event and check the alert log for occurrence of the ORA-01110.
      SQL> connect / as sysdba
      SQL> alter system set events '1110 trace name errorstack level 3';

 2) If the trace files are still being generated, then once a file is created, the ORA-01110 should now be seen 
      in the alert log. When you capture it, disable the tracing:
      SQL> connect / as sysdba
      SQL> alter system set events '1110 trace name errorstack off';

 3. The ORA-01110 in the alert log seen, should give the name of the data file that's offline.

 4. Please switch that data file/ table space status to online, and that should avoid the traces.

 5. If the table space/ data file is set to offline for a reason, then the traces are expected and should be of no 
      concern.

 Note that you can also use below query to find offline data files. The point from above steps is to get the data file triggering the error:
  
 SQL> connect / as sysdba
 SQL> column file_name format a40;
 SQL> column tablespace_name format a12;
 SQL> select file_name,file_id,tablespace_name,online_status from dba_data_files order by 
             tablespace_name, file_id;


Even when the temp file is offline, ORA-01110 is seen in alert log or trace file. Run the sql to check temp files and online or drop it.


SQL>select file_name, tablespace_name, status from dba_temp_files order by file_name;


 

 

<think>好的,我需要帮用户解决ORA-01511错误,特别是关于重命名日志或数据文件时的解决方案。首先,我应该回忆一下ORA-01511错误的基本信息。这个错误通常与重命名或管理数据库的日志文件或数据文件有关,可能是在执行ALTER DATABASE RENAME FILE命令时出现的。用户之前提到过ORA-01578ORA-26040,但这次的问题不同,需要专注于ORA-01511。 接下来,我需要确认错误的具体原因。ORA-01511的错误代码通常表示在重命名文件时,数据库无法更新控制文件中的文件信息。可能的原因包括:文件不存在、权限问题、文件正在被使用,或者操作步骤不正确。 根据Oracle的文档,重命名数据文件或日志文件需要特定的步骤。通常,用户需要将数据库启动到MOUNT状态,而不是OPEN状态,否则无法修改控制文件。此外,物理文件必须已经存在于目标路径,并且Oracle进程(如DBWn或LGWR)必须有权限访问新位置。 可能用户在执行ALTER DATABASE RENAME FILE时,数据库仍处于OPEN状态,导致无法修改控制文件,从而触发ORA-01511。另外,检查操作系统级别的文件是否存在,权限是否正确也很重要。例如,Linux/Unix上的权限问题或Windows上的共享锁定可能导致文件无法访问。 解决方案方面,标准步骤应该是:关闭数据库,启动到MOUNT状态,执行重命名命令,然后打开数据库。但用户可能需要在线操作,所以可能需要分情况处理,比如对于日志文件,可能需要先重新创建日志组,然后删除旧的;对于数据文件,可能需要将表空间脱机后进行重命名。 另外,需要注意在RAC环境中,所有实例都必须关闭,否则会有实例仍在使用文件,导致重命名失败。同时,确保在重命名后,备份控制文件spfile,以防止后续问题。 用户可能遇到的另一个问题是,在重命名过程中,如果文件路径错误或文件不存在,也会导致错误。因此,验证源文件目标文件的路径是否正确,以及Oracle用户是否有足够的权限访问这些路径是必要的步骤。 最后,应该提醒用户在进行任何结构修改前备份数据库,避免数据丢失。同时,引用相关的Oracle文档或可靠的资源来支持解决方案的正确性,比如官方文档或认证的博客文章。例如,用户提供的引用[2]虽然涉及NOLOGGING操作,但可能部分步骤类似,但需要确保引用的准确性。 总结来说,解决ORA-01511的步骤应包括检查数据库状态,确保正确操作步骤,验证文件存在权限,处理在线或离线情况,并在操作前后进行必要的备份。同时,根据具体情况可能需要不同的处理方法,比如数据文件日志文件的不同操作流程。</think>### ORA-01511错误解决方案:重命名日志或数据文件 ORA-01511错误通常发生在尝试通过`ALTER DATABASE RENAME FILE`命令修改数据库文件路径时,**控制文件未能正确更新文件信息**。以下是分步解决方案: --- #### **1. 检查数据库状态与文件路径** - **错误场景**: 若数据库处于`OPEN`状态时执行重命名操作,会因文件被活跃进程占用而失败[^1]。 - **解决方法**: ```sql -- 关闭数据库并启动到MOUNT状态 SHUTDOWN IMMEDIATE; STARTUP MOUNT; ``` --- #### **2. 执行文件重命名操作** - **对于数据文件**: ```sql ALTER DATABASE RENAME FILE '/old/path/datafile01.dbf' TO '/new/path/datafile01.dbf'; ``` - **对于日志文件**: ```sql ALTER DATABASE RENAME FILE '/old/path/redo01.log' TO '/new/path/redo01.log'; ``` **注意**: - 目标文件必须已物理存在且路径正确。 - Oracle用户需有目标目录的读写权限(如Linux中`chown`或`chmod`)[^1]。 --- #### **3. 处理在线重命名(特定场景)** - **表空间脱机法(数据文件)**: ```sql ALTER TABLESPACE users OFFLINE; -- 手动复制文件到新路径(操作系统命令) ALTER TABLESPACE users RENAME DATAFILE '/old/path/users01.dbf' TO '/new/path/users01.dbf'; ALTER TABLESPACE users ONLINE; ``` - **重建日志组(日志文件)**: ```sql ALTER DATABASE DROP LOGFILE GROUP 1; ALTER DATABASE ADD LOGFILE GROUP 1 ('/new/path/redo01.log') SIZE 100M; ``` --- #### **4. 验证与恢复** - 重命名后执行: ```sql ALTER DATABASE OPEN; ``` - 检查告警日志(`alert_<SID>.log`)确认无残留错误。 - 若操作中断导致数据库无法启动,需通过备份恢复控制文件或使用`RECOVER DATABASE`命令[^2]。 --- #### **关键注意事项** 1. **RAC环境**:所有实例必须关闭,仅保留一个实例执行操作。 2. **ASM存储**:使用`ALTER DISKGROUP`移动文件,而非直接重命名路径。 3. **备份控制文件**: ```sql ALTER DATABASE BACKUP CONTROLFILE TO TRACE; ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值