Oracle DB备份恢复目录
Oracle DB备份恢复目录
将配置恢复目录的保留策略,然后备份该恢复目录。
1) 为 ORCL 数据库设置环境。 [oracle@rtest ~]$ export ORACLE_SID=test0924 2) 启动 RMAN,在不指定目录的情况下使用恢复目录数据库作为目标。 [oracle@rtest ~]$ rman target sys@rcat1028 Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 28 16:17:22 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. target database Password: ****** connected to target database: RCAT1028 (DBID=2744053659) RMAN> 3) 确保已将恢复目录的保留策略设置为冗余大于 1 。如果该值不大于 1 ,则至少将其设置为 2 。 RMAN> show retention policy; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name RCAT1028 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2 2> ; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters are successfully stored 4) 尝试备份数据库。 RMAN> backup database; Starting backup at 28-OCT-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=190 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set RMAN-03009: failure of backup command on ORA_DISK_1 channel at 10/28/2013 16:18:54 ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode continuing other job steps, job failed will not be re-run channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 28-OCT-13 channel ORA_DISK_1: finished piece 1 at 28-OCT-13 piece handle=+RECOVERY/rcat1028/backupset/2013_10_28/ncsnf0_tag20131028t161854_0.261.830017137 tag=TAG20131028T161854 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of backup command on ORA_DISK_1 channel at 10/28/2013 16:18:54 ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode RMAN> 请注意,无法备份模式不为 ARCHIVELOG 的打开数据库。为确保最高的可用性,恢复目录数据库应以 ARCHIVELOG 模式运行。 5) 退出 RMAN。 RMAN> exit 6) 首先设置 RCAT1028数据库的环境,然后将恢复目录数据库更改为在 ARCHIVELOG 模式下运行。 [oracle@rtest dbs]$ export ORACLE_SID=rcat1028 [oracle@rtest dbs]$ sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 28 16:21:36 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> conn /as sysdba Connected. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 1235959808 bytes Fixed Size 2227904 bytes Variable Size 738197824 bytes Database Buffers 486539264 bytes Redo Buffers 8994816 bytes Database mounted. SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 3 Next log sequence to archive 5 Current log sequence 5 SQL> 7) 确认RCAT1028数据库环境, 按照前面提供的步骤重新登录 RMAN。 [oracle@rtest ~]$ export ORACLE_SID=test0924 [oracle@rtest ~]$ rman target sys@rcat1028 Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 28 16:25:17 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. target database Password: ****** connected to target database: RCAT1028 (DBID=2744053659) RMAN> 9) 备份恢复目录数据库。此时操作应成功。 RMAN> backup database; Starting backup at 28-OCT-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=131 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=+DATA/rcat1028/datafile/system.262.830015445 input datafile file number=00002 name=+DATA/rcat1028/datafile/sysaux.261.830015451 input datafile file number=00003 name=+DATA/rcat1028/datafile/undotbs1.265.830015451 input datafile file number=00005 name=+DATA/rcat01.dbf input datafile file number=00004 name=+DATA/rcat1028/datafile/users.259.830015453 channel ORA_DISK_1: starting piece 1 at 28-OCT-13 channel ORA_DISK_1: finished piece 1 at 28-OCT-13 piece handle=+RECOVERY/rcat1028/backupset/2013_10_28/nnndf0_tag20131028t162544_0.262.830017545 tag=TAG20131028T162544 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:03:25 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 28-OCT-13 channel ORA_DISK_1: finished piece 1 at 28-OCT-13 piece handle=+RECOVERY/rcat1028/backupset/2013_10_28/ncsnf0_tag20131028t162544_0.263.830017753 tag=TAG20131028T162544 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04 Finished backup at 28-OCT-13 RMAN> exit Recovery Manager complete. [oracle@rtest ~]$