oracle log optimization

 

SELECT * FROM v$archived_log ;

SELECT * FROM v$log ;

SELECT * FROM v$logfile ;

 

Query the switching frequency of redolong:

method 1:

select b.SEQUENCE#, b.FIRST_TIME,a.SEQUENCE#,a.FIRST_TIME,round(((a.FIRST_TIME-b.FIRST_TIME)*24)*60,2) from v$log_history a, v$log_history b where a.SEQUENCE#=b.SEQUENCE#+1 and b.THREAD#=1 order by a.SEQUENCE# desc;

 

Method 2:

select sequence#,first_time,nexttime,round(((first_time-nexttime)*24)*60,2) diff from (select sequence#,first_time,lag(first_time) over(order by sequence#) nexttime from v$log_history where thread#=1) order by sequence# desc;

 

If the switching frequency is too high (it is recommended to switch every 15~20 minutes), the size of the logfile should be enlarged:

1. Execute SELECT * FROM v$logfile ; view the existing logfile information

 
  

2. Create a new log group file that you need to create according to the maximum value of the existing group#

 

ALTER DATABASE ADD logfile GROUP 12 '/opt/oracle/oradata/orcl/redo12.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 13 '/opt/oracle/oradata/orcl/redo13.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 14 '/opt/oracle/oradata/orcl/redo14.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 15 '/opt/oracle/oradata/orcl/redo15.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 16 '/opt/oracle/oradata/orcl/redo16.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 17 '/opt/oracle/oradata/orcl/redo17.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 18 '/opt/oracle/oradata/orcl/redo18.log' SIZE 5120m ;

ALTER DATABASE ADD logfile GROUP 19 '/opt/oracle/oradata/orcl/redo19.log' SIZE 5120m ;

 ALTER DATABASE ADD logfile GROUP 20 '/opt/oracle/oradata/orcl/redo20.log' SIZE 5120m ;

Execute SELECT * FROM v$logfile ; confirm whether the new creation is successful:



 

 

 3. Delete the current logfile

Execute SELECT * FROM v$log before delete; confirm log status; is INACTIVE.



 

ALTER database DROP logfile group 8;

ALTER database DROP logfile group 9;

ALTER database DROP logfile group 10;

ALTER database DROP logfile group 11;

 

 Fourth, switch the current log

ALTER system switch logfile ;

alter system checkpoint;

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326222349&siteId=291194637