This discussion is archived
7 Replies Latest reply: Dec 20, 2012 9:52 PM by MahirM.Quluzade RSS

Help for: ORA-01103: database name PRIMARY in control file is not STANDBY

980920 Newbie
Currently Being Moderated
Hello all, this will be my first post to the support forum. I'm an associate dba with just 6 months on the job, so if I've forgotten something or not given some infromation that is needed please let me know.

I've also combed the forums/internet, and some of the answers haven't helped. The Oracle Document ORA-1103 While Mounting the Database Using PFILE [ID 237073.1] says my init.ora file is corrupted, but creating a new init.ora file from the spfile does not help. Neither does just starting from the spfile. I have older copies of the init.ora file and the spfiles that the database was running on previously, so I believe they are good.

This standby NIRNASD1 has existed previously, I had to refresh the primary NIKNASD2, and then re-instantiate NIRNASD1 after the refresh is complete.

My env is set correctly, and my ORACLE_SID has been exported to NIRNASD1
NIKNASD2 = Primary Database
NIRNASD1 = Secondary/Standby Database
Goal: Creation of Logical Standby NIRNASD1 after creating Physical Standby from NIKNASD2
My database versions are 10.2.0.4.0, and the databases are on a Unix server. Both databases are located on separate servers.


Steps that I have taken:

I used RMAN to backup our primary database to the staging area:
$ rman target /

run {
backup database
format '/datatransa/dg_stage/%U'
include current controlfile for standby;
sql "alter system archive log current";
backup archivelog all format '/datatransa/dg_stage/%U';
}

I used RMAN to Create Secondary Database utilizing RMAN DUPLICATE command.

RMAN> run {
2> allocate auxiliary channel auxdisk device type disk;     
3> duplicate target database for standby NOFILENAMECHECK;
4> }


On Secondary database I started Managed Recovery mode

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

(I used pfile here, thinking that I needed to mount the database to the pfile so that the database would see the change in the dataguard parameters in the init.ora file, the change from logical to physical- I commeneted out the logical and uncommented the physical line)

###########################################
# Dataguard Parameters
###########################################
For logical standby, change db_name to name of standby database.
db_name=NIKNASD2 ### for physical, db_name is same as primary
#db_name=NIRNASD1 ### for logical, db_name is same as unique_name


SQL> STARTUP MOUNT PFILE = /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/initNIRNASD1.ora;
ORACLE instance started.

Total System Global Area 1577058304 bytes
Fixed Size 2084368 bytes
Variable Size 385876464 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14692352 bytes
Database mounted.

SQL> ALTER DATABASE recover managed standby database using current logfile disconnect;

I then verified the Data Guard Configuration by using “alter system archive log current;” on the primary database and watching the sequence number change in the secondary database.

I made sure that:
•     The primary database was in MAXIMUM PERFORMANCE MODE
•     Stopped managed recover on the standby database: alter database recover managed standby database cancel;
•     Built a logical standby data dictionary on the primary database
•     The db_name in init.ora was changed (this is in our document at my job)
•     I changed my database name (from physical to logical) in my init.ora pfile (reverse of what I did above)

###########################################
# Dataguard Parameters
###########################################
For logical standby, change db_name to name of standby database.
#db_name=NIKNASD2 ### for physical, db_name is same as primary
db_name=NIRNASD1 ### for logical, db_name is same as unique_name

I then went to shutdown my standby database and re-start it in a mount exclusive state, which is where I get the ORA-01103 Error (Again I used the pfile, thinking that I needed to tell the database it is now a logical standby):
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


SQL> STARTUP EXCLUSIVE MOUNT PFILE = /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/initNIRNASD1.ora;
ORACLE instance started.

Total System Global Area 1577058304 bytes
Fixed Size 2084368 bytes
Variable Size 385876464 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14692352 bytes
ORA-01103: database name 'NIKNASD2' in control file is not 'NIRNASD1'

From what I understand of the process, the name in the control file is correct, I want it to be NIRNASD1. But the database for some reason thinks it should be NIKNASD2. The following are the parts of my init.ora file that include the dataguard parameters:


###########################################
# Database Identification
###########################################
db_domain=""
#db_name=NIRNASD1
#db_unique_name=NIRNASD1

###########################################
# File Configuration
###########################################
control_files=("/oradba2/oradata/NIRNASD1/control01.ctl", "/oradba3/oradata/NIRNASD1/control02.ctl", "/oradba4/oradata/NIRNASD1/control03.ctl")

###########################################
# Instance Identification
###########################################
instance_name=NIRNASD1

###########################################
# Dataguard Parameters
###########################################
#db_name=NIKNASD2 ### for physical, db_name is same as prmary
db_name=NIRNASD1 ### for logical, db_name is same as unique_name
db_unique_name=NIRNASD1
dg_broker_start=TRUE
db_file_name_convert='NIKNASD2','NIRNASD1'
log_file_name_convert='NIKNASD2','NIRNASD1'
log_archive_config='dg_config=(NIRNASD1,NIKNASD2)'
log_archive_dest_1='LOCATION="/oraarcha/NIRNASD1/" valid_for=(ONLINE_LOGFILES,all_roles) db_unique_name=NIRNASD1'
#log_archive_dest_2='LOCATION="/oraarcha/NIKNASD2/" valid_for=(standby_logfiles,standby_roles) db_unique_name=NIRNASD1'
log_archive_dest_2='LOCATION="/oraarcha/NIKNASD2/" valid_for=(standby_logfile,standby_role) db_unique_name=NIRNASD1'
STANDBY_ARCHIVE_DEST='LOCATION=/oraarcha/NIKNASD2/'

######################################################################
#
# Parameters are not needed since this server will NOT become primary
#
######################################################################
#log_archive_dest_2='service=NIKNASD2
# valid_for=(online_logfiles,primary_role)
# db_unique_name=NIKNASD2'
fal_server='NIKNASD2'
fal_client='NIRNASD1'
######################################################################


I would appreciate any help, or pointing me in the right direction. I'm just missing something. I am reviewing the documents for building a physical and logical standby from oracle. Just not sure where to go from here.

Thank you

Edited by: 977917 on Dec 19, 2012 5:49 PM
  • 1. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    980920 Newbie
    Currently Being Moderated
    I forgot to add, my database versions are 10.2.0.4.0, and the databases are on a Unix server. Both databases are located on separate servers.
  • 2. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    UweHesse Expert
    Currently Being Moderated
    A couple of points:

    1) Your version is pretty outdated - consider to move to 11g
    2) You should always use a spfile
    3) You are not using Data Guard Broker, although that is recommended. Consider using it - it makes it easier and will avoid many mistakes you made
    4) You want a Logical Standby, right?

    In this case, you start with a Physical Standby - do this step first. Here, the db_name in spfile & controlfile is the same as the primary.
    The command to start apply is recover managed standby database using current logfile disconnect
    After that, you convert the Physical Standby into Logical Standby, changing the db_name

    Kind regards
    Uwe Hesse

    "Don't believe it, test it!"
    http://uhesse.com
  • 3. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    MahirM.Quluzade Guru
    Currently Being Moderated
    Hi,

    Welcome to OTN Forums!

    I think your problem with parameter files.
    Can you check pfile of standby database?
    DB_NAME must be same with DB_NAME Primary database, DB_UNIQUE_NAME is unique name, not same with DB_NAME.
    Controlfile is contains DB_NAME (After 11g contains DB_UNIQUE_NAME, too), Your version is 10g.

    Careful read Uwe Hesse's reply.
    Recommended Configure Data Guard Broker.

    Regards
    Mahir M. Quluzade
  • 4. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    980920 Newbie
    Currently Being Moderated
    Seemed to have found the problem. We had a redirect from the /dbs directory that pointed to the spfileNIRNASD1.ora in our pfile directory. I removed that, and that solved the problem. I'm not sure I understand why.
  • 5. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    980920 Newbie
    Currently Being Moderated
    First of all, thank you both for answering my post. I've pulled up Mr. Hesse's page and will make it a go-to staple.

    We're in the process of upgrading our databases, but we have 130+ databases and only six Oracle dba's, and I'm one of them. It's a large corporation, and things move at a "slow and tested" pace.

    The pfile parameters listed above are from my secondary/standby database. And I do want to create a logical standby.

    I forgot to mention that we do use DataGuard Broker, but I did not think that would be the cause of why the database was starting up incorrectly, so I did not mention it. My apologies there.



    As far as the db_name, here's my question on that. It's my understanding the the db_name should be the name of the primary database when you are working with a physical standby, but as soon as you convert it to logical, you should change the db_name to the secondary/standby database? Am I correct on that?

    Leading from that, during the process of creating the physical standby and converting the physical standby to the logical standby, should I change the db_name in the secondary/standby database in the spfile and never use the pfile at all? For instance, when I create the physical standby I have to change the db_name in the standby to the PRIMARY database, so that makes me think I should change db_name in the spfile? (If you see above, I changed db_name in the pfile and did a startup pfile)


    This morning I was able to reach out to a fellow DBA (they are were asleep when I posted this last night), and they tried a few things. We had a redirect in the standby directory /oraa/app/oracle/product/1020/dbs folder that looked like this: spfileNIRNASD1.ora -> /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/spfileNIRNASD1.ora

    She removed the redirect and the startup mount exclusive then worked without the error.

    Thank you again for your help Mr.Quluzade and Mr. Hesse, I appreciate you all taking the time to teach someone new to the craft. I will definitely read up on the link that you sent me.

    Chris Cranford
  • 6. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    UweHesse Expert
    Currently Being Moderated
    After you have created a physical standby, the conversion into logical standby is as follows:

    1) on standby: recover managed standby database cancel
    2) on primary: execute dbms_logstdby.build
    3) on standby:

    alter database recover to logical standby <name of your choice of the logical standby DB>; This step changes db_name in the spfile automatically
    shutdown immediate
    startup mount
    alter database open resetlogs;
    alter database start logical standby apply immediate;

    Kind regards
    Uwe Hesse

    "Don't believe it, test it!"
    http://uhesse.com
  • 7. Re: Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
    MahirM.Quluzade Guru
    Currently Being Moderated
    Hi,

    Please check my post : http://www.mahir-quluzade.com/2012/06/oracle-data-guard-11g-overview-logical.html
    I showed there How to create Logical Standby database, and I using Data Guard Broker.

    Thanks
    Mahir M. Quluzade

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points