当前位置:网站首页>Database exception resolution caused by large table delete data deletion
Database exception resolution caused by large table delete data deletion
2022-07-07 15:18:00 【1024 questions】
One 、 Problem description
Two 、 Check the database
3、 ... and 、 Put forward a plan
Four 、 Execution process
One 、 Problem descriptionI was on my way to work this morning , Customers in the group say , There is a 24G The big table of ,delete Deleted 26 I haven't run for hours , At present, the process is still running. Let me help you deal with it , Stop the current process , And keep the data corresponding to the conditions , Delete the redundant data .
Two 、 Check the database1. Not open for filing
2.UNDO The table space is full
3、 ... and 、 Put forward a plan1. After communication , This table is the test data table , Not currently in use ;
So I plan to rename This table , adopt ctas The way to get the data you need , Rebuild indexes and related constraints .
2. There is a problem :delete The process has been executed 26 Hours , If kill process , Must lead to undo Roll back , Rolling back enables parallelism by default, resulting in high database and system load , So we need to deal with it in advance , Set parameters _fast_start_parallel_rollback_ Turn off the UNDO parallel .
-- View rollback parameter settings , Whether it is the default parallelism SQL> show parameter fast_start_parallel_rollbackNAME TYPE VALUE------------------------------------ ----------- ------------------------------fast_start_parallel_rollback string LOW--LOW representative Turn on CPU*2 parallel -- Set up spfile Cancel parallel SQL> alter system set fast_start_parallel_rollback=false;System altered.
Four 、 Execution process 1. Backup retention Table creation statement .
2. Record current invalid object .
SELECT d.OWNER ,d.OBJECT_NAME ,d.OBJECT_TYPE ,d.statusFROM dba_objects dWHERE d.status = 'INVALID' AND d.owner = '**';
3. see delete process pid, The system level kill fall .
-- Inquire about SID, SERIAL#select s.SQL_TEXT, se.SID, se.SERIAL# from v$session se, v$sql s where s.sql_id = se.SQL_ID and username = '**' and status = 'ACTIVE' and s.SQL_TEXT like '%delete * from *****%';-- Database level kill process alter system kill session '2953,31083';
Report errors
ERROR at line 1:
ORA-00031: session marked for kill
-- The system level kill process
select spid, osuser, s.program
from v$session s,v$process p
where s.paddr=p.addr and s.sid=2953;
kill -9 105257
4. Observe undo Rollback condition
-- View the waiting Events select inst_id,event,count(*) from gv$session a where a.status='ACTIVE' and not (a.type = 'BACKGROUND' and a.state='WAITING' and a.wait_class='Idle') group by inst_id,event order by a.inst_id,count(*) desc;---------------------------------------------------1wait for a undo record611resmgr:cpu quantum291enq: RO - fast object reuse221enq: CR - block range reuse ckpt201free buffer waits17-- View the current data rollback alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';select usn, state, undoblockstotal "Total", undoblocksdone "Done", undoblockstotal - undoblocksdone "ToDo", decode(cputime, 0, 'unknown', sysdate + (((undoblockstotal - undoblocksdone) / (undoblocksdone / cputime)) / 86400)) "Estimated time to complete" from v$fast_start_transactions where state = 'RECOVERING';---------------------------------------------------83RECOVERING9026713455902625826-4 month -21
5. Look at the system load ,IO load , Memory usage
6. Wait for rollback to complete , For a long time .
7. After successful rollback ,rename The original table .
rename table to table_20210410;
8.CTAS Get the required data to a new table ( The original table name ) in .
create table USER.TABLEnologging parallel 8tablespace TBSas select /*+parallel(TABLE,'8')*/ * from USER.TABLE_20210410where *** like '******%';-- Cancel parallel alter table USER.TABLE noparallel;-- Turn on loggingalter table USER.TABLE logging;
9.rename Indexes , And rebuild the index .
alter index USER.INDEX1 rename to INDEX1_20210410;-- Rebuild index create index USER.INDEX1 on USER.TABLE (***) tablespace TBS parallel 8;-- Cancel parallel alter index USER.INDEX1 noparallel;
10. Create constraints , to grant authorization .
11. Match invalid object , Is the data consistent
12.drop fall rename Table of .
drop table USER.TABLE_20210410 cascade;
The above is the big watch delete Details of database exception resolution caused by deleting data , More about delete Please pay attention to other relevant articles of software development network for information about abnormal deletion of data database !
边栏推荐
- Novel Slot Detection: A Benchmark for Discovering Unknown Slot Types in the Dialogue System
- [follow Jiangke University STM32] stm32f103c8t6_ PWM controlled DC motor_ code
- Cocoscreator resource encryption and decryption
- CTFshow,信息搜集:web9
- Lidar Knowledge Drop
- Unity's ASE realizes cartoon flame
- With 8 modules and 40 thinking models, you can break the shackles of thinking and meet the thinking needs of different stages and scenes of your work. Collect it quickly and learn it slowly
- Niuke real problem programming - Day17
- Read PG in data warehouse in one article_ stat
- 最安全的证券交易app都有哪些
猜你喜欢
银行需要搭建智能客服模块的中台能力,驱动全场景智能客服务升级
【深度学习】图像超分实验:SRCNN/FSRCNN
【OBS】RTMPSockBuf_ Fill, remote host closed connection.
Stm32cubemx, 68 sets of components, following 10 open source protocols
Ctfshow, information collection: web2
asp. Netnba information management system VS development SQLSERVER database web structure c programming computer web page source code project detailed design
Niuke real problem programming - day13
【跟着江科大学Stm32】STM32F103C8T6_PWM控制直流电机_代码
[server data recovery] data recovery case of raid failure of a Dell server
简述keepalived工作原理
随机推荐
Apache multiple component vulnerability disclosure (cve-2022-32533/cve-2022-33980/cve-2021-37839)
【數據挖掘】視覺模式挖掘:Hog特征+餘弦相似度/k-means聚類
Excerpted words
Andriod --- JetPack :LiveData setValue 和 postValue 的区别
Typescript release 4.8 beta
Win10 or win11 taskbar, automatically hidden and transparent
微信小程序 01
Niuke real problem programming - Day11
Cocoscreator operates spine for animation fusion
Ctfshow, information collection: web6
简述keepalived工作原理
CTFshow,信息搜集:web8
【服务器数据恢复】某品牌StorageWorks服务器raid数据恢复案例
CTFshow,信息搜集:web7
一个需求温习到的所有知识,h5的表单被键盘遮挡,事件代理,事件委托
IDA pro逆向工具寻找socket server的IP和port
用于增强压缩视频质量的可变形卷积密集网络
Infinite innovation in cloud "vision" | the 2022 Alibaba cloud live summit was officially launched
什么是pv和uv? pv、uv
MySQL bit type resolution