Phục hồi mysql bị rớt bảng

MƯU ĐÍCH

Các trường hợp sau sử dụng Table Point-in-time  Recovery trong 12c

  • Bảng hoặc phân vùng bị cắt bớt. Trong trường hợp này Flashback Table không giúp lấy lại dữ liệu của bảng do không có dữ liệu hoàn tác
  • Bảng thả với từ khóa thanh lọc hoặc phân vùng bị bỏ khi bảng đó, phân vùng không nằm trong thùng rác
  • Bảng hoặc phân vùng bị lỗi logic và không thể hoàn tác
  • Bảng hoặc phân vùng bị lỗi logic và cấu trúc của bảng hoặc phân vùng bị thay đổi

GIẢI PHÁP.  


Use Table point-int-time recovery, chi tiết như sữa


Backup cơ sở dữ liệu trước đó với RMAN


RMAN> run{
   2  backup database;
   3  backup archivelog all;
   4  }

Drop table emp with option purge, when that will not also in recyle_bin


SQL> drop table emp purge;

Table dropped.
Hoặc: SQL>  truncate table emp;

Thực hiện phục hồi dữ liệu tại thời điểm 15 phút trước


RMAN> recover table bing.emp until time 'sysdate - 15/1440' auxiliary destination '/u01/oracle/recover';

Starting recover at 17-MAR-16
using channel ORA_DISK_1
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='Yzeg'

initialization parameters used for automatic instance:
db_name=O37114KT
db_unique_name=Yzeg_pitr_O37114KT
compatible=12.1.0.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/oracle/recover
_system_trig_enabled=FALSE
sga_target=1024M
processes=200
db_create_file_dest=/u01/oracle/recover
log_archive_dest_1='location=/u01/oracle/recover'
#No auxiliary parameter file used
Performing import of tables...
   IMPDP> Master table "SYS"."TSPITR_IMP_Yzeg_jowq" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_Yzeg_jowq":
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   IMPDP> . . imported "BING"."EMP"                                5.476 KB       1 rows
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   IMPDP> Job "SYS"."TSPITR_IMP_Yzeg_jowq" successfully completed at Mon Sep 7 14:13:05 2015 elapsed 0 00:00:11
Import completed
Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/oracle/recover/O37114KT/datafile/o1_mf_temp_bytw2co8_.tmp deleted
auxiliary instance file /u01/oracle/recover/Yzeg_PITR_O37114KT/onlinelog/o1_mf_3_bytw4md4_.log deleted
auxiliary instance file /u01/oracle/recover/Yzeg_PITR_O37114KT/onlinelog/o1_mf_2_bytw4m1t_.log deleted
auxiliary instance file /u01/oracle/recover/Yzeg_PITR_O37114KT/onlinelog/o1_mf_1_bytw4lhq_.log deleted
auxiliary instance file /u01/oracle/recover/Yzeg_PITR_O37114KT/datafile/o1_mf_users_bytw4gos_.dbf deleted
auxiliary instance file /u01/oracle/recover/O37114KT/datafile/o1_mf_sysaux_bytvy598_.dbf deleted
auxiliary instance file /u01/oracle/recover/O37114KT/datafile/o1_mf_undotbs1_bytvy590_.dbf deleted
auxiliary instance file /u01/oracle/recover/O37114KT/datafile/o1_mf_system_bytvy59h_.dbf deleted
auxiliary instance file /u01/oracle/recover/O37114KT/controlfile/o1_mf_bytvxw4w_.ctl deleted
auxiliary instance file tspitr_Yzeg_10996.dmp deleted
Finished recover at 17-MAR-16

Kiểm tra lại bảng dữ liệu emp


SQL> select * from emp;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
      7939 DUKE       CEO                  17-NOV-81       5000                    10
      7949 PRINCE     CFO                  17-NOV-81       5000                    10
      7959 QUEEN      CIO                  17-NOV-81       5000                    10
      7869 JACK       PRESIDENT            17-NOV-81       5000                    10

18 rows selected.

SQL>

Hy vọng hữu ích cho bạn


============================================
* KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE trực tiếp từ tôi giúp bạn bước đầu trở thành những chuyên gia DBA, đủ kinh nghiệm đi thi chứng chỉ OA/OCP, đặc biệt là rất nhiều kinh nghiệm, bí quyết thực chiến trên các hệ thống Core
* REPOIN KÝ. Đi (. ) hoặc để quay lại số điện thoại hoặc hộp thư đến https. // m. me/travanbinh. vn hoặc Hotline/Zalo 090. 29. 12. 888
* Chi tiết tham khảo
https. //chút. ly/oaz_w
============================================
truy N ĐỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH
📧 Thư. binhoracle@gmail. com
☎️ Di động. 0902912888
⚡️ Skype. tranbinh48ca
👨Facebook. https. //www. Facebook. com/BinhOracleMaster
👨 Hộp thư đến Messenger. https. // m. tôi/101036604657441 (hồ sơ)
👨 Fanpage. https. //www. Facebook. com/tranvanbinh. vn
👨 Inbox Fanpage. https. // m. me/travanbinh. vn
👨👩 Nhóm FB. https. //www. Facebook. com/groups/DBAVietNam
👨 Trang web. https. //www. travanbinh. vn
👨Blogger. https. //tranvanbinhmaster. blogspot. com
🎬Youtube. http. //chút. ly/ytb_binhoraclemaster
👨 Tiktok. https. //www. tiki. com/@binhoraclemaster?lang=vi
👨 Liên kết. https. //www. linkin. com/trong/binhoracle
👨Twitter. https. //twitter. com/binhoracle
👨 Địa chỉ. Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP. hà nội

============================================
oracle 12c point-in-time recovery học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle