Rman Demo Recovery Table Point in time Oracle database 19c

Các bước thực hiện:

  • Database phải trong chế độ Archivelog mode
  • Tạo dữ liệu test
  • Xoá và recover table
  • Test dữ liệu

Tạo dữ liệu test:

create user duong identified by "oracle" default tablespace users temporary tablespace temp profile default account unlock;

grant create session, create table to duong;

alter user duong quota 500M on users;

create table duong.tab1(id number);

## Thêm data vào table

begin 
for i in 1 .. 100000 loop 
insert into duong.tab1 values(i); 
end loop;

commit; 
end; 
/

select count(*) from duong.tab1;

alter session set nls_date_format = 'dd-mm-yyyy hh24:mi:ss';

select to_char (sysdate, 'dd-mm-yyyy hh24:mi:ss') "now" from dual;

word image 1519 1

Thực hiện backup database:

sqlplus / as sysdba

archive log list

rman target /

backup database plus archivelog ;

Xoá table:

drop table duong.tab1;

select * from duong.tab1;

RMAN> select * from duong.tab1;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of sql statement command at 05/11/2024 11:55:59

ORA-00942: table or view does not exist

Recover table:

Tạo thư mục lưu trữ tạm thời trong quá trình recovery: (quan trọng)

mkdir -p /u01/backup;

Tiến hành recover:

rman target /

recover table duong.tab1 until time "to_date('11-05-2024 12:44:46', 'dd-mm-yyyy hh24:mi:ss')" auxiliary destination '/u01/backup';

word image 1519 2

Check dữ liệu sau khi recover:

select count(*) from duong.tab1;

Chúc các bạn thành công.

 

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest

0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận