Skip to content

Commit 86f7ab7

Browse files
authored
[b/352469041] Add dtl-index-type, update other SQLs with a snapshot time range (#465)
- add dtl-index-type - limit the time range of snapshot to last 30 days
1 parent fd870f5 commit 86f7ab7

File tree

8 files changed

+59
-0
lines changed

8 files changed

+59
-0
lines changed

dumper/app/src/main/java/com/google/edwmigration/dumper/application/dumper/connector/oracle/StatsTaskListGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ class StatsTaskListGenerator {
4141
ImmutableList.of(
4242
"data-types",
4343
"db-features",
44+
"db-info",
4445
"db-instances",
4546
"db-objects",
4647
// The version of db-objects that gets SYNONYM objects, for which owner is PUBLIC.
4748
// A JOIN is performed to exclude objects which appear in the cdb_synonyms table.
4849
"db-objects-synonym-public",
50+
"dtl-index-type",
4951
"dtl-source-code",
5052
"exttab",
5153
"m-view-types",

dumper/app/src/main/resources/oracle-stats/awr/hist-cmd-types-awr.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ INNER JOIN cdb_hist_snapshot C
3737
ON A.snap_id = C.snap_id
3838
AND A.dbid = C.dbid
3939
AND A.instance_number = C.instance_number
40+
AND B.end_interval_time > sysdate - 30
4041
LEFT JOIN audit_actions D
4142
ON B.command_type = D.action
4243
GROUP BY

dumper/app/src/main/resources/oracle-stats/awr/source-conn-latest.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ INNER JOIN cdb_hist_snapshot B
2727
AND A.instance_number = B.instance_number
2828
AND A.dbid = B.dbid
2929
AND A.session_type = 'FOREGROUND'
30+
AND B.end_interval_time > sysdate - 30
3031
INNER JOIN v$sqlcommand C
3132
ON A.sql_opcode = C.command_type
3233
GROUP BY

dumper/app/src/main/resources/oracle-stats/awr/sql-stats-awr.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ JOIN cdb_hist_snapshot B
4242
ON A.dbid = B.dbid
4343
AND A.instance_number = B.instance_number
4444
AND A.snap_id = B.snap_id
45+
AND B.end_interval_time > sysdate - 30
4546
GROUP BY
4647
A.con_id,
4748
A.dbid,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Copyright 2022-2024 Google LLC
2+
-- Copyright 2013-2021 CompilerWorks
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- http://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
SELECT
16+
A.dbid "DbId",
17+
A.name "Name",
18+
A.db_unique_name "DbUniqueName",
19+
A.con_id "ConId",
20+
A.con_dbid "ConDbId",
21+
A.cdb "Cdb",
22+
A.database_role "DatabaseRole"
23+
FROM v$database A
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- Copyright 2022-2024 Google LLC
2+
-- Copyright 2013-2021 CompilerWorks
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- http://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
SELECT
16+
A.con_id "ConId",
17+
A.owner "Owner",
18+
A.index_type "IndexType",
19+
A.uniqueness "Uniqueness",
20+
A.compression "Compression",
21+
A.partitioned "Partitioned",
22+
A.temporary "Temporary",
23+
A.secondary "Secondary",
24+
A.join_index "JoinIndex",
25+
CASE WHEN A.ityp_owner IS NOT NULL THEN 'Y' ELSE 'N' END "CustomIndexType",
26+
A.table_name "TableName",
27+
A.index_name "IndexName"
28+
FROM cdb_indexes A
29+
WHERE A.owner NOT LIKE '%SYS'

dumper/app/src/main/resources/oracle-stats/statspack/hist-cmd-types-statspack.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ INNER JOIN stats$snapshot C
4040
ON A.dbid = C.dbid
4141
AND A.snap_id = C.snap_id
4242
AND A.instance_number = C.instance_number
43+
AND C.snap_time > sysdate - 30
4344
GROUP BY
4445
A.dbid,
4546
A.instance_number,

dumper/app/src/main/resources/oracle-stats/statspack/sql-stats-statspack.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ INNER JOIN stats$sql_summary B
3838
ON A.dbid = B.dbid
3939
AND A.snap_id = B.snap_id
4040
AND A.instance_number = B.instance_number
41+
AND A.end_interval_time > sysdate - 30
4142
GROUP BY
4243
A.dbid,
4344
A.instance_number,

0 commit comments

Comments
 (0)