< Back
Add-CustomAvailabilityDB
Post
NAME Add-CustomAvailabilityDB
SYNOPSIS
Adds an existing Database to an existing Availabilty Group on all replicas provided
SYNTAX
Add-CustomAvailabilityDB [-Servers] <String[]> [-SqlAgName] <String> [[-Databases] <String[]>] [[-BackupDirectory]
<String>] [[-Timeout] <Int32>] [<CommonParameters>]
DESCRIPTION
Utilizes SMO to access SQL Server
If SQL Client Tools are not loaded on the machine it will error and fail.
Verifys DB exists on first server in list which is requried to be the Primary server. If not Aborts
Verifys DB doesnt exist in an availabilty database already. If it does Aborts.
Verifys DB is in Full Recovery mode if not puts db in Full recovery.
PARAMETERS
-Servers <String[]>
Servers participating in AlwaysOn, first server will be assumed to be where the database is which needs to be
replicated.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SqlAgName <String>
Availability Group Name database will be created in
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Databases <String[]>
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-BackupDirectory <String>
Backup location which all nodes will have access to. Used to backup and restore database from.
If Paramater is not passed function assumes Join Only operation and Backup and Restore operations are skipped.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Timeout <Int32>
Connection Timeout for SQL Server connections. Function defaults this to 0 so that backup and restore will
run as long as needed, however you have the ability to override.
Required? false
Position? 5
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases Test16
-BackupDirectory \\\\ohnas001\\SQLBackups -verbose
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases Test16 -verbose
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases
Test16,Test17,Test18 -verbose
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001,MISQL3001,OHSQL3001 -SqlAgName AG-TNWA3004 -Databases
Test16,Test17,Test18 -verbose
RELATED LINKS
SYNOPSIS
Adds an existing Database to an existing Availabilty Group on all replicas provided
SYNTAX
Add-CustomAvailabilityDB [-Servers] <String[]> [-SqlAgName] <String> [[-Databases] <String[]>] [[-BackupDirectory]
<String>] [[-Timeout] <Int32>] [<CommonParameters>]
DESCRIPTION
Utilizes SMO to access SQL Server
If SQL Client Tools are not loaded on the machine it will error and fail.
Verifys DB exists on first server in list which is requried to be the Primary server. If not Aborts
Verifys DB doesnt exist in an availabilty database already. If it does Aborts.
Verifys DB is in Full Recovery mode if not puts db in Full recovery.
PARAMETERS
-Servers <String[]>
Servers participating in AlwaysOn, first server will be assumed to be where the database is which needs to be
replicated.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SqlAgName <String>
Availability Group Name database will be created in
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Databases <String[]>
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-BackupDirectory <String>
Backup location which all nodes will have access to. Used to backup and restore database from.
If Paramater is not passed function assumes Join Only operation and Backup and Restore operations are skipped.
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Timeout <Int32>
Connection Timeout for SQL Server connections. Function defaults this to 0 so that backup and restore will
run as long as needed, however you have the ability to override.
Required? false
Position? 5
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases Test16
-BackupDirectory \\\\ohnas001\\SQLBackups -verbose
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases Test16 -verbose
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001 -SqlAgName AG-TNWA3004 -Databases
Test16,Test17,Test18 -verbose
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Add-CustomAvailabilityDB -Servers TNSQL3001,WASQL3001,MISQL3001,OHSQL3001 -SqlAgName AG-TNWA3004 -Databases
Test16,Test17,Test18 -verbose
RELATED LINKS