DATAGUARD手記(READONLY驗證REAL-TIME DML)(五)
http://zhouwf0726.itpub.net/post/9689/395349
http://zhouwf0726.itpub.net/post/9689/395350
http://zhouwf0726.itpub.net/post/9689/395437
http://zhouwf0726.itpub.net/post/9689/401874
http://zhouwf0726.itpub.net/post/9689/403401
Open Database read only to verify transmission redolog in Real-Time model
--只讀方式開啟資料庫來驗證時時應用日誌模式
一、READ ONLY開啟資料庫
--主庫
oracle:db-tfusn2cn-a-r1.amazon.com: /opt/app/oracle> sqlplus "/as sysdba"
SQL*Plus: Release 10.1.0.4.0 - Production on Thu Oct 4 14:09:11 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
SYS.YUDONG>alter system switch logfile;
System altered.
SYS.YUDONG>conn zwf/zwf
Connected.
1 row selected.
ZWF.YUDONG>create table t_1004(id number);
Table created.
ZWF.YUDONG>insert into t_1004 values(100);
1 row created.
ZWF.YUDONG>commit;
Commit complete.
--從庫
SYS.YUDONG>SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
--------------
962
1 row selected.
.>alter database recover managed standby database cancel;
Database altered.
.>alter database open read only;
Database altered.
.>CONN ZWF/ZWF
Connected.
1 row selected.
ZWF.YUDONG>SELECT TNAME FROM TAB; --沒有時時建立t_1004
TNAME
------------------------------
TEST
T1
T2
T
ABC
5 rows selected.
ZWF.YUDONG>CONN /AS SYSDBA
Connected.
1 row selected.
SYS.YUDONG>alter database recover managed standby database disconnect from session;
Database altered.
--主庫
SYS.YUDONG>ALTER SYSTEM SWITCH LOGFILE;
System altered.
SYS.YUDONG>SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
--------------
963
1 row selected.
--從庫
SYS.YUDONG>SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
--------------
963
1 row selected.
SYS.YUDONG>alter database recover managed standby database cancel;
Database altered.
SYS.YUDONG>alter database open read only;
Database altered.
SYS.YUDONG>CONN ZWF/ZWF
Connected.
1 row selected.
ZWF.YUDONG>SELECT TNAME FROM TAB; --切換日誌後建立該表
TNAME
------------------------------
TEST
T1
T2
T
ABC
T_1004
6 rows selected.
ZWF.YUDONG>SELECT * FROM T_1004;
ID
----------
100
1 row selected.
二、切換到最到保護模式
--登入從庫:
SYS.YUDONG>alter database recover managed standby database cancel;
Database altered.
SYS.YUDONG>alter database add standby logfile group 5('/opt/app/oracle/standbylog/standlog5') size 134217728;
Database altered.
SYS.YUDONG>alter database add standby logfile group 6('/opt/app/oracle/standbylog/standlog6') size 134217728;
Database altered.
SYS.YUDONG>alter database add standby logfile group 7('/opt/app/oracle/standbylog/standlog7') size 134217728;
Database altered.
SYS.YUDONG>alter database add standby logfile group 8('/opt/app/oracle/standbylog/standlog8') size 134217728;
Database altered.
SYS.YUDONG>alter database add standby logfile group 9('/opt/app/oracle/standbylog/standlog9') size 134217728;
Database altered.
SYS.YUDONG>SELECT * FROM V$STANDBY_LOG;
GROUP# DBID THREAD# SEQUENCE# BYTES USED ARC STATUS FIRST_CHANGE#
---------- ---------------------------------------- ---------- ---------- ---------- ---------- --- ---------- -------------
FIRST_TIME LAST_CHANGE# LAST_TIME
------------------- ------------ -------------------
5 UNASSIGNED 0 0 134217728 512 YES UNASSIGNED 0
0
6 UNASSIGNED 0 0 134217728 512 YES UNASSIGNED 0
0
7 UNASSIGNED 0 0 134217728 512 YES UNASSIGNED 0
0
8 UNASSIGNED 0 0 134217728 512 YES UNASSIGNED 0
0
9 UNASSIGNED 0 0 134217728 512 YES UNASSIGNED 0
0
5 rows selected.
--登入主庫:
SYS.YUDONG>select protection_mode from v$database;
PROTECTION_MODE
--------------------
MAXIMUM PERFORMANCE
1 row selected.
SYS.YUDONG>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS.YUDONG>STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 490733568 bytes
Fixed Size 779456 bytes
Variable Size 406985536 bytes
Database Buffers 81920000 bytes
Redo Buffers 1048576 bytes
Database mounted.
SYS.YUDONG>ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
Database altered.
SYS.YUDONG>ALTER DATABASE OPEN;
Database altered.
SYS.YUDONG>SELECT PROTECTION_MODE FROM V$DATABASE;
PROTECTION_MODE
--------------------
MAXIMUM PROTECTION
1 row selected.
--登入到從庫:
SYS.YUDONG>alter database recover managed standby database disconnect from session;
Database altered.
SYS.YUDONG>SELECT PROCESS FROM V$MANAGED_STANDBY;
PROCESS
---------
ARCH
ARCH
RFS
RFS
RFS
MRP0
6 rows selected.
SYS.YUDONG>SELECT GROUP#,DBID,STATUS FROM V$STANDBY_LOG;
GROUP# DBID STATUS
---------- ---------------------------------------- ----------
5 404134968 ACTIVE
6 UNASSIGNED UNASSIGNED
7 UNASSIGNED UNASSIGNED
8 UNASSIGNED UNASSIGNED
9 UNASSIGNED UNASSIGNED
5 rows selected.
三、啟動時時應用日誌模式
SYS.YUDONG>recover managed standby database cancel;
Media recovery complete.
SYS.YUDONG>recover managed standby database using current logfile DISCONNECT;
Media recovery complete.
--登入到主庫:
SYS.YUDONG>conn zwf/zwf
Connected.
1 row selected.
ZWF.YUDONG>create table test_real_time(id number);
Table created.
--登入到從庫:只讀開啟資料庫發現TEST_REAL_TIME
SYS.YUDONG>recover managed standby database cancel;
Media recovery complete.
SYS.YUDONG>alter database open read only;
Database altered.
SYS.YUDONG>conn zwf/zwf
Connected.
1 row selected.
ZWF.YUDONG>select tname from tab;
TNAME
------------------------------
BIN$O/W3ny81x1jgQAgKK+JqLw==$0
TEST
TEST_REAL_TIME
T1
T2
T
ABC
T_1004
8 rows selected.
ZWF.YUDONG>SELECT GROUP#,DBID,STATUS FROM V$STANDBY_LOG;
GROUP# DBID STATUS
---------- ---------------------------------------- ----------
5 UNASSIGNED UNASSIGNED
6 404134968 ACTIVE
7 UNASSIGNED UNASSIGNED
8 UNASSIGNED UNASSIGNED
9 UNASSIGNED UNASSIGNED
5 rows selected.
--登入到其他從庫:沒有發現TEST_REAL_TIME
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database open read only;
Database altered.
SQL> conn zwf/zwf
Connected.
SQL> select tname from tab;
TNAME
------------------------------
BIN$O/W3ny81x1jgQAgKK+JqLw==$0
TEST
T1
T2
T
ABC
T_1004
7 rows selected.
SQL> select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PHYSICAL STANDBY RESYNCHRONIZATION RESYNCHRONIZATION
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APP
---------- ---
................................................
1078 YES
1079 YES
1080 YES
1081 YES
1082 YES
225 rows selected.
--登入主庫:
SYS.YUDONG>shutdown immediate;Database closed.
Database dismounted.
ORACLE instance shut down.
SYS.YUDONG>startup mount
ORACLE instance started.
Total System Global Area 490733568 bytes
Fixed Size 779456 bytes
Variable Size 406985536 bytes
Database Buffers 81920000 bytes
Redo Buffers 1048576 bytes
Database mounted.
SYS.YUDONG>alter database set standby database to maximize performance;
Database altered.
SYS.YUDONG>alter database open;
Database altered.
--登入其他從庫
SQL> select database_role,protection_mode,protection_level from v$database
SQL> /
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APP
---------- ---
................................................
1177 YES
1178 YES
1179 YES
1180 YES
1181 YES
1182 YES
325 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242473/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DATAGUARD手記(DUPLICATE)(四)
- dataguard驗證是否正常同步的2種方法
- DATAGUARD手記(PRIMARY+2STANDBY)(二)
- DATAGUARD手記(PRIMARY+2STANDBY)(一)
- jQuery 表單驗證 學習手記jQuery
- laravel(五) 驗證碼Laravel
- 手動驗證 TLS 證書TLS
- 手機號碼驗證方法(正則驗證)
- 手機號碼驗證
- 深度殘差收縮網路:(五)實驗驗證
- JavaScript隨機五位數驗證碼JavaScript隨機
- js驗證手機號碼JS
- Laravel——驗證碼認證學習記錄Laravel
- 【Koa】腳手架登入驗證
- ios 手機驗證碼獲取iOS
- Vue筆記之props驗證Vue筆記
- 2020-10-26 實驗五:NAT工作原理分析與驗證
- SpringBoot + Spring Security 學習筆記(五)實現簡訊驗證碼+登入功能Spring Boot筆記
- 【驗證碼逆向專欄】某驗四代五子棋、消消樂驗證碼逆向分析
- KgCaptcha驗證碼實現筆記GCAPT筆記
- js正規表示式驗證手機,郵箱,身份證JS
- Vue-手動清空Form表單的驗證及驗證提示(紅字提示)VueORM
- swift 郵箱、密碼、手機號、身份證驗證正則Swift密碼
- 安卓手機 平板 Cloudflare人機驗證時無限迴圈 驗證您是真人安卓Cloud
- antd4表單手機號驗證
- 手機號碼簡訊驗證註冊
- python傳送手機動態驗證碼Python
- js中使用正則驗證手機號JS
- 很漂亮的Python驗證碼(記錄)Python
- swoft 學習筆記之驗證器筆記
- Laravel unique驗證 排除當前記錄Laravel
- 【日常筆記】生成驗證碼圖片筆記
- 驗證碼原理及驗證
- angularjs學習第五天筆記(第二篇:表單驗證升級篇)AngularJS筆記
- jquery-disabled和readonlyjQuery
- 【DATAGUARD】Oracle Dataguard nologging 塊修復Oracle
- 【Dataguard】DataGuard運維注意事項運維
- Hibernate Validator、Regex 和手動驗證:哪個更快?