linux 下oralce 11g的rman 备份

rman备份
 前言:
本着记录生活中的点点滴滴,借用大神的一句话,技术分享,成就梦想!
最近一直想抽出时间研究下rman备份与恢复 ,周末闲暇,测试一下:
测试背景:
VMware虚机
数据库版本:Version 11.2.0.4.0 - Production
操作系统版本:Red Hat Enterprise Linux Server release 6.7
工具: 从oracle8i开始就使用的oracle专业备份恢复工具,也是最常使用的备份工具
了解rman之前觉得无从下手,参数设置,备份策略等等一系列问题,但有时候实践比原理重要的多,所以“Just do it”!
首先连接本地库:


 有DBID说明连接上了目标库
退出rman,exit即可
备份前的准备工作:
1、control_file_record_keep_time 初始化参数: rman 元数据在控制文件中保留的最小有效天数,默认为 7 天。
看网上的经验值,设置该参数为30天,动态参数可直接修改,不用重启库
 
 
2、启用归档模式

首先我们先要创建一个存放archive log的目录

Oracle10g&11g默认归档、闪回、备份都存放在flash_recovery_area中,默认大小2G,一般在生产环境中为了更方便管理这些重要文件,为其专门创建目录存放
登陆sqlplus设置归档路径

 alter system set log_archive_dest_1='location=/mnt/dbback/archdata' scope=both; 

这一步还涉及log_archive_dest和log_archie_dest_n的区别,可以自己百度下
下面重启数据库mount,开启归档

SYS@base> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@base> startup mount

ORACLE instance started.

Total System Global Area1610612736 bytes

Fixed Size                  2084296 bytes

Variable Size             385876536 bytes

Database Buffers         1207959552 bytes

Redo Buffers               14692352 bytes

Database mounted.

SYS@base> alter database archivelog;          --开启归档模式

Database altered.

SYS@base> alter database open;                --打开数据库

Database altered.

SQL> alter systemswitch logfile;              --手动切换不会触发checkpoint,自动切换会触发checkpoint

System altered

 3、rman环境变量设置
包括配置默认备份保存目录、配置控制文件自动备份保存目录、配置备份保留时间等
4、备份全库

 backup full database format              

'/mnt/dbback/full_bk1_%u%p%s.rmn' include current controlfile

 plus

 archivelog format '/mnt/dbback/arch_bk1_%u%p%s.rmn'delete all input;
--------------------------------------------我是分割线

[oracle@zheng fullback]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 10 03:54:22 2016


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


connected to target database: IPTV (DBID=2121374600)


RMAN> list backupset;  


using target database control file instead of recovery catalog


List of Backup Sets

===================



BS Key  Size       Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ ---------------

4       834.30M    DISK        00:01:27     10-APR-16      

        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20160410T015102

        Piece Name: /mnt/dbback/arch_bk1_06r2l6o716.rmn


  List of Archived Logs in backup set 4

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

  ---- ------- ---------- --------- ---------- ---------

  1    129     1157167    08-MAR-16 1179501    10-MAR-16

  1    130     1179501    10-MAR-16 1215888    13-MAR-16

  1    131     1215888    13-MAR-16 1232295    13-MAR-16

  1    132     1232295    13-MAR-16 1255405    14-MAR-16

  1    133     1255405    14-MAR-16 1286152    16-MAR-16

  1    134     1286152    16-MAR-16 1308829    18-MAR-16

  1    135     1308829    18-MAR-16 1345172    19-MAR-16

  1    136     1345172    19-MAR-16 1613887    19-MAR-16

  1    137     1613887    19-MAR-16 1701498    19-MAR-16

  1    138     1701498    19-MAR-16 1724837    20-MAR-16

  1    139     1724837    20-MAR-16 1726636    20-MAR-16

  1    140     1726636    20-MAR-16 1732217    26-MAR-16

  1    141     1732217    26-MAR-16 1742380    26-MAR-16

  1    142     1742380    26-MAR-16 1755481    26-MAR-16

  1    143     1755481    26-MAR-16 1777973    26-MAR-16

  1    144     1777973    26-MAR-16 1799131    27-MAR-16

  1    145     1799131    27-MAR-16 1836331    02-APR-16

  1    146     1836331    02-APR-16 1844588    02-APR-16

  1    147     1844588    02-APR-16 1855225    03-APR-16

  1    148     1855225    03-APR-16 1898376    04-APR-16

  1    149     1898376    04-APR-16 1905017    04-APR-16

  1    150     1905017    04-APR-16 1933438    09-APR-16

  1    151     1933438    09-APR-16 1970977    10-APR-16

  1    152     1970977    10-APR-16 1971736    10-APR-16

  1    153     1971736    10-APR-16 1973291    10-APR-16


BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

5       Full    5.76G      DISK        00:09:55     10-APR-16      

        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20160410T015241

        Piece Name: /mnt/dbback/full_bk1_07r2l6r917.rmn

  List of Datafiles in backup set 5

  File LV Type Ckp SCN    Ckp Time  Name

  ---- -- ---- ---------- --------- ----

  1       Full 1973355    10-APR-16 /home/oracle/app/oradata/iptv/system01.dbf

  2       Full 1973355    10-APR-16 /home/oracle/app/oradata/iptv/sysaux01.dbf

  3       Full 1973355    10-APR-16 /home/oracle/app/oradata/iptv/undotbs01.dbf

  4       Full 1973355    10-APR-16 /home/oracle/app/oradata/iptv/users01.dbf

  5       Full 1973355    10-APR-16 /mnt/oracle/iptv/iptv01.dbf

  6       Full 1973355    10-APR-16 /mnt/oracle/iptv/iptv01index.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

6       Full    9.36M      DISK        00:00:01     10-APR-16      

        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20160410T015241

        Piece Name: /mnt/dbback/full_bk1_08r2l7dv18.rmn

  SPFILE Included: Modification time: 10-APR-16

  SPFILE db_unique_name: IPTV

  Control File Included: Ckp SCN: 1973790      Ckp time: 10-APR-16


BS Key  Size       Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ ---------------

7       1.28M      DISK        00:00:00     10-APR-16      

        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20160410T020242

        Piece Name: /mnt/dbback/arch_bk1_09r2l7e219.rmn


  List of Archived Logs in backup set 7

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

  ---- ------- ---------- --------- ---------- ---------

  1    154     1973291    10-APR-16 1973796    10-APR-16


RMAN> 
----
备份成功,先到这吧! 
 

  


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31123655/viewspace-2085509/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31123655/viewspace-2085509/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值