variable p_Start_Snap_ID number
variable p_End_Snap_ID number
alter session set nls_date_format = 'dd/mm/yyyy hh24:mi'
/
alter session set nls_timestamp_format = 'dd/mm/yyyy hh24:mi'
/
col Begin_interval_time format a20
col End_interval_time format a20
set linesize 400
set pagesize 4000
select Snap_ID, Instance_Number, begin_interval_time, end_interval_time
from (
select snap_id
,Instance_Number
,begin_interval_time
,end_interval_time
from dba_hist_snapshot
order by snap_id desc
)
where rownum < &&Rownum_Limit
/
prompt Get Start and End snapshot ID
begin
-- One must use an anonymous block when setting a Bind Variable
select min(Snap_ID)
,max (Snap_ID)
into :p_Start_Snap_ID
,:p_End_Snap_ID
from
(select snap_id
,Instance_Number
,begin_interval_time
,end_interval_time
from dba_hist_snapshot
order by snap_id desc)
where rownum < &&Rownum_Limit;
end;
/
I use this blog as a dumping ground for various scripts as well as solutions to Maths problems.
Labels
- Alter (2)
- Analytic functions (2)
- AQ (2)
- AWR (4)
- Collections (2)
- Connect By (2)
- Constraints (7)
- Date/Time calculations (3)
- Dynamic SQL (4)
- Explain Plan (1)
- Formatting (3)
- Functions (1)
- Generating Functions (1)
- Indexes (7)
- Insert (3)
- JMS (3)
- Joins (4)
- LOB (3)
- locking (5)
- Partitions (3)
- Performance (10)
- Security (1)
- SQL Plus (3)
- Tabibitosan (1)
- Triggers (1)
- Views (1)
- XML (4)
Script categories
- Performance (10)
- Constraints (7)
- Indexes (7)
- locking (5)
- AWR (4)
- Dynamic SQL (4)
- Joins (4)
- XML (4)
- Date/Time calculations (3)
- Formatting (3)
- Insert (3)
- JMS (3)
- LOB (3)
- Partitions (3)
- SQL Plus (3)
- AQ (2)
- Analytic functions (2)
- Collections (2)
- Connect By (2)
- Explain Plan (1)
- Functions (1)
- Security (1)
- Triggers (1)
- Views (1)
Friday, 4 November 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment