ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle10g data guard(dg)__主库重命名数据文件_在备库上同步重命名数据文件

oracle10g data guard(dg)__主库重命名数据文件_在备库上同步重命名数据文件

原创 Linux操作系统 作者:wisdomone1 时间:2010-01-26 22:56:26 0 删除 编辑

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      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, query the V$ARCHIVED_LOG view to verify all of the archived redo log files are applied, and then stop Redo Apply:

    SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
    SEQUENCE# APP
    --------- ---
    8 YES
    9 YES
    10 YES
    11 YES
    4 rows selected.

    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 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:

    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
    2> DISCONNECT FROM SESSION;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-626106/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12689917