ORACLE 手動創建或刪除snapshot

原文鏈接:https://blog.csdn.net/gaobudong1234/article/details/73771104

原文鏈接:https://blog.csdn.net/gaobudong1234/article/details/73771104
--如果需要的話DBA可以通過DBMS_WORKLOAD_REPOSITORY過程手動創建、刪除或修改snapshots.
調用DBMS_WORKLOAD_REPOSITORY包需要擁有DBA權限。
--1.手動創建Snapshots 手動創建Snapshots通過DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT過程
--例如
exec dbms_workload_repository.create_snapshot();


-- 然後可以通過 DBA_HIST_SNAPSHOT 視圖查看剛剛創建的Snapshots信息。
SELECT * FROM DBA_HIST_SNAPSHOT;


-- 2手動刪除Snapshots
--刪除Snapshots是使用DBMS_WORKLOAD_REPOSITORY包的另一個過程DROP_SNAPSHOT_RANGE 該過程在執行時可以通過指定snap_id的範圍的方式一次刪除多個Snapshot
--例如
select count(0) from dba_hist_snapshot where snap_id between 6770 and 6774;


select max(snap_id) from dba_hist_snapshot;
select dbid from v$database;
exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 6770,high_snap_id => 6774,dbid => 4059638244);
--或者
begin
dbms_workload_repository.drop_snapshot_range(
low_snap_id => 6770,
high_snap_id => 6774,
dbid => 4059638244);
end;


select count(0) from dba_hist_snapshot where snap_id between 6770 and 6774;
————————————————
版權聲明:本文爲CSDN博主「小學生湯米」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/gaobudong1234/article/details/73771104

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章