Home > Database > Oracle > body text

How to delete oracle archive logs

WBOY
Release: 2022-01-26 10:17:05
Original
26650 people have browsed it

Method: 1. Use the "DELETE EXPIRED ARCHIVELOG ALL;" statement to delete all archive logs; 2. Use the "DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';" statement to retain 7 days of archive logs.

How to delete oracle archive logs

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to delete the oracle archive log

su - oracle //Enter the oracle account

sqlplus / as sysdba //Log in with the oracle sys administrator authenticated with operating system authority

archive log list //View the archive mode of the database

Note: Entering archive log list will display USE_DB_RECOVERY_FILE_DEST

select * from V$RECOVERY_FILE_DEST; //Query the archive log space size And path

show parameter recover; //Show archive file path

Exit to the oracle account root directory and then enter rman and enter the following command to enter rman

rman target sys/password

RMAN> crosscheck archivelog all; //Verified DB archive log

RMAN> delete expired archivelog all; //Delete all archive logs

RMAN>DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7'; //Keep 7 days of archive logs

Check again

SQL> select * from V$RECOVERY_FILE_DEST;

Modify size

SQL> alter system set db_recovery_file_dest_size=5G scope=both;

Close archiving

SQL> alter system set log_archive_start=false scope=spfile; #Disable self-archiving

SQL> shutdown immediate; //Force to close the database

SQL> startup mount; //Restart the database to mount mode

SQL> alter database noarchivelog; //Change to non-archive mode

SQL> alter database open; //Open data files

SQL> archive log list; //View the previous archive mode again

Recommended tutorial: "Oracle Video Tutorial

The above is the detailed content of How to delete oracle archive logs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!