rman 使用catalog备份的演示
来源:互联网 发布:mac 终端 路径 编辑:程序博客网 时间:2024/06/05 01:11
介绍了如何使用catalog方式做RMAN备份,以及如何取消以catalog方式做备份。
SQL> create tablespace catalog1 datafile '/u01/app/oracle/oradata/bys001/catalog1.dbf' size 50m ;
Tablespace created.
SQL> create user rmanuser identified by rmanuser default tablespace catalog1;
User created.
SQL> grant connect,resource,recovery_catalog_owner to rmanuser;
Grant succeeded.
SQL> select * from role_sys_privs where role='RECOVERY_CATALOG_OWNER';
ROLE 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 SESSION NO
RECOVERY_CATALOG_OWNER CREATE TABLE NO
RECOVERY_CATALOG_OWNER CREATE SEQUENCE NO
RECOVERY_CATALOG_OWNER CREATE PROCEDURE NO
RECOVERY_CATALOG_OWNER CREATE VIEW NO
RECOVERY_CATALOG_OWNER CREATE TYPE NO
RECOVERY_CATALOG_OWNER CREATE TRIGGER NO
11 rows selected.
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 14:28:59 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Connected.
SQL> select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
2 4 2041679290 BYS001 1143629 16-JUN-13
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 14:28:59 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> backup database;
Starting backup at 19-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/bys001/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/bys001/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/bys001/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/bys001/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/bys001/catalog1.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/bys001/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-JUN-13
channel ORA_DISK_1: finished piece 1 at 19-JUN-13
piece handle=/u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_19/o1_mf_nnndf_TAG20130619T143220_8w2n3r2o_.bkp tag=TAG20130619T143220 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:12:38
Finished backup at 19-JUN-13
Starting Control File and SPFILE Autobackup at 19-JUN-13
piece handle=/backup/ctl_c-2041679290-20130619-08 comment=NONE
Finished Control File and SPFILE Autobackup at 19-JUN-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
545 Full 1.13G DISK 00:12:34 19-JUN-13
BP Key: 548 Status: AVAILABLE Compressed: NO Tag: TAG20130619T143220
Piece Name: /u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_19/o1_mf_nnndf_TAG20130619T143220_8w2n3r2o_.bkp
List of Datafiles in backup set 545
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/system01.dbf
2 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/sysaux01.dbf
3 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/undotbs01.dbf
4 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/users01.dbf
5 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/example01.dbf
6 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/catalog1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
559 Full 9.52M DISK 00:00:01 19-JUN-13
BP Key: 566 Status: AVAILABLE Compressed: NO Tag: TAG20130619T144500
Piece Name: /backup/ctl_c-2041679290-20130619-08
SPFILE Included: Modification time: 19-JUN-13
SPFILE db_unique_name: BYS001
Control File Included: Ckp SCN: 1306060 Ckp time: 19-JUN-13
RMAN> unregister database; 取消当前登陆的数据库注册到catalog
database name is "BYS001" and DBID is 2041679290
Do you really want to unregister the database (enter YES or NO)? y
database unregistered from the recovery catalog
RMAN> list backup;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 06/19/2013 15:15:22
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
RMAN> exit
Recovery Manager complete.
报错是因为登陆时是以指定catalog方式登陆,退出重新查询就可以了。
在SQLPLUS中查询
SQL> conn rmanuser/rmanuser
Connected.
SQL> select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
2 4 2041679290 BYS001 1143629 16-JUN-13
SQL> select * from rc_database;
no rows selected
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 15:15:48 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
81 Full 9.52M DISK 00:00:03 19-JUN-13
BP Key: 81 Status: AVAILABLE Compressed: NO Tag: TAG20130619T110902
Piece Name: /backup/ctl_c-2041679290-20130619-02
SPFILE Included: Modification time: 18-JUN-13
SPFILE db_unique_name: BYS001
Control File Included: Ckp SCN: 1277256 Ckp time: 19-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
82 32.50K DISK 00:00:00 19-JUN-13
BP Key: 82 Status: AVAILABLE Compressed: NO Tag: BYS001-1
Piece Name: /backup/full/bys001arch_BYS001_818507657_87
第一步:创建RMAN CATALOG表空间及用户。
[oracle@oel-01 ~]$ sqlplus / as sysdbaSQL> create tablespace catalog1 datafile '/u01/app/oracle/oradata/bys001/catalog1.dbf' size 50m ;
Tablespace created.
SQL> create user rmanuser identified by rmanuser default tablespace catalog1;
User created.
SQL> grant connect,resource,recovery_catalog_owner to rmanuser;
Grant succeeded.
SQL> select * from role_sys_privs where role='RECOVERY_CATALOG_OWNER';
ROLE 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 SESSION NO
RECOVERY_CATALOG_OWNER CREATE TABLE NO
RECOVERY_CATALOG_OWNER CREATE SEQUENCE NO
RECOVERY_CATALOG_OWNER CREATE PROCEDURE NO
RECOVERY_CATALOG_OWNER CREATE VIEW NO
RECOVERY_CATALOG_OWNER CREATE TYPE NO
RECOVERY_CATALOG_OWNER CREATE TRIGGER NO
11 rows selected.
第二步:注册数据库到RMAN CATALOG
[oracle@oel-01 ~]$ rman target sys/sys@192.168.1.212:1521/bys001 catalog rmanuser/rmanuserRecovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 14:28:59 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
第三步:查看是否注册
SQL> conn rmanuser/rmanuserConnected.
SQL> select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
2 4 2041679290 BYS001 1143629 16-JUN-13
第四步:到RMAN中执行全备备份
[oracle@oel-01 ~]$ rman target sys/sys@192.168.1.212:1521/bys001 catalog rmanuser/rmanuserRecovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 14:28:59 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> backup database;
Starting backup at 19-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/bys001/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/bys001/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/bys001/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/bys001/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/bys001/catalog1.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/bys001/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-JUN-13
channel ORA_DISK_1: finished piece 1 at 19-JUN-13
piece handle=/u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_19/o1_mf_nnndf_TAG20130619T143220_8w2n3r2o_.bkp tag=TAG20130619T143220 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:12:38
Finished backup at 19-JUN-13
Starting Control File and SPFILE Autobackup at 19-JUN-13
piece handle=/backup/ctl_c-2041679290-20130619-08 comment=NONE
Finished Control File and SPFILE Autobackup at 19-JUN-13
第五步:取消使用CATALOG备份
这是使用list backup 查出来的信息,信息太多,只截了此次使用CATALOG备份的两个备份集。BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
545 Full 1.13G DISK 00:12:34 19-JUN-13
BP Key: 548 Status: AVAILABLE Compressed: NO Tag: TAG20130619T143220
Piece Name: /u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_19/o1_mf_nnndf_TAG20130619T143220_8w2n3r2o_.bkp
List of Datafiles in backup set 545
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/system01.dbf
2 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/sysaux01.dbf
3 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/undotbs01.dbf
4 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/users01.dbf
5 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/example01.dbf
6 Full 1305626 19-JUN-13 /u01/app/oracle/oradata/bys001/catalog1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
559 Full 9.52M DISK 00:00:01 19-JUN-13
BP Key: 566 Status: AVAILABLE Compressed: NO Tag: TAG20130619T144500
Piece Name: /backup/ctl_c-2041679290-20130619-08
SPFILE Included: Modification time: 19-JUN-13
SPFILE db_unique_name: BYS001
Control File Included: Ckp SCN: 1306060 Ckp time: 19-JUN-13
RMAN> unregister database; 取消当前登陆的数据库注册到catalog
database name is "BYS001" and DBID is 2041679290
Do you really want to unregister the database (enter YES or NO)? y
database unregistered from the recovery catalog
RMAN> list backup;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 06/19/2013 15:15:22
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
RMAN> exit
Recovery Manager complete.
报错是因为登陆时是以指定catalog方式登陆,退出重新查询就可以了。
在SQLPLUS中查询
SQL> conn rmanuser/rmanuser
Connected.
SQL> select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
2 4 2041679290 BYS001 1143629 16-JUN-13
SQL> select * from rc_database;
no rows selected
第六步:重新登陆RMAN查看备份集信息:
[oracle@oel-01 ~]$ rman target /Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 19 15:15:48 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYS001 (DBID=2041679290)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
81 Full 9.52M DISK 00:00:03 19-JUN-13
BP Key: 81 Status: AVAILABLE Compressed: NO Tag: TAG20130619T110902
Piece Name: /backup/ctl_c-2041679290-20130619-02
SPFILE Included: Modification time: 18-JUN-13
SPFILE db_unique_name: BYS001
Control File Included: Ckp SCN: 1277256 Ckp time: 19-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
82 32.50K DISK 00:00:00 19-JUN-13
BP Key: 82 Status: AVAILABLE Compressed: NO Tag: BYS001-1
Piece Name: /backup/full/bys001arch_BYS001_818507657_87
- rman 使用catalog备份的演示
- 使用catalog的rman备份与恢复
- rman备份,未使用catalog,控制文件丢失的解决办法
- rman备份,未使用catalog,控制文件丢失的解决办法
- 使用Catalog命令注册RMAN备份集
- 使用Catalog命令注册RMAN备份集
- 使用Catalog命令注册RMAN备份集
- 使用Catalog命令注册RMAN备份集
- 基于catalog 的RMAN 备份与恢复
- -- 基于catalog 的RMAN 备份与恢复
- 基于catalog 的RMAN 备份脚本
- 基于catalog 的RMAN 备份与恢复
- rman的配置,使用catalog
- rman备份之catalog
- DBA工作备忘录之三:rman备份,未使用catalog,控制文件丢失的解决办法
- DBA工作备忘录之三:rman备份,未使用catalog,控制文件丢失的解决办法
- RMAN未使用catalog备份丢失控制文件的恢复方法
- rman中CATALOG命令的使用
- 留住你的用户:8款第三方移动推送服务
- iOS利用单例实现不同界面间的数据传输
- 改善C++ 程序的150个建议学习之建议26:用引用代替指针
- 我对计算机类专业教学中一些问题的看法
- 静态方法调用
- rman 使用catalog备份的演示
- Deep Learning in NLP (一)词向量和语言模型
- android 中一个工程引用另一个工程
- 到了50岁你还愿意做编程工作吗?
- IOS 页面属性传值、委托传值、单例传值
- JQuery操作select标签
- Asp.net Json数据解析的一种思路
- 64位系统下报libstdc++.so.6 GLIBCXX 错误
- IO流(二)