alert日志报错信息:
[oracle@hd04 trace]$ cat alert_db12c.log |grep "corrupt" -A 2 -B 2|more
Hex dump of (file 11, block 704337) in trace file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_p006_20208.trc
Reading datafile '/app/oracle/oradata/orcl/db12cpdb/undotbs01.dbf' for corruption at rdba: 0x024abf51 (file 11, block 704337)
2019-08-22T15:30:39.594783+08:00
Hex dump of (file 3, block 97921) in trace file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_p004_20204.trc
Reading datafile '/app/oracle/oradata/orcl/sysaux01.dbf' for corruption at rdba: 0x00c17e81 (file 3, block 97921)
Reread (file 3, block 97921) found same corrupt data (logically corrupt)
2019-08-22T15:30:39.614714+08:00
Reread (file 11, block 704337) found same corrupt data (logically corrupt)
2019-08-22T15:30:39.637609+08:00
*****************************************************************
--
2019-08-22T15:30:48.232309+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_p003_20202.trc (incident=146194) (PDBNAME=CDB$ROOT):
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-10564: tablespace SYSAUX
--
2019-08-22T15:30:49.761279+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_p003_20202.trc:
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-10564: tablespace SYSAUX
--
2019-08-22T15:30:54.735880+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_ora_20194.trc (incident=146162) (PDBNAME=CDB$ROOT):
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-10564: tablespace SYSAUX
--
2019-08-22T15:30:56.296743+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_ora_20194.trc:
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-10564: tablespace SYSAUX
--
Hex dump of (file 3, block 97921) in trace file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_ora_20194.trc
Reading datafile '/app/oracle/oradata/orcl/sysaux01.dbf' for corruption at rdba: 0x00c17e81 (file 3, block 97921)
Reread (file 3, block 97921) found same corrupt data (logically corrupt)
*****************************************************************
An internal routine has requested a dump of selected redo.
--
2019-08-22T15:35:00.962427+08:00
Completed redo application of 0.96MB
Reading datafile '/app/oracle/oradata/orcl/sysaux01.dbf' for corruption at rdba: 0x00c17e81 (file 3, block 97921)
Reread (file 3, block 97921) found same corrupt data (logically corrupt)
*****************************************************************
1.查询Oracle坏块方法
set lines 120
select * from v$database_block_corruption;
[oracle@hd04 trace]$ sqlplus / as sysdba'
SQL*Plus: Release 12.2.0.1.0 Production on Sat Sep 18 14:45:29 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO CON_ID
---------- ---------- ---------- ------------------ --------- ----------
3 60630 1 115606079 CORRUPT 1
SQL>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
2.分析Oracle坏块对应的对象内容
执行如下命令:
set pagesize 2000
set linesize 250
col OWNER for a15
col SEGMENT_NAME for a25
col PARTITION_NAME for a25
SELECT e.owner,
e.segment_type,
e.segment_name,
e.partition_name,
c.file#,
greatest(e.block_id, c.block#) corr_start_block#,
least(e.block_id + e.blocks - 1, c.block# + c.blocks - 1) corr_end_block#,
least(e.block_id + e.blocks - 1, c.block# + c.blocks - 1) -
greatest(e.block_id, c.block#) + 1 blocks_corrupted,
null description
FROM dba_extents e, v$database_block_corruption c
WHERE e.file_id = c.file#
AND e.block_id <= c.block# + c.blocks - 1
AND e.block_id + e.blocks - 1 >= c.block#
UNION
SELECT s.owner,
s.segment_type,
s.segment_name,
s.partition_name,
c.file#,
header_block corr_start_block#,
header_block corr_end_block#,
1 blocks_corrupted,
'Segment Header' description
FROM dba_segments s, v$database_block_corruption c
WHERE s.header_file = c.file#
AND s.header_block between c.block# and c.block# + c.blocks - 1
UNION
SELECT null owner,
null segment_type,
null segment_name,
null partition_name,
c.file#,
greatest(f.block_id, c.block#) corr_start_block#,
least(f.block_id + f.blocks - 1, c.block# + c.blocks - 1) corr_end_block#,
least(f.block_id + f.blocks - 1, c.block# + c.blocks - 1) -
greatest(f.block_id, c.block#) + 1 blocks_corrupted,
'Free Block' description
FROM dba_free_space f, v$database_block_corruption c
WHERE f.file_id = c.file#
AND f.block_id <= c.block# + c.blocks - 1
AND f.block_id + f.blocks - 1 >= c.block#
order by file#, corr_start_block#;
结果:
3.查看创建索引语句。
查看创建索引语句:
set linesize 200
set pagesize 200
set long 999999
select dbms_metadata.get_ddl('INDEX','SMON_SCN_TIME_TIM_IDX') from dual;
4.重建索引
mark一下,不建议使用rebuild online选项。
alter index "SYS"."SMON_SCN_TIME_TIM_IDX" rebuild ;
analyze index "SYS"."SMON_SCN_TIME_TIM_IDX" validate structure;
select * from v$database_block_corruption;
5.再次查看alert 日志,不再报错。
2021-09-18T14:59:56.023510+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_smon_17951.trc (incident=587538) (PDBNAME=CDB$ROOT):
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
2021-09-18T14:59:56.031705+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_smon_17951.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
2021-09-18T15:04:29.724393+08:00
--
2021-09-18T15:05:06.491927+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_smon_17951.trc (incident=587539) (PDBNAME=CDB$ROOT):
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
2021-09-18T15:05:06.495228+08:00
Errors in file /app/oracle/diag/rdbms/orcl/db12c/trace/db12c_smon_17951.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 3, block # 60630)
ORA-01110: data file 3: '/app/oracle/oradata/orcl/sysaux01.dbf'
2021-09-18T15:05:28.860120+08:00
[oracle@hd04 trace]$ date
Sat Sep 18 15:24:34 CST 2021
[oracle@hd04 trace]$
版权声明:本文为CSDN博主「qyq88888」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qyq88888/article/details/120385424
1. 根据表名,查询一张表的索引
select * from user_indexes where table_name=upper('表名');
2. 根据索引号,查询表索引字段
select * from user_ind_columns where index_name=('索引名');
3.根据索引名,查询创建索引的语句
select dbms_metadata.get_ddl('INDEX','索引名', ['用户名']) from dual ; --['用户名']可省,默认为登录用户
PS:dbms_metadata.get_ddl还可以得到建表语句,如:
SELECT DBMS_METADATA.GET_DDL('TABLE','表名', ['用户名']) FROM DUAL ; //取单个表的建表语句,['用户名']可不输入,默认为登录用户SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) FROM USER_TABLES u; //取用户下所有表的建表语句
当然,也可以用pl/sql developer工具来查看相关的表的各种信息。
参考技术A可以查看数据字典 dba_indexes all_indexes user_indexes 来查看索引这三个字典都可以查到执行查询的当前用户的索引信息,不同的是查询范围依次减少 user_indexes 只能看到当前用户的索引对象,还可以结合dba_ind_columns(all_\user_)视图来查看更详细的信息参考技术B如果不太熟悉oracle,建议使用工具软件,如pl/sql developer,连接以后,选择查看索引对象。参考技术C你也可以查看EM,在Administration中Schema对象中Database Objects下有个Indexes,里面是各用户表的索引信息,很全很清晰的。参考技术Dselect * from all_objects where object_type='INDEX' AND OWNER='SCOTT';OR
SELECT * from all_indexes;
怎么查看索引oracle,建索引
参考技术A一、查看和建立索引
select * from user_indexes where table_name = 'student'
create index i_student_num on student(num)
二、使用索引的注意点
①类型匹配
若student中num列是varchar类型,语句select * from student where num = 100
该语句被转化为select * from student where to_number(num) = 100,该列的索引就失效了。
②避免索引列参与计算
索引失效:select * from student where num * 10 > 10000
索引有效:select * from student where num > 10000 / 10
③不要对索引列使用IS NULL或IS NOT NULL
原则上对某一个列建立索引的时候,该列就不应该允许为空。
索引失效:select * from student where num is null
以上是关于oracle数据库中如何查看已经创建的索引信息?的主要内容,如果未能解决你的问题,请参考以下文章
在oracle中如何查询一张表的所有数据结构,包括字段,视图,索引,约束
标签:app,db12c,索引,file,oracle,block,重建 From: https://www.cnblogs.com/redarmy/p/17680153.html