-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtable_mods_on_proc_user.sql
60 lines (52 loc) · 1.35 KB
/
table_mods_on_proc_user.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
REM
REM Script: table_mods_on_proc_user.sql
REM Author: Quanwen Zhao
REM Dated: May 14, 2018
REM
REM Purpose:
REM This sql script usually views information of modifications for username and tablename (or only username)
REM which need to input manually as the parameter of substitution variable on SQL*Plus. These modifications
REM columns include "table_name", "inserts", "updates", "deletes", "timestamp", "truncated" and "drop_segments".
REM
SET VERIFY OFF
SET FEEDBACK OFF
SET LINESIZE 300
SET PAGESIZE 300
COLUMN table_owner FORMAT a20
COLUMN table_name FORMAT a25
COLUMN truncated FORMAT a5
SELECT table_owner
, table_name
, inserts
, updates
, deletes
, timestamp
, truncated
, drop_segments
FROM dba_tab_modifications
WHERE table_owner = UPPER('&username')
AND ( table_name = UPPER('&tablename')
AND table_name NOT LIKE 'BIN$%'
)
ORDER BY timestamp DESC
, table_owner
, table_name
;
PROMPT
SELECT table_owner
, table_name
, inserts
, updates
, deletes
, timestamp
, truncated
, drop_segments
FROM dba_tab_modifications
WHERE table_owner = UPPER('&username')
AND table_name NOT LIKE 'BIN$%'
ORDER BY timestamp DESC
, table_name
;
PROMPT
SET VERIFY ON
SET FEEDBACK ON