oracle 在线修改online redo logfiles size 大小

oracle 在线修改online redo logfiles size 大小

[javascript] view plain copy
  1.    
  2.  在线修改online redo logfiles size 大小  
  3.   
  4. oracle redolog size 过小有时候会导致性能问题,现在我们在线修改redolog,一般在业务量比较小的时候进行此操作  
  5.   
  6. 1. 首先查看当前的日志组大小,路径名             
  7.                  
  8. [oracle@tora10 ~]$ sqlplus / as sysdba  
  9.   
  10. SQL*Plus: Release 10.2.0.4.0 - Production on Sat Feb 23 17:08:33 2013  
  11.   
  12. SQL> select group#, bytes, status from v$log;   
  13.   
  14.     GROUP#      BYTES STATUS  
  15. ---------- ---------- ----------------  
  16.          1  524288000 INACTIVE  
  17.          2  524288000 CURRENT  
  18.          3  524288000 INACTIVE  
  19.            
  20.     当前的日志组大小是 512MB 文件系统,每个组成员只有1个member                                
  21.                                     
  22.    SQL> select group#, member from v$logfile;                                      
  23.                                                          
  24.     GROUP# MEMBER  
  25. ---------- ----------------------------------------  
  26.          1 /opt/oracle/oradata/test/redo01.log  
  27.          2 /opt/oracle/oradata/test/redo02.log  
  28.          3 /opt/oracle/oradata/test/redo03.log                                   
  29.                                                                  
  30.                                                                   
  31. 2. 现在创建新的redolog group 4, 5, and 6 每个log大小为1024MB                            
  32.                               
  33.    SQL> alter database add logfile group 4                                
  34.            '/opt/oracle/oradata/test/redo04.log ' size 1024M;                                   
  35.                                    
  36.    SQL> alter database add logfile group 5                                    
  37.            '/opt/oracle/oradata/test/redo05.log ' size 1024M;       
  38.           
  39.    SQL> alter database add logfile group 6            
  40.            '/opt/oracle/oradata/test/redo06.log ' size 1024M;     
  41.           
  42.   
  43. 3. 创建完新的日志组后,查询所有日志组状态:                                     
  44.                                                                            
  45.    SQL> select group#, status from v$log;                                         
  46.   
  47.       GROUP# STATUS  
  48.    --------- ----------------  
  49.            1 INACTIVE  
  50.            2 CURRENT  
  51.            3 INACTIVE              
  52.            4 UNUSED  
  53.            5 UNUSED  
  54.            6 UNUSED           
  55.                          
  56.    当前使用的是group 2 日志组,现在通过“多次”切日志换命令将group 1,2,3状态变为INACTIVE,  
  57. 让oracle使用新建的group4,5,6,然后将小的日志组group 1,2,3删除              
  58.                                 
  59.       
  60.    SQL> alter system switch logfile;            
  61.                                         
  62.    SQL> alter system checkpoint;                                                        
  63.                                                                                                                          
  64. 4.切换完成后,再次查询当前的日志组状态,当前使用的日志组是group 5  
  65.                                                                  
  66.    SQL> select group#, status from v$log;                                         
  67.                                                                            
  68.              
  69.       GROUP# STATUS  
  70.      -------- ------  
  71.          1 INACTIVE  
  72.          2 INACTIVE  
  73.          3 INACTIVE  
  74.          4 INACTIVE  
  75.          5 CURRENT  
  76.          6 INACTIVE  
  77.     当redolog group 1,2,3状态为active时,意味着不能删除当前redo,直至用"alter system switch log file" ,"alter system checkpoint"   
  78. 命令将其切换为“inactive”状态才能将其删除  
  79.                          
  80.                                                     
  81. 5.删除group 1,2,3日志组      
  82.   
  83.    SQL> alter database drop logfile group 1;    
  84.         Database altered.                                    
  85.    SQL> alter database drop logfile group 2;    
  86.         Database altered.                                    
  87.    SQL> alter database drop logfile group 3;    
  88.         Database altered.                                    
  89.                                      
  90.   
  91.    SQL> select group#, bytes, status from v$log;  
  92.   
  93.       GROUP#     BYTES STATUS  
  94.    --------- --------- ----------------  
  95.            4  10485760 CURRENT  
  96.            5  10485760 UNUSED  
  97.            6  10485760 UNUSED              
  98.   
  99.   
  100.      
  101. 6.  整个操作完成后,最好做一个backup  
  102.   
  103. 7.在操作系统层面删除原来的redolog  
  104.       
  105. [oracle@tora10 ~]$ cd /opt/oracle/oradata/test/  
  106. [oracle@tora10 test]$ ll -al redo*  
  107. -rw-r----- 1 oracle oinstall  524288512 Feb 23 17:15 redo01.log  
  108. -rw-r----- 1 oracle oinstall  524288512 Feb 23 17:15 redo02.log  
  109. -rw-r----- 1 oracle oinstall  524288512 Feb 23 17:15 redo03.log  
  110. -rw-r----- 1 oracle oinstall 1073742336 Feb 23 17:16 redo04.log   
  111. -rw-r----- 1 oracle oinstall 1073742336 Feb 23 17:16 redo05.log   
  112. -rw-r----- 1 oracle oinstall 1073742336 Feb 23 17:17 redo06.log   
  113.   
  114. 删除小的redolog  
  115.   
  116. [oracle@tora10 test]$ rm -rf redo01.log   
  117. [oracle@tora10 test]$ rm -rf redo02.log   
  118. [oracle@tora10 test]$ rm -rf redo03.log                                              
  119.                                                     
  120.   
  121. 值得注意的是,加完新的redolog group 后,要监控下alert log 查看新的redolog的切换频率与原来情况相比较 

你可能感兴趣的:(oracle 在线修改online redo logfiles size 大小)