0
votes

I am an administrator of Azure DevOps Server 2019 Update 1.1 in an organization. I will migrate our collection from the on-premises server to Azure DevOps Services. Currently, I am on the step of using SqlPackage.exe to generate a DACPAC file. https://docs.microsoft.com/en-us/azure/devops/migrate/migration-import?view=azure-devops

According to this reference, the command example to generate DACPAC is as below.

SqlPackage.exe /sourceconnectionstring:"Data Source=localhost;Initial Catalog=Foo;Integrated Security=True" /targetFile:C:\DACPAC\Foo.dacpac /action:extract /p:ExtractAllTableData=true /p:IgnoreUserLoginMappings=true /p:IgnorePermissions=true /p:Storage=Memory

However, I cannot understand what is Initial Catalog. The reference said Initial Catalog - Name of the collection database. But I could not find the name of the collection database in Azure DevOps Server management console.

I referred another article on dev.to
https://dev.to/timothymcgrath/the-great-azure-devops-migration-part-6-import-2obc
By this article, Initial Catalog=[COLLECTION_NAME], and the collection name in my Azure DevOps Server is "DefaultCollection" (default name).

Then, I tried the following command then failed.

C:\Program Files (x86)\Microsoft Visual Studio\2017\SQL\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130> ./SqlPackage.exe /sourceconnectionstring:”Data Source=localhost;Initial Catalog=DefaultCollection;Integrated Security=True” /targetFile:C:\DefaultCollection.dacpac /action:extract /p:ExtractAllTableData=true /p:IgnoreUserLoginMappings=true /p:IgnorePermissions=true /p:Storage=Memory
Connecting to database 'DefaultCollection' on server 'localhost'.
Extracting schema
Extracting schema from database
*** Error extracting database:Could not connect to database server.

(provider: Named Pipes Provider, error: 40

Is this error caused by wrong Initial Catalog?
How do I find the correct Initial Catalog - Name of the collection database?

Environment and pre-conditions

  • Windows 10 Pro
  • SqlPackage.exe installed from SSDT for Visual Studio 2017
  • The machine where commands are executed and where Azure DevOps Server running is the same
    • so, DataSource=localhost should be correct, I think
  • Detached my collection by Azure DevOps Server management console
  • SQL Server Express for my Azure DevOps server is running
2
the name of the collection in Management Console is usually the name of the database catalog, maybe prefixed with tfs_. If this is not the case, try using sql server management studio to connect to the server and find out the names of the catalgos-collections. - Mario Dietner
I tried SQL Server Management Studio. Successfully connected to the database and found the name "AzureDevOps_DefaultCollection". Thank you. - masskaneko

2 Answers

0
votes

Look at the admin console on your app tier. That shows you all of the databases.

For what it's worth, the standard name for the default collection database is Tfs_DefaultCollection. It may be different in your case, but that's a safe bet.

0
votes

Resolved. The database name in the case is "AzureDevOps_DefaultCollection". It could be found by Azure DevOps Management Console in the feature of selecting attach. (Application Tier -> Team Project Collections) Or, by using SQL Server Management Studio, we can also find "AzureDevOps_DefaultCollection".

And, in my case, DataSource=localhost is wrong, DataSource=<hostname>\SQLEXPRESS is correct. I noticed this answer when I connect to my database by SQL Server Management Studio. Finally, I successfully generated a DACPAC file.

Connecting to database 'AzureDevOps_DefaultCollection' on server '<my machine host name>\SQLEXPRESS'.
Extracting schema
Extracting schema from database
Resolving references in schema model
Validating schema model for data package
Validating schema
Exporting data from database
Exporting data
Processing Export.
Processing Table '[dbo].[tbl_PropertyValue]'.
Processing Table '[Task].[tbl_LibraryItemString]'.
...
...
...
Processing Table '[Search].[tbl_FileMetadataStore]'.
Processing Table '[dbo].[SequenceIds]'.
Successfully extracted database and saved it to file 'C:\DACPAC\DefaultCollection.dacpac'.

Thanks so much! Mario Dietner, Daniel Mann.