// 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 = 365,
TimeCollected = DateTime.Parse("04/05/2016 09:41:10"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 919,
DiskReads = 278,
DirectReads = 5,
DirectWrites = 292,
BufferGets = 489,
RowsProcessed = 968,
SerializableAborts = 922,
Fetches = 401,
Executions = 226,
AvoidedExecutions = 400,
EndOfFetchCount = 414,
Loads = 982,
VersionCount = 811,
Invalidations = 436,
ObsoleteCount = 553,
PxServersExecutions = 699,
CpuTimeInUs = 351,
ElapsedTimeInUs = 992,
AvgHardParseTimeInUs = 586,
ConcurrencyWaitTimeInUs = 633,
ApplicationWaitTimeInUs = 526,
ClusterWaitTimeInUs = 64,
UserIoWaitTimeInUs = 330,
PlsqlExecTimeInUs = 854,
JavaExecTimeInUs = 50,
Sorts = 55,
SharableMem = 650,
TotalSharableMem = 689,
TypeCheckMem = 302,
IoCellOffloadEligibleBytes = 447,
IoInterconnectBytes = 752,
PhysicalReadRequests = 265,
PhysicalReadBytes = 11,
PhysicalWriteRequests = 306,
PhysicalWriteBytes = 235,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 721,
IoCellOffloadReturnedBytes = 558,
ChildNumber = 513,
CommandType = 255,
UsersOpening = 677,
UsersExecuting = 809,
OptimizerCost = 869,
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 = 669,
DeltaCpuTime = 181,
DeltaIoBytes = 369,
DeltaCpuRank = 445,
DeltaExecsRank = 776,
SharableMemRank = 359,
DeltaIoRank = 841,
HarmonicSum = 631,
WtHarmonicSum = 68,
TotalSqlCount = 429
}
}
};
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 = "5RJJVNPNMDH3M61NJXP9<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;
}
}
}
}