ITPub博客

首页 > 数据库 > Oracle > Oracle primary DB 到 snapshot DB第二部分

Oracle primary DB 到 snapshot DB第二部分

原创 Oracle 作者:大鲨鱼o0O 时间:2018-01-12 22:49:26 0 删除 编辑

确认备库dest1和dest2

  1. 17:02:29 SYS @ gotime >show parameter dest;

  2. NAME                 TYPE     VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. audit_file_dest          string     /u01/app/oracle/admin/gotime/a
  5.                          dump
  6. background_dump_dest         string     /u01/app/oracle/diag/rdbms/got
  7.                          ime/gotime/trace
  8. core_dump_dest             string     /u01/app/oracle/diag/rdbms/got
  9.                          ime/gotime/cdump
  10. cursor_bind_capture_destination string     memory+disk
  11. db_create_file_dest         string
  12. db_create_online_log_dest_1     string
  13. db_create_online_log_dest_2     string
  14. db_create_online_log_dest_3     string

  15. NAME                 TYPE     VALUE
  16. ------------------------------------ ----------- ------------------------------
  17. db_create_online_log_dest_4     string
  18. db_create_online_log_dest_5     string
  19. db_recovery_file_dest         string     /dsk1/gotime_recover/
  20. db_recovery_file_dest_size     big integer 4G
  21. diagnostic_dest          string     /u01/app/oracle
  22. log_archive_dest         string
  23. log_archive_dest_1         string     LOCATION=/dsk1/arch_gotime/
  24.                          VALID_FOR=(ALL_LOGFILES,ALL_
  25.                          ROLES)
  26.                          DB_UNIQUE_NAME=gotime
  27. log_archive_dest_10         string

  28. NAME                 TYPE     VALUE
  29. ------------------------------------ ----------- ------------------------------
  30. log_archive_dest_11         string
  31. log_archive_dest_12         string
  32. log_archive_dest_13         string
  33. log_archive_dest_14         string
  34. log_archive_dest_15         string
  35. log_archive_dest_16         string
  36. log_archive_dest_17         string
  37. log_archive_dest_18         string
  38. log_archive_dest_19         string
  39. log_archive_dest_2         string     SERVICE=slow ASYNC
  40.                          VALID_FOR=(ONLINE_LOGFILES,P

  41. NAME                 TYPE     VALUE
  42. ------------------------------------ ----------- ------------------------------
  43.                          RIMARY_ROLE)
  44.                          DB_UNIQUE_NAME=slow
  45. log_archive_dest_20         string
  46. log_archive_dest_21         string
  47. log_archive_dest_22         string
  48. log_archive_dest_23         string
  49. log_archive_dest_24         string
  50. log_archive_dest_25         string
  51. log_archive_dest_26         string
  52. log_archive_dest_27         string
  53. log_archive_dest_28         string

  54. NAME                 TYPE     VALUE
  55. ------------------------------------ ----------- ------------------------------
  56. log_archive_dest_29         string
  57. log_archive_dest_3         string
  58. log_archive_dest_30         string
  59. log_archive_dest_31         string
  60. log_archive_dest_4         string
  61. log_archive_dest_5         string
  62. log_archive_dest_6         string
  63. log_archive_dest_7         string
  64. log_archive_dest_8         string
  65. log_archive_dest_9         string
  66. log_archive_dest_state_1     string     ENABLE

  67. NAME                 TYPE     VALUE
  68. ------------------------------------ ----------- ------------------------------
  69. log_archive_dest_state_10     string     enable
  70. log_archive_dest_state_11     string     enable
  71. log_archive_dest_state_12     string     enable
  72. log_archive_dest_state_13     string     enable
  73. log_archive_dest_state_14     string     enable
  74. log_archive_dest_state_15     string     enable
  75. log_archive_dest_state_16     string     enable
  76. log_archive_dest_state_17     string     enable
  77. log_archive_dest_state_18     string     enable
  78. log_archive_dest_state_19     string     enable
  79. log_archive_dest_state_2     string     ENABLE

  80. NAME                 TYPE     VALUE
  81. ------------------------------------ ----------- ------------------------------
  82. log_archive_dest_state_20     string     enable
  83. log_archive_dest_state_21     string     enable
  84. log_archive_dest_state_22     string     enable
  85. log_archive_dest_state_23     string     enable
  86. log_archive_dest_state_24     string     enable
  87. log_archive_dest_state_25     string     enable
  88. log_archive_dest_state_26     string     enable
  89. log_archive_dest_state_27     string     enable
  90. log_archive_dest_state_28     string     enable
  91. log_archive_dest_state_29     string     enable
  92. log_archive_dest_state_3     string     enable

  93. NAME                 TYPE     VALUE
  94. ------------------------------------ ----------- ------------------------------
  95. log_archive_dest_state_30     string     enable
  96. log_archive_dest_state_31     string     enable
  97. log_archive_dest_state_4     string     enable
  98. log_archive_dest_state_5     string     enable
  99. log_archive_dest_state_6     string     enable
  100. log_archive_dest_state_7     string     enable
  101. log_archive_dest_state_8     string     enable
  102. log_archive_dest_state_9     string     enable
  103. log_archive_duplex_dest      string
  104. log_archive_min_succeed_dest     integer     1
  105. standby_archive_dest         string     ?/dbs/arch

  106. NAME                 TYPE     VALUE
  107. ------------------------------------ ----------- ------------------------------
  108. user_dump_dest             string     /u01/app/oracle/diag/rdbms/got
  109.                          ime/gotime/trace
  110. 17:06:51 SYS @ gotime >

确认主库dest1和dest2

  1. 17:34:18 SYS @ slow >show parameter dest;

  2. NAME                 TYPE     VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. audit_file_dest          string     /u01/app/oracle/admin/slow/adu
  5.                          mp
  6. background_dump_dest         string     /u01/app/oracle/diag/rdbms/slo
  7.                          w/slow/trace
  8. core_dump_dest             string     /u01/app/oracle/diag/rdbms/slo
  9.                          w/slow/cdump
  10. cursor_bind_capture_destination string     memory+disk
  11. db_create_file_dest         string
  12. db_create_online_log_dest_1     string
  13. db_create_online_log_dest_2     string
  14. db_create_online_log_dest_3     string

  15. NAME                 TYPE     VALUE
  16. ------------------------------------ ----------- ------------------------------
  17. db_create_online_log_dest_4     string
  18. db_create_online_log_dest_5     string
  19. db_recovery_file_dest         string
  20. db_recovery_file_dest_size     big integer 0
  21. diagnostic_dest          string     /u01/app/oracle
  22. log_archive_dest         string
  23. log_archive_dest_1         string     LOCATION=/dsk1/arch_slow/
  24.                          VALID_FOR=(ALL_LOGFILES,ALL_
  25.                          ROLES)
  26.                          DB_UNIQUE_NAME=slow
  27. log_archive_dest_10         string

  28. NAME                 TYPE     VALUE
  29. ------------------------------------ ----------- ------------------------------
  30. log_archive_dest_11         string
  31. log_archive_dest_12         string
  32. log_archive_dest_13         string
  33. log_archive_dest_14         string
  34. log_archive_dest_15         string
  35. log_archive_dest_16         string
  36. log_archive_dest_17         string
  37. log_archive_dest_18         string
  38. log_archive_dest_19         string
  39. log_archive_dest_2         string     SERVICE=gotime ASYNC
  40.                          VALID_FOR=(ONLINE_LOGFILES,P

  41. NAME                 TYPE     VALUE
  42. ------------------------------------ ----------- ------------------------------
  43.                          RIMARY_ROLE)
  44.                          DB_UNIQUE_NAME=gotime
  45. log_archive_dest_20         string
  46. log_archive_dest_21         string
  47. log_archive_dest_22         string
  48. log_archive_dest_23         string
  49. log_archive_dest_24         string
  50. log_archive_dest_25         string
  51. log_archive_dest_26         string
  52. log_archive_dest_27         string
  53. log_archive_dest_28         string

  54. NAME                 TYPE     VALUE
  55. ------------------------------------ ----------- ------------------------------
  56. log_archive_dest_29         string
  57. log_archive_dest_3         string
  58. log_archive_dest_30         string
  59. log_archive_dest_31         string
  60. log_archive_dest_4         string
  61. log_archive_dest_5         string
  62. log_archive_dest_6         string
  63. log_archive_dest_7         string
  64. log_archive_dest_8         string
  65. log_archive_dest_9         string
  66. log_archive_dest_state_1     string     ENABLE

  67. NAME                 TYPE     VALUE
  68. ------------------------------------ ----------- ------------------------------
  69. log_archive_dest_state_10     string     enable
  70. log_archive_dest_state_11     string     enable
  71. log_archive_dest_state_12     string     enable
  72. log_archive_dest_state_13     string     enable
  73. log_archive_dest_state_14     string     enable
  74. log_archive_dest_state_15     string     enable
  75. log_archive_dest_state_16     string     enable
  76. log_archive_dest_state_17     string     enable
  77. log_archive_dest_state_18     string     enable
  78. log_archive_dest_state_19     string     enable
  79. log_archive_dest_state_2     string     ENABLE

  80. NAME                 TYPE     VALUE
  81. ------------------------------------ ----------- ------------------------------
  82. log_archive_dest_state_20     string     enable
  83. log_archive_dest_state_21     string     enable
  84. log_archive_dest_state_22     string     enable
  85. log_archive_dest_state_23     string     enable
  86. log_archive_dest_state_24     string     enable
  87. log_archive_dest_state_25     string     enable
  88. log_archive_dest_state_26     string     enable
  89. log_archive_dest_state_27     string     enable
  90. log_archive_dest_state_28     string     enable
  91. log_archive_dest_state_29     string     enable
  92. log_archive_dest_state_3     string     enable

  93. NAME                 TYPE     VALUE
  94. ------------------------------------ ----------- ------------------------------
  95. log_archive_dest_state_30     string     enable
  96. log_archive_dest_state_31     string     enable
  97. log_archive_dest_state_4     string     enable
  98. log_archive_dest_state_5     string     enable
  99. log_archive_dest_state_6     string     enable
  100. log_archive_dest_state_7     string     enable
  101. log_archive_dest_state_8     string     enable
  102. log_archive_dest_state_9     string     enable
  103. log_archive_duplex_dest      string
  104. log_archive_min_succeed_dest     integer     1
  105. standby_archive_dest         string     ?/dbs/arch

  106. NAME                 TYPE     VALUE
  107. ------------------------------------ ----------- ------------------------------
  108. user_dump_dest             string     /u01/app/oracle/diag/rdbms/slo
  109.                          w/slow/trace

主库做一些DML操作,提交,并切换日志处罚ARCH归档日志

  1. 17:36:32 SYS @ slow >create table t2 as select * from scott.emp;

  2. Table created.

  3. Elapsed: 00:00:00.10
  4. 17:38:43 SYS @ slow >commit;

  5. Commit complete.

  6. Elapsed: 00:00:00.00
  7. 17:38:47 SYS @ slow >alter system switch logfile;

  8. System altered.

  9. Elapsed: 00:00:00.01
  10. 17:38:58 SYS @ slow >

查看备库的告警日志,是否接收到日志,此时已处罚RFS(remote file server)故主备连接没有问题

  1. RFS[1]: Assigned to RFS process 4339
  2. RFS[1]: Selected log 4 for thread 1 sequence 16 dbid 1147482511 branch 963616975
  3. Fri Jan 12 17:33:36 2018
  4. RFS[2]: Assigned to RFS process 4335
  5. RFS[2]: Opened log for thread 1 sequence 10 dbid 1147482511 branch 963616975
  6. Archived Log entry 1 added for thread 1 sequence 10 rlc 963616975 ID 0x4465718f dest 2:
  7. RFS[1]: Opened log for thread 1 sequence 12 dbid 1147482511 branch 963616975
  8. RFS[2]: Opened log for thread 1 sequence 13 dbid 1147482511 branch 963616975
  9. Fri Jan 12 17:33:36 2018
  10. Archived Log entry 2 added for thread 1 sequence 16 ID 0x4465718f dest 1:
  11. Fri Jan 12 17:33:36 2018
  12. RFS[3]: Assigned to RFS process 4343
  13. RFS[3]: Opened log for thread 1 sequence 11 dbid 1147482511 branch 963616975
  14. Archived Log entry 3 added for thread 1 sequence 13 rlc 963616975 ID 0x4465718f dest 2:
  15. RFS[2]: Opened log for thread 1 sequence 14 dbid 1147482511 branch 963616975
  16. Archived Log entry 4 added for thread 1 sequence 14 rlc 963616975 ID 0x4465718f dest 2:
  17. RFS[2]: Opened log for thread 1 sequence 15 dbid 1147482511 branch 963616975
  18. Archived Log entry 5 added for thread 1 sequence 15 rlc 963616975 ID 0x4465718f dest 2:
  19. Archived Log entry 6 added for thread 1 sequence 11 rlc 963616975 ID 0x4465718f dest 2:
我上一次搭建DG的时候主库是startup pfile=xxxx 所以隔天我来做主备互换的时候是startup,主备无法连接,折
腾一下午终于找出原因了,通过以上的一些验证证明没有问题之后我们继续下面的操作

执行此命令将备库开启到snapshot mode

  1. 17:42:10 SYS @ gotime >r
  2.   1* alter database convert to snapshot standby

  3. Database altered.

  4. Elapsed: 00:00:02.37

查看备库告警日志

  1. Created guaranteed restore point SNAPSHOT_STANDBY_REQUIRED_01/12/2018 17:42:11
  2. Killing 4 processes with pids 4406,4385,4389,4393 (all RFS) in order to disallow current and futions. Requested by OS process 3844
  3. Begin: Standby Redo Logfile archival
  4. End: Standby Redo Logfile archival
  5. RESETLOGS after incomplete recovery UNTIL CHANGE 336029
  6. Resetting resetlogs activation ID 1147498895 (0x4465718f)
  7. Online log /u01/app/oracle/oradata/gotime/redo01a.log: Thread 1 Group 1 was previously cleared
  8. Online log /u01/app/oracle/oradata/gotime/redo01b.log: Thread 1 Group 1 was previously cleared
  9. Online log /u01/app/oracle/oradata/gotime/redo02a.log: Thread 1 Group 2 was previously cleared
  10. Online log /u01/app/oracle/oradata/gotime/redo02b.log: Thread 1 Group 2 was previously cleared
  11. Online log /u01/app/oracle/oradata/gotime/redo03a.log: Thread 1 Group 3 was previously cleared
  12. Online log /u01/app/oracle/oradata/gotime/redo03b.log: Thread 1 Group 3 was previously cleared
  13. Standby became primary SCN: 336027
  14. Fri Jan 12 17:42:13 2018
  15. Setting recovery target incarnation to 2
  16. CONVERT TO SNAPSHOT STANDBY: Complete - Database mounted as snapshot standby
  17. Completed: alter database convert to snapshot standby
  18. Fri Jan 12 17:43:05 2018
  19. ARC1: Becoming the 'no SRL' ARCH

此时备库的 状态是mounted,我们下面可以将他转换成open read write 状态了

  1. 17:56:17 SYS @ gotime >select status from v$instance;

  2. STATUS
  3. ------------
  4. MOUNTED

  5. row selected.

  6. Elapsed: 00:00:00.00

现在可以以read write的方式打开备库了!!!因为转换成功了

  1. 17:56:25 SYS @ gotime >alter database open read write;

  2. Database altered.

  3. Elapsed: 00:00:01.01
  4. 17:58:12 SYS @ gotime >

查看转换后的database_role是snapshot standby !!!

  1. 18:00:55 SYS @ gotime >select name,database_role,protection_mode,open_mode fromv$database;

  2. NAME     DATABASE_ROLE PROTECTION_MODE    OPEN_MODE
  3. --------- ---------------- -------------------- --------------------
  4. SLOW     SNAPSHOT STANDBY MAXIMUM PERFORMANCE    READ WRITE

  5. row selected.

  6. Elapsed: 00:00:00.01
  7. 18:02:03 SYS @ gotime >

做一些DML操作,提交,好等备库回到snapshot DB之前做对比

  1. 18:00:30 SYS @ gotime >r
  2.   1* create table t2018 as select * from scott.emp

  3. Table created.

  4. Elapsed: 00:00:00.04
  5. 18:00:30 SYS @ gotime >select * from t2018;

  6.      EMPNO ENAME JOB     MGR HIREDATE     SAL COMM DEPTNO
  7. ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
  8.       7369 SMITH CLERK     7902 17-DEC-80     800          20
  9.       7499 ALLEN SALESMAN     7698 20-FEB-81     1600 300     30
  10.       7521 WARD SALESMAN     7698 22-FEB-81     1250 500     30
  11.       7566 JONES MANAGER     7839 02-APR-81     2975          20
  12.       7654 MARTIN SALESMAN     7698 28-SEP-81     1250 1400     30
  13.       7698 BLAKE MANAGER     7839 01-MAY-81     2850          30
  14.       7782 CLARK MANAGER     7839 09-JUN-81     2450          10
  15.       7788 SCOTT ANALYST     7566 19-APR-87     3000          20
  16.       7839 KING PRESIDENT      17-NOV-81     5000          10
  17.       7844 TURNER SALESMAN     7698 08-SEP-81     1500      0     30
  18.       7876 ADAMS CLERK     7788 23-MAY-87     1100          20

  19.      EMPNO ENAME JOB     MGR HIREDATE     SAL COMM DEPTNO
  20. ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
  21.       7900 JAMES CLERK     7698 03-DEC-81     950          30
  22.       7902 FORD ANALYST     7566 03-DEC-81     3000          20
  23.       7934 MILLER CLERK     7782 23-JAN-82     1300          10

  24. 14 rows selected.

  25. Elapsed: 00:00:00.00
  26. 18:00:42 SYS @ gotime >commit;

  27. Commit complete.

  28. Elapsed: 00:00:00.00
  29. 18:00:55 SYS @ gotime >

这时候刚才创建的standby redo log被使用了

  1. 18:02:03 SYS @ gotime >select group#,thread#,sequence#,archived,status from v$standby_log;

  2.     GROUP# THREAD# SEQUENCE# ARC STATUS
  3. ---------- ---------- ---------- --- ----------
  4.      4     1     22 YES ACTIVE
  5.      5     1     0 NO UNASSIGNED
  6.      6     0     0 YES UNASSIGNED
  7.      7     0     0 YES UNASSIGNED

  8. rows selected.

  9. Elapsed: 00:00:00.00
  10. 18:03:39 SYS @ gotime >

主库做一些DML操作,提交,好等备库回到snapshot DB之前做对比

  1. 17:38:58 SYS @ slow >create table t2017 as select * from scott.dept;

  2. Table created.

  3. Elapsed: 00:00:00.06
  4. 18:08:04 SYS @ slow >select * from t2017;

  5.     DEPTNO DNAME     LOC
  6. ---------- -------------- -------------
  7.     10 ACCOUNTING     NEW YORK
  8.     20 RESEARCH     DALLAS
  9.     30 SALES     CHICAGO
  10.     40 OPERATIONS     BOSTON

  11. rows selected.

  12. Elapsed: 00:00:00.01
  13. 18:08:13 SYS @ slow >commit;

  14. Commit complete.

  15. Elapsed: 00:00:00.00
  16. 18:08:19 SYS @ slow >alter system switch logfile;

  17. System altered.

  18. Elapsed: 00:00:00.01
  19. 18:10:28 SYS @ slow >

关闭备库,重新启动到mounted然后转换回physical standby DB

  1. 18:11:34 SYS @ gotime >shutdown immediate;
  2. Database closed.
  3. Database dismounted.
  4. ORACLE instance shut down.
  5. 18:12:42 SYS @ gotime >startup mount;
  6. ORACLE instance started.

  7. Total System Global Area 521936896 bytes
  8. Fixed Size         2254824 bytes
  9. Variable Size         377489432 bytes
  10. Database Buffers     138412032 bytes
  11. Redo Buffers         3780608 bytes
  12. Database mounted.
  13. 18:12:57 SYS @ gotime >alter database convert to physical standby;

  14. Database altered.

  15. Elapsed: 00:00:02.23
  16. 18:13:18 SYS @ gotime >

转换回physical standby DB告警日志的情况

  1. alter database convert to physical standby
  2. ALTER DATABASE CONVERT TO PHYSICAL STANDBY (gotime)
  3. Killing 3 processes with pids 4994,4998,5002 (all RFS) in order to disallow current and future RFS connections. Requested by OS process 4988
  4. Flashback Restore Start
  5. Flashback Restore Complete
  6. Drop guaranteed restore point 
  7. Stopping background process RVWR
  8. Deleted Oracle managed file/dsk1/gotime_recover/GOTIME/flashback/o1_mf_f5k0qmlb_.flb
  9. Deleted Oracle managed file/dsk1/gotime_recover/GOTIME/flashback/o1_mf_f5k0qoco_.flb
  10. Guaranteed restore point dropped
  11. Clearing standby activation ID 1149107987 (0x447dff13)
  12. The primary database controlfile was created using the
  13. 'MAXLOGFILES 10' clause.
  14. There is space for up to 7 standby redo logfiles
  15. Use the following SQL commands on the standby database to create
  16. standby redo logfiles that match the primary database:
  17. ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 104857600;
  18. ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 104857600;
  19. ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 104857600;
  20. ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 104857600;
  21. Shutting down archive processes
  22. Archiving is disabled
  23. Fri Jan 12 18:13:17 2018
  24. ARCH shutting down
  25. ARC3: Archival stopped
  26. Fri Jan 12 18:13:17 2018
  27. ARCH shutting down
  28. ARC2: Archival stopped
  29. Fri Jan 12 18:13:17 2018
  30. ARCH shutting down
  31. ARC1: Archival stopped
  32. Fri Jan 12 18:13:17 2018
  33. ARCH shutting down
  34. ARC0: Archival stopped
  35. Completed: alter database convert to physical standby

打开备库查看数据库模式role和状态

  1. 18:13:18 SYS @ gotime >select name,database_role,protection_mode,open_mode fromv$database; select name,database_role,protection_mode,open_mode from v$database
  2.                                                          *
  3. ERROR at line 1:
  4. ORA-01507: database not mounted


  5. Elapsed: 00:00:00.01
  6. 18:15:42 SYS @ gotime >select name,database_role,protection_mode,open_mode fromv$database;
  7. select name,database_role,protection_mode,open_mode from v$database
  8.                                                          *
  9. ERROR at line 1:
  10. ORA-01507: database not mounted


  11. Elapsed: 00:00:00.00
  12. 18:15:51 SYS @ gotime >recover managed standby database disconnect;
  13. ORA-01507: database not mounted


  14. 18:16:37 SYS @ gotime >select status from v$instance;

  15. STATUS
  16. ------------
  17. STARTED

  18. row selected.

  19. Elapsed: 00:00:00.01
  20. 18:17:00 SYS @ gotime >alter database mount; 
  21. alter database mount
  22. *
  23. ERROR at line 1:
  24. ORA-00750: database has been previously mounted and dismounted


  25. Elapsed: 00:00:00.00
  26. 18:17:13 SYS @ gotime >startup mount;
  27. ORA-01081: cannot start already-running ORACLE - shut it down first
  28. 18:17:26 SYS @ gotime >shutdown immediate;
  29. ORA-01507: database not mounted


  30. ORACLE instance shut down.
  31. 18:18:58 SYS @ gotime >startup mount;
  32. ORACLE instance started.

  33. Total System Global Area 521936896 bytes
  34. Fixed Size         2254824 bytes
  35. Variable Size         377489432 bytes
  36. Database Buffers     138412032 bytes
  37. Redo Buffers         3780608 bytes
  38. Database mounted.
  39. 18:19:10 SYS @ gotime >select name,database_role,protection_mode,open_mode fromv$database;

  40. NAME     DATABASE_ROLE PROTECTION_MODE    OPEN_MODE
  41. --------- ---------------- -------------------- --------------------
  42. SLOW     PHYSICAL STANDBY MAXIMUM PERFORMANCE    MOUNTED

  43. row selected.

  44. Elapsed: 00:00:00.02
  45. 18:19:17 SYS @ gotime >

重新恢复到physical DB之后,对积压的主库传过来的日志进行media recover 应用

  1. 18:19:17 SYS @ gotime >recover managed standby database disconnect;
  2. Media recovery complete.

此时备库告警日志信息

  1. MRP0 started with pid=27, OS id=5221 
  2. MRP0: Background Managed Standby Recovery process started (gotime)
  3. Serial Media Recovery started
  4. Managed Standby Recovery not using Real Time Apply
  5. Waiting for all non-current ORLs to be archived...
  6. All non-current ORLs have been archived.
  7. Clearing online redo logfile 1 /u01/app/oracle/oradata/gotime/redo01a.log
  8. Clearing online log 1 of thread 1 sequence number 25
  9. Completed: ALTER DATABASE RECOVER managed standby database disconnect 
  10. Clearing online redo logfile 1 complete
  11. Clearing online redo logfile 2 /u01/app/oracle/oradata/gotime/redo02a.log
  12. Clearing online log 2 of thread 1 sequence number 2
  13. Clearing online redo logfile 2 complete
  14. Clearing online redo logfile 3 /u01/app/oracle/oradata/gotime/redo03a.log
  15. Clearing online log 3 of thread 1 sequence number 24
  16. Fri Jan 12 18:21:56 2018
  17. Clearing online redo logfile 3 complete
  18. Media Recovery Log /dsk1/arch_gotime/1_21_963616975.arc
  19. Media Recovery Log /dsk1/arch_gotime/1_22_963616975.arc
  20. Media Recovery Log /dsk1/arch_gotime/1_23_963616975.arc
  21. Media Recovery Log /dsk1/arch_gotime/1_24_963616975.arc
  22. Media Recovery Waiting for thread 1 sequence 25 (in transit)

以只读的方式打开数据库,此时备库snapshot DB期间主库所做的操作都应用到备库了

  1. 18:21:51 SYS @ gotime >alter database open;
  2. alter database open
  3. *
  4. ERROR at line 1:
  5. ORA-10456: cannot open standby database; media recovery session may be in progress


  6. Elapsed: 00:00:00.00
  7. 18:24:11 SYS @ gotime >recover managed standby database cancel;
  8. Media recovery complete.
  9. 18:24:34 SYS @ gotime >alter database open ;

  10. Database altered.

  11. Elapsed: 00:00:00.28
  12. 18:24:41 SYS @ gotime >select name,database_role,protection_mode,open_mode fromv$database;

  13. NAME     DATABASE_ROLE PROTECTION_MODE    OPEN_MODE
  14. --------- ---------------- -------------------- --------------------
  15. SLOW     PHYSICAL STANDBY MAXIMUM PERFORMANCE    READ ONLY

  16. row selected.

  17. Elapsed: 00:00:00.01
  18. 18:25:15 SYS @ gotime >

在备库上对比查询,t2017(主库DML)存在,t2018(备库DML)消失,snapshot DB转换成功!!!

  1. 18:25:15 SYS @ gotime >select * from t2017;

  2.     DEPTNO DNAME     LOC
  3. ---------- -------------- -------------
  4.     10 ACCOUNTING     NEW YORK
  5.     20 RESEARCH     DALLAS
  6.     30 SALES     CHICAGO
  7.     40 OPERATIONS     BOSTON

  8. rows selected.

  9. Elapsed: 00:00:00.01
  10. 18:26:51 SYS @ gotime >select * from t2018;
  11. select * from t2018
  12.               *
  13. ERROR at line 1:
  14. ORA-00942: table or view does not exist


  15. Elapsed: 00:00:00.00
  16. 18:27:01 SYS @ gotime >
2017悄然逝去已成历史,我们无法改变,2018还像一张白纸,等我们认真填写,我那时候站在2019回望2018又会不会呆着遗憾呢,期待2018。。。
我做的所有改变只为我心中不变,应对变化的只有改变



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

请登录后发表评论 登录
全部评论

注册时间:2016-10-26

  • 博文量
    32
  • 访问量
    5161