Help us shape the future of Go! Take the 2026 Go Developer Survey

oracle

package
v0.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OracleQueryLogSchema added in v0.12.0

type OracleQueryLogSchema struct {
	SqlId             string     `db:"SQL_ID"`
	SqlFulltext       *string    `db:"SQL_FULLTEXT"`
	ParsingSchemaName *string    `db:"PARSING_SCHEMA_NAME"`
	ParsingUserName   *string    `db:"PARSING_USER_NAME"`
	LastActiveTime    *time.Time `db:"LAST_ACTIVE_TIME"`
	IntervalStart     *time.Time `db:"INTERVAL_START"`
	Executions        *int64     `db:"EXECUTIONS"`
	ElapsedTime       *int64     `db:"ELAPSED_TIME"`
	CpuTime           *int64     `db:"CPU_TIME"`
	DiskReads         *int64     `db:"DISK_READS"`
	BufferGets        *int64     `db:"BUFFER_GETS"`
	RowsProcessed     *int64     `db:"ROWS_PROCESSED"`
	CommandType       *int64     `db:"COMMAND_TYPE"`
	Module            *string    `db:"MODULE"`
	Action            *string    `db:"ACTION"`
	OptimizerCost     *int64     `db:"OPTIMIZER_COST"`
	Fetches           *int64     `db:"FETCHES"`
	Sorts             *int64     `db:"SORTS"`
}

OracleQueryLogSchema maps columns from V$SQL or DBA_HIST query results. Fields shared between both sources use the same column aliases.

type OracleScrapper

type OracleScrapper struct {
	// contains filtered or unexported fields
}

func NewOracleScrapper

func NewOracleScrapper(ctx context.Context, conf *OracleScrapperConf) (*OracleScrapper, error)

func (*OracleScrapper) Capabilities added in v0.10.6

func (e *OracleScrapper) Capabilities() scrapper.Capabilities

func (*OracleScrapper) Close

func (e *OracleScrapper) Close() error

func (*OracleScrapper) DialectType

func (e *OracleScrapper) DialectType() string

func (*OracleScrapper) EstimateQuery added in v0.16.0

func (e *OracleScrapper) EstimateQuery(ctx context.Context, sql string) (*scrapper.QueryEstimate, error)

EstimateQuery is unsupported for now. Oracle has no single-statement EXPLAIN that returns an estimate as a result set: `EXPLAIN PLAN FOR` writes to PLAN_TABLE and requires a follow-up read, and the Cardinality/Bytes columns depend on gathered optimizer statistics. Returning ErrUnsupported until a validation spike confirms a trustworthy, side-effect-free path.

func (*OracleScrapper) Executor added in v0.12.0

func (*OracleScrapper) FetchQueryLogs added in v0.12.0

func (s *OracleScrapper) FetchQueryLogs(
	ctx context.Context,
	from, to time.Time,
	obfuscator querylogs.QueryObfuscator,
) (querylogs.QueryLogIterator, error)

func (*OracleScrapper) IsPermissionError

func (e *OracleScrapper) IsPermissionError(err error) bool

func (*OracleScrapper) QueryCatalog

func (e *OracleScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)

func (*OracleScrapper) QueryCustomMetrics

func (e *OracleScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)

func (*OracleScrapper) QueryDatabases

func (e *OracleScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)

func (*OracleScrapper) QueryPlatformUsers added in v0.21.0

func (e *OracleScrapper) QueryPlatformUsers(ctx context.Context) (*scrapper.PlatformUsers, error)

QueryPlatformUsers lists the database users from DBA_USERS. Login is USERNAME, the name V$SQL reports as PARSING_SCHEMA_NAME in query logs; Type is AUTHENTICATION_TYPE (PASSWORD, EXTERNAL, GLOBAL, NONE). Oracle-maintained users (SYS, SYSTEM, ...) are listed too: they are logins, and SYSTEM in particular runs queries. Roles come from DBA_ROLE_PRIVS.

ALL_USERS lists the same users with only their name, id and creation time, so it is read only when DBA_USERS did not answer, whatever the reason: a refusal, a version without the view, or a failure of that one statement. A connection that is down fails ALL_USERS too, and the call then fails; one that is up still returns every user.

func (*OracleScrapper) QueryRoutines added in v0.23.0

func (e *OracleScrapper) QueryRoutines(ctx context.Context) ([]*scrapper.RoutineRow, error)

QueryRoutines lists the standalone procedures and functions with their source, from DBA_OBJECTS and DBA_SOURCE, which SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE lets a role read. ALL_SOURCE lists a routine only to a role that may execute or debug it, so it is read only when the DBA views were refused.

func (*OracleScrapper) QuerySchemas added in v0.14.5

func (e *OracleScrapper) QuerySchemas(ctx context.Context) ([]*scrapper.SchemaRow, error)

QuerySchemas lists Oracle users as schemas. In Oracle a schema is owned by (and named after) a user, so the schema set equals the non-system user set — the same source QueryDatabases uses, but mapped to the schema level with the service name as the database container.

func (*OracleScrapper) QuerySegments

func (e *OracleScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)

func (*OracleScrapper) QueryShape

func (e *OracleScrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)

func (*OracleScrapper) QuerySqlDefinitions

func (e *OracleScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)

func (*OracleScrapper) QueryTableConstraints

func (e *OracleScrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)

func (*OracleScrapper) QueryTableMetrics

func (e *OracleScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)

func (*OracleScrapper) QueryTables

func (e *OracleScrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)

func (*OracleScrapper) RunRawQuery added in v0.13.7

func (*OracleScrapper) SqlDialect

func (e *OracleScrapper) SqlDialect() sqldialect.Dialect

func (*OracleScrapper) ValidateConfiguration

func (e *OracleScrapper) ValidateConfiguration(ctx context.Context) ([]string, error)

type OracleScrapperConf

type OracleScrapperConf struct {
	dwhexecoracle.OracleConf

	// UseDiagnosticsPack enables use of AWR (Automatic Workload Repository) views
	// for query log collection. AWR is part of the Oracle Diagnostics Pack, which
	// requires a separate license for Oracle Database Enterprise Edition.
	// When false (default), query logs come from V$SQL (no additional license needed).
	// V$SQL provides in-memory cached SQL statements that age out under memory pressure.
	// When true, query logs come from DBA_HIST_SQLSTAT + DBA_HIST_SQLTEXT which
	// provides persistent AWR snapshots (typically hourly, retained for days/weeks).
	// Requires Diagnostics Pack license and SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE grant.
	UseDiagnosticsPack bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL