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.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
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!