miércoles, 21 de noviembre de 2012

Renaming a Datafile in the Primary Database


Renaming a Datafile in the Primary 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 performed automatically, even if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.
The following steps describe how to rename a datafile in the primary database and manually propagate the changes to the standby database.
  1. To rename the datafile in the primary database, take the tablespace offline:
    SQL> ALTER TABLESPACE tbs_4 OFFLINE;
    
  2. Exit from the SQL prompt and issue an operating system command, such as the following UNIX mv command, to rename the datafile on the primary system:
    % 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:
    SQL> ALTER TABLESPACE tbs_4 RENAME DATAFILE -
    > '/disk1/oracle/oradata/payroll/tbs_4.dbf' -
    >  TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
    
    SQL> ALTER TABLESPACE tbs_4 ONLINE;
    
  4. Connect to the standby database and stop Redo Apply:
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
    
  5. Shut down the standby database:
    SQL> SHUTDOWN;
    
  6. Rename the datafile at the standby site using an operating system command, such as the UNIX mv command:
    % mv /disk1/oracle/oradata/payroll/tbs_4.dbf /disk1/oracle/oradata/payroll/tbs_x.dbf
    
  7. Start and mount the standby database:
    SQL> STARTUP MOUNT;
    
  8. Rename the datafile in the standby control file. Note that the STANDBY_FILE_MANAGEMENT database initialization parameter must be set to MANUAL in order to rename a datafile. This parameter can be reset to its previous value after renaming a datafile.
    SQL> ALTER DATABASE RENAME FILE '/disk1/oracle/oradata/payroll/tbs_4.dbf' -
    > TO '/disk1/oracle/oradata/payroll/tbs_x.dbf';
    
  9. On the standby database, restart Redo Apply:
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE -
    > 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:
ORA-00283: recovery session canceled due to errors
ORA-01157: cannot identify/lock datafile 4 - see DBWR trace file
ORA-01110: datafile 4: '/Disk1/oracle/oradata/payroll/tbs_x.dbf'

Source: http://docs.oracle.com/cd/E11882_01/server.112/e25608/manage_ps.htm#i1034172

No hay comentarios:

Publicar un comentario