参考文档:Recovery catalog for RMAN backup (Doc ID 452529.1)
catalog库 : bak,将其他库的备份信息存放在catalog库上
-- 在cagalog库上创建用户
- create tablespace cat_tbs datafile '/oradata/bak/cat_tbs01.dbf' size 200M autoextend on;
- CREATE USER catuser IDENTIFIED BY oracle DEFAULT TABLESPACE cat_tbs TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON cat_tbs;
- GRANT CONNECT, RECOVERY_CATALOG_OWNER TO catuser;
-
- SYS@bak SQL> create tablespace cat_tbs datafile '/oradata/bak/cat_tbs01.dbf' size 200M autoextend on;
-
- Tablespace created.
-
- SYS@bak SQL> CREATE USER catuser IDENTIFIED BY oracle DEFAULT TABLESPACE cat_tbs TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON cat_tbs;
-
- User created.
-
- SYS@bak SQL> GRANT CONNECT, RECOVERY_CATALOG_OWNER TO catuser;
-
- Grant succeeded.
-
- SYS@bak SQL>
-- 创建catalog
- % rman catalog <catalog username>/<password> @<catalog db connect string>
-
- rman catalog catuser/oracle@bak
- create catalog;
-
- [oracle@19ctest ~]$ rman catalog catuser/oracle@bak
-
- Recovery Manager: Release 19.0.0.0.0 - Production on Fri Nov 17 14:17:07 2023
- Version 19.21.0.0.0
-
- Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
-
- connected to recovery catalog database
-
- RMAN> create catalog;
-
- recovery catalog created
-
- RMAN>
-- 注册database,分别在bak,test,orcl库上执行
- % rman TARGET / CATALOG <catalog username>/<password> @<catalog db connect string>
-
- rman target / catalog catuser/oracle@bak
- register database;
-
- [oracle@19ctest ~]$ rman target / catalog catuser/oracle@bak
-
- Recovery Manager: Release 19.0.0.0.0 - Production on Fri Nov 17 14:18:29 2023
- Version 19.21.0.0.0
-
- Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
-
- connected to target database: BAK (DBID=1552936560)
- connected to recovery catalog database
-
- RMAN> register database;
-
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
-
- RMAN>
-
- [oracle@19ctest ~]$ rman target / catalog catuser/oracle@bak
-
- Recovery Manager: Release 19.0.0.0.0 - Production on Fri Nov 17 14:19:10 2023
- Version 19.21.0.0.0
-
- Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
-
- connected to target database: TEST (DBID=2318641842)
- connected to recovery catalog database
-
- RMAN> register database;
-
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
-
- RMAN>
-
-
- [oracle@19ctest ~]$ rman target / catalog catuser/oracle@bak
-
- Recovery Manager: Release 19.0.0.0.0 - Production on Fri Nov 17 14:19:53 2023
- Version 19.21.0.0.0
-
- Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
-
- connected to target database: ORCL (DBID=1628558668)
- connected to recovery catalog database
-
- RMAN> register database;
-
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
-
- RMAN>
-- 升级catalog
RMAN>UPGRADE CATALOG;
--remove catalog
RMAN> DROP CATALOG;
-- unregister database
RMAN> UNREGISTER DATABASE
% sqlplus
SQL > DBMS_RCVCAT.UNREGISTERDATABASE(db_key, db_id);
-- 查看catalog版本
- % sqlplus <catalog username>/<password> @<catalog db connect string>
-
- SQL > SELECT * FROM rcver;
-
- sqlplus catuser/oracle@bak
- SELECT * FROM rcver;
-
- [oracle@19ctest ~]$ sqlplus catuser/oracle@bak
-
- SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 17 14:20:55 2023
- Version 19.21.0.0.0
-
- Copyright (c) 1982, 2022, Oracle. All rights reserved.
-
- Last Successful login time: Fri Nov 17 2023 14:19:54 +08:00
-
- Connected to:
- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
- Version 19.21.0.0.0
-
-
- Session altered.
-
- CATUSER@bak SQL> SELECT * FROM rcver;
-
- VERSION
- ---------------
- 19.21.00.00.00
-
- CATUSER@bak SQL>
-- 查看在catalog中的库
- SYS@bak SQL> select * from catuser.node;
-
- DB_UNIQUE_ DB_KEY INST_STARTUP_STAMP DATABAS SITE_KEY DB_TIMEZONE T
- ---------- ---------- ------------------ ------- ---------- ---------------------------------------------------------------- -
- BAK 1 1153144098 PRIMARY 3 +08:00 R
- TEST 105 1153142785 PRIMARY 107 +08:00 R
- ORCL 263 1153142862 PRIMARY 265 +08:00 R
-
- SYS@bak SQL>
END