RMAN 回炉
redo :
记录的数据库存的所有历史变更,它包含数据文件的所有变更,但不包含参数文件和控制 文件,其主要应用:
实例恢复/日志挖掘/oracle 流复制/oracle dataguard
undo:
rollback/data recover/read consistency/flashback
resetkigs 与 noresetlogs
alter database open resetlogs;
alter database open noresetlogs;
resetlogs 将导致online logs里的内容丢失,并脯所有的备份失效,仅当online logs损坏的情况下,才使用resetlogs 模式.
做不完全恢复必须使用resetlogs ,resetlogs 也可以做完全恢复.
noresetlogs则是必须做完全恢复时使用. 会重置日志序列号强制清空或重建REDO,而noresetlogs 则不会这么做
rman recover manager:主要用来备份,还原和恢复,可以实现基于数据库级别,表空间级别,文件级别完全恢复和不完全恢复.
用来备份恢复数据库的数据文件,归档日志,控制文件以及参数文件及整个数据库的备份恢复工具.同时也可以用来执行完全备份恢复.
不完全备份恢复,通过计划任务实现自动的定时的最优化的备份恢复方案.
可以自动检测新的数据文件
支持增量备份
最大限度的减少备份和恢复的错误,减少恢复的时间
在热备中不会产生REDO日志.
自动检测损坏的数据块,并跳过.
并行备份,
在线备份不影响业务的正常运转
在非归档模式下,RMAN只能在mount状态进行备份与恢复.
nocatalog 用control file 作为catalog,每一次备份都要往控制文件里面写好多备份信息,控制文件里面会有越来越多的备份信息,因些,使用nocatlog方式备份时,备份controlfile 是非常重要的
1.建立ORACLE 运行环境(包括PFILE或SPFILE文件)
2.文件方式恢复CONTROLFILE 到INIT文件指定的位置
3.STARTUP MOUNT
4.RMAN ,RESTORE DATAFILE
5. ALTER DATABASE OPEN RESETLOGS
example: backup database format '/oracle/D4C/backup/D4CDB_FULL_%s_%p+^H_%t';
backup spfile format '/oracle/D4C/backup/D4CDB_spfile_%d_%U';
backup controlfile format '/oracle/D4C/backup/D4CDB_ctl_%d_%U';
backup archivelog all delete input format '/oracle/D4C/backup/D4CDB_log_%d_%U';
restore database;
recover database until time '2020-06-12 22:40:00';
restore datafile 8;
recover datafile 8;
alter database datafile 8 online;
alter database open;
startup nomount force;
restore spfile;
set DBID=1232132
restore spfile FROM AUTOBACKUP;
restore spfile from '/oracle/D4C/backup/D4CDB_spfile_%d_%U';
set DBID=1232132
restore controlfile from autobackup;
recover database;
alter database open RESETLOGS;
catalog 恢复目录存储的是与RMAN备份有关的元数据.恢复目录可以看做是保存RMAN备份和恢复所需的相关信息的副本.
1.建立ORACLE 运行环境(包括PFILE或SPFILE文件)
2.RMAN恢复CONTROLFILE(startup nomount)
3.ALTER DATABASE MOUNT
4.RMAN ,RESTORE DATAFILE
5. ALTER DATABASE OPEN RESETLOGS
create tablespace remantbs datafile '/oracle/D4C/oradata/rman.dbf' size 100m;
grant connect,resource,recovery_catalog_owner to C##SAPR3;
rman catalog C##SAPR3/123456
create catalog tablespace remantbs;
rman target / catalog C##SAPR3/123456
rman catalog C##rman/rman target /
create user C##rman identified by rman default tablespace remantbs temporary tablespace temp quota unlimited on remantbs;
register database;
upgrade catalog;
unregister database;
show all;
list backup summary
list backup
list expired backup
list incarnation
list backup of spfile
list backup of controlfile
list backup of datafile n,n,n,nocatalog
list backup of archivelog all
list backup of archivelog {all,from,high,like,logseq,low,scn,sequence,time,until}
REPORT
report schema
report obsolete
report unrecoverable
report need backup
configure
show all;
configure 可以配置保存策略,备份优化,设备,控制文件,并行数,生成备份副本,排除选项,备份集大小
backup
backup database
backup validate database
backup tablespace
backup datafile 5
backup archivelog all
backup current controlfile
backup incremental level=0 database
backup incremental level=1 database
backup incremental level=2 cumulative database
set rman session setting
crosscheck
crosscheck backup
crosscheck archive1og
crosscheck copy
crosscheck datafilecopy
validate
change
delete
restore
restore database
restore controlfile
restore spfile
restore tablespace
restore datafile
restore database until time
restore database until SCN
restore database until sequence
restore archivelog all;
recover
recover database
recover tablespace
recover datafile
recover database until time
recover database until SCN
recover database until sequence
switch
blockrecover
convert
duplicate database to test1 from active database nofilenamecheck
backup as compressed backupset full database format '/oracle/app/oracle/rmanback/full_bk1_%u%p%s.rmn'
configure ENCRYPTION FOR database on
set encryption on
list failure
advise failure
repair failure
alter database enable block change tracking using file '/home/oracle/block.tr';