Skip to content

Remove-Database

SYNOPSIS

Remove a SQL database and its associated assets.

SYNTAX

Remove-Database [-HEATtask] <String> [-dbname] <String> [-SQLServer] <String> [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

This function removes a SQL database from a specified SQL Server. It performs the following actions: - Checks if the database exists before attempting removal. - Removes the database from the SQL Server. - Cleans up associated Active Directory groups. - Removes DNS aliases in Infoblox. - Deletes SQL users associated with the database. - Removes credentials from Passwordstate.

EXAMPLES

EXAMPLE 1

Remove-Database -HEATtask "12345" -dbname "TestDB" -SQLServer "SQLInstance1"

Removes the "TestDB" database from "SQLInstance1" and cleans up associated assets.

EXAMPLE 2

Remove-Database -HEATtask "67890" -dbname "ProdDB" -SQLServer "SQLInstance2"

Removes the "ProdDB" database from "SQLInstance2" and cleans up associated assets, including AD groups and DNS aliases.

PARAMETERS

-HEATtask

The HEAT task ID associated with the database removal.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-dbname

The name of the database to be removed.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SQLServer

The name of the SQL Server instance where the database resides.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES