oracle監控表空間,JOB,rman備份
1,表空間監控
begin
sys.dbms_job.submit(job => :job,
what => 'begin
for v in
(select aa.tablespace_name a1,aa.megs_alloc a2, aa.megs_free a3,aa.megs_used a4,aa.pct_free a5,aa.pct_used a6,aa.max a7 from
(select a.tablespace_name,
round(a.bytes_alloc / 1024 / 1024, 2) megs_alloc,
round(nvl(b.bytes_free, 0) / 1024 / 1024, 2) megs_free,
round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2) megs_used,
round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2) Pct_Free,
100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2) Pct_used,
round(maxbytes/1048576,2) Max
from ( select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, ''YES'',f.maxbytes,''NO'', f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
( select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name (+)and a.tablespace_name not in (''SYSTEM'',''SYSAUX'',''EXAMPLE'',
''USERS'',''UNDOTBS1'',''TEMP'' )
union all
select h.tablespace_name,
round(sum(h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
round(sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / 1048576, 2) megs_free,
round(sum(nvl(p.bytes_used, 0))/ 1048576, 2) megs_used,
round((sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / sum(h.bytes_used + h.bytes_free)) * 100,2) Pct_Free,
100 - round((sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / sum(h.bytes_used + h.bytes_free)) * 100,2) pct_used,
round(f.maxbytes / 1048576, 2) max
from sys.v_$TEMP_SPACE_HEADER h, sys.v_$Temp_extent_pool p, dba_temp_files f
where p.file_id(+) = h.file_id
and p.tablespace_name(+) = h.tablespace_name
and f.file_id = h.file_id
and f.tablespace_name = h.tablespace_name
and h.tablespace_name not in (''SYSTEM'',''SYSAUX'',''EXAMPLE'',
''USERS'',''UNDOTBS1'',''TEMP'' )
group by h.tablespace_name, f.maxbytes
ORDER BY 1) aa) loop
insert into checktablespace_66@check_link(tablespace_name,megs_alloc,megs_free,megs_used,pct_free,pct_used,max)
values(v.a1,v.a2,v.a3,v.a4,v.a5,v.a6,v.a7);
end loop;
end;',
next_date => to_date('19-03-2013 08:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate) + 1 + 8/24');
commit;
end;
/
2,JOB 監控
begin
sys.dbms_job.submit(job => :job,
what => 'insert into oscheck.check_job_1@check_link
select ''10.182.15.66'' as host, job,log_user,last_date,next_date,total_time,broken,interval,failures, what,sysdate as record_date
from dba_jobs where schema_user not in
(''SYSTEM'',
''SYS'',
''OUTLN'',
''DIP'',
''TSMSYS'',
''DBSNMP'',
''WMSYS '',
''EXFSYS'',
''DMSYS '',
''CTXSYS'',
''XDB'',
''ANONYMOUS'',
''ORDPLUGINS'',
''SI_INFORMTN_SCHEMA'',
''ORDSYS'',
''MDSYS'',
''OLAPSYS'',
''MDDATA'',
''SYSMAN'',
''MGMT_VIEW'',
''SCOTT'');',
next_date => to_date('18-03-2013 17:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate,''HH'')+1/24');
commit;
end;
begin
sys.dbms_job.submit(job => :job,
what => 'begin
for v in
(select aa.tablespace_name a1,aa.megs_alloc a2, aa.megs_free a3,aa.megs_used a4,aa.pct_free a5,aa.pct_used a6,aa.max a7 from
(select a.tablespace_name,
round(a.bytes_alloc / 1024 / 1024, 2) megs_alloc,
round(nvl(b.bytes_free, 0) / 1024 / 1024, 2) megs_free,
round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2) megs_used,
round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2) Pct_Free,
100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2) Pct_used,
round(maxbytes/1048576,2) Max
from ( select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, ''YES'',f.maxbytes,''NO'', f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
( select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name (+)and a.tablespace_name not in (''SYSTEM'',''SYSAUX'',''EXAMPLE'',
''USERS'',''UNDOTBS1'',''TEMP'' )
union all
select h.tablespace_name,
round(sum(h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
round(sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / 1048576, 2) megs_free,
round(sum(nvl(p.bytes_used, 0))/ 1048576, 2) megs_used,
round((sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / sum(h.bytes_used + h.bytes_free)) * 100,2) Pct_Free,
100 - round((sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)) / sum(h.bytes_used + h.bytes_free)) * 100,2) pct_used,
round(f.maxbytes / 1048576, 2) max
from sys.v_$TEMP_SPACE_HEADER h, sys.v_$Temp_extent_pool p, dba_temp_files f
where p.file_id(+) = h.file_id
and p.tablespace_name(+) = h.tablespace_name
and f.file_id = h.file_id
and f.tablespace_name = h.tablespace_name
and h.tablespace_name not in (''SYSTEM'',''SYSAUX'',''EXAMPLE'',
''USERS'',''UNDOTBS1'',''TEMP'' )
group by h.tablespace_name, f.maxbytes
ORDER BY 1) aa) loop
insert into checktablespace_66@check_link(tablespace_name,megs_alloc,megs_free,megs_used,pct_free,pct_used,max)
values(v.a1,v.a2,v.a3,v.a4,v.a5,v.a6,v.a7);
end loop;
end;',
next_date => to_date('19-03-2013 08:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate) + 1 + 8/24');
commit;
end;
/
2,JOB 監控
begin
sys.dbms_job.submit(job => :job,
what => 'insert into oscheck.check_job_1@check_link
select ''10.182.15.66'' as host, job,log_user,last_date,next_date,total_time,broken,interval,failures, what,sysdate as record_date
from dba_jobs where schema_user not in
(''SYSTEM'',
''SYS'',
''OUTLN'',
''DIP'',
''TSMSYS'',
''DBSNMP'',
''WMSYS '',
''EXFSYS'',
''DMSYS '',
''CTXSYS'',
''XDB'',
''ANONYMOUS'',
''ORDPLUGINS'',
''SI_INFORMTN_SCHEMA'',
''ORDSYS'',
''MDSYS'',
''OLAPSYS'',
''MDDATA'',
''SYSMAN'',
''MGMT_VIEW'',
''SCOTT'');',
next_date => to_date('18-03-2013 17:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate,''HH'')+1/24');
commit;
end;
3,備份監控
begin
sys.dbms_job.submit(job => :job,
what => 'begin
for v in (select a.SESSION_RECID a1,a.row_type,a.operation a2,a.status a3,a.start_time a4,a.end_time a5,
round(a.OUTPUT_BYTES / 1024 / 1024, 2) output_bytes from v$rman_status a
where trunc(start_time, ''DD'') = trunc(sysdate - 1, ''DD'')
and peration=''BACKUP''order by start_time ) loop
insert into checkbackup_66_1@check_link(operation,status,start_time,end_time,datasize)
values(v.a2,v.a3,v.a4,v.a5,v.output_bytes);
end loop;
end;',
next_date => to_date('19-03-2013 06:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate) +1 +6/(24)');
commit;
end;
/
begin
sys.dbms_job.submit(job => :job,
what => 'begin
for v in (select a.SESSION_RECID a1,a.row_type,a.operation a2,a.status a3,a.start_time a4,a.end_time a5,
round(a.OUTPUT_BYTES / 1024 / 1024, 2) output_bytes from v$rman_status a
where trunc(start_time, ''DD'') = trunc(sysdate - 1, ''DD'')
and peration=''BACKUP''order by start_time ) loop
insert into checkbackup_66_1@check_link(operation,status,start_time,end_time,datasize)
values(v.a2,v.a3,v.a4,v.a5,v.output_bytes);
end loop;
end;',
next_date => to_date('19-03-2013 06:00:00', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'trunc(sysdate) +1 +6/(24)');
commit;
end;
/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15187685/viewspace-756406/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle表空間增加監控Oracle
- RMAN說,我能備份(3)--RMAN全庫備份和表空間備份
- oracle rman備份驗證和備份進度監控Oracle
- 監控oracle表空間指令碼Oracle指令碼
- 實戰RMAN備份傳輸表空間
- Oracle RMAN備份為什麼會大量使用temp表空間?Oracle
- 透過rman備份system系統表空間
- oracle rman備份驗證和備份/恢復進度監控Oracle
- Oracle 12C RMAN備份佔用大量臨時表空間Oracle
- 被動式監控oracle的rman備份情況Oracle
- 非系統表空間損壞,rman備份恢復
- 監控和管理Oracle UNDO表空間的使用Oracle
- 使用Oracle可傳輸表空間的特性複製資料(7)實戰RMAN備份傳輸表空間Oracle
- Oracle RMAN 表空間恢復Oracle
- Oracle 傳輸表空間-RmanOracle
- 如何用rman 不備份只讀表空間的資料
- 表空間監控(三)tablespace detailAI
- 多臺ORACLE資料庫表空間監控方案Oracle資料庫
- [原創] 利用Oracle metric(threshold)監控表空間Oracle
- WINDOWS 環境下 監控ORACLE臨時表空間WindowsOracle
- 利用Oracle threshold(度量閥值)監控表空間Oracle
- Rman增量壓縮備份來解決備份空間不足
- Oracle rman 備份與恢復 臨時表空間的檔案問題解決Oracle
- oracle空間使用監控指令碼Oracle指令碼
- RMAN使用備份傳輸表空間的各種自定義操作
- 表空間監控(二)datafile size detailAI
- MySQL 遷移表空間,備份單表MySql
- Oracle 11g RMAN恢復-只讀表空間的恢復(備份是在表空間只讀狀態下做的)Oracle
- Oracle RMAN 表空間的完全恢復Oracle
- 區別oracle 9i 與 oracle 10g 備份表空間Oracle 10g
- Oracle12c多租戶資料庫備份與恢復 - 備份表空間Oracle資料庫
- oracle之rman備份Oracle
- Oracle RMAN 增量備份Oracle
- oracle rman備份命令Oracle
- 【轉】Oracle rman備份Oracle
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份表空間和資料檔案GUIIDE資料庫
- RMAN遷移表空間
- 一次磁碟空間緊缺的RMAN備份策略