생계/백업복구2023. 2. 23. 17:09

전통적 테이블복구방식
recover table 명령
개념
undo, 해당 datafile, archive 을 자동 restore
dump로 떨구기

모니터링
어느시점의 백업을 쓰는가

어느시점의 아카이브를 적용중인가

-- rman table backup test
* archive mode
@testdb

1) setting 
rman target / 
backup database;

drop table oraadm.rman_test purge;
create table oraadm.rman_test(a int, b timestamp);

2) dml & arch

set time on

insert into oraadm.rman_test(a,b) values(1,systimestamp);
insert into oraadm.rman_test(a,b) values(2,systimestamp);
insert into oraadm.rman_test(a,b) values(3,systimestamp);
insert into oraadm.rman_test(a,b) values(4,systimestamp);
insert into oraadm.rman_test(a,b) values(5,systimestamp);

alter system switch logfile;
alter system switch logfile;
alter system switch logfile;

commit;

select count(*) from oraadm.rman_test;

select systimestamp from dual;

3) human error

insert into oraadm.rman_test(a,b) values(6,systimestamp);
insert into oraadm.rman_test(a,b) values(7,systimestamp);

-- human error
delete from oraadm.rman_test;

commit;

select count(*) from oraadm.rman_test;

4) restore & recover

backup database plus archivelog;

/* ##### init ora ###############
db_name=TESTDB
db_unique_name=AUX_TESTDB
compatible=19.0.0
db_block_size=8192
db_files=3000
diagnostic_dest=/oralog
_system_trig_enabled=FALSE
sga_target=2194M
processes=200
db_create_file_dest=+RECO_DG
log_archive_dest_1='location=+RECO_DG'
max_string_size=EXTENDED
############################## */

SET AUXILIARY INSTANCE PARAMETER FILE TO '/xxx/initAUX.ora'

recover table oraadm.rman_test
until time "to_date('2023-02-23 15:49:30','YYYY-MM-DD HH24:MI:SS')"
AUXILIARY DESTINATION '+RECO_DG'
DATAPUMP DESTINATION '/dawork/TESTDB/dpdump'
DUMP FILE 'exp_rman_test.dmp'
NOTABLEIMPORT;

-- monitoring
select
from v$backup files
where tag like

select
from v$archived log
where archived yes
  and completion time > sysdate 1



impdp oraadm/oraadm \
job_name=imp_aux_t
DUMPFILE='exp_rman_test.dmp'
remap_table=RMAN_TEST:RMAN_TEST2
LOGFILE='imp_test.log'
DIRECTORY=DATA_PUMP_DIR
CONTENT=all
TABLE_EXISTS_ACTION=REPLACE

col b for a40
select * from oraadm.rman_test2;












반응형

'생계 > 백업복구' 카테고리의 다른 글

오라클 백업 복구 방식  (0) 2023.02.03
Posted by 돌고래트레이너