| ORA-00283: recovery session canceled due to errors ORA-01111: name for data file 57 is unknown – rename to correct file ORA-01110: data file 57: ‘/apps/prod/db/tech_st/11.2.0.4/dbs/UNNAMED00057’ ORA-01157: cannot identify/lock data file 57 – see DBWR trace file |
I found above error trace in one of the standby database. Upon checking the Gap between standby and production, I found archives getting shipped but not applying.
I went through the production logs and came to know, one of the Junior DBA added a datafile ‘a_txn_data19.dbf’ on a production database.
As we set parameter STANDBY_FILE_MANAGEMENT=AUTO, Oracle tried to add the datafile on standby database.
Oracle couldn’t add the datafile on Standby DB as datafile with the same name “a_txn_data19.dbf” was already existed on standby site. That file doesn’t belongs to the database but unfortunately it was existed under Oradata.
Since, it was a standby site, I prioritized to make the standby site consistent with production without further delay,
Action Plan :
1. Set parameter STANDBY_FILE_MANAGEMENT=MANUAL on both Primary and Standby Database.
------- On Primary
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL SCOPE=BOTH;
------- On Standby
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL SCOPE=BOTH;2. Stop Redo Apply on Standby Database:
---- On Standby
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;3. Take the Tablespace offline on the Primary Database:
-------- Verify the file name.
SQL> select file#,name,status from v$datafile where file#=57;
SQL> alter database datafile 57 offline;4. Rename Datafile on Primary Site at OS Level:
mv /data/disk/proddata/a_txn_data19.dbf /data/disk/proddata/a_txn_data20.dbf
scp a_txn_data20.dbf oraprod@proddr:/oradata/prod/5. Rename the Datafile in the Primary Database and bring the Tablespace back online:
SQL> ALTER TABLESPACE APPS_TS_TX_DATA RENAME DATAFILE '/data/disk/proddata/a_txn_data19.dbf' TO '/data/disk/proddata/a_txn_data20.dbf';
SQL> alter database datafile 57 online;
SQL> alter database recover datafile 57;6. Shutdown and start Standby Database in mount mode:
SQL> shut immediate;
SQL> STARTUP MOUNT;7. Rename the Datafile in the Standby Database control file.
SQL> ALTER DATABASE RENAME FILE '/apps/prod/db/tech_st/11.2.0.4/dbs/UNNAMED00057' TO '/oradata/prod/a_txn_data20.dbf';
SQL> shut immediate;8. On the Standby Database, restart Redo Apply:
SQL> alter database mount standby database;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;9. Set STANDBY_FILE_MANAGEMENT=AUTO on both Primary and Standby Database.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;10. Check the GAP at the interval of 10-15 min. It should be decreasing.
SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"
FROM
(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE
ARCH.THREAD# = APPL.THREAD#;Disclaimer:
This is an independent personal blog and is not affiliated with, sponsored by, or endorsed by Oracle Corporation. The views, explanations, and experiences expressed here are the author’s own. Commands, scripts, and procedures may be based on Oracle’s official documentation and are provided for educational and reference purposes only. Always test and validate them before use in a Live/Production environment. Sample output shown in this article was generated during the author’s own testing and may vary depending on the environment.
Please read full Disclaimer.
