RMAN進行資料表空間的備份和恢複

來源:互聯網
上載者:User

1、建立表空eygle

2、建立使用者eygle,隸屬於eygle資料表空間;賦予使用者DBA許可權

3、egyle使用者登入DB,建立表test_egyle

4、rman備份egyle資料表空間

RMAN> backup tablespace eygle tag="ey_first";

Starting backup at 15-FEB-14
using target database control file instead of recovery catalog    ----使用目標庫控制檔案替代恢複目錄
allocated channel: ORA_DISK_1   
channel ORA_DISK_1: SID=317 device type=DISK
channel ORA_DISK_1: starting full datafile backup set              ----啟動full資料檔案備份組
channel ORA_DISK_1: specifying datafile(s) in backup set        ----指定備份組中的資料檔案
input datafile file number=00029 name=/home/Oracle/oradata/temp/eygle.f      ----輸入資料檔案
channel ORA_DISK_1: starting piece 1 at 15-FEB-14
channel ORA_DISK_1: finished piece 1 at 15-FEB-14
piece handle=/home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2_.bkp tag=EY_FIRST comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-FEB-14

Starting Control File and SPFILE Autobackup at 15-FEB-14      ----庫結構發生變化時,controlfile和spfile將自動備份
piece handle=/home/oracle/app/flash_recovery_area/ORA11G/autobackup/2014_02_15/o1_mf_s_839597011_9hxygn23_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 15-FEB-14

6、sys使用者登入DB,修改資料表空間egyle狀態offline

SQL> alter tablespace eygle offline;

7、破壞資料表空間egyle對應資料檔案,如刪除或改名

oracle@linux:~/oradata/temp> mv eygle.f eygle_bak.f

8、修改資料表空間egyle狀態online,報錯

SQL> alter tablespace eygle online;
alter tablespace eygle online
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 29 - see DBWR trace file
ORA-01110: data file 29: '/home/oracle/oradata/temp/eygle.f'

9、rman恢複

RMAN> restore tablespace eygle;    將備份檔案恢複到原先位置

Starting restore at 15-FEB-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=261 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00029 to /home/oracle/oradata/temp/eygle.f
channel ORA_DISK_1: reading from backup piece /home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2_.bkp
channel ORA_DISK_1: piece handle=/home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2_.bkp tag=EY_FIRST
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-FEB-14

RMAN> recover tablespace eygle;    執行恢複操作

Starting recover at 15-FEB-14
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 15-FEB-14

10、檢驗恢複結果

SQL> alter tablespace eygle online;

Tablespace altered.

推薦閱讀:

RMAN 配置歸檔日誌刪除策略

Oracle基礎教程之通過RMAN複製資料庫

RMAN備份策略制定參考內容

RMAN備份學習筆記

OracleDatabase Backup加密 RMAN加密

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.