(一)数据库备份
备份前需要关闭全部应用,并进行数据库checkpoint和crchive log current操作,数据库无外部程序链接的前提下进行全备,确保数据库一致性。
备份恢复详细操作步骤如下:
lsnrctl stop
export ORACLE_SID=oracle11
sqlplus /nolog
conn / as sysdba
alter system checkpoint;
alter system archive log current
exit
rman target /
backup database format '/home/oracle/rman/%U'
exit
lsnrctl start
等待10分钟左右数据库备份完毕(根据库的大小而定),备份集在/oracle/rman目录下
(二)数据库恢复
数据库在备份前关闭所有应用进行全库备份,因此进行回退恢复时无需恢复归档日志,直接通过备份集进行回退恢复即可,
su - oracle
export ORACLE_SID=oracle11
rman target /
shutdown immediate
startup mount
restore database
alter database open
提示:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/app/oracle/oradata/oracle11/system01.dbf'
RECOVER DATAFILE '/app/oracle/oradata/oracle11/system01.dbf'
recover tablespace system;
RECOVER DATABASE;
ALTER DATABASE OPEN;(完成恢复)