使用 RMAN 备份Oracle数据库(6)

resync catalog)
3、create script back {
allocate channel n1 type disk;
backup database
format '/data/backup/ora8_%d_%s_%p';
release channel n1;}
4、如果是备份固定的文件或表空间也可以
create script back_file{
allocate channel n1 type disk;
copy 
datafile 4 to '/data/backup/users.dbf';
release channel n1;}
create script back_tablespace{
allocate channel m1 type disk;
backup tablespace users
format '/data/backup/users_%t_%s_%p';
release channel n1;}
使用copy就是文件镜像保存,使用backup就是用oracle专有的格式保存,支持压缩等等,此处就不细说了!
5、执行备份
run{execute script back;}
等等!
以上说了备份数据库,下面是恢复数据库
1、rman target sys/manager@ora8 catalog rman/rman@rman
2、run{
allcote channel n1 type disk;
sql "alter tablespce users offline immediate";
restore tablespace users;
recover tablespace users;
sql "alter tablespace user online";
release channel n1;}
3、run{
allocate channel n1 type disk;
restore database;
recover database;
sql "alter database open resetlogs";
release channel n1;}
4、run{
allocate channel n1 type disk;
restore datafile 4;
release channel n1;}

以上都是一些基本的rman操作,如有错误之处,希望被指出。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e4409bb422204e1dd4839f223b817ec5.html