// 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 = 894,
TimeCollected = DateTime.Parse("07/25/2005 21:22:11"),
InstanceName = "EXAMPLE-instanceName-Value",
LastActiveTime = "EXAMPLE-lastActiveTime-Value",
ParseCalls = 360,
DiskReads = 267,
DirectReads = 479,
DirectWrites = 776,
BufferGets = 256,
RowsProcessed = 343,
SerializableAborts = 550,
Fetches = 816,
Executions = 25,
AvoidedExecutions = 95,
EndOfFetchCount = 947,
Loads = 731,
VersionCount = 341,
Invalidations = 499,
ObsoleteCount = 604,
PxServersExecutions = 292,
CpuTimeInUs = 498,
ElapsedTimeInUs = 685,
AvgHardParseTimeInUs = 170,
ConcurrencyWaitTimeInUs = 804,
ApplicationWaitTimeInUs = 276,
ClusterWaitTimeInUs = 402,
UserIoWaitTimeInUs = 642,
PlsqlExecTimeInUs = 209,
JavaExecTimeInUs = 923,
Sorts = 629,
SharableMem = 996,
TotalSharableMem = 236,
TypeCheckMem = 982,
IoCellOffloadEligibleBytes = 337,
IoInterconnectBytes = 909,
PhysicalReadRequests = 425,
PhysicalReadBytes = 542,
PhysicalWriteRequests = 707,
PhysicalWriteBytes = 333,
ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
IoCellUncompressedBytes = 129,
IoCellOffloadReturnedBytes = 201,
ChildNumber = 645,
CommandType = 711,
UsersOpening = 554,
UsersExecuting = 651,
OptimizerCost = 999,
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 = 112,
DeltaCpuTime = 443,
DeltaIoBytes = 345,
DeltaCpuRank = 749,
DeltaExecsRank = 394,
SharableMemRank = 320,
DeltaIoRank = 146,
HarmonicSum = 332,
WtHarmonicSum = 802,
TotalSqlCount = 45
}
}
};
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 = "5OTJHHKZBBZO3DGMSYBI<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;
}
}
}
}