zoukankan      html  css  js  c++  java
  • 『ORACLE』DG之Snapshot Standby功能(11g)

    SQL> select database_role,open_mode from v$database;

    DATABASE_ROLE OPEN_MODE
    ---------------- --------------------
    PHYSICAL STANDBY READ ONLY WITH APPLY

    SQL> alter database recover managed standby database cancel;

    Database altered.

    SQL> alter database convert to snapshot standby;
    alter database convert to snapshot standby
    *
    ERROR at line 1:
    ORA-38784: Cannot create restore point 'SNAPSHOT_STANDBY_REQUIRED_05/04/2017
    03:31:26'.
    ORA-38786: Recovery area is not enabled.

    SQL> show parameter recover

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    db_recovery_file_dest string
    db_recovery_file_dest_size big integer 0
    db_unrecoverable_scn_tracking boolean TRUE
    recovery_parallelism integer 0
    SQL> alter system set db_recovery_file_dest_size=1G;

    System altered.

    SQL> alter system set db_recovery_file_dest='/u01/app/oracle/recovery';

    System altered.

    SQL> alter database convert to snapshot standby;

    Database altered.

    SQL> select database_role,open_mode from v$database;

    DATABASE_ROLE OPEN_MODE
    ---------------- --------------------
    SNAPSHOT STANDBY MOUNTED

    SQL> alter database open;

    Database altered.

    SQL> show parameter user

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    license_max_users integer 0
    parallel_adaptive_multi_user boolean TRUE
    redo_transport_user string
    user_dump_dest string  /u01/app/oracle/diag/rdbms/enmo2/enmo2/trace

    此时查看alert日志,会发现数据见了一个guaranteed restore point,确保我们切回主备,可应用日志。

    [oracle@enmo2 ~]$ cd /u01/app/oracle/diag/rdbms/enmo2/enmo2/trace
    [oracle@enmo2 trace]$ tail -100f alert_enmo2.log

    alter database convert to snapshot standby
    Starting background process RVWR
    Thu May 04 04:09:35 2017
    RVWR started with pid=32, OS id=24686
    Allocated 3981120 bytes in shared pool for flashback generation buffer
    Created guaranteed restore point SNAPSHOT_STANDBY_REQUIRED_05/04/2017 04:09:35
    All dispatchers and shared servers shutdown
    CLOSE: killing server sessions.
    CLOSE: all sessions shutdown successfully.
    Thu May 04 04:09:37 2017
    SMON: disabling cache recovery
    Begin: Standby Redo Logfile archival
    End: Standby Redo Logfile archival
    RESETLOGS after incomplete recovery UNTIL CHANGE 1051425
    Online log /u01/app/oracle/oradata/enmo2/redo01.log: Thread 1 Group 1 was previously cleared
    Online log /u01/app/oracle/oradata/enmo2/redo02.log: Thread 1 Group 2 was previously cleared
    Online log /u01/app/oracle/oradata/enmo2/redo03.log: Thread 1 Group 3 was previously cleared
    Standby became primary SCN: 1051423

    [oracle@enmo2 trace]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Thu May 4 05:26:49 2017

    Copyright (c) 1982, 2013, Oracle. All rights reserved.


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup mount;
    ORACLE instance started.

    Total System Global Area 830930944 bytes
    Fixed Size 2257800 bytes
    Variable Size 692063352 bytes
    Database Buffers 130023424 bytes
    Redo Buffers 6586368 bytes
    Database mounted.
    SQL> alter database convert to physical standby;

    Database altered.

    SQL> shutdown immediate
    ORA-01507: database not mounted

    ORACLE instance shut down.
    SQL> startup mount;
    ORACLE instance started.

    Total System Global Area 830930944 bytes
    Fixed Size 2257800 bytes
    Variable Size 692063352 bytes
    Database Buffers 130023424 bytes
    Redo Buffers 6586368 bytes
    Database mounted.
    SQL> alter database recover managed standby database using current logfile disconnect from session;

    Database altered.

  • 相关阅读:
    linux 网络相关
    工作随笔
    python
    trouble-shooting
    MySQL常见问题总结
    根据 Request 获取客户端 IP
    文件上传按钮优化
    Linux中RabbitMQ安装
    linux 完全卸载MySQL
    Linux 下安装 MySQL-5.7.24
  • 原文地址:https://www.cnblogs.com/KT-melvin/p/6813797.html
Copyright © 2011-2022 走看看