February 7, 2019 at 2:15 am
Hi,
I am using sqlpackage.exe to export only metadata of a database to a file, and then import as another database.
However I would like to position the datafiles to another location. Is that possible with sqlpackage or should I use another method?
The code I use is:
if (-not ($env:path).Contains('C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin'))
{ $env:path = $env:Path + ';C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin'; }
sqlpackage /a:extract /of:true /scs:"server=myserver\myinstance;database=MyDB;trusted_connection=true" /tf:"C:\DACPAC\MyDB.dacpac";
sqlpackage /a:publish /sf:"C:\DACPAC\MyDB.dacpac" /tcs:"server=myserver\myinstance;database=MyDB_placeholder;trusted_connection=true"
The reason I am doing this is to be able to keep one partition as a seperate database for restore if needed, after I remove oldest partition.
February 7, 2019 at 2:27 am
Ah I am realising now that sqlspackage creates all files according to Database default locations settings in the instance properties.
I think that is sufficient. I read somewhere that sqlpackage only supports PRIMARY filegroup, but it seems that that is not the case. It does support partitions with different filegroup names as well.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply