重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2728|回复: 0
打印 上一主题 下一主题

[原创] recovery catalog 应用之一:使用recovery catalog查看数据库过去的定义

[复制链接]
跳转到指定楼层
楼主
发表于 2018-8-29 12:39:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我们平时通过report schema看到的是当前数据库的定义信息,
如果使用 recovery catalog的情况下,我们可以看到数据库以前的数据结构的信息
比如:

1.增加表空间前的情况:

   [oracle@dbserver ~]$ rman target / catalog rman/rman@192.168.133.1:1521/orcl
   Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 29 11:41:49 2018
   Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
   connected to target database: SZTECH1 (DBID=3253410194)
   connected to recovery catalog database

   RMAN> report schema;
   Report of database schema for database with db_unique_name SZTECH1
   List of Permanent Datafiles
   ===========================
   File Size(MB) Tablespace           RB segs Datafile Name
   ---- --------    --------------------   -------     ------------------------
   1    740      SYSTEM                 YES       /u01/app/oracle/oradata/sztech1/system01.dbf
   2    570      SYSAUX                 NO        /u01/app/oracle/oradata/sztech1/sysaux01.dbf
   3    105      UNDOTBS1            YES       /u01/app/oracle/oradata/sztech1/undotbs01.dbf
   4    303      USERS                   NO        /u01/app/oracle/oradata/sztech1/user01.dbf
   5    330      EXAMPLE               NO        /u01/app/oracle/oradata/sztech1/example01.dbf
  List of Temporary Files
  =======================
  File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
  ---- -------- -------------------- ----------- --------------------
  1    29       TEMP                 32767       /u01/app/oracle/oradata/sztech1/temp01.dbf
  RMAN>

2.加一个表空间,ts_test
   可以记录这个时间为:2018-08-29 12:08:47

   [oracle@dbserver ~]$ sqlplus /nolog


   SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 29 12:08:47 2018
   Copyright (c) 1982, 2013, Oracle.  All rights reserved.
   SQL> conn / as sysdba
   Connected.
   SQL> create tablespace ts_test datafile '/u01/app/oracle/oradata/sztech1/ts_test01.dbf' size 10m;
   Tablespace created.
   SQL> exit
   Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
   With the Partitioning, OLAP, Data Mining and Real Application Testing options

3.使用report schema,看到当前的表空间情况,包含新增加的表空间ts_test


  [oracle@dbserver ~]$ rman target / catalog rman/rman@192.168.133.1:1521/orcl
  Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 29 12:09:17 2018
  Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
  connected to target database: SZTECH1 (DBID=3253410194)
  connected to recovery catalog database
  RMAN>
  RMAN> report schema ;
  Report of database schema for database with db_unique_name SZTECH1
  List of Permanent Datafiles
  ===========================
  File Size(MB) Tablespace           RB segs Datafile Name
  ---- -------- -------------------- ------- ------------------------
  1    740      SYSTEM               YES     /u01/app/oracle/oradata/sztech1/system01.dbf
  2    570      SYSAUX               NO      /u01/app/oracle/oradata/sztech1/sysaux01.dbf
  3    105      UNDOTBS1             YES     /u01/app/oracle/oradata/sztech1/undotbs01.dbf
  4    303      USERS                NO      /u01/app/oracle/oradata/sztech1/user01.dbf
  5    330      EXAMPLE              NO      /u01/app/oracle/oradata/sztech1/example01.dbf
  6    10       TS_TEST              NO      /u01/app/oracle/oradata/sztech1/ts_test01.dbf
  List of Temporary Files
  =======================
  File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
  ---- -------- -------------------- ----------- --------------------
  1    29       TEMP                 32767       /u01/app/oracle/oradata/sztech1/temp01.dbf

4. 使用创建新表空间之前的时间查询:

RMAN>  report schema at time "to_date('2018-08-29 12:08:47','yyyy-mm-dd hh24:mi:ss')";
Report of database schema for database with db_unique_name SZTECH1
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    740      SYSTEM               YES     /u01/app/oracle/oradata/sztech1/system01.dbf
2    570      SYSAUX               NO      /u01/app/oracle/oradata/sztech1/sysaux01.dbf
3    105      UNDOTBS1             YES     /u01/app/oracle/oradata/sztech1/undotbs01.dbf
4    303      USERS                NO      /u01/app/oracle/oradata/sztech1/user01.dbf
5    330      EXAMPLE              NO      /u01/app/oracle/oradata/sztech1/example01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    29       TEMP                 32767       /u01/app/oracle/oradata/sztech1/temp01.dbf
RMAN>


这个时候,我们发现,新表空间不见了。

5. 当然,这个功能只能使用了 recovery catalog的情况下,才可以 。

[oracle@dbserver ~]$ rman target /                                          
Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 29 12:37:12 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SZTECH1 (DBID=3253410194)
RMAN>  report schema at time "to_date('2018-08-29 12:08:47','yyyy-mm-dd hh24:mi:ss')";
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of report command at 08/29/2018 12:37:18
RMAN-06137: must have recovery catalog for REPORT SCHEMA AT TIME
RMAN>


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-27 03:34 , Processed in 0.095482 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表