標籤: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實驗筆記[不完整,內容亂]