最近为了不影响开发库的使用,打算复制创建一个备库,定时更新,防止开发库不能使用的情况下,可以临时使用备库,不影响进度。
环境:
11.2.0.4的单实例库。
库1是源库(target),库2是备库(auxiliary)
操作过程:
1.库1执行全库备份
2.库1备份控制文件
3.将备份集(1)拷贝到库2相同路径下,即/home/oracle/duplicate,此时产生了三个文件:
4.将库1的inittest.ora参数文件拷贝到库2,并按照其中配置的控制文件路径,将库1的控制文件(2)可以直接copy到库2对应路径下,包括文件名需要保持和参数文件总定义一致:
创建文件夹:
5.库2启动nomount状态
6.库2执行恢复
报错提示数据库需要置为mount状态。
7.库2置为mount状态
8.库2执行恢复
9.库2执行打开
报错提示需要使用RESETLOGS或NORESETLOGS。
10.库2执行打开
依旧报错,提示:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: ‘/u01/app/oracle/11.2.0.4/oradata/dep/system01.dbf’
查看这两个报错:
[oracle@testvm001 dbs]$ oerr ora 1152 01152, 00000, “file %s was not restored from a sufficiently old backup ” *Cause: An incomplete recovery session was started, but an insufficient number of logs were applied to make the database consistent. This file is still in the future of the last log applied. The most likely cause of this error is forgetting to restore the file from a backup before doing incomplete recovery. *Action: Either apply more logs until the database is consistent or > restore the database file from an older backup and repeat recovery. [oracle@testvm001 dbs]$ oerr ora 1110 01110, 00000, “data file %s: ‘%s’” *Cause: Reporting file name for details of another error. The reported name can be of the old file if a data file move operation is in progress. *Action: See associated error message.
11.库2执行recover
提示需要sequence=745号的archivelog
12.查看备份集中归档文件al_t902681874_s12_p1的sequence是12。
13.再次执行恢复
对应alert日志:
14.开启库2
15.登录库2,用户、对象等信息和库1完全一致。
总结:
1.RMAN执行restore需要数据库置于mount状态。
2.可以先将target的control控制文件拷贝到auxiliary库相同路径下,需要注意参数文件中定义的控制文件路径以及其他文件夹均需要提前在auxiliary库中创建,如果提前将控制文件拷贝到auxiliary库对应路径下,则无需restore control,相当于已经做了这不操作。
3.resetlogs提示ORA1152错误,需要进行相应归档日志的恢复,根据拷贝过来的归档日志文件名推算seq号。