使用 DMRMAN 工具进行数据库还原,根据数据库备份集、数据库的归档日志,可将数据恢复到数据库备份后的任意有效时间点。
此例子采用的是主机数据库备份,备机归档备份来还原恢复数据库,详细步骤如下:
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>SELECT SYSDATE();
–查询当前数据库时间并记录:‘2016-05-19 19:49:12’
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');
SQL>SELECT SYSDATE();
–查询当前数据库时间并记录:‘2016-05-19 19:55:12’
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 until time '2016-05-19 19:49:12'
./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;
–结果集为 10000
文章
阅读量
获赞