Exporting using aPriori’s PowerShell script
aPriori provides a PowerShell script that dumps the contents of a database to a .sql file (this is somewhat similar to MySQL's mysqldump command):
sqlServerExport.ps1
Although this was originally developed for internal aPriori use, we are making this tool available to our customers.
The script includes some basic usage information which can be viewed as follows:
get-help sqlServerExport.ps1 -detailed
For example, to dump the contents of a database named 'apriori_15.2’:
sqlServerExport.ps1 -server 'localhost,1433' -user apriori -pass apriori -db apriori_15.2 -out dbdump.sql
To use native authentication simply omit the '-user' and '-pass' parameters.
To load this dump into another database, first create a new database, then import the dump into that new database ('apriori_copy' in this example) using sqlcmd:
sqlcmd -S "localhost,1433" -d apriori_copy -i dbdump.sql
Note: The 'SQL Server PowerShell provider' must be installed on the machine where the script is run. This is included in SQL Server's Management Tools - Basic install feature and can be installed independently of the SQL Server:
C:\fb53e3733db9a0189f3bca5e6ab68d74
Note: Dumping a large database might be best performed on the server itself to avoid shipping the entire database over the network.