Oracle rman备份还原
  biE3E3UjTjeg 2024年01月22日 18 0

  备份脚本:

oracle备份fullbak.sh 脚本

. /u01/prod/db/12.1.0/PROD_erpdbp.env

LOGDATE="`date '+%Y%m%d'`"

#delete backup logfile

find /u01/backup/log -mtime +360 |xargs rm -f

rman target / cmdfile=/u01/backup/scripts/fullbak.rman log=/u01/backup/log/fullbak_$LOGDATE.log

 

rman备份脚本fullbak.rman:

run{
sql 'alter system archive log current';
      allocate channel ch1 type disk;
      allocate channel ch2 type disk;
      allocate channel ch3 type disk;
      backup as compressed backupset incremental level 0 database format '/u01/backup/data/db_%d_%T_%U.bak' plus archivelog format '/u01/backup/data/arch_%d_%T_%U.bak' delete all input; 
      CONFIGURE CONTROLFILE AUTOBACKUP on; 
      release channel ch1;
      release channel ch2;
      release channel ch3;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete expired archivelog all;
report obsolete;
delete noprompt obsolete;
}

RMAN 还原:

查看oracle的控制文件备份信息:

list backup of controlfile;

用rman恢复数据:

1,startup nomount;
 2,set dbid= 365215955;
 3,restore controlfile from '/u01/bak/db_PROD_20190807_41u8j1iv_1_1.bak';
 4,startup mount;
5,catalog start with '/u01/bak/';
 6,restore database
 7,recover database;
 8,alter database open resetlogs;

365215955

 

recover database until scn 5971330707288;

 

create undo tablespace undotb2 datafile '/u01/prod/db/data/undotb12.dbf' 

size 1024M autoextend on next 10M maxsize 12048M;

 

提示错误:

ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type

 

强制打开数据库:

startup force;

重新创建undo表空间

create undo tablespace undotb2 datafile '/u01/prod/db/data/undotb12.dbf' size 1024M autoextend on next 10M maxsize 12048M

在设置spfile文件

alter system set undo_tablespace=undotb2 scope=spfile;

修改undo的管理模式

alter system set undo_management=auto scope=spfile;

创建undo的表空间文件

create undo tablespace undotb2 datafile '/u01/prod/db/data/undotb12.dbf' size 1024M autoextend on next 10M maxsize 12048M



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2024年01月22日 0

暂无评论

推荐阅读
biE3E3UjTjeg