search
HomeDatabaseMysql Tutorialcatalog 配置 成功笔记

Rman 在恢复数据的情况下,借助catalog 可以恢复control file ,还有spfile 等,今天特地配置了一下catalog 数据库:

Rman 在恢复数据的情况下,借助catalog 可以恢复control file ,还有spfile 等,今天特地配置了一下catalog 数据库:

   1>在catalog数据库上创建一个表空间供catalog使用

        create tablespace rman_ts datafile '/u02/ezhou/rman01.dbf' size 50m extent management  local uniform size 126k;

   2>在catalog数据库上创建用户并赋予权限

       create user rman_user identified by rman_user default tablespace rman_ts quota unlimited on rman_ts;

       grant recovery_catalog_owner to rman_user;

       grant connect,resource to rman_user;

   3:连到catalog 数据库,,建tablespace:
      
       rman catalog rman_user/rman_user
      
       RMAN> create catalog tablespace rman_ts;

       recovery catalog created
      
   4:在catalog上配置并启动监听程序,在target数据库上配置本地命名服务.
  
    cd /$Oracle_HOME/network/admin
    [oracle@aoracle admin]$ vi tnsnames.ora
PRD =    
(DESCRIPTION =
        (ADDRESS_LIST =
                (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.190.140)(PORT = 1521))
        )
        (CONNECT_DATA =
        (SID = EZHOU)
        )
)

好,下面启动监听:lsnrctl start
再lsnrctl status,可以看到status is ready,就可以了。

  5>在target数据库的机器上通过本地命名服务连接到catalog数据库
 
  [oracle@aoracle ~]$ rman target / catalog rman_user/rman_user@prd;

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Dec 8 15:14:46 2011

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

connected to target database: EZHOU (DBID=4046377924)
connected to recovery catalog database

好,下面在catalog 数据库上注册target 数据库。

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>

到现在,catalog 的配置就算完成了。


当然下面的文章,也可以参考一下:

1.在目录数据库中创建恢复目录所需的表空间
  CREATE TABLESPACE rman_ts DATAFILE '/oradata/RCAT/data/rman.dbf' SIZE 200m;
  PS:删除掉该表空间 DROP TABLESPACE rman_ts INCLUDING CONTENTS;
2.在目录数据库中创建RMAN用户
  CREATE USER rman IDENTIFIED BY rman DEFAULT TABLESPACE rman_ts TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON rman_ts;
  PS:删除用户  DROP USER rman CASCADE;
3.给rman用户授权
  GRANT recovery_catalog_owner,connect,resource TO rman;
4.新开启一个CMD
  rman catalog rman/rman
  或者: -C:\>rman
        -RMAN>connect catalog rman/rman@idba;
        -RMAN>create catalog tablespace rman_ts //创建catalog于rman_ts表空间
5.在D:\oracle\ora92\network\admin\tnsnames.ora建立
  PROD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.123.127)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = IDBA)
    )
  )
6.以sys用户登陆上生产数据库上创建备份用户
  -SQL>CREATE USER rman IDENTIFIED BY rman
  -SQL>GRANT sysdba TO rman;
7.连接上生产数据库注册
  -RMAN>CONNECT TARGET rman/rman@prod
  -RMAN>REGISTER DATABASE

##################################################
####################crontab -e####################
##################################################
0 2 28 1 *    /oraapp/oracle/dba/full_bkup.sh
10 0 * * 0    /oraapp/oracle/dba/lev0_bkup.sh
10 0 * * 1-2  /oraapp/oracle/dba/lev2_bkup.sh
10 0 * * 3    /oraapp/oracle/dba/lev1_bkup.sh
10 0 * * 4-6  /oraapp/oracle/dba/lev2_bkup.sh
10 3 * * 0    /oraapp/oracle/dba/ora_wk.sh

##################################################
########/oraapp/oracle/dba/DBA_rename.sql#########
##################################################
        connect RMAN/RMAN@RCAT;
        set echo off
        set feedback off
        set linesize 1000
        set pagesize 0
        set verify off
        spool /oraapp/oracle/dba/log/rename.txt
        select 'dd bs=1024 if=&1 of=/oraapp/oracle/dba/log/RLog_'||to_char(sysdate,'d')||'.txt' from dual;
        spool off
        host chmod 755 /oraapp/oracle/dba/log/rename.txt
        host /oraapp/oracle/dba/log/rename.txt
        host rm -rf /oraapp/oracle/dba/log/rename.txt
        exit;

##################################################
###########/oraapp/oracle/dba/ora_os.sh###########
##################################################
        #!/bin/sh
        #
        # copy all backup files from the db server72
        #
        cp /hotbkup/data/orabk/* /hotbkup/data/tmp/ >>/oraapp/oracle/dba/log/bkup.log
        #
        # move the daily backup to current week directory
        #
        cp /hotbkup/data/tmp/* /offbkup/data/cweek/ >>/oraapp/oracle/dba/log/bkup.log
        #
        # remove the yestoday's backup files
        #
        rm -rf /hotbkup/data/day/* >>/oraapp/oracle/dba/log/bkup.log
        #
        # copy all the backup file to day directory
        #
        mv /hotbkup/data/tmp/* /hotbkup/data/day/ >>/oraapp/oracle/dba/log/bkup.log
        #
        # delete all the db server72's backup files to free diskspace
        # must delete at last for security
        #
        rm -rf /hotbkup/data/orabk/* >>/oraapp/oracle/dba/log/bkup.log
        #
        # list all the backup file
        #
        ls -l /hotbkup/data/orabk/ >>/oraapp/oracle/dba/log/bkup.log
        ls -l /hotbkup/data/tmp/ >>/oraapp/oracle/dba/log/bkup.log
        ls -l /hotbkup/data/day/ >>/oraapp/oracle/dba/log/bkup.log
        ls -l /offbkup/data/cweek/ >>/oraapp/oracle/dba/log/bkup.log
        #
        # send email to dba
        #
        mail -s "BK_`date "+%Y-%m-%d"`_log" westzq@hotmail.com /oracle/dba/log/bkup.log

##################################################
###########/oraapp/oracle/dba/ora_wk.sh###########
##################################################
        #!/bin/sh
        #
        # remove all the last week backup files
        #
        rm -rf /offbkup/data/pweek/*
        #
        # move current week backup file to preview week folder
        #
        mv /offbkup/data/cweek/* /offbkup/data/pweek/

##################################################
#########/oraapp/oracle/dba/full_bkup.sh##########
##################################################
        #!/bin/sh
        export ORACLE_HOME=/oraapp/oracle/92
        export DBA_HOME=/oraapp/oracle/dba
        export ORACLE_SID=RCAT
        export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
        export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
        $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/full_bk.rcv msglog $DBA_HOME/log/bkup.log
        $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
        /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/full_bkup.rcv#########
##################################################
        connect catalog RMAN/RMAN@RCAT;
        connect target RMAN/RMAN@PROD;
        run {
        allocate channel ch1 device type disk;
        allocate channel ch2 device type disk;
        backup full filesperset=2 tag='Full_%d' format='/oradata/orabk/%T_full_%d_%s_%p' database include current controlfile;
        sql 'alter system archive log current';
        backup filesperset=4 format='/oradata/orabk/arch_%T_%d_%s_%p' archivelog all delete input;
        release channel ch1;
        release channel ch2;
        }
        quit;

##################################################
#########/oraapp/oracle/dba/lev0_bkup.sh##########
##################################################
        #!/bin/sh
        export ORACLE_HOME=/oraapp/oracle/92
        export DBA_HOME=/oraapp/oracle/dba
        export ORACLE_SID=RCVCAT
        export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
        export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
        $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev0_bkup.rcv log $DBA_HOME/log/bkup.log
        $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
        /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev0_bkup.rcv#########
##################################################
        connect catalog RMAN/RMAN@RCAT;
        connect target RMAN/RMAN@PROD;
        run {
        allocate channel ch1 device type disk;
        allocate channel ch2 device type disk;
        backup incremental level=0 filesperset=2 tag='Lev0_%d' format='/oradata/orabk/%T_lev0_%d_%s_%p' database include current controlfile;
        sql 'alter system archive log current';
        backup filesperset=4 format='/oradata/orabk/arch_%T_%d_%s_%p'
        archivelog all delete input;
        release channel ch1;
        release channel ch2;
        }
        quit;

##################################################
#########/oraapp/oracle/dba/lev1_bkup.sh##########
##################################################
        #!/bin/sh
        export ORACLE_HOME=/oraapp/oracle/92
        export DBA_HOME=/oraapp/oracle/dba
        export ORACLE_SID=RCAT
        export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
        export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
        $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev1_bkup.rcv log $DBA_HOME/log/bkup.log
        $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
        /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev1_bkup.rcv#########
##################################################
        connect catalog RMAN/RMAN@RCAT;
        connect target RMAN/RMAN@PROD;
        run {
        allocate channel ch1 device type disk;
        allocate channel ch2 device type disk;
        backup incremental
        level=1
        filesperset=2
        tag='Lev1_%d'
        format='/oradata/orabk/%T_lev1_%d_%s_%p'
        database include current controlfile;
        sql 'alter system archive log current';
        backup filesperset=4
        format='/oradata/orabk/arch_%T_%d_%s_%p'
        archivelog all delete input;
        release channel ch1;
        release channel ch2;
        }
        quit;

##################################################
#########/oraapp/oracle/dba/lev2_bkup.sh##########
##################################################
        #!/bin/sh
        export ORACLE_HOME=/oraapp/oracle/92
        export DBA_HOME=/oraapp/oracle/dba
        export ORACLE_SID=RCVCAT
        export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
        export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
        $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev2_bkup.rcv log $DBA_HOME/log/bkup.log
        $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
        /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev2_bkup.rcv#########
##################################################
        connect catalog RMAN/RMAN@RCAT;
        connect target RMAN/RMAN@PROD;
        run {
        allocate channel ch1 device type disk;
        allocate channel ch2 device type disk;
        backup incremental
        level=2
        filesperset=2
        tag='Lev2_%d'
        format='/oradata/orabk/%T_lev2_%d_%s_%p'
        database include current controlfile;
        sql 'alter system archive log current';
        backup filesperset=4
        format='/oradata/orabk/arch_%T_%d_%s_%p'
        archivelog all delete input;
        release channel ch1;
        release channel ch2;
        }
        quit;

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
深入理解MySQL索引优化器工作原理深入理解MySQL索引优化器工作原理Nov 09, 2022 pm 02:05 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于索引优化器工作原理的相关内容,其中包括了MySQL Server的组成,MySQL优化器选择索引额原理以及SQL成本分析,最后通过 select 查询总结整个查询过程,下面一起来看一下,希望对大家有帮助。

sybase是什么数据库sybase是什么数据库Sep 22, 2021 am 11:39 AM

sybase是基于客户/服务器体系结构的数据库,是一个开放的、高性能的、可编程的数据库,可使用事件驱动的触发器、多线索化等来提高性能。

visual foxpro数据库文件是什么visual foxpro数据库文件是什么Jul 23, 2021 pm 04:53 PM

visual foxpro数据库文件是管理数据库对象的系统文件。在VFP中,用户数据是存放在“.DBF”表文件中;VFP的数据库文件(“.DBC”)中不存放用户数据,它只起将属于某一数据库的 数据库表与视图、连接、存储过程等关联起来的作用。

数据库系统的构成包括哪些数据库系统的构成包括哪些Jul 15, 2022 am 11:58 AM

数据库系统由4个部分构成:1、数据库,是指长期存储在计算机内的,有组织,可共享的数据的集合;2、硬件,是指构成计算机系统的各种物理设备,包括存储所需的外部设备;3、软件,包括操作系统、数据库管理系统及应用程序;4、人员,包括系统分析员和数据库设计人员、应用程序员(负责编写使用数据库的应用程序)、最终用户(利用接口或查询语言访问数据库)、数据库管理员(负责数据库的总体信息控制)。

microsoft sql server是什么软件microsoft sql server是什么软件Feb 28, 2023 pm 03:00 PM

microsoft sql server是Microsoft公司推出的关系型数据库管理系统,是一个全面的数据库平台,使用集成的商业智能(BI)工具提供了企业级的数据管理,具有使用方便可伸缩性好与相关软件集成程度高等优点。SQL Server数据库引擎为关系型数据和结构化数据提供了更安全可靠的存储功能,使用户可以构建和管理用于业务的高可用和高性能的数据应用程序。

go语言可以写数据库么go语言可以写数据库么Jan 06, 2023 am 10:35 AM

go语言可以写数据库。Go语言和其他语言不同的地方是,Go官方没有提供数据库驱动,而是编写了开发数据库驱动的标准接口,开发者可以根据定义的接口来开发相应的数据库驱动;这样做的好处在于,只要是按照标准接口开发的代码,以后迁移数据库时,不需要做任何修改,极大方便了后期的架构调整。

数据库的什么是指数据的正确性和相容性数据库的什么是指数据的正确性和相容性Jul 04, 2022 pm 04:59 PM

数据库的“完整性”是指数据的正确性和相容性。完整性是指数据库中数据在逻辑上的一致性、正确性、有效性和相容性。完整性对于数据库系统的重要性:1、数据库完整性约束能够防止合法用户使用数据库时向数据库中添加不合语义的数据;2、合理的数据库完整性设计,能够同时兼顾数据库的完整性和系统的效能;3、完善的数据库完整性有助于尽早发现应用软件的错误。

mysql查询慢的因素除了索引,还有什么?mysql查询慢的因素除了索引,还有什么?Jul 19, 2022 pm 08:22 PM

mysql查询为什么会慢,关于这个问题,在实际开发经常会遇到,而面试中,也是个高频题。遇到这种问题,我们一般也会想到是因为索引。那除开索引之外,还有哪些因素会导致数据库查询变慢呢?

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use