So you have followed the recipes to create a standby database, setup the database to switch logs automatically, and now, as with any good database, the space required to support the application grows and grows and grows.
Eventually, using your monitoring software (in my case, Pythian’s avail or dailies), you get an alert suggesting that you will need to add additional space. In this case you are going to add a datafile to a tablespace, or add a brand new tablespace.
You add the datafile on the primary and minutes later are paged with these kind of errors:
File #5 added to control file as 'UNNAMED00005' because the parameter STANDBY_FILE_MANAGEMENT is set to MANUAL The file should be manually created to continue. MRP0: Background Media Recovery terminated with error 1274 Fri Apr 8 10:00:22 2005 Some recovered datafiles maybe left media fuzzy Media recovery may continue but open resetlogs may fail
Basically, the standby is having some trouble applying the changes it has received from the primary redo log because the datafile is not there.
You can use the Oracle parameter standby_file_management along as:
- Your standby database doesn’t have major differences in datafile locations.
- The standby database is not using raw devices to store your datafiles.
This parameter set to AUTO means that Oracle will handle creating the new datafile on the standby if you add one or more on the primary.
But right now you are stuck with this new datafile and nowhere to go.
Add the datafile to the standby database.
Oracle documentation: 9iR2, 10gR1 and 10gR2.
- Determine the impact of taking the tablespace offline!
- Take the tablespace offline OR put in backup mode: ALTER TABLESPACE name BEGIN BACKUP;
- Make a copy of the file locally.
- Bring the tablespace online OR take out of backup mode: ALTER TABLESPACE name END BACKUP;
- Copy the file to the standby server.
ALTER SYSTEM ARCHIVE LOG CURRENT;
ALTER DATABASE CREATE DATAFILE (on the standby).
RECOVER MANAGED STANDBY DATABASE CANCEL;
select file#,name from v$datafile where name like '%UNNAMED%';
ALTER DATABASE CREATE DATAFILE 'unnamed datafile' AS 'proper filename';
RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Save yourself the hassle, just
alter system set STANDBY_FILE_MANAGEMENT = AUTO;
Update: Thanks to Sverre for pointing out you can use tablespace hotbackup mode instead of tablespace offline.
2 Responses to “Oracle: Standby Automatic File Management”
Leave a Reply