Brent Ozar maintains a Microsoft SQL Server version of the public Stack Overflow data export.
He provides detailed explanation on how to download, extract and use it.
You need to download the desired versions and put them on your network.
For easy deployment of the StackOverflow database, I’ve put together a PowerShell function that takes care of downloading the files from your domain (if needed), extracting the archives and mounting the files on an existing instance.
The function uses the dbatools and 7Zip4PowerShell PowerShell modules. If they are not present on the host, they will be installed from the official PSGallery.
1 |
Get-StackOverflow -Url "C:\Temp\StackOverflow2010.7z" -Path D:\Temp -SqlInstance 'server\instance' |
This will extract the StackOverflow2010.7z archive to D:\Temp, then it will get the default path for Data and Log from the ‘server\instance’, it will move the data and the log files to the appropriate location and then mount them.
The function also offers the possibility to specify that the data and log files should be placed in custom locations.
1 |
Get-StackOverflow -Url "\\TF-WINGUI01\c$\Temp\StackOverflow2010.7z" -Path D:\Temp -SqlInstance 'localhost,10001' -DataPath D:\MSSQL\Data -LogPath D:\MSSQL\Log |
1 |
Get-StackOverflow -Url "https://downloads.yourdomain.local/StackOverflow2010.7z" -Path D:\Temp -SqlInstance 'localhost,10001' -DataPath D:\MSSQL\Data -LogPath D:\MSSQL\Log |
The full version of the script is available on my GitHub account.
https://github.com/cviorel/PowerShell/blob/main/Get-StackOverflow.ps1
Hope this comes in handy!
Enjoy!