// 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 = 496,
TimeCollected = DateTime.Parse("10/30/2011 13:01:14"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 360,
DiskReads = 537,
DirectReads = 106,
DirectWrites = 576,
BufferGets = 805,
RowsProcessed = 868,
SerializableAborts = 981,
Fetches = 912,
Executions = 416,
AvoidedExecutions = 192,
EndOfFetchCount = 596,
Loads = 500,
VersionCount = 203,
Invalidations = 485,
ObsoleteCount = 964,
PxServersExecutions = 986,
CpuTimeInUs = 898,
ElapsedTimeInUs = 83,
AvgHardParseTimeInUs = 472,
ConcurrencyWaitTimeInUs = 648,
ApplicationWaitTimeInUs = 991,
ClusterWaitTimeInUs = 249,
UserIoWaitTimeInUs = 833,
PlsqlExecTimeInUs = 775,
JavaExecTimeInUs = 96,
Sorts = 716,
SharableMem = 926,
TotalSharableMem = 921,
TypeCheckMem = 13,
IoCellOffloadEligibleBytes = 487,
IoInterconnectBytes = 622,
PhysicalReadRequests = 659,
PhysicalReadBytes = 291,
PhysicalWriteRequests = 622,
PhysicalWriteBytes = 206,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 602,
IoCellOffloadReturnedBytes = 1,
ChildNumber = 967,
CommandType = 598,
UsersOpening = 8,
UsersExecuting = 903,
OptimizerCost = 766,
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 = 171,
DeltaCpuTime = 11,
DeltaIoBytes = 171,
DeltaCpuRank = 886,
DeltaExecsRank = 589,
SharableMemRank = 575,
DeltaIoRank = 388,
HarmonicSum = 953,
WtHarmonicSum = 771,
TotalSqlCount = 615
}
}
};
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 = "BDQONHDIXJTJRC3RNW4J<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;
}
}
}
}