// 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 = 903,
TimeCollected = DateTime.Parse("12/29/2049 05:14:54"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 136,
DiskReads = 685,
DirectReads = 744,
DirectWrites = 684,
BufferGets = 5,
RowsProcessed = 937,
SerializableAborts = 747,
Fetches = 224,
Executions = 399,
AvoidedExecutions = 957,
EndOfFetchCount = 247,
Loads = 603,
VersionCount = 475,
Invalidations = 755,
ObsoleteCount = 607,
PxServersExecutions = 619,
CpuTimeInUs = 374,
ElapsedTimeInUs = 877,
AvgHardParseTimeInUs = 103,
ConcurrencyWaitTimeInUs = 923,
ApplicationWaitTimeInUs = 211,
ClusterWaitTimeInUs = 616,
UserIoWaitTimeInUs = 486,
PlsqlExecTimeInUs = 658,
JavaExecTimeInUs = 28,
Sorts = 789,
SharableMem = 384,
TotalSharableMem = 139,
TypeCheckMem = 636,
IoCellOffloadEligibleBytes = 647,
IoInterconnectBytes = 457,
PhysicalReadRequests = 759,
PhysicalReadBytes = 374,
PhysicalWriteRequests = 808,
PhysicalWriteBytes = 113,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 463,
IoCellOffloadReturnedBytes = 590,
ChildNumber = 345,
CommandType = 537,
UsersOpening = 641,
UsersExecuting = 102,
OptimizerCost = 254,
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 = 920,
DeltaCpuTime = 312,
DeltaIoBytes = 972,
DeltaCpuRank = 605,
DeltaExecsRank = 92,
SharableMemRank = 779,
DeltaIoRank = 664,
HarmonicSum = 585,
WtHarmonicSum = 194,
TotalSqlCount = 740
}
}
};
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 = "I3PO50LANWV8BPWTCUZ7<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;
}
}
}
}