Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

81

积分

0

好友

4

主题
1#
发表于 2013-10-10 12:51:36 | 查看: 4806| 回复: 3

当主备库lag很大时,通常采用增量备份主库然后在备库recover noredo解决。
问题:
1
以下命令的工作原理是什么,  如何获取从指定SCN起所有的data change,仅依靠archive logs吗? 可假定需要从30天前开始备份而archive log只有最近2天的,不是照样可以成功吗?
BACKUP INCREMENTAL FROM SCN <SCN from previous step> DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY'
2
recover noredo的恢复原理, oracle是如何直接将data change直接应用于datafile?
2#
发表于 2013-10-10 16:39:30
odm finding:

• NOREDO: The NOREDO option is used to signal RMAN that redo logs should not be

applied during the recovery phase of the duplication operation. This option should be

specified when the database was in NOARCHIVELOG mode at the time of the backup or

when the archived redo log files are not available for use during the duplication

operation. This option is appropriate if a database that is currently in ARCHIVELOG

mode is being duplicated to a point-in-time when it was in NOARCHIVELOG mode.

If you are performing a targetless DUPLICATE and the database is in NOARCHIVELOG

mode you must use this option to inform RMAN of the database mode. Without a

connection to the target database, RMAN cannot determine the mode.

回复 只看该作者 道具 举报

3#
发表于 2013-10-10 16:58:27
[oracle@vrh8 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Oct 10 16:51:28 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: G10R21 (DBID=2864536750)

RMAN> backup database;

Starting backup at 10-OCT-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf
input datafile fno=00003 name=/s01/oradata/G10R21/datafile/o1_mf_sysaux_912v4jh0_.dbf
input datafile fno=00005 name=/s01/oradata/G10R21/datafile/o1_mf_example_912v5pkl_.dbf
input datafile fno=00002 name=/s01/oradata/G10R21/datafile/o1_mf_undotbs1_912v4jj6_.dbf
input datafile fno=00004 name=/s01/oradata/G10R21/datafile/o1_mf_users_912v4jjb_.dbf
channel ORA_DISK_1: starting piece 1 at 10-OCT-13
channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnndf_TAG20131010T165131_95dtnmsz_.bkp tag=TAG20131010T165131 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 10-OCT-13
channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_ncsnf_TAG20131010T165131_95dtoq8q_.bkp tag=TAG20131010T165131 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 10-OCT-13

RMAN>

RMAN> backup incremental level 0 database;

Starting backup at 10-OCT-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf
input datafile fno=00003 name=/s01/oradata/G10R21/datafile/o1_mf_sysaux_912v4jh0_.dbf
input datafile fno=00005 name=/s01/oradata/G10R21/datafile/o1_mf_example_912v5pkl_.dbf
input datafile fno=00002 name=/s01/oradata/G10R21/datafile/o1_mf_undotbs1_912v4jj6_.dbf
input datafile fno=00004 name=/s01/oradata/G10R21/datafile/o1_mf_users_912v4jjb_.dbf
channel ORA_DISK_1: starting piece 1 at 10-OCT-13

channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd0_TAG20131010T165252_95dtq4ml_.bkp tag=TAG20131010T165252 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 10-OCT-13
channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_ncsn0_TAG20131010T165252_95dtqxq6_.bkp tag=TAG20131010T165252 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-OCT-13

RMAN>
RMAN> alter system switch logfile;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "clone, database"
RMAN-01008: the bad identifier was: system
RMAN-01007: at line 2 column 7 file: standard input

RMAN> sql 'alter system switch logfile';

sql statement: alter system switch logfile

RMAN> sql 'alter system switch logfile';

sql statement: alter system switch logfile

RMAN> backup incremental level 1 database;

Starting backup at 10-OCT-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf
input datafile fno=00003 name=/s01/oradata/G10R21/datafile/o1_mf_sysaux_912v4jh0_.dbf
input datafile fno=00005 name=/s01/oradata/G10R21/datafile/o1_mf_example_912v5pkl_.dbf
input datafile fno=00002 name=/s01/oradata/G10R21/datafile/o1_mf_undotbs1_912v4jj6_.dbf
input datafile fno=00004 name=/s01/oradata/G10R21/datafile/o1_mf_users_912v4jjb_.dbf
channel ORA_DISK_1: starting piece 1 at 10-OCT-13
channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd1_TAG20131010T165350_95dtryz1_.bkp tag=TAG20131010T165350 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 10-OCT-13
channel ORA_DISK_1: finished piece 1 at 10-OCT-13
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_ncsn1_TAG20131010T165350_95dts23d_.bkp tag=TAG20131010T165350 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-OCT-13

RMAN>

RMAN>

RMAN>  sql 'alter system switch logfile';

sql statement: alter system switch logfile

RMAN> shutdown abort;

Oracle instance shut down

RMAN> startup mount;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     356515840 bytes

Fixed Size                     2020736 bytes
Variable Size                339741312 bytes
Database Buffers               8388608 bytes
Redo Buffers                   6365184 bytes

RMAN> restore database;

Starting restore at 10-OCT-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf
restoring datafile 00002 to /s01/oradata/G10R21/datafile/o1_mf_undotbs1_912v4jj6_.dbf
restoring datafile 00003 to /s01/oradata/G10R21/datafile/o1_mf_sysaux_912v4jh0_.dbf
restoring datafile 00004 to /s01/oradata/G10R21/datafile/o1_mf_users_912v4jjb_.dbf
restoring datafile 00005 to /s01/oradata/G10R21/datafile/o1_mf_example_912v5pkl_.dbf
channel ORA_DISK_1: reading from backup piece /s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd0_TAG20131010T165252_95dtq4ml_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd0_TAG20131010T165252_95dtq4ml_.bkp tag=TAG20131010T165252
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 10-OCT-13


RMAN> recover database noredo;

Starting recover at 10-OCT-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf
destination for restore of datafile 00002: /s01/oradata/G10R21/datafile/o1_mf_undotbs1_912v4jj6_.dbf
destination for restore of datafile 00003: /s01/oradata/G10R21/datafile/o1_mf_sysaux_912v4jh0_.dbf
destination for restore of datafile 00004: /s01/oradata/G10R21/datafile/o1_mf_users_912v4jjb_.dbf
destination for restore of datafile 00005: /s01/oradata/G10R21/datafile/o1_mf_example_912v5pkl_.dbf
channel ORA_DISK_1: reading from backup piece /s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd1_TAG20131010T165350_95dtryz1_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/s01/flash_recovery_area/G10R21/backupset/2013_10_10/o1_mf_nnnd1_TAG20131010T165350_95dtryz1_.bkp tag=TAG20131010T165350
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 10-OCT-13



==> noredo 直接restore 了增量备份



RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 10/10/2013 16:55:55
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/s01/oradata/G10R21/datafile/o1_mf_system_912v4jgt_.dbf'

回复 只看该作者 道具 举报

4#
发表于 2013-10-10 17:01:44
以下命令的工作原理是什么,  如何获取从指定SCN起所有的data change,仅依靠archive logs吗?

==》不需要 

有一道经典的 ocp 试题

在有level 0 backup 和level 1 backup 和 所有归档日志的情况下  restore full database后 recover的过程是如何的 你可以去看一下

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-6-1 22:48 , Processed in 0.049756 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569