Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Damage of sysaux tablespace database block / repair of free block

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The database on the customer's side has not been maintained for a long time, which reflects that there is not enough server space recently. While checking the server space, I stumbled upon a problem with the backup of the database.

After checking that there is a bad block in the database sysaux table space, and the table with the bad block is WRH$_ENQUEUE_STAT, after querying the data on the test database, I am sure that the data of the table has little impact on the operation of the whole system.

There is no RMAN backup available at this time, and block recover cannot be used. So I decided to delete and rebuild the table. However, after doing so, the original data blocks become free blocks instead. In order to fix the free block, I started testing on the test library.

1. Simulate database damage

1) ddbd can be used to simulate database corruption. For the configuration of this tool, please refer to the following link:

Http://www.cnblogs.com/jyzhao/p/5139584.html

2) simulate the block to be damaged

Select file_id,block_id from dba_extents where segment_name='WRH$_ENQUEUE_STAT'

The result is file_id=2,block_id=4440.

Modify / x 62 file 2 block 4440 offset 255

3) in the rman command, execute backup validate database or backup validate datafile 2

Use the view v$database_block_corruption to view the damaged blocks found by the backup operation.

Select * from v$database_block_corruption

4) the table is deleted and rebuilt, and it is found that file2 4440 has become a free block

Select * from dba_extents where file_id=2 and 4440 between block_id-1 and block_id+1;# query No data

2. Repair of bad blocks

1) the tablespace is modified to not grow automatically

Alter database datafile 2 autoextend off

2) create an entity table on sysaux

Create table test (id varchar (50)) tablespace sysaux

3) insert data until an error in ORA01653 is reported, and even insert into test values ('aaaaaaaaaa') fails to execute

Insert into test values ('aaaaaaaaaa')

Commit

Insert into test

Select *

From test

Commit

4) create another entity table

Create table test_2 (id varchar (50)) tablespace sysaux

-- check if file 2 block_id 4440 has data

Select * from dba_extents where file_id=2 and 4440 between block_id-1 and block_id+1;# simulates this step, and file 2 block_id 4440 queries the data for test_2.

5) delete the test table

Drop table test_1

Drop table test

6) the tablespace growth mode is changed to automatic growth.

Alter database datafile 2 autoextend on

7) Test the backup in RMAN, and you can perform the full backup normally.

RMAN > backup incremental level 0 database

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report