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
#清内存 (this statement is not very good)
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;
The backup file for the above command is placed in the following path:
/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;//Now the database is not available, but the tablespace file has been restored
rman> Recover tablespace users;
Rman> SQL "alter tablespace users online";
#恢复完成
# # # #实验3
Backup #备份就是手工copy dbf files (same as experiment 1)
#恢复
Sql> alter TABLESPACE users offline immediate;
sql> Recover tablespace users;
sql> alter tablespace users online;
Oracle Database Backup Lab Note [incomplete, content messy]