Class: DatabaseManagement::SqlTuningClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database_management/sql_tuning_client.rb

Overview

Use the Database Management API to perform tasks such as obtaining performance and resource usage metrics for a fleet of Managed Databases or a specific Managed Database, creating Managed Database Groups, and running a SQL job on a Managed Database or Managed Database Group.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ SqlTuningClient

Creates a new SqlTuningClient. Notes:

If a config is not specified, then the global OCI.config will be used.

This client is not thread-safe

Either a region or an endpoint must be specified.  If an endpoint is specified, it will be used instead of the
  region. A region may be specified in the config or via or the region parameter. If specified in both, then the
  region parameter will be used.

Parameters:

  • config (Config) (defaults to: nil)

    A Config object.

  • region (String) (defaults to: nil)

    A region used to determine the service endpoint. This will usually correspond to a value in OCI::Regions::REGION_ENUM, but may be an arbitrary string.

  • endpoint (String) (defaults to: nil)

    The fully qualified endpoint URL

  • signer (OCI::BaseSigner) (defaults to: nil)

    A signer implementation which can be used by this client. If this is not provided then a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication, so that the instance principals signer can be provided to the client

  • proxy_settings (OCI::ApiClientProxySettings) (defaults to: nil)

    If your environment requires you to use a proxy server for outgoing HTTP requests the details for the proxy can be provided in this parameter

  • retry_config (OCI::Retry::RetryConfig) (defaults to: nil)

    The retry configuration for this service client. This represents the default retry configuration to apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation will not perform any retries



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/oci/database_management/sql_tuning_client.rb', line 55

def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
  # If the signer is an InstancePrincipalsSecurityTokenSigner or SecurityTokenSigner and no config was supplied (they are self-sufficient signers)
  # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
  # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
  # pass it to this constructor.
  #
  # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
  # so try and load the config from the default file.
  config = OCI::Config.validate_and_build_config_with_signer(config, signer)

  signer = OCI::Signer.config_file_auth_builder(config) if signer.nil?

  @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
  @retry_config = retry_config

  if endpoint
    @endpoint = endpoint + '/20201101'
  else
    region ||= config.region
    region ||= signer.region if signer.respond_to?(:region)
    self.region = region
  end
  logger.info "SqlTuningClient endpoint set to '#{@endpoint}'." if logger
end

Instance Attribute Details

#api_clientOCI::ApiClient (readonly)

Client used to make HTTP requests.

Returns:



15
16
17
# File 'lib/oci/database_management/sql_tuning_client.rb', line 15

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


19
20
21
# File 'lib/oci/database_management/sql_tuning_client.rb', line 19

def endpoint
  @endpoint
end

#regionString

The region, which will usually correspond to a value in OCI::Regions::REGION_ENUM.

Returns:

  • (String)


29
30
31
# File 'lib/oci/database_management/sql_tuning_client.rb', line 29

def region
  @region
end

#retry_configOCI::Retry::RetryConfig (readonly)

The default retry configuration to apply to all operations in this service client. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation will not perform any retries



25
26
27
# File 'lib/oci/database_management/sql_tuning_client.rb', line 25

def retry_config
  @retry_config
end

Instance Method Details

#clone_sql_tuning_task(managed_database_id, clone_sql_tuning_task_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/clone_sql_tuning_task.rb.html) to see an example of how to use clone_sql_tuning_task API.

Clones and runs a SQL tuning task in the database.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/oci/database_management/sql_tuning_client.rb', line 119

def clone_sql_tuning_task(managed_database_id, clone_sql_tuning_task_details, opts = {})
  logger.debug 'Calling operation SqlTuningClient#clone_sql_tuning_task.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling clone_sql_tuning_task." if managed_database_id.nil?
  raise "Missing the required parameter 'clone_sql_tuning_task_details' when calling clone_sql_tuning_task." if clone_sql_tuning_task_details.nil?
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)

  path = '/managedDatabases/{managedDatabaseId}/actions/cloneSqlTuningTask'.sub('{managedDatabaseId}', managed_database_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(clone_sql_tuning_task_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#clone_sql_tuning_task') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningTaskReturn'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#drop_sql_tuning_task(managed_database_id, drop_sql_tuning_task_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/drop_sql_tuning_task.rb.html) to see an example of how to use drop_sql_tuning_task API.

Drops a SQL tuning task and its related results from the database.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:

  • (Response)

    A Response object with data of type nil



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/oci/database_management/sql_tuning_client.rb', line 184

def drop_sql_tuning_task(managed_database_id, drop_sql_tuning_task_details, opts = {})
  logger.debug 'Calling operation SqlTuningClient#drop_sql_tuning_task.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling drop_sql_tuning_task." if managed_database_id.nil?
  raise "Missing the required parameter 'drop_sql_tuning_task_details' when calling drop_sql_tuning_task." if drop_sql_tuning_task_details.nil?
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)

  path = '/managedDatabases/{managedDatabaseId}/actions/dropSqlTuningTask'.sub('{managedDatabaseId}', managed_database_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(drop_sql_tuning_task_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#drop_sql_tuning_task') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_execution_plan_stats_comparision(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, execution_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/get_execution_plan_stats_comparision.rb.html) to see an example of how to use get_execution_plan_stats_comparision API.

Retrieves a comparison of the existing SQL execution plan and a new plan. A SQL tuning task may suggest a new execution plan for a SQL, and this API retrieves the comparison report of the statistics of the two plans.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/oci/database_management/sql_tuning_client.rb', line 247

def get_execution_plan_stats_comparision(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, execution_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#get_execution_plan_stats_comparision.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling get_execution_plan_stats_comparision." if managed_database_id.nil?
  raise "Missing the required parameter 'sql_tuning_advisor_task_id' when calling get_execution_plan_stats_comparision." if sql_tuning_advisor_task_id.nil?
  raise "Missing the required parameter 'sql_object_id' when calling get_execution_plan_stats_comparision." if sql_object_id.nil?
  raise "Missing the required parameter 'execution_id' when calling get_execution_plan_stats_comparision." if execution_id.nil?
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)
  raise "Parameter value for 'sql_tuning_advisor_task_id' must not be blank" if OCI::Internal::Util.blank_string?(sql_tuning_advisor_task_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks/{sqlTuningAdvisorTaskId}/executionPlanStatsComparision'.sub('{managedDatabaseId}', managed_database_id.to_s).sub('{sqlTuningAdvisorTaskId}', sql_tuning_advisor_task_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:sqlObjectId] = sql_object_id
  query_params[:executionId] = execution_id

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#get_execution_plan_stats_comparision') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::ExecutionPlanStatsComparision'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_sql_execution_plan(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, attribute, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/get_sql_execution_plan.rb.html) to see an example of how to use get_sql_execution_plan API.

Retrieves a SQL execution plan for the SQL being tuned.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/oci/database_management/sql_tuning_client.rb', line 312

def get_sql_execution_plan(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, attribute, opts = {})
  logger.debug 'Calling operation SqlTuningClient#get_sql_execution_plan.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling get_sql_execution_plan." if managed_database_id.nil?
  raise "Missing the required parameter 'sql_tuning_advisor_task_id' when calling get_sql_execution_plan." if sql_tuning_advisor_task_id.nil?
  raise "Missing the required parameter 'sql_object_id' when calling get_sql_execution_plan." if sql_object_id.nil?
  raise "Missing the required parameter 'attribute' when calling get_sql_execution_plan." if attribute.nil?
  unless %w[ORIGINAL ORIGINAL_WITH_ADJUSTED_COST USING_SQL_PROFILE USING_NEW_INDICES USING_PARALLEL_EXECUTION].include?(attribute)
    raise "Invalid value for 'attribute', must be one of ORIGINAL, ORIGINAL_WITH_ADJUSTED_COST, USING_SQL_PROFILE, USING_NEW_INDICES, USING_PARALLEL_EXECUTION."
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)
  raise "Parameter value for 'sql_tuning_advisor_task_id' must not be blank" if OCI::Internal::Util.blank_string?(sql_tuning_advisor_task_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks/{sqlTuningAdvisorTaskId}/sqlExecutionPlan'.sub('{managedDatabaseId}', managed_database_id.to_s).sub('{sqlTuningAdvisorTaskId}', sql_tuning_advisor_task_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:sqlObjectId] = sql_object_id
  query_params[:attribute] = attribute

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#get_sql_execution_plan') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningAdvisorTaskSqlExecutionPlan'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_sql_tuning_advisor_task_summary_report(managed_database_id, sql_tuning_advisor_task_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/get_sql_tuning_advisor_task_summary_report.rb.html) to see an example of how to use get_sql_tuning_advisor_task_summary_report API.

Gets the summary report for the specified SQL Tuning Advisor task.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :search_period (String)

    How far back the API will search for begin and end exec id. Unused if neither exec ids nor time filter query params are supplied. This is applicable only for Auto SQL Tuning tasks. (default to ALL) Allowed values are: LAST_24HR, LAST_7DAY, LAST_31DAY, SINCE_LAST, ALL

  • :time_greater_than_or_equal_to (DateTime)

    The optional greater than or equal to query parameter to filter the timestamp. This is applicable only for Auto SQL Tuning tasks.

  • :time_less_than_or_equal_to (DateTime)

    The optional less than or equal to query parameter to filter the timestamp. This is applicable only for Auto SQL Tuning tasks.

  • :begin_exec_id_greater_than_or_equal_to (Integer)

    The optional greater than or equal to filter on the execution ID related to a specific SQL Tuning Advisor task. This is applicable only for Auto SQL Tuning tasks.

  • :end_exec_id_less_than_or_equal_to (Integer)

    The optional less than or equal to query parameter to filter on the execution ID related to a specific SQL Tuning Advisor task. This is applicable only for Auto SQL Tuning tasks.

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/oci/database_management/sql_tuning_client.rb', line 383

def get_sql_tuning_advisor_task_summary_report(managed_database_id, sql_tuning_advisor_task_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#get_sql_tuning_advisor_task_summary_report.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling get_sql_tuning_advisor_task_summary_report." if managed_database_id.nil?
  raise "Missing the required parameter 'sql_tuning_advisor_task_id' when calling get_sql_tuning_advisor_task_summary_report." if sql_tuning_advisor_task_id.nil?

  if opts[:search_period] && !%w[LAST_24HR LAST_7DAY LAST_31DAY SINCE_LAST ALL].include?(opts[:search_period])
    raise 'Invalid value for "search_period", must be one of LAST_24HR, LAST_7DAY, LAST_31DAY, SINCE_LAST, ALL.'
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)
  raise "Parameter value for 'sql_tuning_advisor_task_id' must not be blank" if OCI::Internal::Util.blank_string?(sql_tuning_advisor_task_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks/{sqlTuningAdvisorTaskId}/summaryReport'.sub('{managedDatabaseId}', managed_database_id.to_s).sub('{sqlTuningAdvisorTaskId}', sql_tuning_advisor_task_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:searchPeriod] = opts[:search_period] if opts[:search_period]
  query_params[:timeGreaterThanOrEqualTo] = opts[:time_greater_than_or_equal_to] if opts[:time_greater_than_or_equal_to]
  query_params[:timeLessThanOrEqualTo] = opts[:time_less_than_or_equal_to] if opts[:time_less_than_or_equal_to]
  query_params[:beginExecIdGreaterThanOrEqualTo] = opts[:begin_exec_id_greater_than_or_equal_to] if opts[:begin_exec_id_greater_than_or_equal_to]
  query_params[:endExecIdLessThanOrEqualTo] = opts[:end_exec_id_less_than_or_equal_to] if opts[:end_exec_id_less_than_or_equal_to]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#get_sql_tuning_advisor_task_summary_report') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningAdvisorTaskSummaryReport'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_sql_tuning_advisor_task_findings(managed_database_id, sql_tuning_advisor_task_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/list_sql_tuning_advisor_task_findings.rb.html) to see an example of how to use list_sql_tuning_advisor_task_findings API.

Gets an array of the details of the findings that match specific filters.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :begin_exec_id (Integer)

    The optional greater than or equal to filter on the execution ID related to a specific SQL Tuning Advisor task.

  • :end_exec_id (Integer)

    The optional less than or equal to query parameter to filter on the execution ID related to a specific SQL Tuning Advisor task.

  • :search_period (String)

    The search period during which the API will search for begin and end exec id, if not supplied. Unused if beginExecId and endExecId optional query params are both supplied.

    (default to ALL)
    

    Allowed values are: LAST_24HR, LAST_7DAY, LAST_31DAY, SINCE_LAST, ALL

  • :finding_filter (String)

    The filter used to display specific findings in the report. (default to none) Allowed values are: none, FINDINGS, NOFINDINGS, ERRORS, PROFILES, INDICES, STATS, RESTRUCTURE, ALTERNATIVE, AUTO_PROFILES, OTHER_PROFILES

  • :stats_hash_filter (String)

    The hash value of the object for the statistic finding search.

  • :index_hash_filter (String)

    The hash value of the index table name.

  • :sort_by (String)

    The possible sortBy values of an object's recommendations. (default to DBTIME_BENEFIT) Allowed values are: DBTIME_BENEFIT, PARSING_SCHEMA, SQL_ID, STATS, PROFILES, SQL_BENEFIT, DATE, INDICES, RESTRUCTURE, ALTERNATIVE, MISC, ERROR, TIMEOUTS

  • :sort_order (String)

    The option to sort information in ascending (u2018ASCu2019) or descending (u2018DESCu2019) order. Descending order is the default order. (default to DESC)

  • :page (String)

    The page token representing the page from where the next set of paginated results are retrieved. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximum number of records returned in the paginated response. (default to 10)

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/oci/database_management/sql_tuning_client.rb', line 467

def list_sql_tuning_advisor_task_findings(managed_database_id, sql_tuning_advisor_task_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#list_sql_tuning_advisor_task_findings.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling list_sql_tuning_advisor_task_findings." if managed_database_id.nil?
  raise "Missing the required parameter 'sql_tuning_advisor_task_id' when calling list_sql_tuning_advisor_task_findings." if sql_tuning_advisor_task_id.nil?

  if opts[:search_period] && !%w[LAST_24HR LAST_7DAY LAST_31DAY SINCE_LAST ALL].include?(opts[:search_period])
    raise 'Invalid value for "search_period", must be one of LAST_24HR, LAST_7DAY, LAST_31DAY, SINCE_LAST, ALL.'
  end

  if opts[:finding_filter] && !%w[none FINDINGS NOFINDINGS ERRORS PROFILES INDICES STATS RESTRUCTURE ALTERNATIVE AUTO_PROFILES OTHER_PROFILES].include?(opts[:finding_filter])
    raise 'Invalid value for "finding_filter", must be one of none, FINDINGS, NOFINDINGS, ERRORS, PROFILES, INDICES, STATS, RESTRUCTURE, ALTERNATIVE, AUTO_PROFILES, OTHER_PROFILES.'
  end

  if opts[:sort_by] && !%w[DBTIME_BENEFIT PARSING_SCHEMA SQL_ID STATS PROFILES SQL_BENEFIT DATE INDICES RESTRUCTURE ALTERNATIVE MISC ERROR TIMEOUTS].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of DBTIME_BENEFIT, PARSING_SCHEMA, SQL_ID, STATS, PROFILES, SQL_BENEFIT, DATE, INDICES, RESTRUCTURE, ALTERNATIVE, MISC, ERROR, TIMEOUTS.'
  end

  if opts[:sort_order] && !OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.'
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)
  raise "Parameter value for 'sql_tuning_advisor_task_id' must not be blank" if OCI::Internal::Util.blank_string?(sql_tuning_advisor_task_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks/{sqlTuningAdvisorTaskId}/findings'.sub('{managedDatabaseId}', managed_database_id.to_s).sub('{sqlTuningAdvisorTaskId}', sql_tuning_advisor_task_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:beginExecId] = opts[:begin_exec_id] if opts[:begin_exec_id]
  query_params[:endExecId] = opts[:end_exec_id] if opts[:end_exec_id]
  query_params[:searchPeriod] = opts[:search_period] if opts[:search_period]
  query_params[:findingFilter] = opts[:finding_filter] if opts[:finding_filter]
  query_params[:statsHashFilter] = opts[:stats_hash_filter] if opts[:stats_hash_filter]
  query_params[:indexHashFilter] = opts[:index_hash_filter] if opts[:index_hash_filter]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#list_sql_tuning_advisor_task_findings') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningAdvisorTaskFindingCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_sql_tuning_advisor_task_recommendations(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, execution_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/list_sql_tuning_advisor_task_recommendations.rb.html) to see an example of how to use list_sql_tuning_advisor_task_recommendations API.

Gets the findings and possible actions for a given object in a SQL tuning task. The task ID and object ID are used to retrieve the findings and recommendations.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :sort_by (String)

    The possible sortBy values of an object's recommendations. (default to RECOMMENDATION_TYPE) Allowed values are: RECOMMENDATION_TYPE, BENEFIT

  • :sort_order (String)

    The option to sort information in ascending (u2018ASCu2019) or descending (u2018DESCu2019) order. Descending order is the default order. (default to DESC)

  • :page (String)

    The page token representing the page from where the next set of paginated results are retrieved. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximum number of records returned in the paginated response. (default to 10)

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/oci/database_management/sql_tuning_client.rb', line 562

def list_sql_tuning_advisor_task_recommendations(managed_database_id, sql_tuning_advisor_task_id, sql_object_id, execution_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#list_sql_tuning_advisor_task_recommendations.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling list_sql_tuning_advisor_task_recommendations." if managed_database_id.nil?
  raise "Missing the required parameter 'sql_tuning_advisor_task_id' when calling list_sql_tuning_advisor_task_recommendations." if sql_tuning_advisor_task_id.nil?
  raise "Missing the required parameter 'sql_object_id' when calling list_sql_tuning_advisor_task_recommendations." if sql_object_id.nil?
  raise "Missing the required parameter 'execution_id' when calling list_sql_tuning_advisor_task_recommendations." if execution_id.nil?

  if opts[:sort_by] && !%w[RECOMMENDATION_TYPE BENEFIT].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of RECOMMENDATION_TYPE, BENEFIT.'
  end

  if opts[:sort_order] && !OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.'
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)
  raise "Parameter value for 'sql_tuning_advisor_task_id' must not be blank" if OCI::Internal::Util.blank_string?(sql_tuning_advisor_task_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks/{sqlTuningAdvisorTaskId}/recommendations'.sub('{managedDatabaseId}', managed_database_id.to_s).sub('{sqlTuningAdvisorTaskId}', sql_tuning_advisor_task_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:sqlObjectId] = sql_object_id
  query_params[:executionId] = execution_id
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#list_sql_tuning_advisor_task_recommendations') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningAdvisorTaskRecommendationCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_sql_tuning_advisor_tasks(managed_database_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/list_sql_tuning_advisor_tasks.rb.html) to see an example of how to use list_sql_tuning_advisor_tasks API.

Lists the SQL Tuning Advisor tasks for the specified Managed Database.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :name (String)

    The optional query parameter to filter the SQL Tuning Advisor task list by name.

  • :status (String)

    The optional query parameter to filter the SQL Tuning Advisor task list by status. Allowed values are: INITIAL, EXECUTING, INTERRUPTED, COMPLETED, ERROR

  • :time_greater_than_or_equal_to (DateTime)

    The optional greater than or equal to query parameter to filter the timestamp.

  • :time_less_than_or_equal_to (DateTime)

    The optional less than or equal to query parameter to filter the timestamp.

  • :page (String)

    The page token representing the page from where the next set of paginated results are retrieved. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximum number of records returned in the paginated response. (default to 10)

  • :sort_by (String)

    The option to sort the SQL Tuning Advisor task summary data. (default to START_TIME) Allowed values are: NAME, START_TIME

  • :sort_order (String)

    The option to sort information in ascending (u2018ASCu2019) or descending (u2018DESCu2019) order. Descending order is the default order. (default to DESC)

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# File 'lib/oci/database_management/sql_tuning_client.rb', line 647

def list_sql_tuning_advisor_tasks(managed_database_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#list_sql_tuning_advisor_tasks.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling list_sql_tuning_advisor_tasks." if managed_database_id.nil?

  if opts[:status] && !%w[INITIAL EXECUTING INTERRUPTED COMPLETED ERROR].include?(opts[:status])
    raise 'Invalid value for "status", must be one of INITIAL, EXECUTING, INTERRUPTED, COMPLETED, ERROR.'
  end

  if opts[:sort_by] && !%w[NAME START_TIME].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of NAME, START_TIME.'
  end

  if opts[:sort_order] && !OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.'
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningAdvisorTasks'.sub('{managedDatabaseId}', managed_database_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:name] = opts[:name] if opts[:name]
  query_params[:status] = opts[:status] if opts[:status]
  query_params[:timeGreaterThanOrEqualTo] = opts[:time_greater_than_or_equal_to] if opts[:time_greater_than_or_equal_to]
  query_params[:timeLessThanOrEqualTo] = opts[:time_less_than_or_equal_to] if opts[:time_less_than_or_equal_to]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#list_sql_tuning_advisor_tasks') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningAdvisorTaskCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_sql_tuning_sets(managed_database_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/list_sql_tuning_sets.rb.html) to see an example of how to use list_sql_tuning_sets API.

Lists the SQL tuning sets for the specified Managed Database.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :owner (String)

    The owner of the SQL tuning set.

  • :name_contains (String)

    Allow searching the name of the SQL tuning set by partial matching. The search is case insensitive.

  • :sort_by (String)

    The option to sort the SQL tuning set summary data. (default to NAME) Allowed values are: NAME

  • :sort_order (String)

    The option to sort information in ascending (u2018ASCu2019) or descending (u2018DESCu2019) order. Ascending order is the default order. (default to ASC)

  • :page (String)

    The page token representing the page from where the next set of paginated results are retrieved. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximum number of records returned in the paginated response. (default to 10)

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/oci/database_management/sql_tuning_client.rb', line 731

def list_sql_tuning_sets(managed_database_id, opts = {})
  logger.debug 'Calling operation SqlTuningClient#list_sql_tuning_sets.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling list_sql_tuning_sets." if managed_database_id.nil?

  if opts[:sort_by] && !%w[NAME].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of NAME.'
  end

  if opts[:sort_order] && !OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::DatabaseManagement::Models::SORT_ORDERS_ENUM.'
  end
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)

  path = '/managedDatabases/{managedDatabaseId}/sqlTuningSets'.sub('{managedDatabaseId}', managed_database_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:owner] = opts[:owner] if opts[:owner]
  query_params[:nameContains] = opts[:name_contains] if opts[:name_contains]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#list_sql_tuning_sets') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningSetCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#loggerLogger

Returns The logger for this client. May be nil.

Returns:

  • (Logger)

    The logger for this client. May be nil.



94
95
96
# File 'lib/oci/database_management/sql_tuning_client.rb', line 94

def logger
  @api_client.config.logger
end

#start_sql_tuning_task(managed_database_id, start_sql_tuning_task_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/databasemanagement/start_sql_tuning_task.rb.html) to see an example of how to use start_sql_tuning_task API.

Starts a SQL tuning task for a given set of SQL statements from the active session history top SQL statements.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit `nil` value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:



807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
# File 'lib/oci/database_management/sql_tuning_client.rb', line 807

def start_sql_tuning_task(managed_database_id, start_sql_tuning_task_details, opts = {})
  logger.debug 'Calling operation SqlTuningClient#start_sql_tuning_task.' if logger

  raise "Missing the required parameter 'managed_database_id' when calling start_sql_tuning_task." if managed_database_id.nil?
  raise "Missing the required parameter 'start_sql_tuning_task_details' when calling start_sql_tuning_task." if start_sql_tuning_task_details.nil?
  raise "Parameter value for 'managed_database_id' must not be blank" if OCI::Internal::Util.blank_string?(managed_database_id)

  path = '/managedDatabases/{managedDatabaseId}/actions/startSqlTuningTask'.sub('{managedDatabaseId}', managed_database_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(start_sql_tuning_task_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'SqlTuningClient#start_sql_tuning_task') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::DatabaseManagement::Models::SqlTuningTaskReturn'
    )
  end
  # rubocop:enable Metrics/BlockLength
end