ORA-1157处理过程

三节点的rac环境。

asm磁盘组为+DATA5

由于运维人员疏忽,在加表空间时,少写了一个加号,表空间创建的位置变为$ORACLE_HOME/dbs,使用12c新特性在线移动数据文件,将数据文件移动至asm磁盘组,

2-3节点访问表空间出现ora-1157错误,一节点正常。

解决思路:

将表空间内对象移至其他表空间,删除该表空间。

 

SQL> l
1* select OWNER,SEGMENT_NAME,PARTITION_NAME from dba_extents where FILE_ID=4769
SQL> /

OWNER SEGMENT_NAME PARTITION_NAME
---------------------------------------- ---------------------------------------- ----------------------------------------
DSM IDX_Q_COMPRE_IND_D_DD
DSM IDX_Q_COMPRE_IND_D_DD
DSM IDX_Q_COMPRE_IND_D_DD

 

SQL> alter index DSM.IDX_Q_COMPRE_IND_D_DD rebuild tablespace DSM_STATS_IDX_2020 online;

Index altered.

SQL>
SQL>
SQL> select count(*) from dba_extents where file_id=4769;

COUNT(*)
----------
0

执行删除表空间语句

SQL> drop tablespace DSM_STATS_IDX including contents and datafiles;
drop tablespace DSM_STATS_IDX including contents and datafiles
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-02429: cannot drop index used for enforcement of unique/primary key

 

存在主键不能删除(延迟段分配,db_extends查询不到信息,分别查询dba_tables和dba_indexes视图确定对象)。

SQL> select count(*) from dba_indexes where tablespace_name='DSM_STATS_IDX';

COUNT(*)
----------
2

 

SQL> select 'alter index '||owner||'.'||index_name||' rebuild online tablespace DSM_STATS_IDX_2020 ;' from dba_indexes where tablespace_name='DSM_STATS_IDX';

'ALTERINDEX'||OWNER||'.'||INDEX_NAME||'REBUILDONLINETABLESPACEDSM_STATS_IDX_2020;'
----------------------------------------------------------------------------------------------------
alter index DSM.PK_M_TASK_SET rebuild online tablespace DSM_STATS_IDX_2020 ;
alter index DSM.PK_M_TASK_REC rebuild online tablespace DSM_STATS_IDX_2020 ;

 

(删除成功)

 SQL> drop tablespace DSM_STATS_IDX including contents and datafiles;

重建表空间

SQL> create tablespace DSM_STATS_IDX datafile '+DG5' size 1g autoextend on next 1g;

Tablespace created.

posted @ 2020-06-16 09:38  阿西吧li  阅读(359)  评论(0编辑  收藏  举报