下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、完整的 oracle rman 备份恢复的例子作者: zhumy1、 建 rman 库作为 repository$more createrman_db1.shset echo onspool makedb1.logcreate database rmandatafile /export/home/oracle/oradata/rman_data/system.dbf size 50m autoextendon next 640Klogfile /export/home/oracle/oradata/rman_data/redo0101.log SIZE 10M,/export/home/ora
2、cle/oradata/rman_data/redo0201.log SIZE 10Mmaxdatafiles 30maxinstances 8maxlogfiles 64character set US7ASCIInational character set US7ASCII;disconnectspool offexit/export/home/oracle/8.1.6/rdbms/admin/catalog.sql;REM * ALTER SYSTEM TABLESPACE *ALTER TABLESPACE SYSTEMDEFAULT STORAGE ( INITIAL 64K NEX
3、T 64K MINEXTENTS 1 MAXEXTENTS UNLIMITEDPCTINCREASE 50);ALTER TABLESPACE SYSTEMMINIMUM EXTENT 64K;REM * TABLESPACE FOR ROLLBACK *CREATE TABLESPACE RBS DATAFILE /export/home/oracle/oradata/rman_data/rbs.dbf size 50mAUTOEXTEND ON NEXT 512KMINIMUM EXTENT 512KDEFAULT STORAGE ( INITIAL 512K NEXT 512K MINE
4、XTENTS 10 MAXEXTENTS UNLIMITED PC TINCREASE 0 );REM * TABLESPACE FOR TEMPORARY *CREATE TABLESPACE TEMP DATAFILE /export/home/oracle/oradata/rman_data/temp.dbf size 50mAUTOEXTEND ON NEXT 64KMINIMUM EXTENT 64KDEFAULT STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS UNLIMITEDPCTINCREASE 0) TEMPOR
5、ARY;REM * Creating four rollback segments *CREATE PUBLIC ROLLBACK SEGMENT RBS_0 TABLESPACE RBSSTORAGE ( OPTIMAL 64000K );ALTER ROLLBACK SEGMENT RBS_0 ONLINE;REM*SYS and SYSTEM users*alter user sys temporary tablespace TEMP;alter user system temporary tablespace TEMP;disconnect spool offexit$more cre
6、aterman_db3.shspool crdb3.log/export/home/oracle/8.1.6/rdbms/admin/catproc.sql/export/home/oracle/8.1.6/rdbms/admin/caths.sql/export/home/oracle/8.1.6/rdbms/admin/otrcsvr.sqlconnect system/manager/export/home/oracle/8.1.6/sqlplus/admin/pupbld.sqldisconnectspool offexit2 、建 repository 存放的表空间和rman 用户$
7、more createrman_db4.shconnect internalcreate tablespace rman_tsdatafile /export/home/oracle/oradata/rman_data/rman_ts.dbfsize 20M default storage (initial 100K next 100K pctincrease 0);create user rman_hainan identified by rman_hainantemporary tablespace TEMPdefault tablespace rman_ts quota unlimite
8、d onrman_ts;grant recovery_catalog_owner to rman_hainan;grant connect ,resource to rman_hainan;3 、建 catalog ,注册目标数据库$more createrman_db5.shrman catalog rman_hainan/rman_hainanrman msglog=rman.logcreate catalog ;exit;rman target sys/oracledb1connect catalog rman_hainan/rman_hainanrmanregister databas
9、e;exit;4、可以开始做备份了。5、做全备$more rmanshell. /export/home/oracle/.profilerman rcvcat rman_hainan/rman_hainanrman target / cmdfile /export/home/oracle/backup_level0.rcv log /export/home/oracle/backup.log$more backup_level0.rcvresync catalog;run allocate channel t1 type disk;backupincremental level 0skip i
10、naccessibletag hot_db_bk_level0filesperset 3format /export/home/oracle/bk_%s_%p_%t.bk(database);sql alter system archive log current;backup filesperset 10format /export/home/oracle/a1_%s_%p_%t.ac(archivelog all delete input);backupformat /export/home/oracle/df_t%t_s%s_p%p.ctcurrent controlfile ;6、做增
11、备$more rmanshell1rman rcvcat rman_hainan/rman_hainanrman target / cmdfile backup_level1.rcv log backup.log$more backup_level1.rcvresync catalog;run allocate channel t1 type disk;backupincremental level 1skip inaccessibletag hot_db_bk_level1filesperset 3format bk_%s_%p_%t.bk1(database);sql alter syst
12、em archive log current;backupfilesperset 10format a1_%s_%p_%t.ac1(archivelog all delete input);backup current controlfile;1、 删除旧的全备$rman rcvcat rman_hainan/rman_hainanrman target /Recovery Manager: Release .0 - ProductionRMAN-06005: connected to target database: TEST (DBID=1692992254)RMAN-060
13、08: connected to recovery catalog databaseRMAN list backupset;RMAN-03022: compiling command: listList of Backup SetsKey Recid Stamp LV Set Stamp Set Count Completion Time38 145 399987408 0 399987406 153 11-JUN-00根据 key 来删除旧的备份。RMAN allocate channel for maintenance type disk;RMAN change backupset 169
14、 delete; THIS IS THE COMMAND TO REMOVE THE ENTRY& OS FILE做完后可以看到 list backupset 和操作系统的文件都没有了。2 、 恢复( 1) 将数据库启动到 nomount 状态:$svrmgrlOracle Server Manager Release .0 - ProductionCopyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.Oracle8i Enterprise Edition Release .0 - 64b
15、it ProductionWith the Partitioning optionJServer Release .0 - ProductionSVRMGR connect internalConnected.SVRMGR startup nomount;ORACLE instance started.Total System Global Area 339275684 bytesFixed Size 94116 bytesVariable Size 318685184 bytesDatabase Buffers 16384000 bytesRedo Buffers 411238
16、4 bytesSVRMGR exitServer Manager complete.( 2 ) 恢复控制文件:$rman rcvcat rman_hainan/rman_hainanrman target /Recovery Manager: Release .0 - ProductionRMAN-06006: connected to target database: test (not mounted)RMAN-06008: connected to recovery catalog databaseRMAN run 2 allocate channel d1 type di
17、sk;3 restore controlfile;4 release channel d1;5 ( 3 ) 恢复数据文件RMAN run 2 allocate channel d1 type disk;3 sql alter database mount;4 restore datafile 1;5 restore datafile 2;6 restore datafile 3;7 restore datafile 4;8 release channel d1;9 ( 4 ) 恢复日志文件RMAN run 2 set archivelog destination to /export/home
18、/oracle/admin/test/arch;3 allocate channel d1 type disk;4 restore archivelog all;5 release channel d1;6 会把所有的日志文件恢复。( 5 ) 根据日志做recover$svrmgrlOracle Server Manager Release .0 - ProductionCopyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.Oracle8i Enterprise Edition Release 8.1.
19、6.0.0 - 64bit ProductionWith the Partitioning optionJServer Release .0 - ProductionSVRMGR connect internalConnected.SVRMGR recover database using backup controlfile until cancel;ORA-00279: change 51054 generated at 06/11/2000 11:38:37 needed for thread 1ORA-00289: suggestion : /export/home/or
20、acle/admin/test/arch/arch_1_3.arcORA-00280: change 51054 for thread 1 is in sequence #3Specify log: =suggested | filename | AUTO | CANCELLog applied.ORA-00279: change 51058 generated at 06/11/2000 11:38:44 needed for thread 1ORA-00289: suggestion : /export/home/oracle/admin/test/arch/arch_1_4.arcORA
21、-00280: change 51058 for thread 1 is in sequence #4ORA-00278: log file /export/home/oracle/admin/test/arch/arch_1_3.arc no longerneeded for this recoverySpecify log: =suggested | filename | AUTO | CANCELLog applied.ORA-00279: change 51074 generated at 06/11/2000 11:40:20 needed for thread 1ORA-00289
22、: suggestion : /export/home/oracle/admin/test/arch/arch_1_5.arcORA-00280: change 51074 for thread 1 is in sequence #5ORA-00278: log file /export/home/oracle/admin/test/arch/arch_1_4.arc no longerneeded for this recoverySpecify log: =suggested | filename | AUTO | CANCELcancelMedia recovery cancelled.SVRMGR alter database open resetlogs;Statement processed
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 别墅园林合同范本
- 《吉林万科松花湖冰雪小镇发展现状研究》
- 《AT公司财务风险评价及控制研究》
- 质量监管委托合同三篇
- 城市道路碎石垫层施工方案的创新设计
- 市政环卫垃圾收集管理制度
- 公路沿线管道清淤施工方案
- 城市商业中心品牌推广方案
- 环保工程护壁井施工方案设计
- 国有企业薪酬管理制度改革建议
- 中药项目投资合同范例
- 2024-2025学年上海市普陀区八年级(上)期中数学试卷
- 假期补课协议书
- 电子商务支付结算系统开发合同
- 服务质量、保证措施
- (必练)广东省军队文职(经济学)近年考试真题试题库(含答案)
- 含羞草天气课件
- 2024年安全生产知识竞赛考试题库及答案(共五套)
- 22《鸟的天堂》课件
- 农业灌溉装置市场环境与对策分析
- 新疆乌鲁木齐市第十一中学2024-2025学年八年级上学期期中道德与法治试卷
评论
0/150
提交评论