8.3.4Renaming a Datafile in the Primary Database8.3.4 recommand the data file in the master database (that is, manually modify the same changes in the slave database)
When you rename one or more datafiles in the primary database, the change is not propagated to the standby database. therefore, if you want to rename the same datafiles on the standby database, you must manually make the equivalent modifications on the standby database because the modifications are not synchronized med automatically, even ifSTANDBY_FILE_MANAGEMENT
Initialization parameter is setAUTO
.
When you rename one or more data files in the master database, the slave database will not change accordingly. Therefore, if you want to rename the same data file in the slave database, you must manually make the same changes in the slave database. Because these changes are not automatic, and even setting STANDBY_FILE_MANAGEMENT to AUTO will not change.
The following steps describe how to rename a datafile in the primary database and manually propagate the changes to the standby database.
Rename the data file in the master database as described below, and manually spread these changes to the slave database.
Torename the datafile in the primary database, take the tablespace offline:
1. Rename the data file in the master database and take the tablespace offline first:
SQL> ALTER TABLESPACE tbs_4 OFFLINE;
Exit from the SQL prompt and issue an operating system command, such as the following UNIXmv
Command, to rename the datafile on the primary system:
Exit the SQL prompt and rename the data file on the operating system of the master database using the OS command, such as the unix mv command:
% Mv/disk1/Oracle/oradata/payroll/tbs_4.dbf/disk1/oracle/oradata/payroll/tbs_x.dbf
Rename the datafile in the primary database and bring the tablespace back online:
Run the following command on the master database to rename the data file and then bring the tablespace online:
SQL> ALTER TABLESPACE tbs_4RENAMEDATAFILE 2> '/disk1/oracle/oradata/payroll/tbs_4.dbf' 3> TO'/disk1/oracle/oradata/payroll/tbs_x.dbf '; SQL> ALTER TABLESPACE tbs_4 ONLINE;
Connect to the standby database, queryV$ARCHIVED_LOG
View to verify all of the archived redo log files are applied, and then stop Redo Apply:
Connect to the slave database and queryV$ARCHIVED_LOG
View to verify that all archived logs have been applied, and then stop redoing the application:
SQL> select sequence #, applied from v $ ARCHIVED_LOG order by sequence #; SEQUENCE # APP --------- --- 8 YES9 YES10 YES11 YES4 rows selected. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Shut down the standby database:
5. Close the slave Database
SQL> SHUTDOWN;
Rename the datafile at the standby site using an operating system command, such as the UNIXmv
Command:
6. In the operating environment of the slave database, use the operating system commands, such as the UNIX mv command, to rename the data file:
% Mv/disk1/oracle/oradata/payroll/tbs_4.dbf/disk1/oracle/oradata/payroll/tbs_x.dbf
Start and mount the standby database:
7. Start and load the slave database:
SQL> STARTUP MOUNT;
Rename the datafile in the standby control file. Note thatSTANDBY_FILE_MANAGEMENT
Initialization parameter must be setMANUAL
.
Rename the data file on the slave database to the control file. Note: The STANDBY_FILE_MANAGEMENT initialization parameter must be set to MANUAL.
SQL> ALTER DATABASE RENAME FILE '/disk1/oracle/oradata/payroll/tbs_4.dbf' 2> TO '/disk1/oracle/oradata/payroll/tbs_x.dbf ';
On the standby database, restart Redo Apply:
9. Restart the redo application in the slave database:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE2> DISCONNECT FROM SESSION;
If you do not rename the corresponding datafile at the standby system, and then try to refresh the standby database control file, the standby database will attempt to use the renamed datafile, but it will not find it. consequently, you will see error messages similar to the following in the alert log:
If you have not renamed the corresponding data file in the slave database, when you try to refresh the control file of the slave database, the slave database will try to use the named data file but cannot find it. Therefore, you will see the following similar error information in the alarm log:
ORA-00283: recovery session canceled due to errorsORA-01157: cannot identify/lock datafile 4-see DBWR trace fileORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'
References:
Important configuration parameters of Oracle Data Guard
Configure Oracle 11g Data Guard based on the same host
Explore Oracle 11g elastic uard
Oracle Data Guard (RAC + DG) archive deletion policies and scripts
Role conversion for Oracle Data Guard
FAL gap in Oracle Data Guard logs
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby