OracleDatabase Backup實驗筆記[不完整,內容亂]

來源:互聯網
上載者:User

標籤:mit   file   11.2   offline   commit   開始   資料庫   current   hang   

rman target / log=/orasoft/backup/${DATE}backup1.log <<EOF
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
backup database format ‘/orasoft/backup/db_%T%U.bak‘;
backup current controlfile format ‘/orasoft/backup/ctl_%T_%U‘;
backup spfile format ‘/orasoft/backup/spfile_%T_%U‘;
release channel c1;
release channel c2;
release channel c3;
}
EOF


#####實驗1

#建立測試資料
create table test1a(id int) tablespace users;
insert into test1a values (1);
select * from test1a;
commit;

#開始備份
alter tablespace users begin backup;
cp users01.dbf -t ~/backup/
alter tablespace users end backup;

#類比物理損壞
rm users01.dbf

#清記憶體(這條語句不太好使)
SQL> alter system flush buffer_cache;
alter system checkpoint;


#恢複備份檔案
cp ~/backup/users01.dbf -t ./

#恢複
alter tablespace users offline immediate;
recover tablespace users;
alter tablespace users online;

#恢複完成

select * from test1a;





#####實驗2

#備份
RMAN> backup tablespace users;
上面命令的備份檔案放到了如下路徑:
/home/zhang/app/zhang/product/11.2.0/dbhome_1/dbs

#恢複
[[email protected] zhang]$ rman target /
sql "alter tablespace users offline immediate";
RMAN> restore tablespace users;//現在資料庫還不能用,但是資料表空間的檔案已經恢複了
RMAN> recover tablespace users;
RMAN> sql "alter tablespace users online";  

#恢複完成




#####實驗3

#備份就是手工copy dbf檔案的方式備份(同實驗1)

#恢複
SQL> alter tablespace users offline immediate;
SQL> recover tablespace users;   
SQL> alter tablespace users online;

OracleDatabase Backup實驗筆記[不完整,內容亂]

聯繫我們

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