Delete to delete the archive log data cause an increase in the operating system space due to insufficient database hang live

Business needs for historical data log table clean. Historical tables are large, use the delete operation to delete data older than 90 days.

 

Part I: Fast delete data

The SQL> ALTER CC.F_LOG Table Parallel . 4 ; 
the SQL > ALTER Parallel DML enable the session;     
the SQL > Delete the FROM CC.F_LOG the WHERE S.CREATE_DATE S> (SYSDATE- 90 ); 
execution plan is determined in parallel

-----------------------------------------------
| Id | Operation |
-----------------------------------------------
| 0 | DELETE STATEMENT |
| 1 | PX COORDINATOR |
| 2 | PX SEND QC (RANDOM) |
| 3 | INDEX MAINTENANCE |
| 4 | PX RECEIVE |
| 5 | PX SEND RANGE |
| 6 | DELETE |
| 7 | BUFFER SORT |
| 8 | PX RECEIVE |
| 9 | PX SEND HASH (BLOCK ADDRESS)|
|* 10 | INDEX RANGE SCAN |
-----------------------------------------------

SQL> select INST_ID,sid,serial#,USERNAME,STATUS,MACHINE,SQL_ID,EVENT,(sysdate-LOGON_TIME)*86400 as "s",LAST_CALL_ET from gv$session where status='ACTIVE' and username is not null;
INST_ID SID SERIAL# USERNAME STATUS MACHINE SQL_ID EVENT s LAST_CALL_ET
------- ------ ------- ------------------- --------------- -------------------- ------------------------------ ------- ------------
1 24   44857 SYS ACTIVE p01 6yn37jfu2y88k PX Deq Credit: send blkd 190 189
1 584  28067 SYS ACTIVE p01 2ymxxw3mapxd9 SQL*Net message from client 196 0
1 884  40483 SYS ACTIVE p01 6yn37jfu2y88k PX Deq: Table Q Normal 190 189
1 888   8663 SYS ACTIVE p01 6yn37jfu2y88k PX Deq: Execute Reply 3679 212
1 1157 9679  SYS ACTIVE p01 6yn37jfu2y88k PX Deq: Table Q Normal 190 189
1 1162 10801 SYS ACTIVE p01 6yn37jfu2y88k direct path write temp 190 189
1 1437 22187 SYS ACTIVE p01 6yn37jfu2y88k PX Deq Credit: send blkd 190 189
1 1728 17227 SYS ACTIVE p01 6yn37jfu2y88k PX Deq Credit: send blkd 190 189
1 1740 25759 SYS ACTIVE p01 6yn37jfu2y88k PX Deq: Table Q Normal 190 189
9 rows selected.


Restore deleted-1 parallel

SQL> alter table CC.F_LOG parallel 1;

Part II: data deletion hang

 

After deleting the data found that an increasing number of database sessions, and delete operations session event
File Switch log (Archiving needed) wait for what? You need to wait for the completion of the archive log switch? Why wait so long to archive log switch? Observation alert

SQL> select INST_ID,sid,serial#,USERNAME,STATUS,MACHINE,SQL_ID,EVENT,(sysdate-LOGON_TIME)*86400 as "s",LAST_CALL_ET from gv$session where status='ACTIVE' and username is not null; INST_ID SID SERIAL# USERNAME STATUS MACHINE SQL_ID EVENT ------- ------ ------- -------------- ---------- -------------------- -------------------- ------------------------------ 1 597 51393 CXPT ACTIVE future-app1 fmmd0cjd0ghpf buffer busy waits 1 598 45595 ac ACTIVE pfmptom01.yutong.com 6d7v2nay5vm9n log file switch (archiving needed) 1 1429 41689 ac ACTIVE pfmptom02.yutong.com 3dn60pvzrqz0g buffer busy waits 1 1431 1279 CXPT ACTIVE future-app1 azakfbj8ss7f8 buffer busy waits 1 1449 1569 ac ACTIVE pfmptom01.yutong.com 7nbhsah5kw0q2 log file switch (archiving needed) 1 1453 25515 SYSTEM ACTIVE ZZYT\YT-P610764 1xz9mk73crhu8 log file switch (archiving needed) 1 1458 38363 ac ACTIVE pfmptom02.yutong.com 3dn60pvzrqz0g buffer busy waits 1 1709 27961 ac ACTIVE pfmptom01.yutong.com d8ats3n1vrm7t enq: US - contention 1 1714 62631 ac ACTIVE pfmptom01.yutong.com 0jg5553p23hup enq: SQ - contention 1 1716 57967 CXPT ACTIVE future-app2 azakfbj8ss7f8 enq: US -contention 1 1730 47159 AC BUSY the ACTIVE pfmptom02.yutong.com 3dn60pvzrqz0g Buffer Waits 1 1731 10129 AC btgxyzwsc5sd1 the ACTIVE pfmptom01.yutong.com ENQ: US - contention 1 2009 42483 AC 94cs4sv2zua0u the ACTIVE pfmpbak01 log File Switch (Archiving needed) 1 2033 64813 AC the ACTIVE BUSY 3dn60pvzrqz0g Buffer Waits pfmptom02.yutong.com 48 rows the Selected.

observe the ALERT log, the log can be found in the archive can not create an error

Examine archive trace files for archiving errors
Current log# 8 seq# 41282 mem# 0: /oracle/oradata/fmpdb/redo08.log
Tue Aug 13 19:41:12 2019
ARC1: Encountered disk I/O error 19502
ARC1: Closing local archive destination LOG_ARCHIVE_DEST_1: '/oracle/archivelog/fmpdb_1_41278_961338832.log' (error 19502) (fmpdb)
ARC1: I/O error 19502 archiving log 4 to '/oracle/archivelog/fmpdb_1_41278_961338832.log'
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16038: log 4 sequence# 41278 cannot be archived
ORA-19502: write error on file "", block number (block size=)
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'
Tue Aug 13 19:41:13 2019
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16014: log 4 sequence# 41278 not archived, no available destinations
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'
Tue Aug 13 19:44:28 2019
minact-scn: useg scan erroring out with error e:12751
Tue Aug 13 19:46:14 2019
ARC1: Encountered disk I/O error 19502
ARC1: Closing local archive destination LOG_ARCHIVE_DEST_1: '/oracle/archivelog/fmpdb_1_41278_961338832.log' (error 19502) (fmpdb)
ARC1: I/O error 19502 archiving log 4 to '/oracle/archivelog/fmpdb_1_41278_961338832.log'
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16038: log 4 sequence# 41278 cannot be archived
ORA-19502: write error on file "", block number (block size=)
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'
Tue Aug 13 19:46:14 2019
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16014: log 4 sequence# 41278 not archived, no available destinations
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'
Tue Aug 13 19:49:35 2019
minact-scn: useg scan erroring out with error e:12751
Tue Aug 13 19:51:15 2019
ARC1: Encountered disk I/O error 19502
ARC1: Closing local archive destination LOG_ARCHIVE_DEST_1: '/oracle/ARC1: I/O error 19502 archiving log 4 to '/oracle/archivelog/fmpdb_1_41278_961338832.log'
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16038: log 4 sequence# 41278 cannot be archived
ORA-19502: write error on file "", block number (block size=)
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'
ARCH: Archival stopped, error occurred. Will continue retrying
ORACLE Instance fmpdb - Archival Error
ORA-16014: log 4 sequence# 41278 not archived, no available destinations
ORA-00312: online log 4 thread 1: '/oracle/oradata/fmpdb/redo04.log'

Tue Aug 13 19:56:16 2019
Archiver process freed from errors. No longer stopped
Tue Aug 13 19:56:18 2019
Archived Log entry 41273 added for thread 1 sequence 41278 ID 0x67cfc4e dest 1:
krse_arc_driver_core: Successful archiving of previously failed ORL
Tue Aug 13 19:56:18 2019
Thread 1 advanced to log sequence 41283 (LGWR switch)
Current log# 4 seq# 41283 mem# 0: /oracle/oradata/fmpdb/redo04.log
Tue Aug 13 19:56:18 2019
Some DDE async actions failed or were cancelled
Tue Aug 13 19:56:23 2019
Archived Log entry 41274 added for thread 1 sequence 41281 ID 0x67cfc4e dest 1:
Archived Log entry 41275 added for thread 1 sequence 41279 ID 0x67cfc4e dest 1:
Archived Log entry 41276 added for thread 1 sequence 41280 ID 0x67cfc4e dest 1:
Archived Log entry 41277 added for thread 1 sequence 41282 ID 0x67cfc4e dest 1:
Tue Aug 13 19:56:43 2019
Thread 1 advanced to log sequence 41284 (LGWR switch)
Current log# 5 seq# 41284 mem# 0: /oracle/oradata/fmpdb/redo05.log
Tue Aug 13 19:56:45 2019
Archived Log entry 41278 added for thread 1 sequence 41283 ID 0x67cfc4e dest 1:
Tue Aug 13 19:57:10 2019
Thread 1 cannot allocate new log, sequence 41285

 

After the operation manually delete the archive log, archive logs to free up space quickly execute a script to delete a compressed backup archive logs that were backed up. After the delete operation is resumed and finished, the database full backup immediately.
[pfmpodb01 the root @ ~] # DF -H
the Filesystem Size Used Avail the Use% Mounted ON
/ dev / Mapper / VolGroup00-LogVol00 297 g of 297 g of 100% the 0G /

Cleaning archive log
[pfmpodb01 the root @ ~] # DF -H
the Filesystem Size Used Avail the Use% Mounted ON
/ dev / Mapper / VolGroup00. 12G-271G LogVol00 297 g of 97% /

After the compressed backup archive log deletion log
backup format '/ oracle / dbbak / archbak_% d_% s_% p_% T' archivelog all delete input;

[root@pfmpodb01 archivelog]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 297G 230G 52G 82% /

 

Guess you like

Origin www.cnblogs.com/lvcha001/p/11349637.html