|
做recovery catalog的流程:
- --SYS
- select * from dba_tablespaces;
- create tablespace rcat datafile size 50M autoextend on maxsize 3G;
- create user u87 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
-
- grant recovery_catalog_owner to u87;
复制代码 是空的。
- [oracle@station87 admin]$ rman catalog u87/oracle_4U@orcl90
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:38:41 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN>
- RMAN> create catalog ;
- recovery catalog created
- RMAN>
复制代码 就有了142个空的表和视图以及一些程序。这些就叫资料档案库。
空的。
- [oracle@station87 admin]$ rman target / catalog u87/oracle_4U@orcl90
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:42:55 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- connected to recovery catalog database
- RMAN> register database;
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
- RMAN>
复制代码
这是目标数据库的控制文件:
这是复制了目标数据库控制文件信息后的CATALOG机器上U87的自己的表:
结论:本地的V$...变成远程的RC...,但是在RC...中为了保持多个注册数据库备份信息的唯一性,备份集号会重新编号:
作为动词的CATALOG,去注册备份片,然后同步远程两个CATALOG;
备份recovery catalog:
- [oracle@station90 ~]$ expdp system/oracle_4U directory=dir1 dumpfile=u87.dmp schemas=u87
复制代码 恢复recovery catalog:
- [oracle@station90 ~]$ impdp system/oracle_4U directory=dir1 dumpfile=u87.dmp
复制代码
11.2.0.3的rman客户端建的catalog,如果要导入11.2.0.1的rman客户端建的catalog,需要把后者upgrade catalog:
- [oracle@station90 ~]$ rman catalog u87/oracle_4U
- Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:05:28 2018
- Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- PL/SQL package U87.DBMS_RCVCAT version 11.02.00.01 in RCVCAT database is not current
- PL/SQL package U87.DBMS_RCVMAN version 11.02.00.01 in RCVCAT database is not current
- RMAN> upgrade catalog;
- recovery catalog owner is U87
- enter UPGRADE CATALOG command again to confirm catalog upgrade
- RMAN> upgrade catalog;
- recovery catalog upgraded to version 11.02.00.03
- DBMS_RCVMAN package upgraded to version 11.02.00.03
- DBMS_RCVCAT package upgraded to version 11.02.00.03
- RMAN>
复制代码
- Recovery Manager complete.
- [oracle@station90 ~]$ rman catalog u870/oracle_4U
- Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:07:49 2018
- Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN> import catalog u87/oracle_4U@orcl;
- Starting import catalog at 2018-06-02:11:07:53
- connected to source recovery catalog database
- import validation complete
- database unregistered from the source recovery catalog
- Finished import catalog at 2018-06-02:11:07:59
- RMAN>
复制代码 两个CATALOG之间复制数据,加上"NO UNREGISTER":
- [oracle@station90 ~]$ rman catalog u87/oracle_4U
- Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:09:32 2018
- Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN> import catalog u870/oracle_4U@orcl no unregister;
- Starting import catalog at 2018-06-02:11:09:53
- connected to source recovery catalog database
- import validation complete
- Finished import catalog at 2018-06-02:11:09:55
- RMAN>
复制代码
虚拟专用CATALOG的配置过程:
先创建三个catalog用户:
- create user u100 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to u100;
- create user v101 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to v101;
- create user v102 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to v102;
复制代码 让u100去注册两个target数据库:
- [oracle@station90 ~]$ rman target / catalog u100/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:24:08 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to target database: EMREP (DBID=4188960434)
- connected to recovery catalog database
- RMAN> register database;
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
- RMAN>
复制代码- [oracle@station87 ~]$ rman target / catalog u100/oracle_4U@rcat
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:24:04 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- connected to recovery catalog database
- RMAN> register database;
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
复制代码
顺便查看一下 U100、V101和V102的db表的情况:
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 2 11:25:05 2018
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
- SQL> conn u100/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- DB_KEY DB_ID REG_DB_UNIQUE_NAME CURR_DBINC_KEY S
- ---------- ---------- ------------------------------ -------------- -
- 77 1359978017 ORCL 78 N
- 1 4188960434 EMREP 2 N
- SQL> conn v101/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- select * from db
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL> conn v102/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- select * from db
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL>
复制代码
从U100开始分(1Z0-053书上3-28幻灯的3b分支):
- [oracle@station90 ~]$ rman catalog u100/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:30:59 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN> grant catalog for database 4188960434 to v101;
- Grant succeeded.
- RMAN> grant catalog for database 1359978017 to v102;
- Grant succeeded.
- RMAN>
复制代码 顺便查看一下 U100、V101和V102的db表的情况:
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 2 11:32:52 2018
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
- SQL> conn u100/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- DB_KEY DB_ID REG_DB_UNIQUE_NAME CURR_DBINC_KEY S
- ---------- ---------- ------------------------------ -------------- -
- 77 1359978017 ORCL 78 N
- 1 4188960434 EMREP 2 N
- SQL> conn v101/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- DB_KEY DB_ID REG_DB_UNIQUE_NAME CURR_DBINC_KEY S
- ---------- ---------- ------------------------------ -------------- -
- 1 4188960434 EMREP 2 N
- SQL> conn v102/oracle_4U@rcat
- Connected.
- SQL> select * from db;
- DB_KEY DB_ID REG_DB_UNIQUE_NAME CURR_DBINC_KEY S
- ---------- ---------- ------------------------------ -------------- -
- 77 1359978017 ORCL 78 N
- SQL>
复制代码
开始用V101和V102:
- [oracle@station90 ~]$ rman catalog v101/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:35:42 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> create virtual catalog;
- found eligible base catalog owned by U100
- found ineligible base catalog owned by U90
- created virtual catalog against base catalog owned by U100
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 ~]$ rman catalog v102/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:35:55 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> create virtual catalog;
- found ineligible base catalog owned by U90
- found eligible base catalog owned by U100
- created virtual catalog against base catalog owned by U100
- RMAN>
复制代码- [oracle@station90 ~]$ rman target / catalog v101/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:37:53 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to target database: EMREP (DBID=4188960434)
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> backup tablespace users;
- Starting backup at 2018-06-02:11:38:00
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=417 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=00004 name=/u01/app/oracle/oradata/emrep/users01.dbf
- channel ORA_DISK_1: starting piece 1 at 2018-06-02:11:38:08
- channel ORA_DISK_1: finished piece 1 at 2018-06-02:11:38:09
- piece handle=/u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp tag=TAG20180602T113807 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
- Finished backup at 2018-06-02:11:38:09
- RMAN> exit
- Recovery Manager complete.
- exit[oracle@station90 ~]$ rman target / catalog u100/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:38:25 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to target database: EMREP (DBID=4188960434)
- connected to recovery catalog database
- RMAN> list backup of tablespace users;
- List of Backup Sets
- ===================
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ -------------------
- 307 Full 1.34M DISK 00:00:01 2018-06-02:11:38:08
- BP Key: 308 Status: AVAILABLE Compressed: NO Tag: TAG20180602T113807
- Piece Name: /u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp
- List of Datafiles in backup set 307
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- ------------------- ----
- 4 Full 4985341 2018-06-02:11:38:08 /u01/app/oracle/oradata/emrep/users01.dbf
- RMAN>
复制代码- [oracle@station87 ~]$ rman target / catalog v102/oracle_4U@rcat
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:36:44 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- connected to recovery catalog database
- RMAN> backup tablespace users;
- Starting backup at 02-JUN-18
- allocated channel: ORA_SBT_TAPE_1
- channel ORA_SBT_TAPE_1: SID=77 device type=SBT_TAPE
- channel ORA_SBT_TAPE_1: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_2: SID=19 device type=SBT_TAPE
- channel ORA_SBT_TAPE_2: Oracle Secure Backup
- channel ORA_SBT_TAPE_1: starting full datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.259.832197065
- channel ORA_SBT_TAPE_1: starting piece 1 at 02-JUN-18
- channel ORA_SBT_TAPE_1: finished piece 1 at 02-JUN-18
- piece handle=0pt4ecb4_1_1 tag=TAG20180602T113708 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:55
- Finished backup at 02-JUN-18
- Starting Control File and SPFILE Autobackup at 02-JUN-18
- piece handle=c-1359978017-20180602-04 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 02-JUN-18
- RMAN> exit
- Recovery Manager complete.
- exit[oracle@station87 ~]$ rman target / catalog u100/oracle_4U@rcat
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:39:14 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- connected to recovery catalog database
- RMAN> list backup of tablespace users;
- List of Backup Sets
- ===================
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ ---------------
- 219 Full 3.31M SBT_TAPE 00:00:46 02-JUN-18
- BP Key: 227 Status: AVAILABLE Compressed: NO Tag: TAG20180602T104700
- Handle: 0lt4e9d4_1_1 Media: station87-000003
- List of Datafiles in backup set 219
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- --------- ----
- 4 Full 1068770 02-JUN-18 +DATA/orcl/datafile/users.259.832197065
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ ---------------
- 221 Full 3.31M SBT_TAPE 00:00:26 02-JUN-18
- BP Key: 229 Status: AVAILABLE Compressed: NO Tag: TAG20180602T105056
- Handle: 0nt4e9kg_1_1 Media: station87-000003
- List of Datafiles in backup set 221
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- --------- ----
- 4 Full 1069050 02-JUN-18 +DATA/orcl/datafile/users.259.832197065
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ ---------------
- 320 Full 3.31M SBT_TAPE 00:00:46 02-JUN-18
- BP Key: 323 Status: AVAILABLE Compressed: NO Tag: TAG20180602T113708
- Handle: 0pt4ecb4_1_1 Media: station87-000003
- List of Datafiles in backup set 320
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- --------- ----
- 4 Full 1072634 02-JUN-18 +DATA/orcl/datafile/users.259.832197065
- RMAN>
复制代码
另外一种实现 虚拟专用catalog的做法是:
先创建三个catalog用户:
- create user u200 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to u200;
- create user v201 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to v201;
- create user v202 identified by oracle_4U default tablespace rcat
- quota unlimited on rcat;
- grant recovery_catalog_owner to v202;
复制代码- [oracle@station90 ~]$ rman catalog u200/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:44:48 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN> create catalog;
- recovery catalog created
- RMAN> grant register database to v201;
- Grant succeeded.
- RMAN> grant register database to v202;
- Grant succeeded.
- RMAN>
复制代码
两个虚拟用户出动:
- [oracle@station90 ~]$ rman catalog v201/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:46:09 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> create virtual catalog;
- found eligible base catalog owned by U200
- found ineligible base catalog owned by U100
- found ineligible base catalog owned by U90
- created virtual catalog against base catalog owned by U200
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 ~]$ rman catalog v202/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:46:38 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> create virtual catalog;
- found ineligible base catalog owned by U90
- found ineligible base catalog owned by U100
- found eligible base catalog owned by U200
- created virtual catalog against base catalog owned by U200
- RMAN>
复制代码
V201去注册emrep:
- [oracle@station90 ~]$ rman target / catalog v201/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:47:47 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to target database: EMREP (DBID=4188960434)
- connected to recovery catalog database
- RMAN-07540: Cleanup is required for the VPC user schema
- RMAN> register database;
- database registered in recovery catalog
- starting full resync of recovery catalog
- full resync complete
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 ~]$ rman target / catalog u200/oracle_4U@rcat
- Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:48:18 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- connected to target database: EMREP (DBID=4188960434)
- connected to recovery catalog database
- RMAN> list backup;
- List of Backup Sets
- ===================
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ -------------------
- 84 Full 1.34M DISK 00:00:01 2018-06-02:11:38:08
- BP Key: 85 Status: AVAILABLE Compressed: NO Tag: TAG20180602T113807
- Piece Name: /u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp
- List of Datafiles in backup set 84
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- ------------------- ----
- 4 Full 4985341 2018-06-02:11:38:08 /u01/app/oracle/oradata/emrep/users01.dbf
- RMAN>
复制代码
V202去注册orcl:
一个备份集下面开多个备份片(控制单个备份片的大小):
- RMAN> run {
- 2> allocate channel c1 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)' maxpiecesize 200M;
- 3> backup tag '2T_SYSTEM_INCR0' copies 1 incremental level 0 tablespace system;
- 4> release channel c1;
- 5> }
复制代码
磁盘份数备份:
- RMAN> run {
- 2> allocate channel c1 device type disk format '/home/oracle/dir1/%U','/home/oracle/dir2/%U';
- 3> backup tag '3D_USERS_INCR0' copies 2 incremental level 0 tablespace users force ;
- 4> release channel c1;
- 5> }
- allocated channel: c1
- channel c1: SID=8 device type=DISK
- Starting backup at 2018-06-08:00:38:35
- channel c1: starting incremental level 0 datafile backup set
- channel c1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.259.832197065
- channel c1: starting piece 1 at 2018-06-08:00:38:35
- channel c1: finished piece 1 at 2018-06-08:00:38:36 with 2 copies and tag 3D_USERS_INCR0
- piece handle=/home/oracle/dir1/24t4t00b_1_1 comment=NONE
- piece handle=/home/oracle/dir2/24t4t00b_1_2 comment=NONE
- channel c1: backup set complete, elapsed time: 00:00:01
- Finished backup at 2018-06-08:00:38:36
- Starting Control File and SPFILE Autobackup at 2018-06-08:00:38:36
- piece handle=+FRA/orcl/autobackup/2018_06_08/s_978223116.276.978223117 comment=NONE
- Finished Control File and SPFILE Autobackup at 2018-06-08:00:38:39
- released channel: c1
- RMAN>
复制代码
永久排除某个表空间在全库备份之外:
- RMAN> configure exclude for tablespace users;
- Tablespace USERS will be excluded from future whole database backups
- new RMAN configuration parameters are successfully stored
- RMAN> show all;
- RMAN configuration parameters for database with db_unique_name ORCL are:
- CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
- CONFIGURE BACKUP OPTIMIZATION ON;
- CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
- CONFIGURE CONTROLFILE AUTOBACKUP ON;
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
- CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 2;
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
- CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE MAXSETSIZE TO UNLIMITED; # default
- CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
- CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
- CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
- CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
- RMAN>
复制代码 (顺便提下:在通道不够的时候,份数备份会pending等待资源,等上一轮释放,下一轮会执行:
)
取消exclude:
- RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' clear;
- old RMAN configuration parameters:
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 2;
- RMAN configuration parameters are successfully reset to default value
- RMAN> show all;
- RMAN configuration parameters for database with db_unique_name ORCL are:
- CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
- CONFIGURE BACKUP OPTIMIZATION ON;
- CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
- CONFIGURE CONTROLFILE AUTOBACKUP ON;
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
- CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
- CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE MAXSETSIZE TO UNLIMITED; # default
- CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
- CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
- CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
- CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
- RMAN> CONFIGURE EXCLUDE FOR TABLESPACE 'USERS' clear;
- Tablespace USERS will be included in future whole database backups
- old RMAN configuration parameters are successfully deleted
- RMAN>
复制代码 压缩备份:
例子:SYSAUX表空间原有560M,不压缩备份436M(完成时间00:01:00),BASIC压缩86.5M(00:00:53)
RMAN加密备份:
先做TDE:
- SQL> select * from v$encryption_wallet;
- WRL_TYPE
- --------------------
- WRL_PARAMETER
- --------------------------------------------------------------------------------
- STATUS
- ------------------
- file
- /u01/app/oracle/admin/orcl/wallet
- CLOSED
复制代码- [oracle@station87 ~]$ ls -l /u01/app/oracle/admin/orcl/wallet/
- ls: /u01/app/oracle/admin/orcl/wallet/: No such file or directory
- [oracle@station87 ~]$ mkdir -p /u01/app/oracle/admin/orcl/wallet/
复制代码- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 8 01:34:55 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> alter system set encryption key identified by "oracle123";
- System altered.
- SQL> select * from v$encryption_wallet;
- WRL_TYPE
- --------------------
- WRL_PARAMETER
- --------------------------------------------------------------------------------
- STATUS
- ------------------
- file
- /u01/app/oracle/admin/orcl/wallet
- OPEN
- SQL>
复制代码- [oracle@station87 ~]$ ls -l /u01/app/oracle/admin/orcl/wallet/
- total 4
- -rw-r--r-- 1 oracle asmadmin 1573 Jun 8 01:35 ewallet.p12
复制代码- SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 8 01:37:17 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> alter system set encryption wallet close identified by "oracle123";
- System altered.
- SQL> alter system set encryption wallet open identified by "oracle123";
- System altered.
- SQL>
复制代码- RMAN> show all;
- RMAN configuration parameters for database with db_unique_name ORCL are:
- CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
- CONFIGURE BACKUP OPTIMIZATION ON;
- CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
- CONFIGURE CONTROLFILE AUTOBACKUP ON;
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
- CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
- CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(OB_MEDIA_FAMILY=station87)';
- CONFIGURE MAXSETSIZE TO UNLIMITED; # default
- CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
- CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
- CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
- RMAN> CONFIGURE ENCRYPTION FOR DATABASE on;
- new RMAN configuration parameters:
- CONFIGURE ENCRYPTION FOR DATABASE ON;
- new RMAN configuration parameters are successfully stored
- RMAN>
复制代码
更换主密钥:
双重加密:
- RMAN> set encryption on identified by "mysql1234" ;
- executing command: SET encryption
- RMAN> backup tag '4TEDUAL_USERS_INCR0' incremental level 0 tablespace users;
- Starting backup at 2018-06-08:02:03:40
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.259.978227903
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-06-08:02:03:40
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-06-08:02:04:45
- piece handle=2kt4t4vs_1_1 tag=4TEDUAL_USERS_INCR0 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:05
- Finished backup at 2018-06-08:02:04:45
- Starting Control File and SPFILE Autobackup at 2018-06-08:02:04:45
复制代码
恢复时候,故意关掉TDE,只提供"mysql1234":
- RMAN> set decryption identified by "qwertyu","dsfydsfdsf","mysql1234";
- executing command: SET decryption
- RMAN> restore tablespace users;
- Starting restore at 2018-06-08:02:10:36
- using channel ORA_DISK_1
- using channel ORA_DISK_2
- using channel ORA_DISK_3
- using channel ORA_DISK_4
- using channel ORA_DISK_5
- using channel ORA_DISK_6
- using channel ORA_DISK_7
- using channel ORA_DISK_8
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_1: restoring datafile 00004 to +DATA/orcl/datafile/users.259.978227903
- channel ORA_SBT_TAPE_1: reading from backup piece 2kt4t4vs_1_1
- channel ORA_SBT_TAPE_1: piece handle=2kt4t4vs_1_1 tag=4TEDUAL_USERS_INCR0
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:45
- Finished restore at 2018-06-08:02:11:22
- RMAN>
复制代码
|
|