Oracle Data Guard _ renaming Data files in the master database

Source: Internet
Author: User

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_MANAGEMENTInitialization 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.

  1. 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;
  2. Exit from the SQL prompt and issue an operating system command, such as the following UNIXmvCommand, 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
  3. 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;
  4. Connect to the standby database, queryV$ARCHIVED_LOGView to verify all of the archived redo log files are applied, and then stop Redo Apply:

    Connect to the slave database and queryV$ARCHIVED_LOGView 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;
  5. Shut down the standby database:

    5. Close the slave Database

    SQL> SHUTDOWN;
  6. Rename the datafile at the standby site using an operating system command, such as the UNIXmvCommand:

    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
  7. Start and mount the standby database:

    7. Start and load the slave database:

    SQL> STARTUP MOUNT;
  8. Rename the datafile in the standby control file. Note thatSTANDBY_FILE_MANAGEMENTInitialization 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 ';
  9. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.