『ORACLE』DG搭建时备库的db_name报错
Posted 九號客栈
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了『ORACLE』DG搭建时备库的db_name报错相关的知识,希望对你有一定的参考价值。
因为搭建DG时备库中的db_name为SBCD,实际应该是主库db_name的PROD1
所以在【主库】执行如下rman操作命令时会报错控制文件记录的数据库名与实际拷贝的数据库名不相同
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 01-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwPROD1‘ auxiliary format
‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwSBDB‘ ;
}
executing Memory Script
Starting backup at 01-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
Finished backup at 01-MAY-17
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format ‘/u01/app/oracle/oradata/SBDB/control01.ctl‘;
restore clone controlfile to ‘/u01/app/oracle/oradata/SBDB/control02.ctl‘ from
‘/u01/app/oracle/oradata/SBDB/control01.ctl‘;
}
executing Memory Script
Starting backup at 01-MAY-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD1.f tag=TAG20170501T171334 RECID=2 STAMP=942858814
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 01-MAY-17
Starting restore at 01-MAY-17
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 01-MAY-17
contents of Memory Script:
{
sql clone ‘alter database mount standby database‘;
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/01/2017 17:13:40
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of sql command on clone_default channel at 05/01/2017 17:13:40
RMAN-11003: failure during parse/execution of SQL statement: alter database mount standby database
ORA-01103: database name ‘PROD1‘ in control file is not ‘SBDB‘
此时会在备库中生成control file,更改的如下:
1、更改备库中的db_name,关闭数据库生成spfile文件,在启动到nomount状态
[[email protected] SBDB]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/
[[email protected] dbs]$ vi initSBDB.ora
SBDB.__db_cache_size=419430400
SBDB.__java_pool_size=4194304
SBDB.__large_pool_size=4194304
SBDB.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment
SBDB.__pga_aggregate_target=377487360
SBDB.__sga_target=566231040
SBDB.__shared_io_pool_size=0
SBDB.__shared_pool_size=130023424
SBDB.__streams_pool_size=0
*.audit_file_dest=‘/u01/app/oracle/admin/SBDB/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘/u01/app/oracle/oradata/SBDB/control01.ctl‘,‘/u01/app/oracle/oradata/SBDB/control02.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.DB_FILE_NAME_CONVERT=‘PROD1‘,‘SBDB‘
*.db_name=‘PROD1‘
*.DB_UNIQUE_NAME=‘SBDB‘
*.diagnostic_dest=‘/u01/app/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=SBDBXDB)‘
*.FAL_SERVER=‘PROD1‘
"initSBDB.ora" 40L, 1380C written
[[email protected] dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon May 1 17:29:34 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> shutdown abort
ORACLE instance shut down.
SQL> create spfile from pfile;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 941600768 bytes
Fixed Size 1348860 bytes
Variable Size 515902212 bytes
Database Buffers 419430400 bytes
Redo Buffers 4919296 bytes
2、进入控制文件的路径下删除生成的控制文件
[[email protected] dbs]$ cd /u01/app/oracle/oradata/SBDB/
[[email protected] SBDB]$ ls
control01.ctl control02.ctl
[[email protected] SBDB]$ rm -rf *
3、主库重新连接rman,再次执行rman命令
RMAN> quit
Recovery Manager complete.
[[email protected] admin]$ rman target / auxiliary sys/[email protected]
Recovery Manager: Release 11.2.0.3.0 - Production on Mon May 1 17:30:29 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2082231315)
connected to auxiliary database: PROD1 (not mounted)
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 01-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwPROD1‘ auxiliary format
‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwSBDB‘ ;
}
executing Memory Script
Starting backup at 01-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=157 device type=DISK
Finished backup at 01-MAY-17
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format ‘/u01/app/oracle/oradata/SBDB/control01.ctl‘;
restore clone controlfile to ‘/u01/app/oracle/oradata/SBDB/control02.ctl‘ from
‘/u01/app/oracle/oradata/SBDB/control01.ctl‘;
}
executing Memory Script
Starting backup at 01-MAY-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD1.f tag=TAG20170501T173047 RECID=7 STAMP=942859847
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 01-MAY-17
Starting restore at 01-MAY-17
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 01-MAY-17
contents of Memory Script:
{
sql clone ‘alter database mount standby database‘;
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/SBDB/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/SBDB/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/SBDB/sysaux01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/SBDB/undotbs01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/SBDB/users01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/SBDB/example01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/SBDB/system01.dbf" datafile
2 auxiliary format
"/u01/app/oracle/oradata/SBDB/sysaux01.dbf" datafile
3 auxiliary format
"/u01/app/oracle/oradata/SBDB/undotbs01.dbf" datafile
4 auxiliary format
"/u01/app/oracle/oradata/SBDB/users01.dbf" datafile
5 auxiliary format
"/u01/app/oracle/oradata/SBDB/example01.dbf" ;
sql ‘alter system archive log current‘;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/SBDB/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 01-MAY-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD1/system01.dbf
output file name=/u01/app/oracle/oradata/SBDB/system01.dbf tag=TAG20170501T173054
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/PROD1/sysaux01.dbf
output file name=/u01/app/oracle/oradata/SBDB/sysaux01.dbf tag=TAG20170501T173054
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/PROD1/example01.dbf
output file name=/u01/app/oracle/oradata/SBDB/example01.dbf tag=TAG20170501T173054
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/PROD1/undotbs01.dbf
output file name=/u01/app/oracle/oradata/SBDB/undotbs01.dbf tag=TAG20170501T173054
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/PROD1/users01.dbf
output file name=/u01/app/oracle/oradata/SBDB/users01.dbf tag=TAG20170501T173054
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 01-MAY-17
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=942859938 file name=/u01/app/oracle/oradata/SBDB/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=942859938 file name=/u01/app/oracle/oradata/SBDB/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=942859938 file name=/u01/app/oracle/oradata/SBDB/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=942859938 file name=/u01/app/oracle/oradata/SBDB/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=942859938 file name=/u01/app/oracle/oradata/SBDB/example01.dbf
Finished Duplicate Db at 01-MAY-17
以上是关于『ORACLE』DG搭建时备库的db_name报错的主要内容,如果未能解决你的问题,请参考以下文章
ORA-15025 搭建DG环境,restore controlfile报错,提示oracle无法使用ASM存储