# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

require 'date'
require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
opsi_client = OCI::Opsi::OperationsInsightsClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
ingest_sql_plan_lines_response =
  opsi_client.ingest_sql_plan_lines(
    OCI::Opsi::Models::IngestSqlPlanLinesDetails.new(
      items: [
        OCI::Opsi::Models::SqlPlanLine.new(
          sql_identifier: 'EXAMPLE-sqlIdentifier-Value',
          plan_hash: 750,
          time_collected: DateTime.parse('2047-03-29T02:41:02.079Z'),
          operation: 'EXAMPLE-operation-Value',
          identifier: 153,
          version: 8426.639,
          force_matching_signature: 'EXAMPLE-forceMatchingSignature-Value',
          time_generated: DateTime.parse('2021-03-09T19:12:40.245Z'),
          remark: 'EXAMPLE-remark-Value',
          options: 'EXAMPLE-options-Value',
          object_node: 'EXAMPLE-objectNode-Value',
          object_owner: 'EXAMPLE-objectOwner-Value',
          object_name: 'EXAMPLE-objectName-Value',
          object_alias: 'EXAMPLE-objectAlias-Value',
          object_instance: 71,
          object_type: 'EXAMPLE-objectType-Value',
          optimizer: 'EXAMPLE-optimizer-Value',
          search_columns: 517,
          parent_identifier: 120,
          depth: 246,
          position: 452,
          cost: 936,
          cardinality: 485,
          bytes: 575,
          other: 'EXAMPLE-other-Value',
          other_tag: 'EXAMPLE-otherTag-Value',
          partition_start: 'EXAMPLE-partitionStart-Value',
          partition_stop: 'EXAMPLE-partitionStop-Value',
          partition_identifier: 822,
          distribution: 'EXAMPLE-distribution-Value',
          cpu_cost: 861,
          io_cost: 188,
          temp_space: 677,
          access_predicates: 'EXAMPLE-accessPredicates-Value',
          filter_predicates: 'EXAMPLE-filterPredicates-Value',
          projection: 'EXAMPLE-projection-Value',
          qblock_name: 'EXAMPLE-qblockName-Value',
          elapsed_time_in_sec: 7009.483,
          other_xml: 'EXAMPLE-otherXML-Value'
        )
      ]
    )
  )

# Get the data from response
puts "#{ingest_sql_plan_lines_response.data}"

Was this article helpful?