When working with Oracle Data Guard, one of the common errors you might face while setting up a standby database manually is:
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '<path>';
ORA-01665: control file is not a standby control file
This error usually pops up when you try to start managed recovery on the standby database but mistakenly use a primary control file instead of a standby control file.
Why Does This Error Happen?
The control file you restored belongs to the primary database, not the standby. As a result, Oracle still treats your database as a PRIMARY rather than a PHYSICAL STANDBY, preventing recovery from starting.
The traditional solution is to:
1.Generate a new standby control file on the primary database using:
ALTER DATABASE CREATE STANDBY CONTROLFILE AS ‘<path>’;
2.Copy this control file to the standby server.
3.Restore it and update file locations (redo logs, datafiles, etc.) if needed.
While this works, it can be a bit time-consuming.
The Quick Solution
If you want a faster workaround, Oracle provides a handy command:
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
This converts your primary control file into a standby control file directly, saving you the trouble of generating and copying files from the primary.
Step-by-Step Example
Here’s a simple walkthrough:
Start the instance and mount the database:
STARTUP MOUNT;
Attempt recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
You’ll see the error:
ORA-01665: control file is not a standby control file
Check the current role:
SELECT database_role FROM v$database;Output:
PRIMARY
Convert to standby:
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
Output:
Database altered.
Restart and mount again:
STARTUP MOUNT;
Check the new role:
SELECT database_role FROM v$database;
Output:
PHYSICAL STANDBY
Start managed recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
Final Thoughts
Using ALTER DATABASE CONVERT TO PHYSICAL STANDBY is a neat shortcut that saves you from regenerating and copying standby control files every time you run into ORA-01665.
However, keep in mind:
- This method is great for quick setups and lab environments.
- For production systems, it’s still best practice to generate and maintain proper standby control files from the primary for consistency and disaster recovery readiness.
By understanding both approaches, you can choose the right method depending on your environment’s needs.




