rman 全库备份脚本

run {

allocate channel d1 type disk;

allocate channel d2 type disk;

backup full database format '$back_path/`date +%Y%m%d`_full_%d_%s_%p_%u.bak'

tag='full' include current controlfile;

sql 'alter system archive log current';

backup archivelog all format '$back_path/`date +%Y%m%d`_archivelog_%d_%s_%p_%u.bak' delete all input;

release channel d2;

release channel d1;

}

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 7 10:47:18 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1299576258)

RMAN> run {
2> 
3> allocate channel d1 type disk;
4> 
5> allocate channel d2 type disk;
6> 
7> backup full database format '$back_path/`date +%Y%m%d`_full_%d_%s_%p_%u.bak'
8> 
9> tag='full' include current controlfile;
10> 
11> sql 'alter system archive log current';
12> 
13> backup archivelog all format '$back_path/`date +%Y%m%d`_archivelog_%d_%s_%p_%u.bak' delete all input;
14> 
15> release channel d2;
16> 
17> release channel d1;
18> 
19> }

using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=41 device type=DISK

allocated channel: d2
channel d2: SID=46 device type=DISK

Starting backup at 07-JAN-12
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel d1: starting piece 1 at 07-JAN-12
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
channel d2: starting piece 1 at 07-JAN-12
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_8_1_08n05k5t.bak tag=FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:01:17
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_7_1_07n05k5t.bak tag=FULL comment=NONE
channel d1: backup set complete, elapsed time: 00:01:20
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 07-JAN-12
including current control file in backup set
channel d2: starting piece 1 at 07-JAN-12
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_10_1_0an05k8e.bak tag=FULL comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_9_1_09n05k8c.bak tag=FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:00:02
Finished backup at 07-JAN-12

sql statement: alter system archive log current

Starting backup at 07-JAN-12
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=2 STAMP=771935241
channel d1: starting piece 1 at 07-JAN-12
channel d2: starting archived log backup set
channel d2: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=3 STAMP=771936534
input archived log thread=1 sequence=6 RECID=4 STAMP=771936534
channel d2: starting piece 1 at 07-JAN-12
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_archivelog_ORCL_11_1_0bn05k8o.bak tag=TAG20120107T104855 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:04
channel d1: deleting archived log(s)
archived log file name=/u02/oradata/1_4_771795526.dbf RECID=2 STAMP=771935241
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_archivelog_ORCL_12_1_0cn05k8p.bak tag=TAG20120107T104855 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:05
channel d2: deleting archived log(s)
archived log file name=/u02/oradata/1_5_771795526.dbf RECID=3 STAMP=771936534
archived log file name=/u02/oradata/1_6_771795526.dbf RECID=4 STAMP=771936534
Finished backup at 07-JAN-12

released channel: d2

released channel: d1

【原创】rman 全库备份脚本的更多相关文章

  1. 从Oracle9i RMAN全库备份迁移到 Oracle10g

    1. 创建以下目录: mkdir -pv $ORACLE_BASE/admin/$ORACLE_SID/{{a,b,c,dp,u}dump,pfile} mkdir -pv $ORACLE_BASE/ ...

  2. MySQL生产库全库备份脚本

    创建一个单独的备份用户backup,不要用root 创建备份目录 :mkdir -p /databackup/fullbackup mysql> grant SELECT,RELOAD,SHOW ...

  3. rman全库恢复到不同主机,不同实例名,不同目录下

    一.配置目标主机的ip.hostname及与源端主机的连通性 1.配置目标主机IP 使用图形界面配置IP: administration----network---修改IP(指定静态IP) deact ...

  4. LINUX学习笔记——LINUX下EXP命令全库备份数据库文件

    LINUX下EXP命令全库备份数据库文件 1)建立备份目录,目录操作权限授权给Oracle用户 mkdir /backup  --创建backup文件夹 cd  /   --进入cd语句 ls  -l ...

  5. MySQL 採用Xtrabackup对数据库进行全库备份

    1,xtrabackup简单介绍 关于数据库备份以及备份工具.參考:http://blog.itpub.net/26230597/viewspace-1460065/,这里来介绍xtrabackup已 ...

  6. 从MySQL全库备份中恢复某个库和某张表【转】

    从MySQL全库备份中恢复某个库和某张表 一.全库备份-A [root@mha2 backup]#mysqldump -uroot -p123456 --default-character-set=u ...

  7. 通过Xtrabackup实现MySQL实例的全库备份与按需单库恢复

    在实际的生产环境中,为了管理方便,我们一般是通过 Xtrabackup实现实例的全库备份,即将实例上的所有数据库备份. 但是,考虑到快速恢复 我们常常面临的需求是快速还原单个数据库.针对初学者来说,网 ...

  8. 从MySQL全库备份中恢复某个库和某张表

    在Mysqldump官方工具中,如何只恢复某个库呢? 全库备份 [root@HE1 ~]# mysqldump -uroot -p --single-transaction -A --master-d ...

  9. MySQL用全库备份数据恢复单表数据

    备份数据库时,采用了全库备份,但是因为某些原因需要回滚一个表的数据到备份数据库上,如果回滚整个库就比较费时间,因为可能这个表只有几十M,但是其它表可能有十几上百G,这时候就需要将需要恢复的表提取出来了 ...

随机推荐

  1. c# rc4算法,加密解密类

    rc4算法,原理,以密匙生成256位的密匙流,然后以车轮式滚过源数据异或加密. /* * 由SharpDevelop创建. * 用户: YISH * 日期: 04/04/2015 * 时间: 03:0 ...

  2. 配置ip地址四种方法,方便学习linux的朋友

    (1)Ifconfig命令  第一种使用ifconfig命令配置网卡的ip地址.此命令通常用来零时的测试用,计算机启动后 ip地址的配置将自动失效.具体用法如下.Ipconfig  ethx   ip ...

  3. socket代码(简单)

    SERVER: #!/usr/bin/python # -*- coding: utf-8 -*- import socket import time s = socket.socket(socket ...

  4. CSS背景使用,引入、尺寸、平铺、定位、多重背景

    <!DOCTYPE html><html>    <head>        <meta charset="UTF-8">      ...

  5. Someing-About-Work

    投料分拨次评估1.调试线投料分波次:(由调试厂录入生产计划:按照实际装机计划做二次分拣)1)计划组必须改两次工单:因为使用的是不同的任务号,一次一次分拣,一次二次分拣,2)计划核对数量困难,不能按照制 ...

  6. Pyhton学习——Day28

    #上下文协议:文件操作时使用with执行# with open('a.txt','w',encoding='utf-8') as f1:# with语句,为了让一个对象兼容with语句,必须在这个对象 ...

  7. 字体样式(.ttf/.woff)文件的配置引入

    在引入前端框架部分功能时,有时需要配置字体样式.可以这样配置:在 .ttf的同级目录下,创建icon.css文件,写入: @font-face {font-family: "element- ...

  8. Redis字符串(STRING)中BIT相关命令

    上篇文章我们对STRING数据类型中一些基本的命令进行了介绍,但是没有涉及到BIT相关的命令,本文我们就来看看几个和BIT相关的命令. 本文是Redis系列的第四篇文章,了解前面的文章有助于更好的理解 ...

  9. Vue系列(二):发送Ajax、JSONP请求、Vue生命周期及实例属性和方法、自定义指令与过渡

    上一篇:Vue系列(一):简介.起步.常用指令.事件和属性.模板.过滤器 一. 发送AJAX请求 1. 简介 vue本身不支持发送AJAX请求,需要使用vue-resource.axios等插件实现 ...

  10. 常用的ES6方法

    常用的ES6方法 ES6之后,新增了定义变量的两个关键字,分别是let和const. let和const都能够声明块级作用域,用法和var是类似的,let的特点是不会变量提升,而是被锁在当前块中. 实 ...