oracle 将物理备用数据库转换为独立数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24512154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:24:18  来源:igfitidea点击:

Convert physical standby to standalone database

databaseoracle

提问by KevinKirkpatrick

I have a standard primary / physical-standby configuration (one primary, one standby), and would like to completely break the connection between primary and standby; converting physical standby to development database that is dissociated from primary/production system.

我有一个标准的主/物理-备用配置(一个主,一个备用),并且想完全断开主和备用之间的连接;将物理备用数据库转换为与主/生产系统分离的开发数据库。

This seems like it should be fairly trivial, but doesn't really follow any documented procedures that I can find (most of which focus on switching over to standby for recovery purposes).

这看起来应该相当简单,但并没有真正遵循我能找到的任何记录的过程(其中大部分集中在切换到待机状态以进行恢复)。

My gameplan is to activate the standby database by "simulating" a failover (without the primary actually failing, of course), following instructions here:
8.2.2 Performing a Failover to a Physical Standby Databasehttp://docs.oracle.com/cd/E11882_01/server.112/e41134/role_management.htm#SBYDB5176

我的游戏计划是通过“模拟”故障转移来激活备用数据库(当然,主数据库实际上没有失败),请按照此处的说明进行操作:
8.2.2 执行到物理备用数据库的故障转移http://docs.oracle.com/ cd/E11882_01/server.112/e41134/role_management.htm#SBYDB5176

This would entail running following on primary:

这将需要在主服务器上运行以下内容:

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM FLUSH REDO TO target_db_name;

And then, if no errors, running this on standby:

然后,如果没有错误,在待机状态下运行:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
     (confirm result is TO PRIMARY or SESSIONS ACTIVE)

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

Then, on both primary and standby, bring up in OPEN mode and disable further replication:

然后,在主服务器和备用服务器上,以 OPEN 模式启动并禁用进一步复制:

SQL> ALTER DATABASE OPEN;
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';

I have 3 problems/questions with this approach:

我对这种方法有 3 个问题/疑问:

  • As a general statement, this feels a little overly complex - is there a more direct way to do this? For example, I'd like to be able to do this without having to shutdown primary database (which is required in order to run ALTER SYSTEM FLUSH REDO TO target_db_name;).
  • 作为一般声明,这感觉有点过于复杂 - 有没有更直接的方法来做到这一点?例如,我希望能够在不必关闭主数据库的情况下执行此操作(这是运行所需的ALTER SYSTEM FLUSH REDO TO target_db_name;)。
  • Current output of SELECT SWITCHOVER_STATUS FROM V$DATABASE;on standby is "NOT ALLOWED". I assume this status will change with the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;but would like confirmation of this, as I don't want to find myself in trouble-shooting mode.
  • SELECT SWITCHOVER_STATUS FROM V$DATABASE;待机电流输出为“NOT ALLOWED”。我认为这种状态会随着 发生变化,ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;但我想确认这一点,因为我不想发现自己处于故障排除模式。
  • Is ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';the clean way to shutdown replication? Should I instead ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2='disable'?

  • ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';关闭复制的干净方法吗?我应该代替ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2='disable'吗?

  • 回答by ynux

    We did this yesterday: Turn two Oracle 11 databases that were primary / physical-standby into standalone / standalone. There are many ways to set up an Oracle physical standby system: With or without broker, data guard manager, in different modese.t.c. pp. This is what worked for us.

    我们昨天这样做了:将两个主要/物理备用的 Oracle 11 数据库转换为独立/独立。有很多方法可以设置 Oracle 物理备用系统:有或没有代理、数据保护管理器、不同模式等 pp。这对我们有用。

    On your three questions:

    关于你的三个问题:

    • The former primary kept running, no shutdown needed. We also felt that the procedure was more complicated and less well documented than it should be.
    • you are probably right. We didn't switch over, but convinced the standby DB that the primary was lost and it has to take over, i.e. only switched the standby to primary ("ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;"). But when I tried this without "ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;", it refused ("ORA-16139: media recovery required")
    • I'm not sure. To shutdown replication, we used the data guard manager. I expect you need at least an additional "alter database recover managed standby database cancel;"
    • 前主继续运行,不需要关闭。我们还认为该程序比应有的更复杂,文档也更少。
    • 你可能是对的。我们没有切换,但让备用数据库确信主数据库丢失了,它必须接管,即只将备用数据库切换到主数据库(“ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;”)。但是当我在没有“ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;”的情况下尝试这个时,它拒绝了(“ORA-16139:需要媒体恢复”)
    • 我不知道。为了关闭复制,我们使用了数据保护管理器。我希望您至少需要一个额外的“更改数据库恢复托管备用数据库取消;”


    preparation:

    准备:

    create spfile from pfile='standalone.ora';
    alter database backup controlfile to trace;
    

    in dgmgrl:

    在 dgmgrl 中:

    REMOVE DATABASE
    REMOVE CONFIGURATION
    

    on standby:

    随时待命:

    alter database recover managed standby database finish;
    ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
    

    (now this database is PRIMARY)

    (现在这个数据库是主要的)

    shutdown immediate;
    startup
    

    And that was it.

    就是这样。



    For cleanup, we modified the pfile: dg_broker_start=false and removed dg_broker_config_file1 dg_broker_config_file2 fal_server standby_file_management

    为了清理,我们修改了 pfile:dg_broker_start=false 并删除了 dg_broker_config_file1 dg_broker_config_file2 fal_server standby_file_management

    and in sqlplus / in the database, we dropped the standby redo logs

    在sqlplus /数据库中,我们删除了备用重做日志

    alter database drop standby logfile group 30;
    

    回答by Seifolah

    There is a fast way to do it. on standby

    有一种快速的方法可以做到。随时待命

    $  sqlplus / as sysdba
    SQL>  ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
    SQL>  SHUTDOWN IMMEDIATE;
    SQL>  STARTUP
    

    Also an oracle document is availble 2074686.1

    还有一个 oracle 文档可用 2074686.1