程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> DATAGUARD 添加修改REDOLOG大小,dataguardredolog

DATAGUARD 添加修改REDOLOG大小,dataguardredolog

編輯:Oracle教程

DATAGUARD 添加修改REDOLOG大小,dataguardredolog


DG在線日志組大小修改
環境(單實例,Centos 6.5 X64,oracle 10.2.0.5,filesystem存儲)
REDO ONLINE LOG
select * from v$logfile where type='STANDBY'; #查詢為standby log 三組
STANDBY LOG
select * from v$logfile where type<>'STANDBY'; #查詢ONLINE LOG 為四組

1.備庫standby log 添加
alter database recover managed standby database cancel;#取消APPLIED
alter database add standby logfile group 8 
('/u01/app/oracle/oradata/netdata/st_redo08a.log','/u01/app/oracle/oradata/netdata/st_redo08b.log') size 300M;
alter database add standby logfile group 9 
('/u01/app/oracle/oradata/netdata/st_redo09a.log','/u01/app/oracle/oradata/netdata/st_redo09b.log') size 300M;
alter database add standby logfile group 10 
('/u01/app/oracle/oradata/netdata/st_redo10a.log','/u01/app/oracle/oradata/netdata/st_redo10b.log') size 300M;
alter database add standby logfile group 11 
('/u01/app/oracle/oradata/netdata/st_redo11a.log','/u01/app/oracle/oradata/netdata/st_redo11b.log') size 300M;

2.刪除備庫standby log
alter database drop logfile group 4;
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 7;

如果出現以下錯誤,在主庫上切換一下日志
ERROR at line 1:
ORA-00261: log 4 of thread 1 is being archived or modified
ORA-00312: online log 4 thread 1: '/u01/app/oracle/oradata/netdata/st_redo04b.log'

3.主庫standbylog添加
alter database add standby logfile group 8 
('/u01/app/oracle/oradata/netdata/st_redo08a.log','/u01/app/oracle/oradata/netdata/st_redo08b.log') size 300M;
alter database add standby logfile group 9 
('/u01/app/oracle/oradata/netdata/st_redo09a.log','/u01/app/oracle/oradata/netdata/st_redo09b.log') size 300M;
alter database add standby logfile group 10 
('/u01/app/oracle/oradata/netdata/st_redo10a.log','/u01/app/oracle/oradata/netdata/st_redo10b.log') size 300M;
alter database add standby logfile group 11 
('/u01/app/oracle/oradata/netdata/st_redo11a.log','/u01/app/oracle/oradata/netdata/st_redo11b.log') size 300M;

4.刪除主庫舊的standby log
alter database drop logfile group 4;
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 7;

5.主庫添加新的ONLINE REDO LOG
alter database add standby logfile group 12 
('/u01/app/oracle/oradata/netdata/st_redo12a.log','/u01/app/oracle/oradata/netdata/st_redo12b.log') size 300M;
alter database add standby logfile group 13 
('/u01/app/oracle/oradata/netdata/st_redo13a.log','/u01/app/oracle/oradata/netdata/st_redo13b.log') size 300M;
alter database add standby logfile group 14 
('/u01/app/oracle/oradata/netdata/st_redo14a.log','/u01/app/oracle/oradata/netdata/st_redo14b.log') size 300M;

6.主庫刪除舊的ONLINE REDOLOG
刪除之前切文檔,首先查看是不是ACTIVE或者是INACTIVE
不是INACTIVE 多切幾次歸檔
alter system logfile switch
alter system checkpoint
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;

7.備庫添加新的ONLINE REDO LOG
alter system set standby_file_management='MANUAL';

alter database add standby logfile group 12 
('/u01/app/oracle/oradata/netdata/st_redo12a.log','/u01/app/oracle/oradata/netdata/st_redo12b.log') size 300M;
alter database add standby logfile group 13 
('/u01/app/oracle/oradata/netdata/st_redo13a.log','/u01/app/oracle/oradata/netdata/st_redo13b.log') size 300M;
alter database add standby logfile group 14 
('/u01/app/oracle/oradata/netdata/st_redo14a.log','/u01/app/oracle/oradata/netdata/st_redo14b.log') size 300M;

8.刪除備庫舊的ONLINE REDO LOG
SQL> alter database drop logfile group 1;
alter database drop logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance netdata (thread 1)
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/netdata/redo01.log'

[oracle@oracle10g-dg1-213-100 ~]$ oerr ora 01624
01624, 00000, "log %s needed for crash recovery of instance %s (thread %s)"
// *Cause:  A log cannot be dropped or cleared until the thread's checkpoint
//          has advanced out of the log.
// *Action: If the database is not open, then open it. Crash recovery will
//          advance the checkpoint. If the database is open force a global
//          checkpoint. If the log is corrupted so that the database cannot
//          be opened, it may be necessary to do incomplete recovery until
//          cancel at this log.

嘗試clean logfile
ALTER DATABASE CLEAR LOGFILE GROUP 1
*
ERROR at line 1:
ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/netdata/redo01.log'

[oracle@oracle10g-dg1-213-100 netdata]$ oerr ora 19527
19527, 00000, "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參數未初始化

SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/netdata/','/u01/app/oracle/oradata/netdata/' scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  704643072 bytes
Fixed Size		    2098912 bytes
Variable Size		  184551712 bytes
Database Buffers	  511705088 bytes
Redo Buffers		    6287360 bytes
SQL> alter database mount standby database;

Database altered.

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 1;

Database altered.

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2;

Database altered.

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 3;

Database altered.

SQL> alter database drop logfile group 1;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.


SQL> alter system set standby_file_management='AUTO' scope=both;

System altered.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

 




  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved