Oracle Database Backup Lab Note [incomplete, content messy]

Source: Internet
Author: User

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]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.