Oracle Recovery catalog

1、在target中创建用户

******************
创建用于recovery catalog的表空间
****************** SQL
> create tablespace rc_data datafile '/oracle/app/oracle/oradata/ocm1/rc_data01.dbf' size 100M autoextend off; Tablespace created.
********************
创建rcowner用户
******************** SQL
> create user rcowner identified by oracle temporary tablespace temp default tablespace rc_data quota unlimited on rc_data; User created. SQL> grant recovery_catalog_owner to rcowner; Grant succeeded.
********************
创建catalog,应该就是在rcowner下创建一些对象,例如表之类的
********************
[ocm1:oracle]:/home/oracle>rman catalog rcowner/oracle Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jun 21 18:06:03 2019 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database RMAN> RMAN> create catalog; recovery catalog created
可以看到user_tables下已经有了很多表

TABLE_NAME
------------------------------
DB
NODE
CONF
DBINC
CKP
TS
TSATT
DF
SITE_DFATT
TF
SITE_TFATT
OFFR
RR
RT
ORL
RLH
AL
BS
BP
BCF
CCF
XCF
BSF
BDF
CDF
XDF
BRL
BCB
CCB
SCR
SCRL
CONFIG
XAL
RSR
FB
GRSP
NRSP
VPC_USERS
VPC_DATABASES
CFS
BCR
ROUT
RCVER
TEMPRES
Recovery Manager complete. [ocm1:oracle]:/home/oracle>sqlplus rcowner/oracle SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 21 18:07:04 2019 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> select object_type,count(*) from user_objects group by object_type; OBJECT_TYPE COUNT(*) ------------------- ---------- SEQUENCE 1 PACKAGE 2 PACKAGE BODY 2 TYPE BODY 1 TRIGGER 3 TABLE 44 INDEX 96 FUNCTION 2 VIEW 98 TYPE 3 10 rows selected.


 

 

2、在target端注册

[ocm:oracle]:/home/oracle>rman target sys/oracle catalog rcowner/oracle@192.168.8.101:1521/ocm1

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jun 21 18:14:59 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OCM (DBID=2393802673)
connected to recovery catalog database

RMAN> register database;            --将target数据库的相关备份信息注册到recovery catalog上

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

RMAN> 

RMAN> 

RMAN> resync catalog;          --重新同步

starting full resync of recovery catalog
full resync complete

RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
169     B  F  A DISK        20-JUN-19       1       1       NO         TAG20190620T152155
170     B  F  A DISK        20-JUN-19       1       1       NO         TAG20190620T152155
171     B  F  A DISK        20-JUN-19       1       1       YES        TAG20190620T152502
172     B  F  A DISK        20-JUN-19       1       1       YES        TAG20190620T152502

RMAN> report schema;

Report of database schema for database with db_unique_name OCM

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    700      SYSTEM               YES     /oracle/app/oracle/oradata/ocm/system01.dbf
2    600      SYSAUX               NO      /oracle/app/oracle/oradata/ocm/sysaux01.dbf
3    760      UNDOTBS1             YES     /oracle/app/oracle/oradata/ocm/undotbs01.dbf
4    5        USERS                NO      /rman/user01.dbf
5    100      FDA                  NO      /oracle/app/oracle/oradata/ocm/fda.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    68       TEMP                 32767       /oracle/app/oracle/oradata/ocm/temp01.dbf

 2、如何去创建vpc1

SQL> cREATE USER vpc1 IDENTIFIED BY oracle DEFAULT TABLESPACE rc_data  QUOTA UNLIMITED ON rc_data;

User created.

SQL> GRANT recovery_catalog_owner TO vpc1;

Grant succeeded.

SQL> CONNECT CATALOG catowner





[ocm1:oracle]:/home/oracle>rman  rcowner/oracle

Argument     Value          Description
-----------------------------------------------------------------------------
target       quoted-string  connect-string for target database
catalog      quoted-string  connect-string for recovery catalog
nocatalog    none           if specified, then no recovery catalog
cmdfile      quoted-string  name of input command file
log          quoted-string  name of output message log file
trace        quoted-string  name of output debugging message log file
append       none           if specified, log is opened in append mode
debug        optional-args  activate debugging
msgno        none           show RMAN-nnnn prefix for all messages
send         quoted-string  send a command to the media manager
pipe         string         building block for pipe names
timeout      integer        number of seconds to wait for pipe input
checksyntax  none           check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00552: syntax error in command line arguments
RMAN-01009: syntax error: found "identifier": expecting one of: "append, auxiliary, catalog, checksyntax, cmdfile, log, msgno, nocatalog, pipe, script, send, target, timeout, using, @, ;"
RMAN-01008: the bad identifier was: rcowner
RMAN-01007: at line 2 column 1 file: command line arguments
[ocm1:oracle]:/home/oracle>rman catalog  rcowner/oracle

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jun 21 18:55:24 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to recovery catalog database

RMAN> GRANT CATALOG FOR DATABASE ocm to vpc1;

Grant succeeded.

RMAN> conn catalog vpc1/oracle;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "advise, allocate, alter, backup, @, catalog, change, configure, connect, convert, copy, create, crosscheck, delete, drop, duplicate, exit, flashback, grant, host, import, list, mount, open, print, quit, recover, register, release, repair, replace, report, reset, restore, resync, revoke, run, send, set, show, shutdown, spool, sql, startup, switch, transport, unregister, upgrade, validate, {, "
RMAN-01008: the bad identifier was: conn
RMAN-01007: at line 1 column 1 file: standard input

RMAN> exit


Recovery Manager complete.
[ocm1:oracle]:/home/oracle>rman catalog  vpc1/oracle

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jun 21 18:56:29 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to recovery catalog database

RMAN> CREATE VIRTUAL CATALOG;

found eligible base catalog owned by RCOWNER
created virtual catalog against base catalog owned by RCOWNER

RMAN> exit


Recovery Manager complete.
[ocm1:oracle]:/home/oracle>sqlplus vpc1/oracle

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 21 18:57:30 2019

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> begin
  2  catowner.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
  3  end;
  4  /
catowner.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
*
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00201: identifier 'CATOWNER.DBMS_RCVCAT' must be declared
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored


SQL> begin
  2  rcowner.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
  3  end;
  4  /

PL/SQL procedure successfully completed.

 

转载于:https://www.cnblogs.com/dayu-liu/p/11066189.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值