Documentation ¶
Index ¶
- Variables
- func ChangePasswordCmd(user, newIdentifier string) string
- func CreateUserCmd(user, identifier string) string
- func FetchMetaDataFromImage() (oracleHome, cdbName, version string, err error)
- func GetDefaultInitParams(dbName string) map[string]string
- func GrantUserCmd(user, permissions string) string
- func LoadTemplateListener(l *ListenerInput, name, port, protocol string) (string, string, string, error)
- func MakeDirs(ctx context.Context, dirs []string, uid, gid uint32) error
- func MapToSlice(kv map[string]string) []string
- func MergeInitParams(defaultParams map[string]string, userParams []string) (map[string]string, error)
- func MoveConfigFiles(OracleHome, CDBName string) error
- func MoveFile(sourceFile, destFile string) error
- func RelinkConfigFiles(OracleHome, CDBName string) error
- func RemoveConfigFileLinks(OracleHome, CDBName string) error
- type BootstrapTask
- func NewBootstrapDatabaseTask(ctx context.Context, iscdb bool, isSeeded bool, ...) (*BootstrapTask, error)
- func NewBootstrapDatabaseTaskForStandby(cdbName, dbDomain string, dbdClient dbdpb.DatabaseDaemonClient) *BootstrapTask
- func NewBootstrapDatabaseTaskForUnseeded(cdbName, dbUniqueName, dbDomain string, dbdClient dbdpb.DatabaseDaemonClient) *BootstrapTask
- type ListenerInput
- type OSUtilImpl
Constants ¶
This section is empty.
Variables ¶
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 ¶
ChangePasswordCmd returns sql cmd to change user identifier.
func CreateUserCmd ¶
CreateUserCmd returns sql cmd to create a user with provided identifier.
func FetchMetaDataFromImage ¶
FetchMetaDataFromImage returns Oracle Home, CDB name, Version by parsing database image metadata file if it exists. Otherwise, environment variables are used.
func GetDefaultInitParams ¶
GetDefaultInitParams returns default init parameters, which will be set in DB creation.
func GrantUserCmd ¶
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 MapToSlice ¶
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 ¶
MoveConfigFiles moves Database config files from Oracle standard paths to the persistent configuration in the PD.
func MoveFile ¶
MoveFile moves a file between directories. os.Rename() gives error "invalid cross-device link" for Docker container with Volumes.
func RelinkConfigFiles ¶
RelinkConfigFiles creates softlinks under the Oracle standard paths from the persistent configuration files in the PD.
func RemoveConfigFileLinks ¶
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).