dbdaemon

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package dbdaemon implements a gRPC service for running privileged database ops, e.g. sqlplus, rman.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
}

DB is a wrapper around database/sql.DB database handle. In unit tests it gets mocked with the FakeDB.

type GCSUtil

type GCSUtil interface {
	// Download returns an io.ReadCloser for GCS object at given gcsPath.
	Download(ctx context.Context, gcsPath string) (io.ReadCloser, error)
	// UploadFile uploads contents of a file at filepath to gcsPath location in
	// GCS and sets object's contentType.
	// If gcsPath ends with .gz it also compresses the uploaded contents
	// and sets object's content type to application/gzip.
	UploadFile(ctx context.Context, gcsPath, filepath, contentType string) error
	// SplitURI takes a GCS URI and splits it into bucket and object names. If the URI does not have
	// the gs:// scheme, or the URI doesn't specify both a bucket and an object name, returns an error.
	SplitURI(url string) (bucket, name string, err error)
}

GCSUtil contains helper methods for reading/writing GCS objects.

type Server

type Server struct {
	*dbdpb.UnimplementedDatabaseDaemonServer
	// contains filtered or unexported fields
}

Server holds a database config.

func New

func New(ctx context.Context, cdbNameFromYaml string) (*Server, error)

New creates a new dbdaemon server.

func (*Server) BackupConfigFile

func (s *Server) BackupConfigFile(ctx context.Context, cdbName string) error

BackupConfigFile converts the binary spfile to human readable pfile and creates a snapshot copy named pfile.lkws (lkws -> last known working state). This file will be used for recovery in the event of parameter update workflow failure due to bad static parameters.

func (*Server) BootstrapDatabaseAsync

func (s *Server) BootstrapDatabaseAsync(ctx context.Context, req *dbdpb.BootstrapDatabaseAsyncRequest) (*lropb.Operation, error)

func (*Server) BounceDatabase

BounceDatabase starts/stops request specified database.

func (*Server) BounceListener

BounceListener starts/stops request specified listener.

func (*Server) CheckDatabaseState

CheckDatabaseState pings a database to check its status. This method has been tested for checking a CDB state.

func (*Server) CreateCDBAsync

func (s *Server) CreateCDBAsync(ctx context.Context, req *dbdpb.CreateCDBAsyncRequest) (*lropb.Operation, error)

CreateCDBAsync turns CreateCDB into an async call.

func (*Server) CreateDirs

CreateDirs RPC call to create directories along with any necessary parents.

func (*Server) CreateFile

CreateFile creates file based on request.

func (*Server) CreateListener

CreateListener create a new listener for the database.

func (*Server) CreatePasswordFile

CreatePasswordFile is a Database Daemon method to create password file.

func (*Server) DataPumpExportAsync

func (s *Server) DataPumpExportAsync(ctx context.Context, req *dbdpb.DataPumpExportAsyncRequest) (*lropb.Operation, error)

DataPumpExportAsync turns dataPumpExport into an async call.

func (*Server) DataPumpImportAsync

func (s *Server) DataPumpImportAsync(ctx context.Context, req *dbdpb.DataPumpImportAsyncRequest) (*lropb.Operation, error)

DataPumpImportAsync turns dataPumpImport into an async call.

func (*Server) DeleteDir

DeleteDir removes path and any children it contains.

func (*Server) DeleteOperation

func (s *Server) DeleteOperation(ctx context.Context, req *lropb.DeleteOperationRequest) (*empty.Empty, error)

DeleteOperation deletes a long running operation by its id.

func (*Server) DownloadDirectoryFromGCS

DownloadDirectoryFromGCS downloads objects from GCS bucket using prefix

func (*Server) FetchServiceImageMetaData

FetchServiceImageMetaData fetches the image metadata via the dbdaemon proxy.

func (*Server) FileExists

FileExists is used to check an existence of a file (e.g. useful for provisioning).

func (*Server) GetDatabaseName

GetDatabaseName returns database name.

func (*Server) GetDatabaseType

GetDatabaseType returns database type, eg. ORACLE_12_2_ENTERPRISE_NONCDB

func (*Server) GetOperation

func (s *Server) GetOperation(ctx context.Context, req *lropb.GetOperationRequest) (*lropb.Operation, error)

GetOperation returns details of a requested long running operation.

func (*Server) KnownPDBs

KnownPDBs runs a database query returning a list of PDBs known to a database. By default it doesn't include a seed PDB. It also by default doesn't pay attention to a state of a PDB. A caller can overwrite both of the above settings with the flags.

func (*Server) ListOperations

ListOperations returns a paged list of currently managed long running operations.

func (*Server) NID

func (s *Server) NID(ctx context.Context, req *dbdpb.NIDRequest) (*dbdpb.NIDResponse, error)

NID changes a database id and/or database name.

func (*Server) PhysicalRestoreAsync

func (s *Server) PhysicalRestoreAsync(ctx context.Context, req *dbdpb.PhysicalRestoreAsyncRequest) (*lropb.Operation, error)

PhysicalRestoreAsync turns physicalRestore into an async call.

func (*Server) ReadDir

ReadDir RPC call to read the directory named by path and returns Fileinfos for the path and children.

func (*Server) RecoverConfigFile

RecoverConfigFile generates the binary spfile from the human readable backup pfile

func (*Server) RunDataGuard

RunDataGuardBroker RPC call executes Oracle's Data Guard command line utility.

func (*Server) RunRMAN

RunRMAN will run the script to execute RMAN and create a physical backup in the target directory, then back it up to GCS if requested

func (*Server) RunRMANAsync

func (s *Server) RunRMANAsync(ctx context.Context, req *dbdpb.RunRMANAsyncRequest) (*lropb.Operation, error)

RunRMANAsync turns RunRMAN into an async call.

func (*Server) RunSQLPlus

RunSQLPlus executes oracle's sqlplus and returns output. This function only returns DBMS_OUTPUT and not any row data. To read from SELECTs use RunSQLPlusFormatted.

func (*Server) RunSQLPlusFormatted

func (s *Server) RunSQLPlusFormatted(ctx context.Context, req *dbdpb.RunSQLPlusCMDRequest) (*dbdpb.RunCMDResponse, error)

RunSQLPlusFormatted executes a SQL command and returns the row results. If instead you want DBMS_OUTPUT please issue RunSQLPlus

func (*Server) SetDnfsState

func (*Server) SetListenerRegistration

func (s *Server) SetListenerRegistration(ctx context.Context, req *dbdpb.SetListenerRegistrationRequest) (*dbdpb.BounceListenerResponse, error)

SetListenerRegistration is a Database Daemon method to create a static listener registration.

func (Server) String

func (s Server) String() string

Remove pdbConnStr from String(), as that may contain the pdb user/password Remove UnimplementedDatabaseDaemonServer field to improve logs for better readability

func (*Server) TNSPing

TNSPing RPC call executes Oracle's tnsping utility.

Jump to

Keyboard shortcuts

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