案例5:非归档模式 RMAN 备份恢复
此案例来至于QQ群17115662中《冰冻心灵》
一、查看测试环境
[oracle@oracle ~]$ !sql
sqlplus ‘/as sysdba’ SQL*Plus: Release 10.2.0.1.0 – Production on Thu Jul 28 08:40:15 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance.SQL> startup ORACLE instance started. Total System Global Area 251658240 bytes Fixed Size 1218820 bytes Variable Size 201328380 bytes Database Buffers 46137344 bytes Redo Buffers 2973696 bytes Database mounted. Database opened. SQL> show parameter name SQL> archive log list; SQL> show parameter name SQL> select * from v$log; SQL> select name from v$datafile; [oracle@oracle ~]$ !sql SQL> conn scott/tiger SQL> select * from tab; 10 rows selected. |
二、利用rman备份
RMAN> run {
2> shutdown immediate; 3> startup mount; 4> backup database format=’/disk4/rman/lx/%d_%s.bak’; 5> alter database open; 6> }database closed database dismounted Oracle instance shut down connected to target database (not started) Oracle instance started database mounted Total System Global Area 251658240 bytes Starting backup at 22-JUL-11 Starting Control File and SPFILE Autobackup at 22-JUL-11 RMAN> list backup; List of Backup Sets BS Key Type LV Size Device Type Elapsed Time Completion Time BS Key Type LV Size Device Type Elapsed Time Completion Time |
三、模拟测试环境
SQL> select * from test order by 1;
ID ———- 1 2 3 4 5 6 7 88 rows selected. SQL> conn /as sysdba SQL> select * from v$log; SQL> insert into scott.test values (9); SQL> insert into scott.test values (10); SQL> commit; SQL> alter system switch logfile; SQL> / SQL> select * from v$log; SQL> insert into scott.test values (11); SQL> insert into scott.test values (12); SQL> commit; SQL> alter system switch logfile; SQL> / SQL> / SQL> / SQL> select * from v$log; SQL> alter system switch logfile; SQL> select * from scott.test; 12 rows selected. SQL> shutdown abort SQL> ! [oracle@oracle ~]$ sqlplus ‘/as sysdba’ SQL*Plus: Release 10.2.0.1.0 – Production on Thu Jul 28 08:50:16 2011 SQL> startup SQL> select file# ,error from v$recover_file; FILE# ERROR 9 rows selected. SQL> exit |
四、用rman restore database
SQL> select dbid from v$database;
DBID ———- 1559643052RMAN> list backup; using target database control file instead of recovery catalog List of Backup Sets BS Key Type LV Size Device Type Elapsed Time Completion Time BS Key Type LV Size Device Type Elapsed Time Completion Time BS Key Type LV Size Device Type Elapsed Time Completion Time RMAN> shutdown RMAN> startup nomount RMAN> set dbid=1559643052; RMAN> restore controlfile from ‘/disk4/recovery/lx01/LX01/autobackup/2011_07_28/o1_mf_s_757673037_732pfw39_.bkp’; RMAN> alter database mount; RMAN> restore database; List of Cataloged Files |
五、查看restore 结果
[oracle@oracle ~]$ !sql
sqlplus ‘/as sysdba’ SQL*Plus: Release 10.2.0.1.0 – Production on Thu Jul 28 08:52:15 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production With the Partitioning, OLAP and Data Mining optionsSQL> select checkpoint_change# from v$database; CHECKPOINT_CHANGE# —————— 1321454 SQL> select checkpoint_change#,file# from v$datafile; 9 rows selected. SQL> select checkpoint_change#,file# from v$datafile_header; 9 rows selected. |
六、用rman 进行恢复
RMAN> recover database;
Starting recover at 28-JUL-11 using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 8 is already on disk as file /disk1/lx01/oradata/redo04b.log archive log thread 1 sequence 9 is already on disk as file /disk1/lx01/oradata/redo01b.log archive log thread 1 sequence 10 is already on disk as file /disk1/lx01/oradata/redo02b.log archive log thread 1 sequence 11 is already on disk as file /disk1/lx01/oradata/redo03b.log unable to find archive log archive log thread=1 sequence=3 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 07/28/2011 08:59:30 RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 1321454RMAN> alter database open; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 07/28/2011 08:59:57 ORA-01589: must use RESETLOGS or NORESETLOGS option for database open RMAN> alter database open resetlogs; –alter_lx01.log 告警日志信息: |
报歉!评论已关闭。