使用 DMRMAN 工具进行数据库还原,根据数据库备份集、数据库的归档日志,可将数据恢复到原数据库最新状态。还原恢复数据库时可采用主机数据库备份+备机归档日志或备机数据库备份+主机归档日志,均可实现恢复数据库。利用主备机的备份文件、归档日志交叉进行数据库还原恢复时,唯一需要注意的是把数据库备份文件和归档日志文件 copy 到同一台机器上来进行。
此例子采用的是主机数据库备份,备机归档备份来还原恢复数据库,详细步骤如下:
disql /nolog
SQL>conn SYSDBA/SYSDBA@10.1.242.169:5236
SQL>CREATE TABLE T1(C1 VARCHAR(20),C2 VARCHAR(20));
SQL>INSERT INTO T1 SELECT LEVEL,LEVEL+1 FROM DUAL CONNECT BY LEVEL<=10000;
SQL>COMMIT;
SQL>BACKUP DATABASE BACKUPSET 'db_bak_01';
SQL>SELECT SF_BAKSET_CHECK('DISK','/dbbak/CNDT/db_bak_01');
SQL>INSERT INTO T1 SELECT LEVEL,LEVEL+1 FROM DUAL CONNECT BY LEVEL<=10000;
SQL>COMMIT;
SQL>conn SYSDBA/SYSDBA@10.1.242.170:5236
SQL>BACKUP ARCHIVE LOG ALL BACKUPSET 'arch_bak_01';
SQL>SELECT SF_BAKSET_CHECK('DISK','/dbbak/CNDT/arch_bak_01');
dmrman
RMAN>restore archive log from backupset '/dbbak/CNDT/arch_bak_01' to archivedir '/arch/all'
dmrachk arch_fil=/arch/all/ ARCHIVE_LOCAL1_20160519194834438.log
rachk V7.1.5.81-Build(2016.05.10-68432trunc-debug)
/*******************************************************************/
archive file ARCHIVE_LOCAL1_20160519194834438.log itemize.
arch_status : INACTIVE
arch n_rpags : 992
arch_db_magic : 1463364211
arch_pemnt_magic : 1463364245
arch_next_seq : 12669
arch_lsn : 34548
arch_seq : 11678
clsn : 40135
rarch file len : 512000
rarch file free: 512000
rarch create time : 2016- 5-19 19:48:34
rarch close time : 2016- 5-19 19:55:12
/*******************************************************************/
The SUMMARY:
total files: 1
okey files: 1
fail file: 0
the rachk tool running cost 0.901 ms
dmrman
RMAN>restore database to '/dbdata/all' from backupset '/dbbak/CNDT/db_bak_01'
RMAN>recover database '/dbdata/all/dm.ini ' with archivedir '/arch/all' use db_magic 1463364211
./dmserver /dbdata/all/dm.ini mount
disql /nolog
SQL>conn SYSDBA/SYSDBA@localhost:5236
SQL>ALTER DATABASE NORMAL;
SQL>ALTER DATABASE OPEN FORCE;
SQL>SELECT COUNT(*) FROM T1;
–结果集为 20000
文章
阅读量
获赞