《备份与恢复笔记》由会员分享,可在线阅读,更多相关《备份与恢复笔记(11页珍藏版)》请在金锄头文库上搜索。
1、1、 备份前的准备启动数据库到 mount修改 archive 模式( alter database archivelog; )启动到 open打开 raman连接数据库(connect target /)然后进行备份2、全备份(backup database)0 级分量备份(backup incremental level 0 database)3、Archivelog 的备份(backup database plus archivelog delete input;)表空间的备份(backup tablespace 表空间)控制文件的备份(backup current controlfil
2、e/backup database include current controlfile)4、批命令备份(callocate channel cha1 type disk;backupformat “路径”tag 标签名称database;release channel cha1;)5、自动备份run allocate channel c1 type disk;backupincremental level 1format /u01/rmanbak/inc0_%u_%Ttag monday_inc1database;release channel c1rootdb-oracle # cron
3、tab -e -u Oracle45 23 * * 0 rman target/ msglog=bakl0.log cmdfile=bakl045 23 * * 1 rman target/ msglog=bakl2.log cmdfile=bakl245 23 * * 2 rman target/ msglog=bakl2.log cmdfile=bakl245 23 * * 3 rman target/ msglog=bakl1.log cmdfile=bakl145 23 * * 4 rman target/ msglog=bakl2.log cmdfile=bakl245 23 * *
4、 5 rman target/ msglog=bakl2.log cmdfile=bakl245 23 * * 6 rman target/ msglog=bakl2.log cmdfile=bakl2再启动 service crond restart 就可以了6、备份控制文件Dbid= 1273224634示例:startup failed: ORA-01078: failure in processing system parametersLRM-00109: could not open parameter file /u01/app/Oracle/product/10.2.0/db_1
5、/dbs/initorcl.orastarting Oracle instance without parameter file for retrival of spfileOracle instance startedTotal System Global Area 159383552 bytesFixed Size 1218268 bytesVariable Size 54528292 bytesDatabase Buffers 100663296 bytesRedo Buffers 2973696 bytesRMAN set dbid 1273224634executing comman
6、d: SET DBIDRMAN restore spfile from /u01/app/Oracle/flash_recovery_area/ORCL/autoback RMAN-00571: =RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =RMAN-00571: =RMAN-00558: error encountered while parsing input commandsRMAN-01006: error signalled during parseRMAN-02001: unrecognized punctuation symbol /RM
7、AN restore spfile from /u01/app/Oracle/flash_recovery_area/ORCL/autobackup/2011_03_12/o1_mf_s_745580370_6qompo30_.bkp;Starting restore at 12-MAR-11using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=36 devtype=DISKchannel ORA_DISK_1: aut
8、obackup found: /u01/app/Oracle/flash_recovery_area/ORCL/autobackup/2011_03_12/o1_mf_s_745580370_6qompo30_.bkpchannel ORA_DISK_1: SPFILE restore from autobackup completeFinished restore at 12-MAR-11RMAN shutdown immediateOracle instance shut downRMAN startup;connected to target database (not started)
9、Oracle instance starteddatabase mounteddatabase openedTotal System Global Area 247463936 bytesFixed Size 1218772 bytesVariable Size 79693612 bytesDatabase Buffers 163577856 bytesRedo Buffers 2973696 bytes7、Controlfile 文件丢失示例RMAN connect target /connected to target database (not started)RMAN startup
10、nomount;Oracle instance startedTotal System Global Area 247463936 bytesFixed Size 1218772 bytesVariable Size 79693612 bytesDatabase Buffers 163577856 bytesRedo Buffers 2973696 bytesRMAN restore controlfile from autobackup;Starting restore at 12-MAR-11using target database control file instead of rec
11、overy catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=156 devtype=DISKrecovery area destination: /u01/app/Oracle/flash_recovery_areadatabase name (or database unique name) used for search: ORCLchannel ORA_DISK_1: autobackup found in the recovery areachannel ORA_DISK_1: autobackup found:
12、/u01/app/Oracle/flash_recovery_area/ORCL/autobackup/2011_03_12/o1_mf_s_745590355_6qoxgo3y_.bkpchannel ORA_DISK_1: control file restore from autobackup completeoutput filename=/u01/app/Oracle/oradata/orcl/control01.ctloutput filename=/u01/app/Oracle/oradata/orcl/control02.ctloutput filename=/u01/app/
13、Oracle/oradata/orcl/control03.ctlFinished restore at 12-MAR-11RMAN alter database mount;database mountedreleased channel: ORA_DISK_1RMAN recover database;Starting recover at 12-MAR-11Starting implicit crosscheck backup at 12-MAR-11allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=156 devtype=DISK
14、Crosschecked 4 objectsFinished implicit crosscheck backup at 12-MAR-11Starting implicit crosscheck copy at 12-MAR-11using channel ORA_DISK_1Finished implicit crosscheck copy at 12-MAR-11searching for all files in the recovery areacataloging files.cataloging doneList of Cataloged Files=File Name: /u0
15、1/app/Oracle/flash_recovery_area/ORCL/autobackup/2011_03_12/o1_mf_s_745590355_6qoxgo3y_.bkpusing channel ORA_DISK_1starting media recoveryarchive log thread 1 sequence 1 is already on disk as file /u01/app/Oracle/oradata/orcl/redo01.logarchive log filename=/u01/app/Oracle/oradata/orcl/redo01.log thread=1 sequence=1media rec