13:00
backup database
backup db :3h
3h: 产生了10 archive log file
16:00 finish
restore database;
13:00 : datafile不一致(因为没有备份archive log,controlfile)
job调用方式
vi /tmp/1.rcv
CONFIGURE CONTROLFILE AUTOBACKUP ON;
方式一 : rman target / @'/tmp/1.rcv'
方式二 :rman target / cmdfile=/tmp/1.rcv log=/tmp/rman.log
方式三 : sh script
内容如下
#!/bin/sh
rman target log=/tmp/rman.log append <<EOF
CONFIGURE CONTROLFILE AUTOBACKUP ON;
EOF;
---------------------------------------------------------------------------------------
备份策略
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
一般的我们这样设置
configure retention policy to recovery window of 30 days;
最简单的可恢复的备份
run{
backup database including archivelog format '/backup/db_%d_%s_%p_%T.bkp';
backup current controlfile format '/backup/cf_%d_%s_%p_%T.bkp';
}
标准备份
online
run{
allocate channel c1 type disk maxpiecesize=20G;
allocate channel c2 type disk maxpiecesize=20G;
sql 'alter system archive log current';
backup database format '/backup/db_%d_%s_%p_%T.bkp' tag 'db_backup_full';
backup archivelog all delete input format '/backup/log_%d_%s_%p_%T.bkp' tag 'log_backup_full';
backup current controlfile format '/backup/cf_%d_%s_%p_%T.bkp' tag 'cf_backup_full';
backup spfile format '/backup/pr_%d_%s_%p_%T.bkp' tag 'pr_backup_full';
}
备份顺序不能返(1.database->2.archivelog->3.controlfile->4.spfile)
offline
run{
allocate channel c1 type disk maxpiecesize=20G;
allocate channel c2 type disk maxpiecesize=20G;
sql 'alter system archive log current';
backup database format '/backup/db_%d_%s_%p_%T.bkp' tag 'db_backup_full';
backup current controlfile format '/backup/cf_%d_%s_%p_%T.bkp' tag 'cf_backup_full';
backup spfile format '/backup/pr_%d_%s_%p_%T.bkp' tag 'pr_backup_full';
}
少了archivelog的备份
备份完后查看备份情况
list backup;
offline的恢复(冷备)
startup force nomount;
restore controlfile;
alter database mount;
restore database;
recover database noredo;
alter database open resetlogs;
------------------------------------------------------------------
report schema;列出当前数据库的文件分布
数据文件丢失恢复:
数据库mount模式下:
restore datafile 5;
recovery datafile 5;
alter database open;
控制文件丢失恢复:
shutdown abort;
startup mount;
show parameter control
cp file1 file2
ls -ltr
restore controlfile from autobackup;
或者 restore controlfile from '/back/....';
alter database mount;
recover database;
alter database open resetlogs;
1.good : backup database
2.file 5: restore recover
3.good
4.controlfile error
5.restore controlfile
--------------------------------------------------------------
删除备份
run{
delete force noprompt backup;
delete force noprompt copy;
delete force noprompt archivelog all;
}
delete backupset 13(BS Key);
delete obsolete;
模拟数据库全库删掉整库恢复
查看数据库是否状态正常
select open_mode from v$database;
report schema;
rm -r /orcl/datafile
restore database;
恢复过程中查看IO
iostat 1
asm的好处数据库使用盘读写很均匀 普通文件系统没办法做到
recover database;通过归档日志做前滚
alter database open resetlogs;
数据库server 重启
srvctl stop database -d orcl
srvctl start database -d orcl
数据库恢复至少需要的文件
- controlfile * 1
- system *1
sysaux * 1
- redolog * 2
undo * 1
将临时文件temp datafile删掉。 数据库能正常起来
这些场景会用到temp表空间order by , distinct , union, group by , join (PGA不够时会用到temp表空间)
alter tablespace temp add tempfile '***/' size **M autoextend on next 10M maxsize 8192M;
恢复temp(建temp2并切换,再建temp再切换回temp)
1.create temporary tablespace temp2 tempfile '***/' size **M autoextend on next 10M maxsize 8192M;
2.alter database default temporary tablespace temp2;
3.drop tablespace temp including contents and datafiles;
4.create temporary tablespace temp tempfile '***/' size **M autoextend on next 10M maxsize 8192M;
5.alter database default temporary tablespace temp;
6.drop tablespace temp2 including contents and datafiles;
- 记录一则RMAN备份策略修正案例
背景:在给某客户处理问题时,发现客户数据库的备份空间即将用尽,进一步查看发现是用户数据库的当前RMAN备份策略存在潜在问题,需要修改备份策略. 环境:SunOS 5.10 + Oracle 11.2. ...
- RMAN备份脚本一列分享
在ORACLE数据库中,RMAN备份的脚本非常多,下面介绍一例shell脚本如何通过RMAN备份,以及FTP上传RMAN备份文件以及归档日志文件的脚本. fullback.sh 里面调用RMAN命令做 ...
- RMAN备份演练进阶篇
前篇介绍了通过rman进行各种备份,进阶篇则主要是rman的一些功能扩展和增加功能,利用前篇你已经完全可以完成数据库的备份,而通过本篇你可以更好更方便的完成数据库的备份. 一.建立增量备份 如果数据库 ...
- RAC 之 RMAN 备份
这篇主要介绍的是RAC 环境下的RMAN 备份. 关于Oracle 备份与恢复的一些理论知识参考我的Blog: Oracle 备份 与 恢复 概述 http://blog.csdn.net ...
- RAC RMAN备份
这篇主要介绍的是RAC 环境下的RMAN 备份. 关于Oracle 备份与恢复的一些理论知识参考我的Blog: Oracle 备份 与 恢复 概述 http://blog.csdn.net ...
- 12C RMAN 备份参考v1
windows bat 1,C:\dba\utility\rman\rman.bat del C:\dba\utility\rman\full_db_* /qset TNSNAME=ceipuatrm ...
- RMAN 备份异机恢复 并创建新DBID
测试平台信息: Oracle:11gR2 操作系统:Redhat 5.5 Target DB:dave 几点说明: (1)RMAN 异机恢复的时候,db_name必须相同. 如果说要想改成其他的实 ...
- RMAN备份-未使用catalog-控制文件丢失
情况描述 客户报告数据库故障,新来的系统管理员误操作.删掉了一些文件.具体情况是:删掉了所有重要数据文件.所有控制文件.数据库原来是归档模式,用rman备份数据,而rman 使用控制文件. 幸运的是, ...
- RMAN优缺点及RMAN备份及恢复步骤
RMAN优缺点及RMAN备份及恢复步骤--以下部分来自网络转摘,仅供参考和OS命令备份方式相比,使用RMAN的优点1 备份执行期间不需要人工干预,因此减少了误操作的机会:2 可以有效的将备份和恢复结合 ...
随机推荐
- Codeforces Round #267 (Div. 2) C. George and Job (dp)
wa哭了,,t哭了,,还是看了题解... 8170436 2014-10-11 06:41:51 njczy2010 C - George and Jo ...
- ZOJ 3306 状压dp
转自:http://blog.csdn.net/a497406594/article/details/38442893 Kill the Monsters Time Limit: 7 Seconds ...
- ctrl+c,ctrl+d,ctrl+z在linux程序中意义和区别
原文: http://blog.csdn.net/sxhlovehmm/article/details/41318111 [侵删] ctrl+c和ctrl+z都是中断命令,但是他们的作用却不一样. ...
- Python入门--1--基本中的基本
一. 1.这是一个面向对面的编程,一种解释性语言. 2.缩进是python的灵魂,使代码变得非常简洁,正确使用冒号“:”,IDLE的 下一行会自动缩进 3.if语句中 python拒绝接受 ...
- 自定义Navigation按钮及Title
导航栏自带的按钮,时常不能满足要求,所以深深需要进行各种定制. 写一个UINavigationItem的category // UINavigationItem+CB_ChangeButton.h
...
- Yii 之视图
控制器方法代码: public function actionIndex(){ $data = array( 'name' => 'zhangsan', 'age' => 12, 'add ...
- Yii 之控制器响应
public function actionIndex(){ //控制器响应处理 $res = \Yii::$app->response; //设置状态码 // $res->statusC ...
- hdu 4885 (n^2*log(n)判断三点共线建图)+最短路
题意:车从起点出发,每次只能行驶L长度,必需加油到满,每次只能去加油站或目的地方向,路过加油站就必需进去加油,问最小要路过几次加油站. 开始时候直接建图,在范围内就有边1.跑最短了,再读题后发现,若几 ...
- LeetCode OJ--Search in Rotated Sorted Array II
http://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ 如果在数组中有重复的元素,则不一定说必定前面或者后面的一半是有序的 ...
- eclispe集成web插件
最近公司需要使用开源框架开发,所有下载了最新版本的eclispe工具,但是在官网下载的eclispe是不包含web插件的,无法创建web项目,需要自行集成web插件 eclipse官网下载地址:htt ...