ORACLE/SCRIPT2009. 9. 28. 14:12
반응형
select to_char(completion_time,'yyyymmdd') DAY, count(*)  CNT From v$archived_log
where   to_char(completion_time,'yyyymmdd') >='20090901'
group by to_char(completion_time,'yyyymmdd')
order by to_char(completion_time,'yyyymmdd')   desc;
반응형
Posted by [PineTree]
ORACLE/RAC2009. 2. 23. 11:22
반응형
출처 : http://kr.blog.yahoo.com/dbacool/1157

RAC(OPS) 환경하에서 양쪽 Node의 archived log file을 RMAN을 사용하여 동시에 BACKUP 받는 방법
======================================================================================

ORACLE 9i 이전 버전
-------------------

Oracle 8i까지는 다음과 같은 Script를 통하여 Backup을 받을 수 있었습니다.

1) Script Name: arch_backup.rcv

run{
allocate channel node_1 type disk connect 'system/manager@v92hp1';
allocate channel node_2 type disk connect 'system/manager@v92hp2';

backup filesperset 1
(archivelog until time 'SYSDATE' thread 1 channel node_1)
(archivelog until time 'SYSDATE' thread 2 channel node_2);

release channel node_1;
release channel node_2;

}

2) 수행 방법

$ rman target=system/manager catalog=rman_user/rmanpw cmdfile='arch_backup.rcv' log='arch_backup.log'



ORACLE 9i 이후 버전
-------------------

그러나 Oracle9i 이상부터는 Archived file backup전에 다음과 같은 설정을 먼저
해 주셔야만 합니다.

1) Configuration 설정

$ rman target=system/manager catalog=rman_user/rmanpw
RMAN> Show all;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> configure default device type to disk;
RMAN> configure channel 1 device type disk connect 'system/manager@v92hp1';
RMAN> configure channel 2 device type disk connect 'system/manager@v92hp2';

위 설정은 backup을 Disk에 받는 경우로 가정하고 device type을 모두 disk로 설정하였습니다.
만일 backup solution을 사용하여 tape에 받는다면 device type을 'sbt_tape'으로 변경해 주시면 됩니다

몇개의 Channel을 설정할 것인가에 따라 PARALLELISM의 값을 반드시맞춰 주어야 합니다.
이것을 맞춰주지 않으면 다음과 같은 형태의 Error가 발생하면서 다른 Node의 archive file들을 인식하지
못하게 됩니다.(실제로 Archived file들은 정상적으로 존재합니다)

RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /u01/64bit/app/oracle/product/9.2.0/admin/V92HP/arch/arch1_146.dbf
ORA-27037: unable to obtain file status
HP-UX Error: 2: No such file or directory
Additional information: 3

위 설정은 한번만 수행해 주시면 됩니다.
만일 CHANNEL을 잘못 설정하였으면 다음과 같은 명령으로 Clear 해 주시면 됩니다.

RMAN> configure channel 1 device type disk clear;


2)Archived file을 Backup 받습니다.

RMAN> run { backup
format='/u01/64bit/app/oracle/product/9.2.0/admin/V92HP/arch/%U'
archivelog all delete input;
}



ADDITIONAL INFORMATION(1)
-------------------------
RAC 환경 하에서 일부 Archived file들이 OS에서 삭제 되었을 경우 다음과 같은 명령을 통하여
validation check를 수행한 후에 backup을 수행하여 주십시요

RMAN> allocate channel for maintenance type disk connect 'system/manager@v92hp1';
RMAN> allocate channel for maintenance type disk connect 'system/manager@v92hp2';
RMAN> crosscheck archivelog all;

만약에 Configuration에서 이미 Channel을 설정해 주었다면
Channel allocation 없이 바로 crosscheck명령어를 수행해 주시면 됩니다.


ADDITIONAL INFORMATION(2)
-------------------------
Channel Configuration 설정시에 Backup FORMAT을 함께 설정하려면 다음과 같은 형태로 수행합니다.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> configure default device type to disk;
RMAN> configure channel 1 device type disk connect 'system/manager@v92hp1' FORMAT '/arch/bkup%t_s%s_s%p';
RMAN> configure channel 2 device type disk connect 'system/manager@v92hp2' FORMAT '/arch/bkup%t_s%s_s%p';


ADDITIONAL INFORMATION(3)
-------------------------
Tape device를 사용할 경우 device type은 'sbt_tape'을 사용합니다.

RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2;
RMAN> configure default device type to 'sbt_tape';
RMAN> configure channel 1 device type 'sbt_tape' connect 'system/manager@v92hp1' FORMAT 'bkup%t_s%s_s%p';
RMAN> configure channel 2 device type 'sbt_tape' connect 'system/manager@v92hp2' FORMAT 'bkup%t_s%s_s%p';
반응형
Posted by [PineTree]
ORACLE/ADMIN2007. 2. 24. 05:55
반응형

DB10g 아카이브 로그 파일관리
==========================

현상> 갑자기 db가 멈추는 현상 발생 abort로 죽이고 다시 살리면 다음과 같은 에러 발생

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-16038: log 2 sequence# 618 cannot be archived
ORA-19809: limit exceeded for recovery files
ORA-00312: online log 2 thread 1:
'/home01/oracle/ocs/oradata/OCSD/onlinelog/o1_mf_2_1k7xomh4_.log'
ORA-00312: online log 2 thread 1:
'/home02/oracle/ocs/infra/flash_recovery_area/OCSD/onlinelog/o1_mf_2_1k7xormv_.log'

 

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


#### 조치하는 법


1) db_recovery_file_dest_size를 증가시켜 주면 된다. 바로 반영됩니다.

    SQL> alter system set db_recovery_file_dest_size=xG;

 

2) Stop using the db_recovery_file_dest by unsetting the parameter.
   ( This assumes you never really wanted to use this option )

 

3)  rman repository/Controlfile 에서 엔트리들을 삭제한다.

SQL> conn / as sysdba
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;

         위의 명령으로 조회해 보면 최대치 까지 로그가 쌓인것을 알 수 있음.

 

다음과 같이 조치한다.

RMAN 사용해서 ARCHIVE LOG 삭제

#$ORACLE_HOME/bin/rman

 

RMAN> connect target /

RMAN> LIST ARCHIVELOG LIKE '%.arc';

RMAN> DELETE ARCHIVELOG LIKE '%.arc';

3일치 아카이브로그 남겨두고 지우기

RMAN> delete archivelog all completed before 'sysdate -3';

 

하나씩 지우는게 번거러울 경우 아래와 같이 한번에 지우는 방법도 있음.

1. os 상에서 우선 파일을 삭제한다.

   # cd $ORACLE_BASE/flash_recovery_area/$ORACLE_SID/archivelog/yyyy_mm_dd

   # rm -r $ORACLE_BASE/flash_recovery_area/$ORACLE_SID/archivelog/'삭제할 디렉토리명'

2. RMAN을 실행한다.

  # $ORACLE_HOME/bin/rman

  RMAN>connect target /

  RMAN>crosscheck archivelog all; -> marks the controlfile that the archives have been deleted

  RMAN>delete expired archivelog all; -> deletes the log entries identified above

반응형
Posted by [PineTree]