查询坏块 SQL set lines 120SQL select * from v$database_block_corruption; FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO ---------- ---------- ---------- ------------------ --------- 3 35418 1 0 FRACTURED 3 61344 1 0 FRACTURED 3 31065 1 0
查询坏块
SQL> set lines 120 SQL> select * from v$database_block_corruption; FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO ---------- ---------- ---------- ------------------ --------- 3 35418 1 0 FRACTURED 3 61344 1 0 FRACTURED 3 31065 1 0 CORRUPT 3 36673 1 0 CORRUPT 3 36721 1 0 CORRUPT 3 42881 1 0 CORRUPT 1 66738 1 0 CORRUPT 3 36329 1 0 CORRUPT 3 36617 1 0 CORRUPT 3 32404 1 0 FRACTURED 3 36281 1 0 FRACTURED FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO ---------- ---------- ---------- ------------------ --------- 3 36625 1 0 FRACTURED 1 39041 1 0 CORRUPT 3 36713 1 0 CORRUPT 10 69927 1 0 FRACTURED 26 94244 1 0 CORRUPT 已选择16行。
查询坏块对应对象
SQL> set pagesize 2000 SQL> set linesize 250 SQL> SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file# 2 , greatest(e.block_id, c.block#) corr_start_block# 3 , least(e.block_id+e.blocks-1, c.block#+c.blocks-1) corr_end_block# 4 , least(e.block_id+e.blocks-1, c.block#+c.blocks-1) 5 - greatest(e.block_id, c.block#) + 1 blocks_corrupted 6 , null description 7 FROM dba_extents e, v$database_block_corruption c 8 WHERE e.file_id = c.file# 9 AND e.block_id = c.block# 11 UNION 12 SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file# 13 , header_block corr_start_block# 14 , header_block corr_end_block# 15 , 1 blocks_corrupted 16 , 'Segment Header' description 17 FROM dba_segments s, v$database_block_corruption c 18 WHERE s.header_file = c.file# 19 AND s.header_block between c.block# and c.block# + c.blocks - 1 20 UNION 21 SELECT null owner, null segment_type, null segment_name, null partition_name, c.file# 22 , greatest(f.block_id, c.block#) corr_start_block# 23 , least(f.block_id+f.blocks-1, c.block#+c.blocks-1) corr_end_block# 24 , least(f.block_id+f.blocks-1, c.block#+c.blocks-1) 25 - greatest(f.block_id, c.block#) + 1 blocks_corrupted 26 , 'Free Block' description 27 FROM dba_free_space f, v$database_block_corruption c 28 WHERE f.file_id = c.file# 29 AND f.block_id = c.block# 31 order by file#, corr_start_block#; OWNER SEGMENT_TYPE SEGMENT_NAME PARTITION_NAME FILE# CORR_START_BLOCK# CORR_END_BLOCK# BLOCKS_CORRUPTED DESCRIPTION ---------------- ----------------- ----------------------- ------------------------------- ------ ----------------- --------------- ---------------- -------------- SYS TABLE OBJ$ 1 39041 39041 1 1 66738 66738 1 Free Block SYSMAN INDEX MGMT_METRICS_1HOUR_PK 3 31065 31065 1 SYS TABLE WRH$_SQL_BIND_METADATA 3 32404 32404 1 SYS TABLE WRH$_BG_EVENT_SUMMARY 3 35418 35418 1 SYS INDEX PARTITION WRH$_FILESTATXS_PK WRH$_FILEST_1232289473_41482 3 36281 36281 1 SYS TABLE PARTITION WRH$_SYSTEM_EVENT WRH$_SYSTEM_1232289473_41482 3 36329 36329 1 SYS TABLE PARTITION WRH$_SGASTAT WRH$_SGASTA_1232289473_41482 3 36617 36617 1 SYS INDEX PARTITION WRH$_SGASTAT_U WRH$_SGASTA_1232289473_41482 3 36625 36625 1 SYS INDEX PARTITION WRH$_PARAMETER_PK WRH$_PARAME_1232289473_41482 3 36673 36673 1 SYS TABLE PARTITION WRH$_SERVICE_STAT WRH$_SERVIC_1232289473_41482 3 36713 36713 1 SYS INDEX PARTITION WRH$_SERVICE_STAT_PK WRH$_SERVIC_1232289473_41482 3 36721 36721 1 SYS TABLE PARTITION WRH$_LATCH WRH$_LATCH_1232289473_41482 3 42881 42881 1 SYS TABLE WRI$_ADV_ACTIONS 3 61344 61344 1 EXAM TABLE EXAM_ITEMS_OLD 10 69927 69927 1 CPR TABLE NEED_MONITOR 26 94244 94244 1 已选择16行。 SQL> SQL> spool off
- 假坏块引起恐慌
- 记录一次ORA-00600[kdsgrp1]分析
- Read by other session等待事件
- table中各种坏块对select/dml操作影响
- shell脚本获得extents分布
- 数据库报ORA-00607/ORA-00600[4194]错误
- 记录一次ORA-600[13013]处理过程
- latch: cache buffers chains
原文地址:ORACEL坏查询对象批量脚本, 感谢原作者分享。

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is an open source relational database management system suitable for data storage, management, query and security. 1. It supports a variety of operating systems and is widely used in Web applications and other fields. 2. Through the client-server architecture and different storage engines, MySQL processes data efficiently. 3. Basic usage includes creating databases and tables, inserting, querying and updating data. 4. Advanced usage involves complex queries and stored procedures. 5. Common errors can be debugged through the EXPLAIN statement. 6. Performance optimization includes the rational use of indexes and optimized query statements.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

InnoDB's lock mechanisms include shared locks, exclusive locks, intention locks, record locks, gap locks and next key locks. 1. Shared lock allows transactions to read data without preventing other transactions from reading. 2. Exclusive lock prevents other transactions from reading and modifying data. 3. Intention lock optimizes lock efficiency. 4. Record lock lock index record. 5. Gap lock locks index recording gap. 6. The next key lock is a combination of record lock and gap lock to ensure data consistency.

The main reasons for poor MySQL query performance include not using indexes, wrong execution plan selection by the query optimizer, unreasonable table design, excessive data volume and lock competition. 1. No index causes slow querying, and adding indexes can significantly improve performance. 2. Use the EXPLAIN command to analyze the query plan and find out the optimizer error. 3. Reconstructing the table structure and optimizing JOIN conditions can improve table design problems. 4. When the data volume is large, partitioning and table division strategies are adopted. 5. In a high concurrency environment, optimizing transactions and locking strategies can reduce lock competition.

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment