본문 바로가기
Oracle/운영

FRA 디렉토리가 물리적으로 용량이 full일 때 조치사항

by 취미툰 2020. 1. 7.
반응형

-Archive mode에서 아카이브파일을 저장하는 FRA의 디스크를 100% 사용하게 되면 DB Hang이 걸리게 됩니다.

아래 예를 통해 알아보겠습니다.

 

1.사전준비사항

 

아카이브 모드 확인

sql> archive log list

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1112

Current log sequence           1115

- 아카이브 모드가 아닐 시에는 아카이브 모드로 변경해줍니다.

 

▶ Mount 상태에서 아카이브모드로 변경

sql> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down

 

sql> startup mount

ORACLE instance started.

 

Total System Global Area 1653518336 bytes

Fixed Size                  2253784 bytes

Variable Size            1090522152 bytes

Database Buffers          553648128 bytes

Redo Buffers                7094272 bytes

Database mounted.

 

sql> alter database archivelog;

 

Database altered.

 

sql> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1112

Next log sequence to archive   1115

Current log sequence           1115

sql> alter database open;

 

Database altered.

 

테스트용 FRA 생성 및 용량 부여

- OS 레벨에서 진행합니다.

- FRA_TEST라는 새로운 디렉토리를 생성합니다.

$ mkdir /app/oracle/FRA_TEST

 

▶ DBFRA 영역과 용량 조회

- /app/oracle/fast_recovery_area의 영역으로 설정되어 있고 4182M의 크기로 설정되어 있다.

sql> show parameter db_recovery

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest                string      /app/oracle/fast_recovery_area

db_recovery_file_dest_size           big integer 4182M

 

▶ DBFRA 영역과 용량 변경

- 100M로 변경하고 아까 생성한 디렉토리로 FRA경로를 변경합니다.

sql> alter system set db_recovery_file_dest_size=100M scope=both;

System altered.

 

sql> alter system set db_recovery_file_dest='/app/oracle/FRA_TEST/' scope=both;

System altered.

 

sql> show parameter db_recovery

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest                string      /app/oracle/FRA_TEST/

db_recovery_file_dest_size           big integer 100M

 

2.테스트

테스트용 테이블 생성 및 데이터 삽입

- DB에 많은 변경사항을 발생시켜 아카이브로그파일을 만들어 FRA영역을 가득 차게 합니다.

 

sql> create table fra_Test

(a number , b varchar2(30), c date);

 

Table created.

 

sql> insert into fra_test

select level ,dbms_random.string('A',30),sysdate+level from dual connect by level < 10000000;

 

insert into fra_test

 *

ERROR at line 1:

ORA-30009: Not enough memory for CONNECT BY operation

Elapsed: 00:06:43.89

 

-ORA-30009 에러를 발생시키며 insert작업이 취소 되었다.

-ORA-30009connect by 절 사용시 충분한 메모리가 확보되지 않아 발생되는 에러입니다.

 

강제로 아카이브파일 생성

- 강제로 생성하려 명령어를 치지만, hang이 걸리며 생성되지 않습니다.

sql> alter system switch logfile;

------계속 대기중----

 

 

3.Alert log 확인

▶ Alert log 확인

 

************************************************************************

ARC0: Error 19809 Creating archive log file to '/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1122_%u_.arc'

Errors in file /app/oracle/diag/rdbms/ysbae/ysbae/trace/ysbae_arc1_19226.trc:

ORA-19815: WARNING: db_recovery_file_dest_size of 104857600 bytes is 100.00% used, and has 0 remaining bytes available.

************************************************************************

You have following choices to free up space from recovery area:

1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,

   then consider changing RMAN ARCHIVELOG DELETION POLICY.

2. Back up files to tertiary device such as tape using RMAN

   BACKUP RECOVERY AREA command.

3. Add disk space and increase db_recovery_file_dest_size parameter to

   reflect the new space.

4. Delete unnecessary files using RMAN DELETE command. If an operating

   system command was used to delete files, then use RMAN CROSSCHECK and

   DELETE EXPIRED commands.

************************************************************************

ARC1: Error 19809 Creating archive log file to '/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1122_%u_.arc

 

-ORA-19815 에러를 발생시켰습니다.

 

4.해결방안1

물리적으로 OS 파일의 아카이브 파일을 삭제하여 공간을 확보하는 방법.

- 물리적인 FRA에 위치한 아카이브 파일을 삭제합니다.

$ rm -rf *.arc

$ ls

 

▶ rman으로 물리적으로 지워준 파일을 논리적으로도 삭제해준다.

-rman에 접속 후 crosscheck archivelog all명령어와 delete expired archivelog all명령어를 칩니다.

 

$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jul 29 11:31:39 2019

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: YSBAE (DBID=1658322064)

 

RMAN> crosscheck archivelog all

2> ;

 

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=80 device type=DISK

validation failed for archived log

archived log file name=/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1115_gmwl49dt_.arc RECID=1 STAMP=1014891289

validation failed for archived log

archived log file name=/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1116_gmwlmh42_.arc RECID=2 STAMP=1014891775

생략

 

RMAN> delete expired archivelog all;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=80 device type=DISK

List of Archived Log Copies for database with db_unique_name YSBAE

=====================================================================

 

Key     Thrd Seq     S Low Time

------- ---- ------- - ---------

1       1    1115    X 29-JUL-19

        Name: /app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1115_gmwl49dt_.arc

 

2       1    1116    X 29-JUL-19

        Name: /app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1116_gmwlmh42_.arc

생략

 

Do you really want to delete the above objects (enter YES or NO)? yes

deleted archived log

archived log file name=/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1115_gmwl49dt_.arc RECID=1 STAMP=1014891289

deleted archived log

archived log file name=/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1116_gmwlmh42_.arc RECID=2 STAMP=1014891775

deleted archived log

생략

 

▶ log switch를 발생시켜 정상적으로 작동되는지 확인

sql> alter system switch logfile;

 

System altered.

 

5.해결방안2

▶ DB에서 db_recovery_file_dest_size를 늘려줌

sql> alter system set db_recovery_file_dest_size=2048M scope=both;

 

sql> show parameter db_recovery_file_dest_size

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest_size           big integer 2G

 

▶ log switch를 발생시켜 정상적으로 작동되는지 확인

sql> alter system switch logfile;

 

System altered.

 

▶ alert log를 확인

ARC0: Error 19809 Creating archive log file to '/app/oracle/FRA_TEST/YSBAE/archivelog/2019_07_29/o1_mf_1_1126_%u_.arc'

Archived Log entry 12 added for thread 1 sequence 1127 ID 0x62d7d290 dest 1:

Archiver process freed from errors. No longer stopped

Archived Log entry 13 added for thread 1 sequence 1128 ID 0x62d7d290 dest 1:

Archived Log entry 14 added for thread 1 sequence 1126 ID 0x62d7d290 dest 1:

Mon Jul 29 12:07:47 2019

Thread 1 advanced to log sequence 1130 (LGWR switch)

  Current log# 1 seq# 1130 mem# 0: /app/oracle/oradata/ysbae/redo01.log

  Current log# 1 seq# 1130 mem# 1: /app/oracle/oradata/ysbae/redo01_02.log

Mon Jul 29 12:07:49 2019

db_recovery_file_dest_size of 2048 MB is 11.51% used. This is a

user-specified limit on the amount of space that will be used by this

database for recovery-related files, and does not reflect the amount of

space available in the underlying filesystem or ASM diskgroup.

Mon Jul 29 12:07:50 2019

Archived Log entry 15 added for thread 1 sequence 1129 ID 0x62d7d290 dest 1:

 

- 파라미터 변경 명령어를 치는 동시에 ORA-19815 에러는 사라지며 정상적으로 archive되는 로그를 볼 수 있습니다.

 

반응형

댓글