OS환경 : Oracle Linux 8.1 (64bit)
DB 환경 : Oracle Database 19.3.0.0
방법 : 오라클 19c 아카이브로그 전체 삭제 스크립트
테스트시 아카이브 로그를 모두 삭제하는용으로 사용하는 del_arch.sh 스크립트
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$ cat del_arch.sh
export NLS_DATE_FORMAT="yyyy/mm/dd hh24:mi:ss"
rman target / <<EOF
delete noprompt archivelog all;
crosscheck archivelog all;
delete noprompt expired archivelog all;
EOF
sqlplus / as sysdba << EOF
exec dbms_system.ksdwrt(2, 'The command "delete noprompt archivelog all" was successfully executed by the script del_arch.sh.');
exec dbms_system.ksdwrt(2, 'The command "crosscheck archivelog all" was successfully executed by the script del_arch.sh.');
exec dbms_system.ksdwrt(2, 'The command "delete noprompt expired archivelog all" was successfully executed by the script del_arch.sh.');
EOF
|
권한 부여
1
|
$ chmod u+x del_arch.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
$ sh del_arch.sh
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Jan 13 10:15:46 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORACLE19 (DBID=3371275020)
RMAN>
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=275 device type=DISK
List of Archived Log Copies for database with db_unique_name ORACLE19
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - -------------------
186 1 186 A 2024/01/12 17:05:21
Name: /oradata1/arch/oracle19_1_186_1191078862.arc
187 1 187 A 2024/01/12 17:15:04
Name: /oradata1/arch/oracle19_1_187_1191078862.arc
188 1 188 A 2024/01/12 17:20:31
Name: /oradata1/arch/oracle19_1_188_1191078862.arc
deleted archived log
archived log file name=/oradata1/arch/oracle19_1_186_1191078862.arc RECID=186 STAMP=1192900507
deleted archived log
archived log file name=/oradata1/arch/oracle19_1_187_1191078862.arc RECID=187 STAMP=1192900834
deleted archived log
archived log file name=/oradata1/arch/oracle19_1_188_1191078862.arc RECID=188 STAMP=1192901166
Deleted 3 objects
RMAN>
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=275 device type=DISK
specification does not match any archived log in the repository
RMAN>
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=275 device type=DISK
specification does not match any archived log in the repository
RMAN>
Recovery Manager complete.
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 13 10:15:49 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
PL/SQL procedure successfully completed.
SQL>
PL/SQL procedure successfully completed.
SQL>
PL/SQL procedure successfully completed.
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
|
alert log 확인
1
2
3
4
5
|
$ tail -300f /ORA19/app/oracle/diag/rdbms/oracle19/oracle19/trace/alert_oracle19.log
2024-01-13T10:15:49.310209+09:00
The command "delete noprompt archivelog all" was successfully executed by the script del_arch.sh.
The command "crosscheck archivelog all" was successfully executed by the script del_arch.sh.
The command "delete noprompt expired archivelog all" was successfully executed by the script del_arch.sh.
|
정상적으로 수행되었다는 로그까지 alert log에 남음
'ORACLE > Sql' 카테고리의 다른 글
오라클 19c 힌트 목록 확인 쿼리 (0) | 2024.02.05 |
---|---|
오라클 19c 테스트 시 사용하는 imsi 유저 생성 쿼리 (0) | 2024.02.05 |
오라클 19c 최근 ash event 확인 쿼리 (0) | 2024.01.19 |
오라클 19c 서버 기동시 db 자동실행 설정 스크립트 (0) | 2023.12.19 |
오라클 19c 기간별 세션 현황 확인 쿼리 (0) | 2023.07.29 |