Get the App
SLTechnology News&Howtos  ›  Database  › 

Delete archive log script regularly under Oracle

Shulou Source: shulou.com Published: 2022-06-01 10:26:26 10月02日 Update

1. Error message

A few days ago, the website was suddenly unavailable, and the following error was reported:

Ora-27101: shared memory realm does not exist

Ora-01034: oracle not available 11g

ORA-24324: service handle not initialized

Reason: due to the database archive log is full, can not continue to write data to the database.

Second, check the size of the archive log

Su-oracle

Sqlplus / as sysdba

Show parameter recover

You can view the archive log directory as / u01/app/oracle/fast_recovery_area/*/archivelog

You can view the size of the directory, compared with the log space set by the database, the size of the directory cannot be larger than the space set by the database.

Expand the size of the archive log

Alter system set db_recovery_file_dest_size=100G

Fourth, clean up the archive log

After the expansion, you also need to set a regular plan to clean up the archive log, and you need to switch to the oracle account to execute the command.

Rman target /

RMAN > crosscheck archivelog all

RMAN > delete expired archivelog all

RMAN > delete archivelog until time 'sysdate-3'

The interpretation of the above three commands:

1. The first command marks the archivelog of the invalid expired.

2. The second command deletes all expired archive logs directly.

3. The third command directly deletes all archived logs from three days ago.

Reference: https://www.2cto.com/database/201308/235338.html

Fifth, set up automatic scripts

1. Write a script

Su-oracle / / switch to the oracle user to perform the operation

Cd / u01/app

Vim arcclear.sh

#! / usr/binrman target / / u01/app/arcclear.log

Service crond restart

Tags: Log command data size database directory script space three items switch task information reason user website account error antecedent reference explanation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Microsoft Shulou Information MariaDB Apple