知识要点
- RMAN连接到当前实例
- RMAN备份方式COPY
- RMAN备份方式BACKUP
- RMAN查看曾经做过的备份
RMAN连接到当前实例
[oracle@host ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jun 17 18:49:53 2017
Copyright (c) 1982,2011,Oracle and/or its affiliates. All rights reserved.
connected to target database: SKY2 (DBID=3847463125)
RMAN>
RMAN备份方式COPY
物理备份,源文件和备份文件是一样大的(不推荐使用)
语法:copy datafile to xxxx
例子:
RMAN>copy current controlfile to '/u01/bak01.ctl';
等价于
sqlPLUS>alter database backup controlfile to '/u01/bak02.ctl';
RMAN>backup as copy database
等价于
sqlPLUS>alter database begin backup
sqlPLUS>ho cp ... ...
sqlPLUS>alter database end backup
RMAN备份方式BACKUP
逻辑物理备份。基于块级别的备份,100M的快,只有10M使用。那么利用COPY,备份文件还是100M,BACKUP仅仅备份10M的大小。下面列出几个备份方式:
backup database;
backup spfile
- 备份当前正在使用的控制文件
backup current controlfile;
- 备份数据文件
backup datafile 4;
- 备份表空间
backup tablespace users,sysaux;
- 备份归档
backup archivelog all;
- 备份归档并把归档删除
backup archivelog all delete input;
- 全库+归档
backup full database plus archivelog;
- 跳过某个表空间
sqlplus:alter tablespace users read only rman backup database skip readonly/offline;
- 全库备份到指定的路径,指定变量,因为备份文件有多个
backup database format '/u01/bakfull_%U';
- 若不指定则必须要有OMF参数路径,会在dbs下
sqlplus:show parameter db_recovery_file_dest
- 自定义使用run{}
查看曾经做过的备份
list backup of database/controlfile