《2022年oracle数据库增量备份 3.pdf》由会员分享,可在线阅读,更多相关《2022年oracle数据库增量备份 3.pdf(4页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、oracle 数据库增量备份Oracle 2009-08-16 23:59:11 阅读 177 评论 0 字号:大中小订阅SQL code7. 将数据库设置成归档模式的数据库(1)查看当前数据库的模式SQLarchive log list; (2)关闭数据库实例SQLshutdown immediate; (3)将数据库启动为mount 状态SQLSTARTUP MOUNT; (4)将数据库设置为archivelog模式SQLalter database archivelog; (5) 打开数据库SQLALTER DATABASE OPEN; (6)检查数据库模式SQLarchive log
2、list; OS :RHEL AS 4 oracle 10g 0 备份脚本#!/bin/bash # incremental level 0 backup script source /home/oracle/.bash_profile current_day=date +%Y%m%d mkdir /home/oracle/RMANBACKUP/$current_day rman target / EOF run CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYP
3、E DISK TO /home/oracle/RMANBACKUP/$current_day/PID-%F; allocate channel dev1 type disk; allocate channel dev2 type disk; allocate channel dev3 type disk; backup incremental level 0 tag=db0 format /home/oracle/RMANBACKUP/$current_day/%n_%T_%U database; sql alter system archive log current; backup arc
4、hivelog all format /home/oracle/RMANBACKUP/$current_day/arc_%n_%T_%U delete all input; release channel dev1; release channel dev2; release channel dev3; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 4 页 - - - - - - - - - EOF 1 级累积增量脚本#!/bin/bash # incremental
5、level 1 backup script source /home/oracle/.bash_profile current_day=date +%Y%m%d incr_day=incr$current_day mkdir /home/oracle/RMANBACKUP/$incr_day rman target / %ShutDownFile% echo shutdown immediate %ShutDownFile% echo startup %ShutDownFile% echo shutdown normal %ShutDownFile% echo exit %ShutDownFi
6、le% 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 4 页 - - - - - - - - - rem * SHUTDOWN THE DATABASE * set oracle_sid=dbprim svrmgrl %ShutDownFile% net stop OracleStart%oracle_sid% net stop OracleService%oracle_sid% rem * SET BACKUP FILES DIRECTORY * e: md orad
7、b cd oradb md backups cd backups rem *cold backup for dbprim database on 2009-3-17 10:56:40 . * rem * COPY FILES * rem Redo logs copy C:ORACLE-DATAREDO03.LOG copy C:ORACLE-DATAREDO02.LOG copy C:ORACLE-DATAREDO01.LOG rem Datafile copy C:ORACLE-DATADBPRIMSYSTEM01.DBF copy C:ORACLE-DATADBPRIMUNDOTBS01.
8、DBF copy C:ORACLE-DATADBPRIMSYSAUX01.DBF copy C:ORACLE-DATADBPRIMUSERS01.DBF copy C:ORACLE-DATADBPRIMEXAMPLE01.DBF copy C:ORACLE-DATADBPRIMORATBS.DBF 6 rows selected rem Control files copy C:ORACLE-DATADBPRIMCONTROL01.CTL copy C:ORACLE-DATADBPRIMCONTROL02.CTL copy C:ORACLE-DATADBPRIMCONTROL03.CTL re
9、m *START UP DATABASE AND SERVICES* net start OracleService%oracle_sid% net start OracleStart%oracle_sid% set StartFile=C:start.SQL echo connect internal/oracle %StartFile% echo startup %StartFile% echo exit %StartFile% set oracle_sid=dbprim svrmgrl %StartFile% 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 4 页 - - - - - - - - - del /Q %ShutDownFile% del /Q %StartFile% exit 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 4 页 - - - - - - - - -
限制150内