dataguard 修改redo log 和standby redo log
一. 主庫操作
1.1 檢視redo 資訊
SQL> select group#,type, member from v$logfile;
GROUP# TYPE MEMBER
---------- ------- -------------------------------------------------------------
3 ONLINE /u01/app/oracle/oradata/xezf/redo03.log
2 ONLINE /u01/app/oracle/oradata/xezf/redo02.log
1 ONLINE /u01/app/oracle/oradata/xezf/redo01.log
4 STANDBY /u01/app/oracle/oradata/xezf/redo04.log
5 STANDBY /u01/app/oracle/oradata/xezf/redo05.log
6 STANDBY /u01/app/oracle/oradata/xezf/redo06.log
7 STANDBY /u01/app/oracle/oradata/xezf/redo07.log
7 rows selected.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES INACTIVE 50
2 1 NO CURRENT 50
3 1 YES INACTIVE 50
1.2 修改standby redo
SQL> alter database drop logfile group 4;
Database altered.
SQL> alter database drop logfile group 5;
Database altered.
SQL> alter database drop logfile group 6;
Database altered.
SQL> alter database drop logfile group 7;
Database altered.
SQL> select group#,type, member from v$logfile;
GROUP# TYPE MEMBER
---------- ------- -------------------------------------------------------------
3 ONLINE /u01/app/oracle/oradata/xezf/redo03.log
2 ONLINE /u01/app/oracle/oradata/xezf/redo02.log
1 ONLINE /u01/app/oracle/oradata/xezf/redo01.log
新增standby redo
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/app/oracle/oradata/xezf/std_redo04.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/app/oracle/oradata/xezf/std_redo05.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/app/oracle/oradata/xezf/std_redo06.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/app/oracle/oradata/xezf/std_redo07.log') size 100M;
Database altered.
SQL> select group#,type, member from v$logfile;
GROUP# TYPE MEMBER
---------- ------- -------------------------------------------------------------
3 ONLINE /u01/app/oracle/oradata/xezf/redo03.log
2 ONLINE /u01/app/oracle/oradata/xezf/redo02.log
1 ONLINE /u01/app/oracle/oradata/xezf/redo01.log
4 STANDBY /u01/app/oracle/oradata/xezf/std_redo04.log
5 STANDBY /u01/app/oracle/oradata/xezf/std_redo05.log
6 STANDBY /u01/app/oracle/oradata/xezf/std_redo06.log
7 STANDBY /u01/app/oracle/oradata/xezf/std_redo07.log
7 rows selected.
1.3 修改Online redo
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES INACTIVE 50
2 1 NO CURRENT 50
3 1 YES INACTIVE 50
先處理inactive, 它表示已經完成規定的,可以刪除。
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database drop logfile group 3;
alter database drop logfile group 3
*
ERROR at line 1:
ORA-01567: dropping log 3 would leave less than 2 log files for instance xezf
(thread 1)
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/xezf/redo03.log'
-- 至少要2個redo組,看來還是隻能慢慢來了。
SQL> alter database add logfile group 1 ('/u01/app/oracle/oradata/xezf/redo01.log') size 100M;
alter database add logfile group 1 ('/u01/app/oracle/oradata/xezf/redo01.log') size 100M
*
ERROR at line 1:
ORA-00301: error in adding log file '/u01/app/oracle/oradata/xezf/redo01.log' -
file cannot be created
ORA-27038: created file already exists
Additional information: 1
-- 物理檔案沒有刪除,手工的把物理檔案刪除後,在建立:
SQL> alter database add logfile group 1 ('/u01/app/oracle/oradata/xezf/redo01.log') size 100M;
Database altered.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES UNUSED 100
2 1 NO CURRENT 50
3 1 YES INACTIVE 50
group1 搞定了。
SQL> alter database drop logfile group 3;
Database altered.
刪除對應的物理檔案,在新增
SQL> alter database add logfile group 3 ('/u01/app/oracle/oradata/xezf/redo03.log') size 100M;
Database altered.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES UNUSED 100
2 1 NO CURRENT 50
3 1 YES UNUSED 100
group3 搞定。
切換一下logfile,在刪除group2
SQL> alter system switch logfile;
System altered.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 NO CURRENT 100
2 1 YES ACTIVE 50
-- group 正在歸檔,我們等會在看一下
3 1 YES UNUSED 100
幾分鐘之後:
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 NO CURRENT 100
2 1 YES INACTIVE 50
3 1 YES UNUSED 100
SQL> alter database drop logfile group 2;
Database altered.
刪除物理檔案,在建立
SQL> alter database add logfile group 2 ('/u01/app/oracle/oradata/xezf/redo02.log') size 100M;
Database altered.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 NO CURRENT 100
2 1 YES UNUSED 100
3 1 YES UNUSED 100
主庫搞定。
二. 備庫操作
2.1 檢視資訊
SQL> select group#,type, member from v$logfile;
GROUP# TYPE MEMBER
---------- ------- -------------------------------------------------------------
3 ONLINE /u01/app/oracle/oradata/xezf/redo03.log
2 ONLINE /u01/app/oracle/oradata/xezf/redo02.log
1 ONLINE /u01/app/oracle/oradata/xezf/redo01.log
4 STANDBY /u01/app/oracle/oradata/xezf/redo04.log
5 STANDBY /u01/app/oracle/oradata/xezf/redo05.log
6 STANDBY /u01/app/oracle/oradata/xezf/redo06.log
7 STANDBY /u01/app/oracle/oradata/xezf/redo07.log
7 rows selected.
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES CLEARING_CURRENT 50
3 1 YES CLEARING 50
2 1 YES CLEARING 50
2.2 處理standby redo
對於standby 上redo的處理之前,我們要先停掉redo 的apply:
SQL> alter database recover managed standby database cancel;
不然會報如下錯誤:
SQL> alter database drop logfile group 2;
alter database drop logfile group 2
*
ERROR at line 1:
ORA-01156: recovery in progress may need access to files
SQL> alter database drop logfile group 4;
Database altered.
SQL> alter database drop logfile group 5;
Database altered.
SQL> alter database drop logfile group 6;
Database altered.
SQL> alter database drop logfile group 7;
Database altered.
[[email protected] xezf]$ rm redo04.log
[[email protected] xezf]$ rm redo05.log
[[email protected] xezf]$ rm redo06.log
[[email protected] xezf]$ rm redo07.log
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/app/oracle/oradata/xezf/std_redo04.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/app/oracle/oradata/xezf/std_redo05.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/app/oracle/oradata/xezf/std_redo06.log') size 100M;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/app/oracle/oradata/xezf/std_redo07.log') size 100M;
Database altered.
SQL> select group#,type, member from v$logfile;
GROUP# TYPE MEMBER
---------- ------- -------------------------------------------------------------
3 ONLINE /u01/app/oracle/oradata/xezf/redo03.log
2 ONLINE /u01/app/oracle/oradata/xezf/redo02.log
1 ONLINE /u01/app/oracle/oradata/xezf/redo01.log
4 STANDBY /u01/app/oracle/oradata/xezf/std_redo04.log
5 STANDBY /u01/app/oracle/oradata/xezf/std_redo05.log
6 STANDBY /u01/app/oracle/oradata/xezf/std_redo06.log
7 STANDBY /u01/app/oracle/oradata/xezf/std_redo07.log
7 rows selected.
2.3 處理online redo
先將standby_file_management設為手動:
SQL> alter system set standby_file_management=manual;
System altered.
不然會報錯:
SQL> alter database drop logfile group 2;
alter database drop logfile group 2
*
ERROR at line 1:
ORA-01275: Operation DROP LOGFILE is not allowed if standby file management is automatic.
在Oracle 官網上搜了一下,找到了一篇文章:
How to Add/Drop/Resize Redo Log with Physical Standby in place. [ID 473442.1]
SQL> SELECT GROUP#, STATUS FROM V$LOG;
GROUP# STATUS
---------- ----------------
1 CLEARING_CURRENT
3 CLEARING
2 CLEARING
SQL>
SQL> alter database clear logfile group 2;
alter database clear logfile group 2
*
ERROR at line 1:
ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/xezf/redo02.log'
ORA-19527: physical standby redo log must be renamed
Cause:
The CLEAR LOGFILE command was used at a physical standby database. This command cannot be used at a physical standby database unless the LOG_FILE_NAME_CONVERT initialization parameter is set. This is required to avoid overwriting the primary database's logfiles.
Action:
Set the LOG_FILE_NAME_CONVERT initialization parameter.
我們需要設定LOG_FILE_NAME_CONVERT 引數,才能使用clear logfile命令。 參考:
ORA-00313, ORA-00312, ORA-27037 in Standby Database [ID 601835.1]
解決方法如下:
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
在pfile裡新增引數:
語法:*.log_file_name_convert = '<location on primary>','<location on standby>'
*.log_file_name_convert ='/u01/app/oracle/oradata/xezf/','/u01/app/oracle/oradata/xezf/'
用pfile 啟動備庫:
SQL> startup nomount pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initxezf.ora';
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
SQL> alter database mount standby database;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CLEARING
3 CLEARING
2 CLEARING_CURRENT
SQL> show parameter log_file_name_convert
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert string /u01/app/oracle/oradata/xezf, /u01/app/oracle/oradata/xezf/
SQL> alter database clear logfile group 1;
Database altered.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT='MANUAL';
System altered.
SQL> alter database drop logfile group 1;
Database altered.
刪除物理檔案:
[[email protected] xezf]$ rm redo01.log
建立新的日誌組:
SQL> alter database add logfile group 1 ('/u01/app/oracle/oradata/xezf/redo01.log') size 100M;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 UNUSED
3 CLEARING
2 CLEARING_CURRENT
處理下一個redo 日誌:
SQL> alter database clear logfile group 3;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
刪除物理檔案:
[[email protected] xezf]$ rm redo03.log
SQL> alter database add logfile group 3 ('/u01/app/oracle/oradata/xezf/redo03.log') size 100M;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 UNUSED
3 UNUSED
2 CLEARING_CURRENT
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES UNUSED 100
3 1 YES UNUSED 100
2 1 YES CLEARING_CURRENT 50
還有最後一個redo 組沒有處理,這個要先切換過來:
(1)在備庫啟動recover 程序:
SQL> alter database recover managed standby database disconnect from session;
SQL>ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT='AUTO';
(2)到主庫手動切換幾次redo
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
在檢視備庫的redo:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT='MANUAL';
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 UNUSED
3 CLEARING_CURRENT
2 CLEARING
SQL> alter database clear logfile group 2;
Database altered.
SQL> alter database drop logfile group 2;
Database altered.
物理刪除檔案:
[[email protected] xezf]$ rm redo02.log
新增redo:
SQL> alter database add logfile group 2 ('/u01/app/oracle/oradata/xezf/redo02.log') size 100M;
Database altered.
檢視:
SQL> select group#,thread#,archived,status, bytes/1024/1024 from v$log;
GROUP# THREAD# ARC STATUS BYTES/1024/1024
---------- ---------- --- ---------------- ---------------
1 1 YES UNUSED 100
3 1 YES CLEARING_CURRENT 100
2 1 YES UNUSED 100
搞定,最後啟動recover,驗證:
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT='AUTO';
System altered.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
主庫:
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
15
備庫:
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APP
---------- ---
2 YES
3 YES
5 YES
4 YES
7 YES
6 YES
8 YES
9 YES
13 YES
10 YES
11 YES
SEQUENCE# APP
---------- ---
12 YES
14 YES
15 YES
14 rows selected.
同步正常。 ok。
相關推薦
dataguard 修改redo log 和standby redo log
一. 主庫操作 1.1 檢視redo 資訊 SQL> select group#,type, member from v$logfile; GROUP# TYPE MEMBER ---------- ------- -----------------
dataguard 下主備 online redo 與 standby redo log resize 重建
環境說明: 本實驗環境是一個節點的rac + 單節點 asm dg database 與 grid 版本是 11.2.0.4 。 提別提醒 如果是多節點叢集,操作時需要特別注意 thread 。 一. 主庫操作 1.1 檢視redo 資訊 SQL> col
MySQL的日誌(二):事務日誌(redo log和undo log)
drive datadir sse 詳細分析 mut 通過 註意 默認 into 本文目錄:1.redo log 1.1 redo log和二進制日誌的區別 1.2 redo log的基本概念 1.3 日誌塊(log block) 1.4 log group和redo lo
轉 Alert.log shows No Standby Redo Logfiles Of Size 153600 Blocks Available
http://blog.itpub.net/23135684/viewspace-703620/ Alert.log shows No Standby Redo Logfiles Of Size 153600 Blocks Available [ID 405836.1
Mysql裡的 undo log 和 redo log
轉載自:http://doc.okbase.net/xinysu/archive/259593.html 1 undo 1.1 undo是啥 undo日誌用於存放資料修改被修改前的值,假設修改 tba 表中 id=2的行資料,把Name='B' 修改為Name = 'B2' ,那麼u
Standby Redo Log 的設定原則、建立、刪除、檢視、歸檔位置
設定: 1.每個standby redo log file 至少要和primary database的redo log 一樣大,為了方便管理,Oracle 建議主備庫的redo log 設定成一樣的大小。 SQL> SELECT GROUP#, BYTES/102
詳細分析MySQL事務日誌(redo log和undo log)
innodb事務日誌包括redo log和undo log。redo log是重做日誌,提供前滾操作.undo log是回滾日誌,提供回滾操作。undo log和redo log都算是用來恢復的日誌:1.redo log通常是物理日誌,記錄的是資料頁的物理修改,而不是某一行或
bin log、redo log、undo log和MVVC
cond 存在 mvc 一個 -c 能夠 開始 elastic 復制。 logs innodb事務日誌包括redo log和undo log。redo log是重做日誌,提供前滾操作,undo log是回滾日誌,提供回滾操作。 undo log不是redo log的逆向過程
MySQL 日誌系統之 redo log 和 binlog
之前我們瞭解了一條查詢語句的執行流程,並介紹了執行過程中涉及的處理模組。一條查詢語句的執行過程一般是經過聯結器、分析器、優化器、執行器等功能模組,最後到達儲存引擎。 那麼,一條 SQL 更新語句的執行流程又是怎樣的呢? 首先我們建立一個表 user_info,主鍵為 id,建立語句如下: CREATE TAB
深入理解MySQL系列之redo log、undo log和binlog
#### 事務的實現 redo log保證事務的永續性,undo log用來幫助事務回滾及MVCC的功能。 #### InnoDB儲存引擎體系結構 ![](https://img2020.cnblogs.com/blog/2211828/202012/2211828-20201222093735507-1
基於Redo Log和Undo Log的MySQL崩潰恢復流程
在之前的文章「簡單瞭解InnoDB底層原理」聊了一下MySQL的Buffer Pool。這裡再簡單提一嘴,Buffer Pool是MySQL記憶體結構中十分核心的一個組成,你可以先把它想象成一個黑盒子。 黑盒下的更新資料流程 當我們查詢資料的時候,會先去Buffer Pool中查詢。如果Buffer Pool
DataGuard之Apply Services(redo應用和SQL應用)
令行 應用 tar 同步 官方 blocks ron strong 其他 應用服務 Apply Services 根據oracle官方文檔整理 http://docs.oracle.com/cd/E11882_01/server.112/e25608/log_apply.h
dataguard中的standby redo 日誌組數及新增的兩種方法
搭建dg需要建立standby redo,怎麼知道應該建多少組standby redo 查詢oracle官方文件 如果主庫是單機,備庫是單機 主庫online redo有n組,那麼備庫standby
RF合並多個output文件,並生成新的log和report文件
結果 png 多個 路徑 行合並 保存 rep out ron 合並兩個output文件並生成新的log和report文件命令: rebot -d 合並生成的log和report文件保存路徑 第1個output文件 第2個output文件 通過執行套件層.txt將結
二維碼帶log和直接跳到你想要的頁面
() else tac color eat cal graphic ica flag package com.example.myapplication6;import android.graphics.Bitmap;import android.graphics.Bitm
R的.Rhistory檔案和Stata的log檔案隨筆
JWen 參考資料 Introduction_to_Scientific_Programming_and_Simulation_Using_R 對於R的作業應該收什麼檔案,第一念頭想到“不就是.R檔案嘛”。通常程式有三個部分:輸入、計算、輸出(有些可能會加入第四部分:程式說明)。.R檔案
在Unity中“Debug.Log”和“Print”兩種列印方式的區別
先寫個指令碼“PrintAndDebug”,掛在Main Camera 元件上,在指令碼的 Start 函式裡通過這兩種方式列印一段內容 然後執行u3d,看控制檯列印日誌,如下圖 在這裡可以明瞭的看到Debug.Log是直接打印出來的 而Print是繼承自MonoBehaviour的,
【Android】adb抓取不同分類Log(kernel、radio、event、main)和獲取ANR log
Log分類 Android日誌主要分為kernel、radio、event、main這四種log。 Kernel Log kernel log屬於Linux核心的log ,可以通過讀取/proc/kmsg或者通過串列埠來抓取。 adb 抓取ke
修改SVN提交記錄中的log message
最近在提交svn有一次log message中打錯了兩個字,所以想去把那次提交的log message修改下,在工作目錄下空白處右鍵TortoiseSVN -> show log -> 選中需要修改的那次提交 -> 右鍵edit log message,整套操作如絲般順滑,
js中console.log()和console.dir()的區別
方法 ole 屬性和方法 stp dir() left 屬性 pan -i console.log(),會在瀏覽器控制臺打印信息 console.dir()可以顯示一個對象的所有屬性和方法(詳細打印,利於分析對象) js中console.log()和consol