September 11, 2017 at 9:47 am
Hello SSC,
My ideal process for a new Availability Group install would be to:
1) Create the Availability Group (without the user database)
2) Create the Listener
3) Install application directly to the Listener
In the past I had posted a question regarding the "install order" for Availability Groups to see if the above was possible. Someone linked me to the following site saying that the user database needs to be installed, first. Under the "Create and Configure SQL Server 2012 AlwaysOn Availability Groups" section it does indeed say that a temporary user database might need to initially be created for the purpose of creating the AG.
https://blogs.technet.microsoft.com/canitpro/2013/08/19/step-by-step-creating-a-sql-server-2012-alwayson-availability-group/
Looking at Microsoft's "CREATE AVAILABILITY GROUP (Transact-SQL)" it describes how to create an AG using T-SQL. The DATABASE argument section states "The DATABASE clause is optional. If you omit it, the new availability group is empty". This sounds like what I'm looking to do, however, I am not able to get this to work - it is not accepting the syntax I give it.
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-availability-group-transact-sql
create availability group MyAG
--for database TestDB
replica on
'server1\instance' with
(
endpoint_url = 'TCP://server1:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = AUTOMATIC
),
'server2\instance' WITH
(
endpoint_url = 'TCP://server2:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = AUTOMATIC
)
Note: I commented out the argument specifying the database. If this were not commented out then the statement would run successfully.
Am I misunderstanding the "The DATABASE clause is optional" portion? Am I not using the correct syntax? Is anyone able to get this to work?
Thanks!
Dan
September 13, 2017 at 7:17 am
icester - Monday, September 11, 2017 9:47 AM
The FOR keywork is required, only the DATABASE clause is optional. The link above states
Microsoft Docs - CREATE AVAILABILITY GROUP (Transact-SQL)
The DATABASE clause is optional. If you omit it, the new availability group is empty.
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
September 13, 2017 at 9:44 am
I think this is a face-palm moment. The FOR word resolved it. Thanks Perry.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply