Thứ Bảy, 19 tháng 2, 2022

Drop table có thể khôi phục được và drop partition không khôi phục được

Mục đích: Demo sự khác nhau giữa drop table và drop partition, lưu ý:
- Drop partition thì mất luôn vì không nằm trong recycle_bin
- Drop table: Nếu tham số recyclebin=on và khi drop table không để PURGE thì bảng đó vẫn ở trong recycle_bin dạng BIN$$

CHI TIẾT MỌI NGƯỜI THAM KHẢO:
$ sqlplus / as sysdba
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> CREATE TABLE list_part (
  2  deptno          NUMBER(10),
  3  deptname        VARCHAR2(20),
  4  quarterly_sales NUMBER(10,2),
  5  state           VARCHAR2(2))
  6  PARTITION BY LIST (state) (
  7  PARTITION q1_northwest VALUES ('OR', 'WA') ,
  8  PARTITION q1_southwest VALUES ('AZ', 'CA', 'NM') ,
  9  PARTITION q1_northeast VALUES ('NY', 'VT', 'NJ') ,
 10  PARTITION q1_southeast VALUES ('FL', 'GA') ,
 11  PARTITION q1_northcent VALUES ('MN', 'WI') ,
 12  PARTITION q1_southcent VALUES ('OK', 'TX') );

Table created.

SQL> purge recyclebin;

Recyclebin purged.

SQL> alter table list_part drop partition q1_northwest;

Table altered.

SQL> show recyclebin

SQL> select * from recyclebin;

no rows selected
SQL> select tablespace_name from user_segments where segment_name='LIST_PART';

TABLESPACE_NAME
------------------------------
EXAMPLE
EXAMPLE
EXAMPLE
EXAMPLE
EXAMPLE

SQL> drop table list_part;

Table dropped.

SQL> show recyclebin
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
LIST_PART        BIN$l0dkDfnoQcqhuMK+PJGkwg==$0 TABLE        2008-10-09:15:29:30
-- Để khôi phục lại bảng đã xóa ta sử dụng câu lệnh
SQL> flashback table LIST_PART before drop;
=============================
* 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í kíp thực chiến trên các hệ thống Core tại VN chỉ sau 1 khoá học.
* CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
* Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile: 0902912888
⚡️ Skype: tranbinh48ca
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: http://bit.ly/ytb_binhoraclemaster
👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi
👨 Linkin: https://www.linkedin.com/in/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

=============================
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 ở đầu, Khóa học Oracle online,khóa học pl/sql, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle weblogic, middleware, hoc solaris, hoc linux, hoc aix, unix, oracle oca, oracle ocp, oracle ocm

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master