Documentation ¶
Overview ¶
Package dbdaemon implements a gRPC service for running privileged database ops, e.g. sqlplus, rman.
Index ¶
- type DB
- type GCSUtil
- type Server
- func (s *Server) BackupConfigFile(ctx context.Context, cdbName string) error
- func (s *Server) BootstrapDatabaseAsync(ctx context.Context, req *dbdpb.BootstrapDatabaseAsyncRequest) (*lropb.Operation, error)
- func (s *Server) BounceDatabase(ctx context.Context, req *dbdpb.BounceDatabaseRequest) (*dbdpb.BounceDatabaseResponse, error)
- func (s *Server) BounceListener(ctx context.Context, req *dbdpb.BounceListenerRequest) (*dbdpb.BounceListenerResponse, error)
- func (s *Server) CheckDatabaseState(ctx context.Context, req *dbdpb.CheckDatabaseStateRequest) (*dbdpb.CheckDatabaseStateResponse, error)
- func (s *Server) CreateCDBAsync(ctx context.Context, req *dbdpb.CreateCDBAsyncRequest) (*lropb.Operation, error)
- func (s *Server) CreateDirs(ctx context.Context, req *dbdpb.CreateDirsRequest) (*dbdpb.CreateDirsResponse, error)
- func (s *Server) CreateFile(ctx context.Context, req *dbdpb.CreateFileRequest) (*dbdpb.CreateFileResponse, error)
- func (s *Server) CreateListener(ctx context.Context, req *dbdpb.CreateListenerRequest) (*dbdpb.CreateListenerResponse, error)
- func (s *Server) CreatePasswordFile(ctx context.Context, req *dbdpb.CreatePasswordFileRequest) (*dbdpb.CreatePasswordFileResponse, error)
- func (s *Server) DataPumpExportAsync(ctx context.Context, req *dbdpb.DataPumpExportAsyncRequest) (*lropb.Operation, error)
- func (s *Server) DataPumpImportAsync(ctx context.Context, req *dbdpb.DataPumpImportAsyncRequest) (*lropb.Operation, error)
- func (s *Server) DeleteDir(ctx context.Context, req *dbdpb.DeleteDirRequest) (*dbdpb.DeleteDirResponse, error)
- func (s *Server) DeleteOperation(ctx context.Context, req *lropb.DeleteOperationRequest) (*empty.Empty, error)
- func (s *Server) DownloadDirectoryFromGCS(ctx context.Context, req *dbdpb.DownloadDirectoryFromGCSRequest) (*dbdpb.DownloadDirectoryFromGCSResponse, error)
- func (s *Server) FetchServiceImageMetaData(ctx context.Context, req *dbdpb.FetchServiceImageMetaDataRequest) (*dbdpb.FetchServiceImageMetaDataResponse, error)
- func (s *Server) FileExists(ctx context.Context, req *dbdpb.FileExistsRequest) (*dbdpb.FileExistsResponse, error)
- func (s *Server) GetDatabaseName(ctx context.Context, req *dbdpb.GetDatabaseNameRequest) (*dbdpb.GetDatabaseNameResponse, error)
- func (s *Server) GetDatabaseType(ctx context.Context, req *dbdpb.GetDatabaseTypeRequest) (*dbdpb.GetDatabaseTypeResponse, error)
- func (s *Server) GetOperation(ctx context.Context, req *lropb.GetOperationRequest) (*lropb.Operation, error)
- func (s *Server) KnownPDBs(ctx context.Context, req *dbdpb.KnownPDBsRequest) (*dbdpb.KnownPDBsResponse, error)
- func (s *Server) ListOperations(ctx context.Context, req *lropb.ListOperationsRequest) (*lropb.ListOperationsResponse, error)
- func (s *Server) NID(ctx context.Context, req *dbdpb.NIDRequest) (*dbdpb.NIDResponse, error)
- func (s *Server) PhysicalRestoreAsync(ctx context.Context, req *dbdpb.PhysicalRestoreAsyncRequest) (*lropb.Operation, error)
- func (s *Server) ReadDir(ctx context.Context, req *dbdpb.ReadDirRequest) (*dbdpb.ReadDirResponse, error)
- func (s *Server) RecoverConfigFile(ctx context.Context, req *dbdpb.RecoverConfigFileRequest) (*dbdpb.RecoverConfigFileResponse, error)
- func (s *Server) RunDataGuard(ctx context.Context, req *dbdpb.RunDataGuardRequest) (*dbdpb.RunDataGuardResponse, error)
- func (s *Server) RunRMAN(ctx context.Context, req *dbdpb.RunRMANRequest) (*dbdpb.RunRMANResponse, error)
- func (s *Server) RunRMANAsync(ctx context.Context, req *dbdpb.RunRMANAsyncRequest) (*lropb.Operation, error)
- func (s *Server) RunSQLPlus(ctx context.Context, req *dbdpb.RunSQLPlusCMDRequest) (*dbdpb.RunCMDResponse, error)
- func (s *Server) RunSQLPlusFormatted(ctx context.Context, req *dbdpb.RunSQLPlusCMDRequest) (*dbdpb.RunCMDResponse, error)
- func (s *Server) SetDnfsState(ctx context.Context, req *dbdpb.SetDnfsStateRequest) (*dbdpb.SetDnfsStateResponse, error)
- func (s *Server) SetListenerRegistration(ctx context.Context, req *dbdpb.SetListenerRegistrationRequest) (*dbdpb.BounceListenerResponse, error)
- func (s Server) String() string
- func (s *Server) TNSPing(ctx context.Context, req *dbdpb.TNSPingRequest) (*dbdpb.TNSPingResponse, error)
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 (*Server) BackupConfigFile ¶
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 (*Server) BounceDatabase ¶
func (s *Server) BounceDatabase(ctx context.Context, req *dbdpb.BounceDatabaseRequest) (*dbdpb.BounceDatabaseResponse, error)
BounceDatabase starts/stops request specified database.
func (*Server) BounceListener ¶
func (s *Server) BounceListener(ctx context.Context, req *dbdpb.BounceListenerRequest) (*dbdpb.BounceListenerResponse, error)
BounceListener starts/stops request specified listener.
func (*Server) CheckDatabaseState ¶
func (s *Server) CheckDatabaseState(ctx context.Context, req *dbdpb.CheckDatabaseStateRequest) (*dbdpb.CheckDatabaseStateResponse, error)
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 ¶
func (s *Server) CreateDirs(ctx context.Context, req *dbdpb.CreateDirsRequest) (*dbdpb.CreateDirsResponse, error)
CreateDirs RPC call to create directories along with any necessary parents.
func (*Server) CreateFile ¶
func (s *Server) CreateFile(ctx context.Context, req *dbdpb.CreateFileRequest) (*dbdpb.CreateFileResponse, error)
CreateFile creates file based on request.
func (*Server) CreateListener ¶
func (s *Server) CreateListener(ctx context.Context, req *dbdpb.CreateListenerRequest) (*dbdpb.CreateListenerResponse, error)
CreateListener create a new listener for the database.
func (*Server) CreatePasswordFile ¶
func (s *Server) CreatePasswordFile(ctx context.Context, req *dbdpb.CreatePasswordFileRequest) (*dbdpb.CreatePasswordFileResponse, error)
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 ¶
func (s *Server) DeleteDir(ctx context.Context, req *dbdpb.DeleteDirRequest) (*dbdpb.DeleteDirResponse, error)
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 ¶
func (s *Server) DownloadDirectoryFromGCS(ctx context.Context, req *dbdpb.DownloadDirectoryFromGCSRequest) (*dbdpb.DownloadDirectoryFromGCSResponse, error)
DownloadDirectoryFromGCS downloads objects from GCS bucket using prefix
func (*Server) FetchServiceImageMetaData ¶
func (s *Server) FetchServiceImageMetaData(ctx context.Context, req *dbdpb.FetchServiceImageMetaDataRequest) (*dbdpb.FetchServiceImageMetaDataResponse, error)
FetchServiceImageMetaData fetches the image metadata via the dbdaemon proxy.
func (*Server) FileExists ¶
func (s *Server) FileExists(ctx context.Context, req *dbdpb.FileExistsRequest) (*dbdpb.FileExistsResponse, error)
FileExists is used to check an existence of a file (e.g. useful for provisioning).
func (*Server) GetDatabaseName ¶
func (s *Server) GetDatabaseName(ctx context.Context, req *dbdpb.GetDatabaseNameRequest) (*dbdpb.GetDatabaseNameResponse, error)
GetDatabaseName returns database name.
func (*Server) GetDatabaseType ¶
func (s *Server) GetDatabaseType(ctx context.Context, req *dbdpb.GetDatabaseTypeRequest) (*dbdpb.GetDatabaseTypeResponse, error)
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 ¶
func (s *Server) KnownPDBs(ctx context.Context, req *dbdpb.KnownPDBsRequest) (*dbdpb.KnownPDBsResponse, error)
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 ¶
func (s *Server) ListOperations(ctx context.Context, req *lropb.ListOperationsRequest) (*lropb.ListOperationsResponse, error)
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 ¶
func (s *Server) ReadDir(ctx context.Context, req *dbdpb.ReadDirRequest) (*dbdpb.ReadDirResponse, error)
ReadDir RPC call to read the directory named by path and returns Fileinfos for the path and children.
func (*Server) RecoverConfigFile ¶
func (s *Server) RecoverConfigFile(ctx context.Context, req *dbdpb.RecoverConfigFileRequest) (*dbdpb.RecoverConfigFileResponse, error)
RecoverConfigFile generates the binary spfile from the human readable backup pfile
func (*Server) RunDataGuard ¶
func (s *Server) RunDataGuard(ctx context.Context, req *dbdpb.RunDataGuardRequest) (*dbdpb.RunDataGuardResponse, error)
RunDataGuardBroker RPC call executes Oracle's Data Guard command line utility.
func (*Server) RunRMAN ¶
func (s *Server) RunRMAN(ctx context.Context, req *dbdpb.RunRMANRequest) (*dbdpb.RunRMANResponse, error)
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 ¶
func (s *Server) RunSQLPlus(ctx context.Context, req *dbdpb.RunSQLPlusCMDRequest) (*dbdpb.RunCMDResponse, error)
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 (s *Server) SetDnfsState(ctx context.Context, req *dbdpb.SetDnfsStateRequest) (*dbdpb.SetDnfsStateResponse, error)
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 ¶
Remove pdbConnStr from String(), as that may contain the pdb user/password Remove UnimplementedDatabaseDaemonServer field to improve logs for better readability
func (*Server) TNSPing ¶
func (s *Server) TNSPing(ctx context.Context, req *dbdpb.TNSPingRequest) (*dbdpb.TNSPingResponse, error)
TNSPing RPC call executes Oracle's tnsping utility.