// 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 = 940,
TimeCollected = DateTime.Parse("12/09/2003 00:06:03"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 729,
DiskReads = 605,
DirectReads = 258,
DirectWrites = 519,
BufferGets = 785,
RowsProcessed = 794,
SerializableAborts = 603,
Fetches = 126,
Executions = 315,
AvoidedExecutions = 671,
EndOfFetchCount = 200,
Loads = 937,
VersionCount = 433,
Invalidations = 962,
ObsoleteCount = 322,
PxServersExecutions = 146,
CpuTimeInUs = 803,
ElapsedTimeInUs = 161,
AvgHardParseTimeInUs = 836,
ConcurrencyWaitTimeInUs = 686,
ApplicationWaitTimeInUs = 859,
ClusterWaitTimeInUs = 730,
UserIoWaitTimeInUs = 513,
PlsqlExecTimeInUs = 836,
JavaExecTimeInUs = 37,
Sorts = 896,
SharableMem = 397,
TotalSharableMem = 814,
TypeCheckMem = 855,
IoCellOffloadEligibleBytes = 199,
IoInterconnectBytes = 650,
PhysicalReadRequests = 154,
PhysicalReadBytes = 885,
PhysicalWriteRequests = 360,
PhysicalWriteBytes = 263,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 963,
IoCellOffloadReturnedBytes = 617,
ChildNumber = 417,
CommandType = 91,
UsersOpening = 807,
UsersExecuting = 726,
OptimizerCost = 302,
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 = 982,
DeltaCpuTime = 75,
DeltaIoBytes = 498,
DeltaCpuRank = 226,
DeltaExecsRank = 147,
SharableMemRank = 152,
DeltaIoRank = 30,
HarmonicSum = 268,
WtHarmonicSum = 516,
TotalSqlCount = 627
}
}
};
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 = "GMWIHU89QG8GKY1RWCLR<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;
}
}
}
}