ORACLE RAC日常运维-调整RAC+DG环境redo大小

ORACLE RAC日常运维-调整RAC+DG环境redo大小

原创 Oracle  作者:chenoracle  时间:2018-03-27 13:33:16  2043  0
摘要

ORACLE RAC+DG调整redo大小由于数据库还没有正式上生产,数据量很小,本案例先调整RAC主库Redo,主库调整完成后重建dg备库;一:调整redo log file(1) 创建临时日志组,5,6,7,8;(2) 切换当前日志组到新建的临时日志组;(3) 删除原日志组1,2,3,4;(4) 创建新日志组1,2,3,4,同时调大redo大小;(5) 切换当前日志组到...

ORACLE RAC日常运维-调整RAC+DG环境redo大小


由于数据库还没有正式上生产,数据量很小,本案例先调整RAC主库Redo,主库调整完成后重建dg备库;

一:调整redo log file
(1) 创建临时日志组,5,6,7,8;
(2) 切换当前日志组到新建的临时日志组;
(3) 删除原日志组1,2,3,4;
(4) 创建新日志组1,2,3,4,同时调大redo大小;
(5) 切换当前日志组到新建的日志组;
(6) 删除临时日志组,5,6,7,8;

二:调整standby log file 
(1)停止备库实例;
(2)删除原standby log file日志组;
(3)创建新日志组,同时调大redo大小;

三:重创建standby备库
(1)删除备库数据文件,日志文件,控制文件等;
(2)重建standby备库

四:校验主、备库数据是同步
五:常见问题

一:调整redo log file 
查看主库online redo信息。
select a.members,
       a.thread#,
       a.status,
       a.bytes / 1024 / 1024,
       b.type,
       b.member,
       b.group#
  from v$log a, v$logfile b
 where a.group# = b.group#;

(1) 创建临时日志组,5,6,7,8;
alter database add logfile thread 1 group 5 ('+DATA/ncdb/onlinelog/redo05a.log','+FRA/ncdb/onlinelog/redo05b.log') size 100M; 
alter database add logfile thread 1 group 6 ('+DATA/ncdb/onlinelog/redo06a.log','+FRA/ncdb/onlinelog/redo06b.log') size 100M; 
alter database add logfile thread 2 group 7 ('+DATA/ncdb/onlinelog/redo07a.log','+FRA/ncdb/onlinelog/redo07b.log') size 100M; 
alter database add logfile thread 2 group 8 ('+DATA/ncdb/onlinelog/redo08a.log','+FRA/ncdb/onlinelog/redo08b.log') size 100M; 

(2) 切换当前日志组到新建的临时日志组;
alter system switch logfile; ---切换当前日志组
alter system checkpoint;  ---将ACTIVE切换到INACTIVE

(3) 删除原日志组1,2,3,4;
alter database drop logfile group 1; 
alter database drop logfile group 2; 
alter database drop logfile group 3; 
alter database drop logfile group 4; 

(4) 创建新日志组1,2,3,4,同时调大redo大小;
alter database add logfile thread 1 group 1 ('+DATA/ncdb/onlinelog/redo01a.log','+FRA/ncdb/onlinelog/redo01b.log') size 100M; 
alter database add logfile thread 1 group 2 ('+DATA/ncdb/onlinelog/redo02a.log','+FRA/ncdb/onlinelog/redo02b.log') size 100M; 
alter database add logfile thread 2 group 3 ('+DATA/ncdb/onlinelog/redo03a.log','+FRA/ncdb/onlinelog/redo03b.log') size 100M; 
alter database add logfile thread 2 group 4 ('+DATA/ncdb/onlinelog/redo04a.log','+FRA/ncdb/onlinelog/redo04b.log') size 100M; 

(5) 切换当前日志组到新建的日志组;
alter system switch logfile; ---切换当前日志组
alter system checkpoint;  ---将ACTIVE切换到INACTIVE

(6) 删除临时日志组,5,6,7,8;
alter database drop logfile group 5; 
alter database drop logfile group 6; 
alter database drop logfile group 7; 
alter database drop logfile group 8; 

二:调整standby log file 
查看standby log file信息
select a.member,
       a.thread#,
       a.status,
       b.bytes / 1024 / 1024,
       b.group#,
       b.used / 1024 / 1024,
       b.status
  from v$logfile a, v$standby_log b
 where a.group# = b.group#;

(1)停止备库实例;
(2)删除原standby log file日志组; 
alter database drop standby logfile group 11; 
alter database drop standby logfile group 12; 
alter database drop standby logfile group 13; 
alter database drop standby logfile group 14; 
alter database drop standby logfile group 15; 
alter database drop standby logfile group 16; 
alter database drop standby logfile group 17; 
alter database drop standby logfile group 18; 
alter database drop standby logfile group 19; 
alter database drop standby logfile group 20; 

(3)创建新日志组,同时调大redo大小;
alter database add standby logfile thread 1 group 11 '+DATA/ncdb/onlinelog/standby_redo11.log' size 100m;
alter database add standby logfile thread 1 group 12 '+DATA/ncdb/onlinelog/standby_redo12.log' size 100m;
alter database add standby logfile thread 1 group 13 '+DATA/ncdb/onlinelog/standby_redo13.log' size 100m;
alter database add standby logfile thread 1 group 14 '+DATA/ncdb/onlinelog/standby_redo14.log' size 100m;
alter database add standby logfile thread 1 group 15 '+DATA/ncdb/onlinelog/standby_redo15.log' size 100m;
alter database add standby logfile thread 2 group 16 '+DATA/ncdb/onlinelog/standby_redo16.log' size 100m;
alter database add standby logfile thread 2 group 17 '+DATA/ncdb/onlinelog/standby_redo17.log' size 100m;
alter database add standby logfile thread 2 group 18 '+DATA/ncdb/onlinelog/standby_redo18.log' size 100m;
alter database add standby logfile thread 2 group 19 '+DATA/ncdb/onlinelog/standby_redo19.log' size 100m;
alter database add standby logfile thread 2 group 20 '+DATA/ncdb/onlinelog/standby_redo20.log' size 100m;

三:重创建standby备库
(1)删除备库数据文件,日志文件,控制文件等;
(2)重建standby备库
[oracle@rac1 ~]$ rman target / auxiliary sys/oracle@standby
RMAN> duplicate target database for standby from active database dorecover;

四:校验主、备库数据是同步
---启动备库
SQL> alter database open;
---启动mgr
SQL> alter database recover managed standby database disconnect from session;
---启动实时应用
SQL> recover managed standby database cancel;
SQL> recover managed standby database using current logfile disconnect from session;

---主库rac1创建测试数据
create tablespace test datafile '+DATA/ncdb/datafile/test01.dbf' size 10M;
create user test identified by a default tablespace test;
grant connect,resource,dba to test;
create table test.t1 as select level as id from dual connect by level <=10;

---主库rac1,rac2,备库standby查看数据是否同步;
select * from test.t1;


五:常见问题
如果不采样重建备库的方式,直接在备库添加或删除日志组可能会遇到如下问题:

(1) ORA-01156:进行中的恢复或闪回可能需要访问文件
alter database recover managed standby database cancel;

(2) ORA-01275:自动进行备用文件管理时,不允许进行ADD LOGFILE操作
alter system set standby_file_management=manual;

(3) ORA-01624, ORA-00312:
alter database clear logfile group xxx;
alter database drop logfile group xxx;

posted @ 2021-08-28 11:59  耀阳居士  阅读(576)  评论(0编辑  收藏  举报