每套⽣产数据库都有其⾃⼰业务的节奏,系统产⽣的归档量⼤⼩⼀定程度反映了系统的繁忙程度。由于存在以下因素,要求我们必须准确 的评估系统的归档⽇志⼤⼩:
1)预估存放归档⽇志的空间⼤⼩时。归档空间的⼤⼩必须能够存放⼀定时间间隔的归档量。
2)预估备份恢复需要的时间时。归档⽇志量的⼤⼩决定着恢复的时间。
3)搭建Golden Gate,Dataguard,Stream时。归档量的⼤⼩决定着传输归档⽇志的⽹络带宽和备库的⽇志应⽤的速度。 以下为估算系统每秒产⽣的⽇志量和每天产⽣的⽇志量的脚本:
DECLARE
ac NUMBER;
sec_redo NUMBER;
day_redo NUMBER;
sec_redo_90 NUMBER;
day_redo_90 NUMBER;
str VARCHAR2(100);
BEGIN
SELECT COUNT(*) INTO ac FROM v$database WHERE log_mode = 'NOARCHIVELOG';
IF ac = 1 THEN
dbms_output.put_line('The database is running on NOARCHIVELOG mode,No archivelog!');
ELSE
str := '';
FOR i IN (SELECT destination
FROM v$archive_dest
WHERE status = 'VALID'
AND destination IS NOT NULL) LOOP
str := str || ',' || i.destination;
END LOOP;
dbms_output.put_line('Archive dest is ' || substr(str, 2));
SELECT trunc(SUM((blocks * block_size) / 1024) /
((MAX(first_time) - MIN(first_time)) * 24 * 3600)),
trunc(SUM((blocks * block_size) / 1024 / 1024) /
((MAX(first_time) - MIN(first_time))))
INTO sec_redo, day_redo
FROM v$archived_log;
dbms_output.put_line('每秒产⽣⽇志的频率: ' || sec_redo || ' (KB)');
dbms_output.put_line('每天产⽣⽇志的频率:' || day_redo || '(MB)');
dbms_output.put_line('最近3个⽉统计数据:');
SELECT trunc(SUM((blocks * block_size) / 1024) /
((MAX(first_time) - MIN(first_time)) * 24 * 3600)),
trunc(SUM((blocks * block_size) / 1024 / 1024) /
((MAX(first_time) - MIN(first_time))))
INTO sec_redo_90, day_redo_90
FROM v$archived_log
WHERE first_time > SYSDATE - 91;
dbms_output.put_line('每秒产⽣⽇志的频率: ' || sec_redo_90 || ' (KB)');
dbms_output.put_line('每天产⽣⽇志的频率:' || day_redo_90 || '(MB)');
END IF;
END;
通过以下脚本可以观察归档⽇志的每⽇⽣产量:
SELECT lpad(to_char(first_time, 'yyyymmdd'), 12) "Date", trunc(SUM(blocks * block_size) / 1024 / 1024) "size(M)", COUNT(*)"COUNT"
FROM v$archived_log
WHERE first_time > SYSDATE - 31
GROUP BY lpad(to_char(first_time, 'yyyymmdd'), 12) ORDER BY 1;
通过以下脚本可以观察归档⽇志的每⼩时⽣产量:
SELECT lpad(to_char(first_time, 'hh24'), 4) "Hour", trunc(SUM(blocks * block_size) / 1024 / 1024) "size(M)", COUNT(*)"COUNT"
FROM v$archived_log
WHERE first_time > SYSDATE - 31
GROUP BY lpad(to_char(first_time, 'hh24'), 4) ORDER BY 1;
Copyright © 2002 myarticle.com.cn |
备案号:浙ICP备17002154号-3 Powered by: MyArticle Version 1.0dev
|