내맘대로긍정이 알려주는
Oracle 23ai 신기능
무료 세미나 발표자료
다운로드
trending_flat
OS환경 : Oracle Linux 7.6 (64bit)
DB 환경 : Oracle Database 11.2.0.4
방법 : 오라클 11g R2 rman output 이전 기록 확인
11g R2 환경에서 rman 으로 백업을 할 때 해당 로그를 남기려면
아래와 같은 방법으로 로그를 저장해야함
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
--https://positivemh.tistory.com/567의 스크립트
rman target / << EOF >> $BKDIR/rman_$date.log
run
{
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$BKDIR/%d_%U_FULL_database_%T.bk';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BKDIR/db_ctl_%F';
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
BACKUP AS BACKUPSET database PLUS ARCHIVELOG;
CROSSCHECK BACKUP;
DELETE NOPROMPT BACKUPSET COMPLETED BEFORE 'SYSDATE-7';
DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-8';
}
quit;
EOF
--https://positivemh.tistory.com/632의 스크립트
rman target / @C:\DBA\rman_backup.sql log=C:\backup\rman\rman_full_backup_%date:-=%.log
|
이 방법을 사용하지 않고 백업을 한 경우 db 내에서도 백업로그를 확인 할수있는 방법이 있음
v$rman_output 뷰를 확인하면됨
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
SQL> select * from v$rman_output;
SID RECID STAMP SESSION_RECID SESSION_STAMP OUTPUT
---------- ---------- ---------- ------------- ------------- ---------------------------------------------------
RMAN_STATUS_RECID RMAN_STATUS_STAMP SESSION_KEY
----------------- ----------------- -----------
70 1 1092477372 108 1092477372 connected to target database: ORCL (DBID=1448972421)
108 1092477372 108
70 2 1092477372 108 1092477372
108 1092477372 108
70 3 1092477375 108 1092477372
108 1092477372 108
70 4 1092477375 108 1092477372 Starting backup at 28-DEC-21
109 1092477375 108
70 5 1092477375 108 1092477372 using target database control file instead of recovery catalog
109 1092477375 108
70 6 1092477375 108 1092477372 allocated channel: ORA_DISK_1
|
이 뷰에는 time이 제대로 나오지 않음, stamp를 date로 변경할수 있다고 하는데 과정이 조금 힘듬
(https://blog.fearcat.in/a?ID=01450-97124500-068c-4fd2-aa97-8377abb30590)
v$rman_status 뷰와 조인하면 시간까지 정확히 알수있음
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
|
SQL> select to_char(rs.START_TIME,'yyyymmdd hh24:mi:ss') start_ime, ro.output
from v$rman_output ro, v$rman_status rs
where ro.stamp = rs.stamp; 2 3
START_IME OUTPUT
----------------- ----------------------------------------------------------------------------------------------------------------------------------
20211228 09:56:12 connected to target database: ORCL (DBID=1448972421)
20211228 09:56:12
20211228 09:56:15
20211228 09:56:15 Starting backup at 28-DEC-21
20211228 09:56:15 using target database control file instead of recovery catalog
20211228 09:56:15 allocated channel: ORA_DISK_1
20211228 09:56:15 channel ORA_DISK_1: SID=197 device type=DISK
20211228 09:56:15 channel ORA_DISK_1: starting full datafile backup set
20211228 09:56:15 channel ORA_DISK_1: specifying datafile(s) in backup set
20211228 09:56:15 input datafile file number=00004 name=/app/oracle/oradata/orcl/users01.dbf
20211228 09:56:15 input datafile file number=00001 name=/app/oracle/oradata/orcl/system01.dbf
20211228 09:56:15 input datafile file number=00003 name=/app/oracle/oradata/orcl/undotbs01.dbf
20211228 09:56:15 input datafile file number=00002 name=/app/oracle/oradata/orcl/sysaux01.dbf
20211228 09:56:15 input datafile file number=00005 name=/app/oracle/oradata/orcl/allnew01.dbf
20211228 09:56:15 channel ORA_DISK_1: starting piece 1 at 28-DEC-21
20211228 09:56:40 channel ORA_DISK_1: finished piece 1 at 28-DEC-21
20211228 09:56:40 piece handle=/app/rman/Full_ORCL_51_20211228.bs tag=TAG20211228T095615 comment=NONE
20211228 09:56:40 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
20211228 09:56:40 Finished backup at 28-DEC-21
20211228 09:56:40
20211228 09:56:40 Starting Control File and SPFILE Autobackup at 28-DEC-21
20211228 09:57:43
20211228 09:57:43 using channel ORA_DISK_1
|
정상적으로 rman log가 나옴
최근 데이터만 보고싶은 경우
start_time 기준으로 30분전, 1시간전 이후에 백업된 내역만 확인
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
|
SQL>
select to_char(rs.START_TIME,'yyyymmdd hh24:mi:ss') start_ime, ro.output
from v$rman_output ro, v$rman_status rs
where ro.stamp = rs.stamp
--and start_time >= sysdate-1/24 --1시간전 이후로 백업된내용 확인
and start_time >= sysdate-1/24*0.5; --30분전 이후로 백업된내용 확인
START_IME OUTPUT
----------------- ----------------------------------------------------------------------------------------------------------------------------------
20211228 10:50:34
20211228 10:50:34 using channel ORA_DISK_1
20211228 10:50:34 specification does not match any backup in the repository
20211228 10:50:34
20211228 10:50:40
20211228 10:50:40 Starting backup at 28-DEC-21
20211228 10:50:40 using channel ORA_DISK_1
20211228 10:50:40 channel ORA_DISK_1: starting full datafile backup set
20211228 10:50:40 channel ORA_DISK_1: specifying datafile(s) in backup set
20211228 10:50:40 input datafile file number=00004 name=/app/oracle/oradata/orcl/users01.dbf
20211228 10:50:40 input datafile file number=00001 name=/app/oracle/oradata/orcl/system01.dbf
20211228 10:50:40 input datafile file number=00003 name=/app/oracle/oradata/orcl/undotbs01.dbf
20211228 10:50:40 input datafile file number=00002 name=/app/oracle/oradata/orcl/sysaux01.dbf
20211228 10:50:40 input datafile file number=00005 name=/app/oracle/oradata/orcl/allnew01.dbf
20211228 10:50:40 channel ORA_DISK_1: starting piece 1 at 28-DEC-21
20211228 10:50:47 channel ORA_DISK_1: finished piece 1 at 28-DEC-21
20211228 10:50:47 piece handle=/app/rman/Full_ORCL_55_20211228.bs tag=TAG20211228T105040 comment=NONE
20211228 10:50:47 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
20211228 10:50:47 Finished backup at 28-DEC-21
20211228 10:50:47
20211228 10:50:47 Starting Control File and SPFILE Autobackup at 28-DEC-21
21 rows selected.
|
*11gR2 기준으로 v$rman_output 뷰는 32768개 row만 저장할수있음
row 제한으로 인해 너무 오래된 로그는 나오지 않음
참조 :
https://docs.oracle.com/cd/E18283_01/server.112/e17110/dynviews_2148.htm
https://docs.oracle.com/cd/E11882_01/server.112/e40402/dynviews_2149.htm
'ORACLE > Backup&Recover' 카테고리의 다른 글
오라클 19c rman 접속하는 몇가지 방법 (0) | 2023.01.25 |
---|---|
Oracle 19c rac to single clone db 생성 가이드 (0) | 2022.02.07 |
오라클 11g R2 RAC PSU 패치전 백업 가이드 (0) | 2021.10.20 |
오라클 11g R2 GRID OLR 백업 복구 (0) | 2021.10.20 |
오라클 11g R2 XML데이터 update 로그마이너 복구 테스트 (0) | 2021.10.06 |