Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[b/341297017] Integrate more queries getting general pdb information #395

Merged
merged 5 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package com.google.edwmigration.dumper.application.dumper.connector.oracle;

import static com.google.edwmigration.dumper.application.dumper.connector.oracle.StatsTaskListGenerator.StatsSource.NATIVE;
import static com.google.edwmigration.dumper.application.dumper.connector.oracle.StatsTaskListGenerator.StatsSource.STATSPACK;

import com.google.common.collect.ImmutableList;
import com.google.edwmigration.dumper.application.dumper.ConnectorArguments;
import com.google.edwmigration.dumper.application.dumper.task.Task;
Expand All @@ -30,9 +33,12 @@ class StatsTaskListGenerator {
ImmutableList<Task<?>> createTasks(ConnectorArguments arguments) throws IOException {
ImmutableList<OracleStatsQuery> queries =
ImmutableList.of(
OracleStatsQuery.create("hist-cmd-types", StatsSource.STATSPACK),
OracleStatsQuery.create("app-schemas-pdbs", StatsSource.METADATA),
OracleStatsQuery.create("app-schemas-summary", StatsSource.METADATA)
OracleStatsQuery.create("db-features", NATIVE),
OracleStatsQuery.create("db-instances", NATIVE),
OracleStatsQuery.create("pdbs-info", NATIVE),
OracleStatsQuery.create("app-schemas-pdbs", NATIVE),
OracleStatsQuery.create("app-schemas-summary", NATIVE),
OracleStatsQuery.create("hist-cmd-types", STATSPACK)
// TODO: add entries for other SQLs to this list
);

Expand All @@ -47,7 +53,7 @@ ImmutableList<Task<?>> createTasks(ConnectorArguments arguments) throws IOExcept
/** The source of performance statistics. */
enum StatsSource {
AWR("awr"),
METADATA("metadata"),
NATIVE("native"),
STATSPACK("statspack");

final String value;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- Copyright 2022-2024 Google LLC
-- Copyright 2013-2021 CompilerWorks
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
SELECT
A.dbid "DbId",
A.name "Name",
A.version "Version",
A.detected_usages "DetectedUsages",
A.total_samples "TotalSamples",
A.currently_used "CurrentlyUsed",
A.first_usage_date "FirstUsageDate",
A.last_usage_date "LastUsageDate",
A.aux_count "AuxCount",
A.feature_info "FeatureInfo",
A.last_sample_date "LastSampleDate",
A.last_sample_period "LastSamplePeriod",
A.sample_interval "SampleInterval",
A.description "Description",
A.con_id "ConId"
FROM cdb_feature_usage_statistics A
ORDER BY A.name
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Copyright 2022-2024 Google LLC
-- Copyright 2013-2021 CompilerWorks
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
SELECT
A.inst_id "InstId",
A.instance_number "InstanceNumber",
A.instance_name "InstanceName",
A.host_name "HostName",
A.version "Version",
A.version_legacy "VersionLegacy",
A.version_full "VersionFull",
A.startup_time "StartupTime",
A.status "Status",
A.parallel "Parallel",
A.thread# "ThreadNumber",
A.archiver "Archiver",
A.log_switch_wait "LogSwitchWait",
A.logins "Logins",
A.shutdown_pending "ShutdownPending",
A.database_status "DatabaseStatus",
A.instance_role "InstanceRole",
A.active_state "ActiveState",
A.blocked "Blocked",
A.con_id "ConId",
A.instance_mode "InstanceMode",
A.edition "Edition",
A.family "Family",
A.database_type "DatabaseType"
FROM gv$instance A
45 changes: 45 additions & 0 deletions dumper/app/src/main/resources/oracle-stats/native/pdbs-info.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- Copyright 2022-2024 Google LLC
-- Copyright 2013-2021 CompilerWorks
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
SELECT
con_id "ConId",
inst_id "InstId",
sum(sum_bytes) "SumBytes",
sum(used_mem) "UsedMem",
sum(alloc_mem) "AllocMem",
sum(max_mem) "MaxMem"
FROM (
SELECT
con_id,
inst_id,
sum(bytes) sum_bytes,
NULL used_mem,
NULL alloc_mem,
NULL max_mem
FROM gv$sgastat
GROUP BY con_id, inst_id
UNION (
SELECT
con_id,
inst_id,
NULL sum_bytes,
sum(pga_used_mem) used_mem,
sum(pga_alloc_mem) alloc_mem,
sum(pga_max_mem) max_mem
FROM gv$process
GROUP BY con_id, inst_id
)
)
GROUP BY con_id, inst_id
ORDER BY con_id, inst_id