nocatalog方式就是用control file作为catalog,每一次备份都要往控制文件里面写好多备份信息,控制文件里面会有越来越多的备份信息,即RMAN的备份信息写在本地控制文件里面。
若为catalog则必须要首先要创建目录备份数据库,建立恢复目录,即数据库的备份信息写到恢复目录里面。
当通过rman nocatalog方式备份Oracle数据库,Oracle使用controlfile存放RMAN的备份信息。因此,当使用Rman nocatalog方式备份数据库时,一定要记得备份controlfile。
由于nocatalog时利用controlfile存放备份信息,建议将Oracle参数文件中的CONTROL_FILE_RECORD_KEEP_TIME值加大(缺省为7天), 参数在$ORACLE_HOME/dbs/initSID.ora中,该参数control_file__record_keep_time设置备份信息保存时间,到规定时间就自动清除以前的备份信息。
1.nocatalog方式
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2228784 bytes
Variable Size 1140854224 bytes
Database Buffers 452984832 bytes
Redo Buffers 7344128 bytes
Database mounted.
Database opened.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/oracle/oradata/orcl/contr
ol01.ctl, /u01/oracle/fast_rec
overy_area/orcl/control02.ctl
control_management_pack_access string DIAGNOSTIC+TUNING
SQL> alter system set control_file_record_keep_time=14 scope=both;
System altered.
SQL> select name,value,issys_modifiable from v$parameter where name='control_file_record_keep_time';
NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
ISSYS_MOD
---------
control_file_record_keep_time
14
IMMEDIATE
2.catalog方式
二.Catalog
Catalog 则必须要首先要创建目录备份数据库,建立恢复目录。示例如下:
1.创建Catalog所需要的表空间
SQL> create tablespace rman_ts datafile '/u01/oracle/oradata/orcl/rmancatalog.dbf' size 20M;
Tablespace created.
2.创建RMAN用户并授权
SQL> create user rman identified by wwwwww default tablespace rman_ts quota unlimited on rman_ts;
User created.
SQL> grant recovery_catalog_owner to rman;
Grant succeeded.
SQL> grant connect to rman;
Grant succeeded.
查看角色所拥有的权限:
SQL> select * from dba_sys_privs where grantee='RECOVERY_CATALOG_OWNER';
GRANTEE PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
RECOVERY_CATALOG_OWNER CREATE SYNONYM NO
RECOVERY_CATALOG_OWNER CREATE CLUSTER NO
RECOVERY_CATALOG_OWNER ALTER SESSION NO
RECOVERY_CATALOG_OWNER CREATE DATABASE LINK NO
RECOVERY_CATALOG_OWNER CREATE PROCEDURE NO
RECOVERY_CATALOG_OWNER CREATE SEQUENCE NO
RECOVERY_CATALOG_OWNER CREATE TABLE NO
RECOVERY_CATALOG_OWNER CREATE SESSION NO
RECOVERY_CATALOG_OWNER CREATE TYPE NO
RECOVERY_CATALOG_OWNER CREATE VIEW NO
RECOVERY_CATALOG_OWNER CREATE TRIGGER NO
11 rows selected.
3.创建恢复目录
[oracle@oracle11g orcl]$ rman target / catalog rman/wwwwww
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jul 10 23:40:26 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1373722558)
connected to recovery catalog database
RMAN>create catalog tablespace rman_ts;
RMAN>register database;(database是target database)
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
命令解释:
Report schema Report shema是指在数据库中需找schema
List backup 从control读取信息
Crosscheck backup 看一下backup的文件,检查controlfile中的目录或文件是否真正在磁盘上
Delete backupset 24 24代表backupset 的编号, 既delete目录,也delete你的文件
rman nocatalog恢复:
1) 建立oracle运行环境(包括init或sp文件)
2) 文件方式恢复controlfile到init文件指定的位置
3) startup mount
4) rman,恢复datafile
5) alter database open resetlogs
rman catalog恢复:
1) 建立oracle运行环境(包括init或sp文件)
2) rman ,restore controfile
3) alter database mount
4) rman, restore datafile
5) alter database open resetlogs
阅读(1370) | 评论(0) | 转发(0) |