ORACLE delete archived logs and ORA-00257 problem

00257-ORA : ORACLE archive log is full, no new space opened up again under the circumstances, is not allowed to operate the database.

- Check ORACLE archiving is turned on and using the path parameter

Sqlplus / as sysdba

SQL > archive log list;

As shown, ORACLE has opened archival mode, the archive is stored in the built-in parameter ORACLE DB_RECOVERY_FILE_DEST of the path

The current archive log sequence number is 173.

- Check the value of the parameter settings DB_RECOVERY_FILE_DEST

show parameter db_recovery_file_dest;

- find the latest archived log files in the operating system

- View serial number format

show parameter log_archive_format;

% s: log sequence number:
% S: log sequence number (leading)
% T: redo thread number.
% T: Redo thread number (leading)
% A: Activity ID No.
% d: Database ID Number
id value% r online redo log (RESETLOGS) of

Is not feeling can not read, how to set the database file format does not match the actual file Yeah, this is because the ORACLE database log_archive_format parameter does not DB_RECOVERY_FILE_DEST parameters take effect, to use log_archive_format parameter settings archive file format, have to use DB_RECOVERY_FILE_DEST_N parameters.

Note: DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_N can not coexist, we are met dead relationship.

- The parameter blank db_recovery_file_dest

alter system set db_recovery_file_dest = '' scope=spfile;


- Configuration parameters log_archive_dest_1

alter system set log_archive_dest_1='location=D:\app\Administrator\flash_recovery_area_My' scope=spfile;


- Modify the archive file naming format

alter system set log_archive_format='%t_%s_%r.arch' scope=spfile;


- restart the database, so that all of the above modifications of parameters to take effect .

SQL> the shutdown load immediate
Database closed.
Database has been uninstalled.
ORACLE instance shut down.
SQL> the Startup
Total Area System, Ltd. Free Join 1720328192 bytes
Fixed Size 2176448 bytes
Variable Size 1023412800 bytes
Database Buffers 687 865 856 bytes
Redo Buffers 6873088 bytes
database loading is completed.
Database has been opened.
SQL> Archive log List;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination                            D: \ app \ Administrator \ flash_recovery_area_My
earliest online log sequence 296
next archived log sequence 298
Current log sequence 298
SQL>alter system switch logfile;

Such a look is not very clear? 1_298_1018868058.ARCH, thread number 1, sequence number 298, a redo log ID 1018868058

These three parameters in the view V $ archived_log can be found.

select * from v$archived_log where archived='YES' and deleted='NO' ;

Archive log space is full, I am not locate the folder to delete archived log can it?

Of course not, we pay attention to query the view V $ archived_log time, plus the conditions deleted = 'NO'

You go to directory files are deleted, Oracle is not known, so we have to use Oracle commands to delete, so Oracle will update the corresponding view.

---- ORACLE delete archived log

target rman /   - operating system authentication enter rman

All ARCHIVELOG CROSSCHECK;    - detect all archives

All expired The ARCHIVELOG List;  - lists all invalid archive

noprompt expired The ARCHIVELOG All the Delete;  - delete expired archive

But most of the time has not expired archive

Time ARCHIVELOG an until the Delete 'sysdate - 7';  - delete seven days before filing

So far, it has been resolved ORA-00257 problem.

If the space is too small archive of default (4999M), can also be extended archive storage space

System SET = 100G DB_RECOVERY_FILE_DEST_SIZE ALTER; - provided the use of space

Delete archived logs, we remove expired invalid archive, a lot of time is all the hair cut can not, which is very confused, ORACLE archiving are being given a little more, how log it will not expire? Which was to talk about the issue rman strategy.

target rman / - operating system authentication enter rman

RMAN> show all;

- date of 1 part of the database backup can be restored, no more than 1 part of the latest backup will be marked as redundancy. The default value is 1 part by
the CONFIGURE the REDUNDANCY The RETENTION POLICY the TO 1; # default

- whether to open an optimized algorithm for data file backup and archiving files, the default closed
the CONFIGURE the BACKUP OPTIMIZATION, OFF; # default

- Specifies the type of device I / O operations to a hard disk or a magnetic tape, a hard disk default is
the CONFIGURE the DEVICE the DEFAULT the TO DISK the TYPE; # default

- force the database after the backup file or execute commands to change the configuration of the database backup control file automatically, the default is off
the CONFIGURE CONTROLFILE AUTOBACKUP is OFF; # default

- backup path and the backup file format configuration control
the CONFIGURE the DEVICE CONTROLFILE the TYPE AUTOBACKUP is the FORMAT the FOR DISK the TO '% F.'; # Default

- degree of parallelism configuration database device type of
the CONFIGURE the DEVICE. 1 the TYPE DISK the PARALLELISM the BACKUP the TYPE BACKUPSET the TO; # default

- the number of each backup copy of the database, oracle every backup parts can have multiple identical copies
the CONFIGURE the DEVICE DATAFILE the BACKUP the COPIES the FOR DISK the TO the TYPE. 1; # default

- archive log database storage device type
the CONFIGURE ARCHIVELOG the BACKUP the COPIES the FOR the DEVICE DISK the TO the TYPE 1; # default


CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

--删除策略
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

- storage path and file name of the configuration file to control the snapshot file, the snapshot files are generated during the backup, read consistency for the control file
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D: \ APP \ ADMINISTRATOR \ PRODUCT \ 11.2. 0 \ DBHOME_1 \ DATABASE \ SNCFYLJ.ORA '; # default

RMAN>

Expiration policy archive log is RETENTION (reserved) strategy led, or DELETION (deletion) dominant strategy, now I have yet to distinguish.

After the clear will update the article.

In addition RETENTION (reserved) a total of three policy options:

The RETENTION POLICY the TO the RECOVERY WINDOW the CONFIGURE OF 7 DAYS;
the CONFIGURE The RETENTION POLICY the TO REDUNDANCY 5;
the CONFIGURE The RETENTION POLICY the TO NONE;

first recover window is enough to keep all of the backup, you can restore the system to the database at any time within the last seven days. Any database backups over the last seven days will be marked as obsolete.


The second redundancy is to maintain most recent five database backup can be restored, no more than 5 copies of the latest backup will be marked as redundancy. Its default value is 1 part.


The third does not require retention policies.

 

 

 

 

Published 35 original articles · won praise 61 · views 160 000 +

Guess you like

Origin blog.csdn.net/woailyoo0000/article/details/100821581