我的任务是为一些远程实例开发 Oracle 11g 备份/恢复策略。我的目标是拥有一个脚本来备份实例,我将能够将其与现有实例(可能在同一服务器上)一起使用或创建一个全新的实例。
假设我有两个实例, asource
和destination
.
source
实例配置,由于RMAN> show all
:
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name SOURCE are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
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
我写了一个备份脚本,如下所示:
#!/bin/bash
export ORACLE_SID=SOURCE
rman target / <<EOF
CONFIGURE CONTROLFILE AUTOBACKUP ON;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F';
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE to '/backup/%F';
DELETE NOPROMPT BACKUP;
BACKUP CURRENT CONTROLFILE;
BACKUP AS BACKUPSET CHECK LOGICAL DATABASE PLUS ARCHIVELOG DELETE INPUT;
QUIT;
EOF
其中/backup
出现了一些文件,例如backup_4noqqute_151_1
,backup_4noqqute_152_1
等,以及c-454077755-20131206-07
- 我相信前者是数据库/归档日志备份,后者是控制文件。
我运行以下命令以尝试将备份还原到另一个实例DESTINATION
:
export ORACLE_SID=DESTINATION
rman target /
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/%F';
RMAN> RESTORE CONTROLFILE FROM '/backup/c-454077755-20131206-07';
RMAN> ALTER DATABASE MOUNT;
并收到此错误消息:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 12/06/2013 10:44:51
ORA-01103: database name 'SOURCE' in control file is not 'DESTINATION'
我该如何解决这个问题?我无法在同一台服务器上按原样重命名DESTINATION
并且SOURCE
仍在运行。我在这篇文章中看到了类似的问题,但解释不完整,我不明白。我希望由于我提供了很多信息,有人能够向我充分解释如何解决这个问题。
谢谢。