RMAN中可以备份metadata到control文件,也可以备份metadata到数据库中,此数据库称为catalog database。

本文参考网上文章,建立一个例子:

使用机器:

机器1:target 机  o_target.loc  192.168.10.111  要备份的数据库。

机器2:catalog 机 o_catalog.loc 192.168.10.112 RMAN catalog metadata 所保存的位置。

由于涉及到两台机器。

分别进行说说明:

在机器1上的/etc/hosts文件:

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

[root@o_target ~]# cat /etc/hosts    
# Do not remove the following line, or various programs    
# that require network functionality will fail.    
127.0.0.1               localhost.localdomain localhost    
::1             localhost6.localdomain6 localhost6    
192.168.10.111  o_target.loc o_target    
192.168.10.112  o_catalog.loc o_catalog    
[root@o_target ~]#     
-----------------------------------------------------

在机器2上的/etc/hosts文件:

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

[root@o_catalog ~]# cat /etc/hosts    
# Do not remove the following line, or various programs    
# that require network functionality will fail.    
127.0.0.1               localhost.localdomain localhost    
::1             localhost6.localdomain6 localhost6    
192.168.10.111  o_target.loc o_target    
192.168.10.112  o_catalog.loc o_catalog    
[root@o_catalog ~]#

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

启动target机的数据库和lisenter:

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

[root@o_target ~]# su - oracle    
[oracle@o_target ~]$ sqlplus / as sysdba    
    
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 14 14:47:14 2014    
    
Copyright (c) 1982, 2009, Oracle.  All rights reserved.    
    
Connected to an idle instance.    
    
SQL> startup    
ORACLE instance started.    
    
Total System Global Area 1023004672 bytes    
Fixed Size                  2219752 bytes    
Variable Size             624951576 bytes    
Database Buffers          390070272 bytes    
Redo Buffers                5763072 bytes    
Database mounted.    
Database opened.    
SQL>

[root@o_target ~]# su - oracle    
[oracle@o_target ~]$ lsnrctl start    
    
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2014 14:48:45    
    
Copyright (c) 1991, 2009, Oracle.  All rights reserved.    
    
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...    
    
TNSLSNR for Linux: Version 11.2.0.1.0 - Production    
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora    
Log messages written to /u01/app/oracle/diag/tnslsnr/o_target/listener/alert/log.xml    
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))    
    
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))    
STATUS of the LISTENER    
------------------------    
Alias                     LISTENER    
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production    
Start Date                14-MAR-2014 14:48:45    
Uptime                    0 days 0 hr. 0 min. 2 sec    
Trace Level               off    
Security                  ON: Local OS Authentication    
SNMP                      OFF    
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora    
Listener Log File         /u01/app/oracle/diag/tnslsnr/o_target/listener/alert/log.xml    
Listening Endpoints Summary...    
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))    
The listener supports no services    
The command completed successfully    
[oracle@o_target ~]$

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

然后,在catalog机上,建立连接到target机的本地服务名:

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

[root@o_catalog ~]# xhost +    
access control disabled, clients can connect from any host    
[root@o_catalog ~]# su - oracle    
    
[oracle@o_catalog ~]$ netca    
    
Oracle Net Services Configuration:    
Default local naming configuration complete.    
    Created net service name: target_orcl    
Oracle Net Services configuration successful. The exit code is 0    
    
    
[oracle@o_catalog ~]$ cd $ORACLE_HOME    
[oracle@o_catalog dbhome_1]$ cd ./network/admin    
[oracle@o_catalog admin]$ ls    
listener14031411AM1252.bak  shrept.lst    
listener14031411AM1303.bak  tnsnames14031411AM1252.bak    
listener1403143PM4135.bak   tnsnames14031411AM1303.bak    
listener.ora                tnsnames1403143PM4135.bak    
samples                     tnsnames.ora    
[oracle@o_catalog admin]$ pwd    
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin    
[oracle@o_catalog admin]$ cat tnsnames.ora    
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora    
# Generated by Oracle configuration tools.    
    
TARGET_ORCL =    
  (DESCRIPTION =    
    (ADDRESS_LIST =    
      (ADDRESS = (PROTOCOL = TCP)(HOST = o_target.loc)(PORT = 1521))    
    )    
    (CONNECT_DATA =    
      (SERVICE_NAME = orcl)    
    )    
  )    
    
    
ORCL =    
  (DESCRIPTION =    
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))    
    (CONNECT_DATA =    
      (SERVER = DEDICATED)    
      (SERVICE_NAME = orcl)    
    )    
  )    
    
[oracle@o_catalog admin]$     
-----------------------------------------------------

再启动catalog机上的DB和listener:

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

[root@o_catalog ~]# su - oracle    
[oracle@o_catalog ~]$ sqlplus / as sysdba    
    
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 14 16:01:03 2014    
    
Copyright (c) 1982, 2009, Oracle.  All rights reserved.    
    
Connected to an idle instance.    
    
SQL> startup;    
ORACLE instance started.    
    
Total System Global Area 1023004672 bytes    
Fixed Size                  2219752 bytes    
Variable Size             624951576 bytes    
Database Buffers          390070272 bytes    
Redo Buffers                5763072 bytes    
Database mounted.    
Database opened.    
SQL>     
    
    
    
    
    
[root@o_catalog ~]# su - oracle    
[oracle@o_catalog ~]$ lsnrctl start    
    
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2014 16:43:40    
    
Copyright (c) 1991, 2009, Oracle.  All rights reserved.    
    
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...    
    
TNSLSNR for Linux: Version 11.2.0.1.0 - Production    
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora    
Log messages written to /u01/app/oracle/diag/tnslsnr/o_catalog/listener/alert/log.xml    
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=o_catalog.loc)(PORT=1521)))    
    
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=o_catalog.loc)(PORT=1521)))    
STATUS of the LISTENER    
------------------------    
Alias                     LISTENER    
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production    
Start Date                14-MAR-2014 16:43:40    
Uptime                    0 days 0 hr. 0 min. 0 sec    
Trace Level               off    
Security                  ON: Local OS Authentication    
SNMP                      OFF    
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora    
Listener Log File         /u01/app/oracle/diag/tnslsnr/o_catalog/listener/alert/log.xml    
Listening Endpoints Summary...    
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=o_catalog.loc)(PORT=1521)))    
The listener supports no services    
The command completed successfully    
[oracle@o_catalog ~]$     
[oracle@o_catalog ~]$ lsnrctl status    
    
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2014 16:44:44    
    
Copyright (c) 1991, 2009, Oracle.  All rights reserved.    
    
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=o_catalog.loc)(PORT=1521)))    
STATUS of the LISTENER    
------------------------    
Alias                     LISTENER    
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production    
Start Date                14-MAR-2014 16:43:40    
Uptime                    0 days 0 hr. 1 min. 4 sec    
Trace Level               off    
Security                  ON: Local OS Authentication    
SNMP                      OFF    
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora    
Listener Log File         /u01/app/oracle/diag/tnslsnr/o_catalog/listener/alert/log.xml    
Listening Endpoints Summary...    
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=o_catalog.loc)(PORT=1521)))    
Services Summary...    
Service "orcl" has 1 instance(s).    
  Instance "orcl", status READY, has 1 handler(s) for this service...    
Service "orclXDB" has 1 instance(s).    
  Instance "orcl", status READY, has 1 handler(s) for this service...    
The command completed successfully    
[oracle@o_catalog ~]$

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

Catalog机上,为rman 用户进行准备:

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

[root@o_catalog ~]# su - oracle    
[oracle@o_catalog ~]$ sqlplus / as sysdba    
    
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 14 16:09:03 2014    
    
Copyright (c) 1982, 2009, Oracle.  All rights reserved.    
    
    
Connected to:    
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production    
With the Partitioning, OLAP, Data Mining and Real Application Testing options    
    
SQL> create tablespace rmancatalog_tb datafile     
  2  '/u01/app/oracle/oradata/orcl/rman.dbf' size 50M;    
    
Tablespace created.    
    
SQL> create user rman identified by rman default tablespace rmancatalog_tb;    
    
User created.    
    
SQL> grant recovery_catalog_owner to rman;    
    
Grant succeeded.    
    
SQL> alter user rman quota unlimited on rmancatalog_tb;    
    
User altered.    
    
SQL>     
    
    
SQL> grant dba to rman;    
    
Grant succeeded.    
    
SQL> grant connect,resource to rman;    
    
Grant succeeded.    
    
SQL>

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

在target机器上、为了从catalog机器上可以访问到target机器,进行设置:

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

[oracle@o_target ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 14 16:21:10 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create user for_rman identified by for_rman;

User created.

SQL> grant dba to for_rman;

Grant succeeded.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@o_target ~]$

[oracle@o_target ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 14 16:23:25 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> grant sysdba to for_rman;

Grant succeeded.

SQL>

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

最后,从catalog机器上,执行RMAN:

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

[oracle@o_catalog ~]$ rman catalog rman/rman@orcl target for_rman/for_rman@target_orcl    
    
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Mar 14 16:49:37 2014    
    
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.    
    
connected to target database: ORCL (DBID=1369869147)    
connected to recovery catalog database    
    
RMAN>     
    
RMAN> create catalog;    
    
recovery catalog created    
    
RMAN> register database;    
    
database registered in recovery catalog    
starting full resync of recovery catalog    
full resync complete    
    
RMAN> list backup;    
    
specification does not match any backup in the repository    
    
RMAN>

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

RMAN中建立Catalog 用数据库的例子的更多相关文章

  1. 使用rman中的duplicate复制数据库

    目标库和复制库环境: OS: Linux Red Hat AS 4 DB Version: 10.2.0.1   1.目标库和复制库信息 Rman 中的目标库(target database)指的是被 ...

  2. catalog备份数据库及RMAN存储脚本

    环境说明: 提前配置好两个库的监听与tnsnames.oraIP:10.100.25.13 为目标数据库  IP:10.100.25.14 为恢复目录数据库(catalog database) 以下操 ...

  3. Spark(Python) 从内存中建立 RDD 的例子

    Spark(Python) 从内存中建立 RDD 的例子: myData = ["Alice","Carlos","Frank"," ...

  4. [Django]中建立数据库视图

    Django中建立数据库视图 Django中没有建立视图的接口.假设要建立一个视图须要一些手动的改变. 这里使用的Django 版本号>1.5, 使用的数据库为mysql 第一步 建立视图,比如 ...

  5. Java中连接MySql数据库的例子

    Java中连接MySql数据库的例子: package com.joinmysql.demo; import java.sql.DriverManager; import java.sql.Resul ...

  6. JPA中建立数据库表和实体间映射小结

    在JPA中,映射数据库表和实体的时候,需要注意一些细节如下, 实体类要用@Entity的注解: 要用 @Id 来注解一个主键: 如果跟数据库相关联,要用@Table注解相关数据库表: 实体类中字段需要 ...

  7. hibernate配置文件中的catalog属性

    在hibernate表的映射文件中 <hibernate-mapping>    <class name="com.sooyie.hibernate.orm.Link&qu ...

  8. 数据库表设计时一对一关系存在的必要性 数据库一对一、一对多、多对多设计 面试逻辑题3.31 sql server 查询某个表被哪些存储过程调用 DataTable根据字段去重 .Net Core Cors中间件解析 分析MySQL中哪些情况下数据库索引会失效

    数据库表设计时一对一关系存在的必要性 2017年07月24日 10:01:07 阅读数:694 在表设计过程中,我无意中觉得一对一关系觉得好没道理,直接放到一张表中不就可以了吗?真是说,网上信息什么都 ...

  9. mysql中的实例、数据库关系简介

    MySQL是单进程多线程(而Oracle等是多进程),也就是说MySQL实例在系 统上表现就是一个服务进程,即进程(通过多种方法可以创建多实例,再安装一个端口号不同的mysql,或者通过workben ...

随机推荐

  1. Oracle存储过程_语法

    create or replace procedure procedure_name --存储过程名字 ( --进行输入/输出的量 量_name in out 量_类型 --e.g. username ...

  2. 从本机构建Linux应用程序VHD映像

    下图描述了总体的虚拟机映像的VHD生成,上传以及发布到 Azure 镜像市场的全过程: 具体步骤如下: 在本地计算机(Windows平台)上安装Hyper-V,并安装您所需要的虚拟机操作系统 在此操作 ...

  3. Java 使用stringTemplate导出大批量数据excel(百万级)

    目前java框架中能够生成excel文件的的确不少,但是,能够生成大数据量的excel框架,我倒是没发现,一般数据量大了都会出现内存溢出,所以,生成大数据量的excel文件要返璞归真,用java的基础 ...

  4. 转:在决定使用ClickOnce发布你的软件前,应该知道的一些事情(一些常见问题解决方法)

    1,无法有效避免非法的下载 使用ClickOnce部署,你的软件的更新版可以发布到Web服务器上,当用户从开始菜单启动软件时,ClickOnce自动到指定的URL去检测是否存在新版本,并且从这个地址下 ...

  5. QuickBI助你成为分析师-数据建模(一)

    摘要: 数据集编辑功能界面介绍以及常见问题总结. 在数据集编辑界面可以进行数据建模来更好的展示数据,创建数据集默认将数值类型字段作为度量,日期.字符串等类型作为维度,度量可以根据维度分组展示.下面来介 ...

  6. C++实现一个Vector3空间向量类(转)

    转自:http://www.2cto.com/kf/201311/260139.html ector2,3,4类在DirectX中都有现成的可以调用,不过要实现其中的功能其实也不难,也都是一些简单的数 ...

  7. 原生 JS 的 Base64 转码

    JavaScript 原生提供两个 Base64 相关的方法: btoa():任意值转为 Base64 编码 atob():Base64 编码转为原来的值 注意:这两个方法不适合非 ASCII 码的字 ...

  8. ACE.js自定义提示实现方法

    ACE.js自定义提示实现方法 时间 2015-11-19 00:55:22  wsztrush's blog 原文  http://wsztrush.github.io/编程技术/2015/11/0 ...

  9. 用windows自带的fsutil修改稀疏文件大小成功,但文件内容似乎丢失

    fsutil sparse setflag. fsutil sparse setrange 10M对应字节,1G对应字节.. 看文件属性,实际尺寸是小了,但内容似乎也丢了..因为自己把该文件做成虚拟盘 ...

  10. PHP设计模式系列 - 中介者模式

    中介者模式 中介者模式用于开发一个对象,这个对象能够在类似对象相互之间不直接相互的情况下传送或者调解对这些对象的集合的修改.一般处理具有类似属性,需要保持同步的非耦合对象时,最佳的做法就是中介者模式. ...