oracle資料庫的資源回收筒

來源:互聯網
上載者:User

標籤:style   color   ar   for   sp   資料   on   ad   ef   

對於oracle資料庫,為了保證資料的安全性,我們需要設定好資料庫的資源回收筒功能,預設這個功能是開啟的。我們可以通過以下步驟進行查看和修改

 

1 查看資料庫是否設定了資料庫的資源回收筒(recyclebin 功能)

 

show parameter recyclebin;

 

 

SQL> show parameter recyclebin;

 

NAME                                 TYPE        VALUE

------------------------------------ -----------  

recyclebin                           string      on

 

2 如果這個value 是on 則表示已經開啟的資源回收筒功能,如果是off狀態,則我們需要通過命令開啟資料庫的資源回收筒功能。

開啟和關閉recyclebin 的命令

開啟reclebin 命令

查看狀態

SQL> show parameter recyclebin;

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

recyclebin                           string      OFF

 

修改會on狀態,需要注意的是要指定scope=spfile,因為這個參數是不能再記憶體中修改的

SQL> alter system set recyclebin=on scope=spfile;

 

System altered

 

狀態已經修改,我們需要重啟資料庫使得參數生效

SQL> alter system set recyclebin=on scope=spfile;

 

System altered

 

 

 

3 關閉資料庫的資源回收筒功能(因為修改的是spfile,需要重啟資料庫才會生效)

SQL> alter system set recyclebin=on scope=spfile;

 

System altered

4 清空資源回收筒裡面的資料

 

清空資源回收筒裡面的所有資料

SQL> purge recyclebin;

 

Done

 

 

清空具體的一個表

SQL> purge table dept;

 

Done

 

 

 

5 資料還原功能(最重要的),開啟資料庫的資源回收筒功能就是防止誤刪除,可以進行資料的回收

 

flashback table BONUS to before drop;

 

重新命名的方式進行資料的還原

flashback table SALGRADE to before drop  rename to SALGRADE_bak;

 

 

修改資料庫中的表名

alter table SALGRADE_bak rename to SALGRADE

oracle資料庫的資源回收筒

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.