// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.OpsiService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Opsi
{
public class IngestSqlStatsExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var ingestSqlStatsDetails = new Oci.OpsiService.Models.IngestSqlStatsDetails
{
Items = new List<Oci.OpsiService.Models.SqlStats>
{
new Oci.OpsiService.Models.SqlStats
{
SqlIdentifier = "EXAMPLE-sqlIdentifier-Value",
PlanHashValue = 764,
TimeCollected = DateTime.Parse("05/01/2039 06:29:09"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 74,
DiskReads = 773,
DirectReads = 795,
DirectWrites = 458,
BufferGets = 300,
RowsProcessed = 640,
SerializableAborts = 831,
Fetches = 591,
Executions = 892,
AvoidedExecutions = 777,
EndOfFetchCount = 979,
Loads = 509,
VersionCount = 830,
Invalidations = 470,
ObsoleteCount = 178,
PxServersExecutions = 898,
CpuTimeInUs = 869,
ElapsedTimeInUs = 143,
AvgHardParseTimeInUs = 613,
ConcurrencyWaitTimeInUs = 425,
ApplicationWaitTimeInUs = 594,
ClusterWaitTimeInUs = 362,
UserIoWaitTimeInUs = 787,
PlsqlExecTimeInUs = 481,
JavaExecTimeInUs = 489,
Sorts = 782,
SharableMem = 611,
TotalSharableMem = 992,
TypeCheckMem = 494,
IoCellOffloadEligibleBytes = 542,
IoInterconnectBytes = 749,
PhysicalReadRequests = 316,
PhysicalReadBytes = 324,
PhysicalWriteRequests = 704,
PhysicalWriteBytes = 933,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 596,
IoCellOffloadReturnedBytes = 172,
ChildNumber = 213,
CommandType = 395,
UsersOpening = 601,
UsersExecuting = 257,
OptimizerCost = 513,
FullPlanHashValue = "EXAMPLE-fullPlanHashValue-Value",
Module = "EXAMPLE-module-Value",
Service = "EXAMPLE-service-Value",
Action = "EXAMPLE-action-Value",
SqlProfile = "EXAMPLE-sqlProfile-Value",
SqlPatch = "EXAMPLE-sqlPatch-Value",
SqlPlanBaseline = "EXAMPLE-sqlPlanBaseline-Value",
DeltaExecutionCount = 97,
DeltaCpuTime = 982,
DeltaIoBytes = 124,
DeltaCpuRank = 390,
DeltaExecsRank = 991,
SharableMemRank = 101,
DeltaIoRank = 492,
HarmonicSum = 830,
WtHarmonicSum = 76,
TotalSqlCount = 60
}
}
};
var ingestSqlStatsRequest = new Oci.OpsiService.Requests.IngestSqlStatsRequest
{
IngestSqlStatsDetails = ingestSqlStatsDetails,
DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
OpcRequestId = "2CA9RX0GNQHAQX79RQGH<unique_ID>",
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new OperationsInsightsClient(provider, new ClientConfiguration()))
{
var response = await client.IngestSqlStats(ingestSqlStatsRequest);
// Retrieve value from the response.
var messageValue = response.IngestSqlStatsResponseDetails.Message;
}
}
catch (Exception e)
{
Console.WriteLine($"IngestSqlStats Failed with {e.Message}");
throw e;
}
}
}
}