備份及還原單一Tablespace



RMAN備份
-----------------------------------------------------------------------------------------

# rman target / nocatalog

RMAN> run {
2> allocate channel c1 type disk;
3> backup format 'd:/rman_back/tab_back_%u_%u_%p'
4> tablespace testback;
5> release channel c1;
6> }

RMAN> show all;

RMAN> exit




RMAN還原
-----------------------------------------------------------------------------------------

查詢需要修復的TABLE,我們要找的是FILE#,也可以使用FILE NAME

在修復之前,最好把該DATAFILE OFFLINE

SQL>alter database datafile '資料檔名' offline;

SQL> select * from v$recover_file;

FILE#  ONLINE         ONLINE_STATUS     ERROR                            CHANGE#   TIME
    6         ONLINE         ONLINE                     FILE NOT FOUND          0

RMAN> run{
2> allocate channel c1 type disk;
3> restore datafile 6;
4> recover datafile 6;
5> release channel c1;
6> }