// 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 = 727,
TimeCollected = DateTime.Parse("09/28/2028 14:17:09"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 293,
DiskReads = 596,
DirectReads = 827,
DirectWrites = 320,
BufferGets = 342,
RowsProcessed = 141,
SerializableAborts = 797,
Fetches = 698,
Executions = 64,
AvoidedExecutions = 36,
EndOfFetchCount = 682,
Loads = 986,
VersionCount = 865,
Invalidations = 82,
ObsoleteCount = 831,
PxServersExecutions = 274,
CpuTimeInUs = 178,
ElapsedTimeInUs = 938,
AvgHardParseTimeInUs = 845,
ConcurrencyWaitTimeInUs = 392,
ApplicationWaitTimeInUs = 571,
ClusterWaitTimeInUs = 868,
UserIoWaitTimeInUs = 385,
PlsqlExecTimeInUs = 575,
JavaExecTimeInUs = 886,
Sorts = 934,
SharableMem = 118,
TotalSharableMem = 95,
TypeCheckMem = 179,
IoCellOffloadEligibleBytes = 361,
IoInterconnectBytes = 953,
PhysicalReadRequests = 914,
PhysicalReadBytes = 122,
PhysicalWriteRequests = 409,
PhysicalWriteBytes = 12,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 8,
IoCellOffloadReturnedBytes = 478,
ChildNumber = 907,
CommandType = 616,
UsersOpening = 374,
UsersExecuting = 237,
OptimizerCost = 777,
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 = 945,
DeltaCpuTime = 920,
DeltaIoBytes = 28,
DeltaCpuRank = 278,
DeltaExecsRank = 924,
SharableMemRank = 338,
DeltaIoRank = 418,
HarmonicSum = 425,
WtHarmonicSum = 320,
TotalSqlCount = 799
}
}
};
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 = "2SNWEAMYDHARKK8FSRR0<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;
}
}
}
}