OS환경 : Oracle Linux 7.2(64bit)
DB 환경 : Oracle Database 18.1.0.3
쿼리 : rmanwork.sh rman으로 아카이브 FULL 시 3일 지난것들 제거하는 쉘
rmanwork.sh 쉘 생성
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
$ cat rmanwork.sh
date >> /home/oracle/ppp/rmanwork.log
echo "start rmanwork" >> /home/oracle/ppp/rmanwork.log
mkdir -p /oracle/app/oracle/fast_recovery_area/ORAC/oldlog/
find /oracle/app/oracle/fast_recovery_area/ORAC/archivelog/ -mtime +2 -exec mv {} /oracle/app/oracle/fast_recovery_area/ORAC/oldlog/ \;
rm -rf /oracle/app/oracle/fast_recovery_area/ORAC/oldlog/
rman target / << EOF1
crosscheck archivelog all;
delete expired archivelog all;
yes
exit
EOF1
sqlplus / as sysdba << EOF2
alter system archive log current;
EOF2
rman target / << EOF0
delete backup;
yes
backup database;
EOF0
date >> /home/oracle/ppp/rmanwork.log
echo "end rmanwork" >> /home/oracle/ppp/rmanwork.log
|
크론탭(crontab) 등록
1
2
|
$ crontab -e
0 6 * * 1,3,5 /home/oracle/ppp/rmanwork.sh
|
결과값 :
크론탭 결과
1
2
3
4
5
|
$ cat rmanwork.log
Mon Oct 1 17:09:38 KST 2018
start rmanwork
Mon Oct 1 17:10:35 KST 2018
end rmanwork
|
참조 :
'ORACLE > Sql' 카테고리의 다른 글
oracle 지난달, 다음달 구하기 (0) | 2018.11.08 |
---|---|
Library Cache Lock , Pin 조회 테스트+킬구문포함 (0) | 2018.10.26 |
desc 사용 못할 때 테이블 구조 확인 dba_tab_columns 활용 (0) | 2018.09.27 |
오라클 temp 사용량 확인 쿼리 (0) | 2018.09.10 |
dbms_lock이란? PL/SQL 작성시 특정 시간 Sleep (0) | 2018.08.31 |