provision

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ListenerTemplateName is the filepath for the listener file template in the container.
	ListenerTemplateName = filepath.Join(consts.ScriptDir, "bootstrap-database-listener.template")

	// TnsnamesTemplateName is the filepath for the tnsnames file template in the container.
	TnsnamesTemplateName = filepath.Join(consts.ScriptDir, "bootstrap-database-tnsnames.template")

	// ControlFileTemplateName is the filepath for the control file template in the container.
	ControlFileTemplateName = filepath.Join(consts.ScriptDir, "bootstrap-database-crcf.template")

	// InitOraTemplateName is the filepath for the initOra file template in the container for Oracle EE/SE.
	InitOraTemplateName = filepath.Join(consts.ScriptDir, "bootstrap-database-initfile.template")

	// InitOraXeTemplateName is the filepath for the initOra file template in the container for Oracle 18c XE.
	InitOraXeTemplateName = filepath.Join(consts.ScriptDir, "bootstrap-database-initfile-oracle-xe.template")

	// SQLNetSrc is the filepath for the control file template in the container.
	SQLNetSrc = filepath.Join(consts.ScriptDir, fileSQLNet)
)

Functions

func ChangePasswordCmd

func ChangePasswordCmd(user, newIdentifier string) string

ChangePasswordCmd returns sql cmd to change user identifier.

func CreateUserCmd

func CreateUserCmd(user, identifier string) string

CreateUserCmd returns sql cmd to create a user with provided identifier.

func FetchMetaDataFromImage

func FetchMetaDataFromImage() (oracleHome, cdbName, version string, err error)

FetchMetaDataFromImage returns Oracle Home, CDB name, Version by parsing database image metadata file if it exists. Otherwise, environment variables are used.

func GetDefaultInitParams

func GetDefaultInitParams(dbName string) map[string]string

GetDefaultInitParams returns default init parameters, which will be set in DB creation.

func GrantUserCmd

func GrantUserCmd(user, permissions string) string

GrantUserCmd returns sql cmd to grant permissions to a user. Permissions are either a single permission or a list of permissions separated by comma.

func LoadTemplateListener

func LoadTemplateListener(l *ListenerInput, name, port, protocol string) (string, string, string, error)

LoadTemplateListener applies listener input to listener and tns template. It returns listener tns and sqlnet in string. In contrast to pfile, env file and a control file, there may be multiple listeners and a search/replace in that file is different, so it's easier to load it while iterating over listeners, not ahead of time. This method also generates the tnsnames based on the port numbers of the listeners.

func MakeDirs

func MakeDirs(ctx context.Context, dirs []string, uid, gid uint32) error

MakeDirs creates directories in the container.

func MapToSlice

func MapToSlice(kv map[string]string) []string

MapToSlice converts map[string]string into a string slice with format "<key>=<value>".

func MergeInitParams

func MergeInitParams(defaultParams map[string]string, userParams []string) (map[string]string, error)

MergeInitParams merges default parameters and user specified parameters, and returns merged parameters.

func MoveConfigFiles

func MoveConfigFiles(OracleHome, CDBName string) error

MoveConfigFiles moves Database config files from Oracle standard paths to the persistent configuration in the PD.

func MoveFile

func MoveFile(sourceFile, destFile string) error

MoveFile moves a file between directories. os.Rename() gives error "invalid cross-device link" for Docker container with Volumes.

func RelinkConfigFiles

func RelinkConfigFiles(OracleHome, CDBName string) error

RelinkConfigFiles creates softlinks under the Oracle standard paths from the persistent configuration files in the PD.

func RemoveConfigFileLinks(OracleHome, CDBName string) error

RemoveConfigFileLinks removes softlinks of config files under the Oracle standard path. Prepare for database creation through DBCA.

Types

type BootstrapTask

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

BootstrapTask defines a task can be invoked to bootstrap an Oracle DB.

func NewBootstrapDatabaseTask

func NewBootstrapDatabaseTask(ctx context.Context, iscdb bool, isSeeded bool, cdbNameFromImage, cdbNameFromYaml, version, zone, host, DBDomain string, pgaMB, sgaMB uint64, provisioned bool, dbdClient dbdpb.DatabaseDaemonClient) (*BootstrapTask, error)

NewBootstrapDatabaseTask returns a Task which can be invoked to bootstrap a DB.

func NewBootstrapDatabaseTaskForStandby

func NewBootstrapDatabaseTaskForStandby(cdbName, dbDomain string, dbdClient dbdpb.DatabaseDaemonClient) *BootstrapTask

NewBootstrapDatabaseTaskForStandby returns a Task for bootstrapping a standby instance.

func NewBootstrapDatabaseTaskForUnseeded

func NewBootstrapDatabaseTaskForUnseeded(cdbName, dbUniqueName, dbDomain string, dbdClient dbdpb.DatabaseDaemonClient) *BootstrapTask

NewBootstrapDatabaseTaskForUnseeded returns a Task for bootstrapping a CDB created during instance creation.

func (*BootstrapTask) Call

func (task *BootstrapTask) Call(ctx context.Context) error

Call triggers bootstrap process for an Oracle DB.

func (*BootstrapTask) GetName

func (task *BootstrapTask) GetName() string

GetName returns task name.

type ListenerInput

type ListenerInput struct {
	PluggableDatabaseNames []string
	DatabaseName           string
	DatabaseBase           string
	DatabaseHome           string
	ListenerName           string
	ListenerPort           string
	ListenerProtocol       string
	DatabaseHost           string
	DBDomain               string
}

ListenerInput is the struct, which will be applied to the listener template.

type OSUtilImpl

type OSUtilImpl struct{}

OSUtilImpl contains utility methods for fetching user/group metadata.

func (*OSUtilImpl) Lookup

func (*OSUtilImpl) Lookup(username string) (*user.User, error)

Lookup method obtains the user's metadata (uid, gid, username, name, homedir).

func (*OSUtilImpl) LookupGroup

func (*OSUtilImpl) LookupGroup(name string) (*user.Group, error)

LookupGroup method obtains the group's metadata (gid, name).

Jump to

Keyboard shortcuts

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