ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 创建rman的catalog 库及备份

创建rman的catalog 库及备份

原创 Linux操作系统 作者:zengzg 时间:2019-01-10 19:45:04 0 删除 编辑

rman很久不做了,最近刚上10g rac,要全面做一遍,在测试机上试了一下,记下来:

1.建好catalog库并建catalog表空间
SQL> create tablespace RCVCAT datafile '/mytestoradata/rcvcat.dbf' size 100M;

Tablespace created.

2.建好管理catalog的rman的user,并给recovery_catalog_owner权限:
SQL> create user RMAN identified by RMAN
  2  temporary tablespace TEMP
  3  default tablespace RCVCAT
  4  quota unlimited on RCVCAT;

User created.

SQL> grant recovery_catalog_owner to RMAN;

Grant succeeded.


3.创建catalog:
standby-> rman

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Nov 16 15:20:36 2008

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

RMAN>  CONNECT CATALOG rman/rman@mytest 

connected to recovery catalog database

RMAN> CREATE CATALOG;

recovery catalog created


4.加tnsnames
rac1-> crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    ONLINE    rac2       
ora....b1.inst application    ONLINE    ONLINE    rac1       
ora....b2.inst application    ONLINE    ONLINE    rac2       

加入catalog的tns到rac 两个实例(rac1,rac2)的tnsnames.ora中:
rac1-> vi tnsnames.ora

mytest =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.218.188)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = mytest)
    )
  )

5.在rac 库上register database 注册到catalog库
rac1-> rman target / catalog rman/rman@mytest

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 18 09:09:59 2008

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

connected to target database: RACDB (DBID=667104169)
connected to recovery catalog database

RMAN> register database;

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

RMAN> REPORT SCHEMA;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    400      SYSTEM               YES     +RACDATA/racdb/datafile/system.259.669487425
2    200      UNDOTBS1             YES     +RACDATA/racdb/datafile/undotbs1.260.669487479
3    300      SYSAUX               NO      +RACDATA/racdb/datafile/sysaux.261.669487497
4    200      UNDOTBS2             YES     +RACDATA/racdb/datafile/undotbs2.263.669487539
5    5        USERS                NO      +RACDATA/racdb/datafile/users.264.669487561

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       +RACDATA/racdb/tempfile/temp.262.669487527

在实例2主机查看:
rac2-> rman target / catalog rman/rman@mytest

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 18 09:16:36 2008

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

connected to target database: RACDB (DBID=667104169)
connected to recovery catalog database

RMAN> report schema;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    400      SYSTEM               YES     +RACDATA/racdb/datafile/system.259.669487425
2    200      UNDOTBS1             YES     +RACDATA/racdb/datafile/undotbs1.260.669487479
3    300      SYSAUX               NO      +RACDATA/racdb/datafile/sysaux.261.669487497
4    200      UNDOTBS2             YES     +RACDATA/racdb/datafile/undotbs2.263.669487539
5    5        USERS                NO      +RACDATA/racdb/datafile/users.264.669487561

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       +RACDATA/racdb/tempfile/temp.262.669487527

RMAN>


SQL> create tablespace rman_backup datafile '+RACDATA/' size 50M;
Tablespace created.

SQL> create user rman identified by rman default tablespace rman_backup temporary tablespace temp;

User created.

SQL> grant sysdba to rman;

Grant succeeded.

 


5.备份rac库及archivelog:
rac1->rman target rman/rman@racdb1 catalog rman/rman@mytest
run{
 allocate CHANNEL ch00  type DISK  CONNECT 'sys/oracle@racdb1';
 allocate CHANNEL ch01  type DISK  CONNECT 'sys/oracle@racdb2';
 resync catalog;
 backup database  filesperset 10  format '/rmanset/full_%d%t%s%p'         tag 'fullbackup';
 sql 'alter system archive log current';
 BACKUP FORMAT '/rmanset/%d_arch_%s_%p_%h' ARCHIVELOG ALL delete all input;                                        
 backup format '/rmanset/control_%d' current controlfile;
 RELEASE CHANNEL ch00;                                                        
 RELEASE CHANNEL ch01;                                                       
}

备份archivelog
run{
   allocate CHANNEL ch00  type DISK  CONNECT 'sys/oracle@racdb1';
   allocate CHANNEL ch01  type DISK  CONNECT 'sys/oracle@racdb2';
   resync catalog;
   sql 'alter system archive log current' ;
   backup filesperset 4    format '/rmanset/node2_%d_arch_%s_%p'
     (archivelog like '/racdb2_arch/%'  delete input);
    backup format '/rmanset/control_%d' current controlfile;
}

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

请登录后发表评论 登录
全部评论

注册时间:2009-09-09

  • 博文量
    50
  • 访问量
    37939