 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
oracle_database_system_management_functions.go Package oracle_database_system_management_functions: helpers for CDB/PDB lifecycle and verification.
Index ¶
- func Close_pluggable_database_immediate(ctx context.Context, db *sql.DB, pdb_name string, instances_all bool) error
- func Create_open_save_state_pdb_from_seed(ctx context.Context, db *sql.DB, admin_user string, admin_password string) (string, string, error)
- func Create_pluggable_database_from_seed(ctx context.Context, db *sql.DB, pdb_name, admin_user, admin_password string) (string, error)
- func Discard_pluggable_database_state(ctx context.Context, db *sql.DB, pdb_name string) error
- func Drop_pluggable_database_including_datafiles(ctx context.Context, db *sql.DB, pdb_name string) error
- func Ensure_connected_to_cdb_root(ctx context.Context, db *sql.DB) error
- func Get_pdb_status(ctx context.Context, db *sql.DB, pdb_name string) (string, error)
- func Get_pdbseed_datafile_directory(ctx context.Context, db *sql.DB) (string, error)
- func Get_root_datafile_directory(ctx context.Context, db *sql.DB) (string, error)
- func Get_saved_state_info(ctx context.Context, db *sql.DB, pdb_name string) (string, string, error)
- func Get_user_sessions(ctx context.Context, db *sql.DB, pdb_name string) ([]user_session, error)
- func Kill_user_sessions_in_pdb(ctx context.Context, db *sql.DB, pdb_name string) error
- func Kill_user_sessions_in_pdb_until_gone(ctx context.Context, db *sql.DB, pdb_name string, max_attempts int, ...) error
- func Open_pluggable_database_read_write(ctx context.Context, db *sql.DB, pdb_name string) error
- func Save_pluggable_database_state(ctx context.Context, db *sql.DB, pdb_name string) error
- func Teardown_drop_pdb(ctx context.Context, db *sql.DB, pdb_name string, instances_all bool, ...) error
- func Verify_pdbseed_directory_matches_expected(ctx context.Context, db *sql.DB) error
- func Verify_pluggable_database_dropped(ctx context.Context, db *sql.DB, pdb_name string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close_pluggable_database_immediate ¶
func Close_pluggable_database_immediate(ctx context.Context, db *sql.DB, pdb_name string, instances_all bool) error
Close_pluggable_database_immediate closes the PDB immediately. If instances_all is true, issues "INSTANCES=ALL" (for RAC).
func Create_open_save_state_pdb_from_seed ¶
func Create_open_save_state_pdb_from_seed( ctx context.Context, db *sql.DB, admin_user string, admin_password string, ) (string, string, error)
Create_open_save_state_pdb_from_seed generates a PDB name using date_time_functions.Generate_pdb_name_from_timestamp(), creates the PDB from PDB$SEED, opens it READ WRITE, saves state, verifies, and returns (pdb_name, dest_dir).
func Create_pluggable_database_from_seed ¶
func Create_pluggable_database_from_seed(ctx context.Context, db *sql.DB, pdb_name, admin_user, admin_password string) (string, error)
Create_pluggable_database_from_seed creates a new PDB using FILE_NAME_CONVERT from PDB$SEED. It verifies the PDB$SEED path matches the expected path (root + PDBSEED\) before creating. admin_user/admin_password are used for the PDB admin account. Returns the computed destination directory (root\pdb_name\).
func Discard_pluggable_database_state ¶
Discard_pluggable_database_state removes any saved state for the PDB, preventing auto-open on next CDB restart.
func Drop_pluggable_database_including_datafiles ¶
func Drop_pluggable_database_including_datafiles(ctx context.Context, db *sql.DB, pdb_name string) error
Drop_pluggable_database_including_datafiles drops the PDB and removes its datafiles. The PDB must be closed on all instances (in RAC) before this succeeds.
func Ensure_connected_to_cdb_root ¶
Ensure_connected_to_cdb_root returns error unless current container is CDB$ROOT.
func Get_pdb_status ¶
Get_pdb_status returns the OPEN_MODE from V$PDBS for the given PDB name.
func Get_pdbseed_datafile_directory ¶
Get_pdbseed_datafile_directory returns the directory where PDB$SEED's SYSTEM01.DBF resides, normalized to Windows backslash with a trailing backslash.
func Get_root_datafile_directory ¶
Get_root_datafile_directory returns the directory where CDB$ROOT's SYSTEM01.DBF resides, normalized to Windows backslash with a trailing backslash.
func Get_saved_state_info ¶
Get_saved_state_info returns (STATE, RESTRICTED) from DBA_PDB_SAVED_STATES for the PDB (by CON_NAME). If the row is not present, it returns ("","") and nil error.
func Get_user_sessions ¶
Get_user_sessions returns all USER sessions attached to the given PDB. Note: the returned struct and its fields are unexported (snake_case). If you want callers in other packages to access fields directly, we can provide an exported DTO or accessor helpers.
func Kill_user_sessions_in_pdb ¶
Kill_user_sessions_in_pdb terminates all USER sessions attached to the given PDB (single pass).
func Kill_user_sessions_in_pdb_until_gone ¶
func Kill_user_sessions_in_pdb_until_gone( ctx context.Context, db *sql.DB, pdb_name string, max_attempts int, wait_between_attempts time.Duration, ) error
Kill_user_sessions_in_pdb_until_gone keeps killing USER sessions in the PDB until none remain or until max_attempts (default: 100) is reached. It rechecks with Get_user_sessions between attempts. wait_between_attempts controls the sleep duration between attempts.
func Open_pluggable_database_read_write ¶
Open_pluggable_database_read_write opens the given PDB READ WRITE.
func Save_pluggable_database_state ¶
Save_pluggable_database_state saves the auto-open state for the given PDB.
func Teardown_drop_pdb ¶
func Teardown_drop_pdb( ctx context.Context, db *sql.DB, pdb_name string, instances_all bool, kill_sessions bool, ) error
Teardown_drop_pdb closes, discards state, and drops a PDB INCLUDING DATAFILES. If kill_sessions is true, it will attempt to terminate USER sessions in that PDB first (retrying until none remain, up to 100 attempts, with 300ms between attempts). If instances_all is true, CLOSE IMMEDIATE will be issued with INSTANCES=ALL (for RAC). The function also verifies the drop via DBA_PDBS and inspects saved state after DISCARD STATE.
func Verify_pdbseed_directory_matches_expected ¶
Verify_pdbseed_directory_matches_expected checks that root\PDBSEED\ equals actual PDB$SEED location.
Types ¶
This section is empty.