You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Prevents restores from using the source server's folder structure when restoring databases to secondary replicas.<br/>
955
+
When enabled, Restore-DbaDatabase uses the replica's default data and log directories instead of attempting to replicate the primary's folder structure.<br/>
956
+
This is automatically set to true when the primary and replica servers run on different operating system platforms (e.g., Windows primary with Linux replica).<br></p>
957
+
<table>
958
+
<thead>
959
+
<tr>
960
+
<th></th>
961
+
<th></th>
962
+
</tr>
963
+
</thead>
964
+
<tbody>
965
+
<tr>
966
+
<td>Alias</td>
967
+
<td></td>
968
+
</tr>
969
+
<tr>
970
+
<td>Required</td>
971
+
<td>False</td>
972
+
</tr>
973
+
<tr>
974
+
<td>Pipeline</td>
975
+
<td>false</td>
976
+
</tr>
977
+
<tr>
978
+
<td>Default Value</td>
979
+
<td>False</td>
980
+
</tr>
981
+
</tbody>
982
+
</table>
951
983
<h5id="enableexception">-EnableException</h5>
952
984
<p>By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.<br/>
953
985
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.<br/>
<p>The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances. <br></p>
<p>Attempts connection with proper TLS validation first, then retries with TrustServerCertificate if the initial connection fails due to certificate validation.<br/>
1345
+
Provides a secure-by-default approach for mixed environments where some servers have valid certificates and others do not.<br/>
1346
+
Only retries on certificate validation failures, not on other connection errors like authentication or network issues.<br></p>
<p>Copies all data from [tempdb].[dbo].[vw1] (3-part name) view on instance sql1 to an auto-created table [SampleDb].[SampleSchema].[SampleTable] on instance sql1<br></p>
591
+
<h5id="example-9">Example: 9</h5>
592
+
<pre><code>PS C:\> $params = @{
593
+
>> SqlInstance = "SERVER001"
594
+
>> Database = "MyDatabaseName"
595
+
>> View = "sys.schemas"
596
+
>> Query = "SELECT 0, DB_NAME(), [name] FROM sys.schemas"
<p>Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2000 or greater.<br></p>
@@ -822,7 +840,9 @@ <h5 id="view">-View</h5>
822
840
</table>
823
841
<h5id="query">-Query</h5>
824
842
<p>Custom SQL SELECT query to use as the data source instead of copying the entire table or view. Supports 3 or 4-part object names.<br/>
825
-
Use this when you need to filter rows, join multiple tables, or transform data during the copy operation. Still requires specifying a Table or View parameter for metadata purposes.<br></p>
843
+
Use this when you need to filter rows, join multiple tables, or transform data during the copy operation. Still requires specifying a Table or View parameter for metadata purposes.<br/>
844
+
Note: Columns are mapped by ordinal position. If the destination table has an identity column, include a placeholder value (e.g., 0) in your SELECT list at that position.<br/>
845
+
The placeholder will be ignored and the identity value auto-generated unless -KeepIdentity is specified.<br></p>
<p>When used together with Query parameter, force the use of explicit column mapping (name-based) instead of switching over to ordinal position mapping. Use with care if query contains aliases.<br/>
874
+
Default behaviour when using Query parameter is to use ordinal position mapping, due to the possibility of the query including aliases (SELECT x AS y) which could lead to column mismatching and data<br/>
875
+
not copying.<br/>
876
+
The downside of it automatically switching over to ordinal mapping is that it also tries to copy over computed columns, which will cause it to fail.<br></p>
877
+
<table>
878
+
<thead>
879
+
<tr>
880
+
<th></th>
881
+
<th></th>
882
+
</tr>
883
+
</thead>
884
+
<tbody>
885
+
<tr>
886
+
<td>Alias</td>
887
+
<td></td>
888
+
</tr>
889
+
<tr>
890
+
<td>Required</td>
891
+
<td>False</td>
892
+
</tr>
893
+
<tr>
894
+
<td>Pipeline</td>
895
+
<td>false</td>
896
+
</tr>
897
+
<tr>
898
+
<td>Default Value</td>
899
+
<td>False</td>
900
+
</tr>
901
+
</tbody>
902
+
</table>
852
903
<h5id="autocreatetable">-AutoCreateTable</h5>
853
904
<p>Automatically creates the destination table if it doesn't exist, using the same structure as the source table.<br/>
854
905
Essential for initial data migrations or when copying to new environments where destination tables haven't been created yet.<br></p>
Want to see the Bill Of Health for this command? Check out <ahref="https://dataplat.github.io/boh#Export-DbaDacPackage">Export-DbaDacPackage</a>.</p>
487
487
<h2id="synopsis">Synopsis</h2>
488
-
<p>Creates DACPAC or BACPAC deployment packages from SQL Server databases using SqlPackage</p>
488
+
<p>Exports DACPAC or BACPAC packages from SQL Server databases using the DacFx framework</p>
489
489
<h2id="description">Description</h2>
490
-
<p>Creates database deployment packages for version control, migrations, and schema distribution. Generates DACPAC files containing database schema definitions or BACPAC files that include both schema and data. This automates the SqlPackage utility so you don't have to remember complex command-line syntax or manage connection strings manually.</p>
490
+
<p>Creates database deployment packages for version control, migrations, and schema distribution. Generates DACPAC files containing database schema definitions or BACPAC files that include both schema and data.</p>
491
491
<p>Perfect for creating deployable packages from development databases, capturing schema snapshots for source control, or preparing migration artifacts for different environments. The function handles multiple databases in batch operations and provides flexible table filtering when you only need specific objects.</p>
492
-
<p>Uses Microsoft DAC Services under the hood with automatic SqlPackage installation if needed. Note that extraction can fail with three-part references to external databases or complex cross-database dependencies.</p>
492
+
<p>Uses Microsoft DacFx API from dbatools.library. Note that extraction can fail with three-part references to external databases or complex cross-database dependencies.</p>
493
493
<p>For help with the extract action parameters and properties, refer to <ahref="https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-extract">https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-extract</a></p>
<p>Using extended parameters to over-write the files and performs the extraction in quiet mode to C:\temp\sql2016-SharePoint_Config-20201227140759-dacpackage.dacpac. Uses command line instead of SMO<br>
547
-
behind the scenes. As noted the generated filename will contain the server name, database name, and the current timestamp in the "%Y%m%d%H%M%S" format.<br></p>
546
+
<p>Using extended parameters to over-write the files and performs the extraction in quiet mode to C:\temp\sql2016-SharePoint_Config-20201227140759-dacpackage.dacpac. Uses SqlPackage.exe command line <br>
547
+
instead of DacFx API behind the scenes. As noted the generated filename will contain the server name, database name, and the current timestamp in the "%Y%m%d%H%M%S" format.<br></p>
Want to see the Bill Of Health for this command? Check out <ahref="https://dataplat.github.io/boh#Get-DbaDbUdf">Get-DbaDbUdf</a>.</p>
487
487
<h2id="synopsis">Synopsis</h2>
488
-
<p>Retrieves User Defined Functions from SQL Server databases with filtering and metadata</p>
488
+
<p>Retrieves User Defined Functions and User Defined Aggregates from SQL Server databases with filtering and metadata</p>
489
489
<h2id="description">Description</h2>
490
-
<p>Retrieves all User Defined Functions (UDFs) from one or more SQL Server databases, returning detailed metadata including schema, creation dates, and data types. This function helps DBAs inventory custom database logic, analyze code dependencies during migrations, and audit user-created functions for security or performance reviews. You can filter results by database, schema, or function name, and exclude system functions to focus on custom business logic.</p>
490
+
<p>Retrieves all User Defined Functions (UDFs) and User Defined Aggregates from one or more SQL Server databases, returning detailed metadata including schema, creation dates, and data types. This function helps DBAs inventory custom database logic, analyze code dependencies during migrations, and audit user-created functions for security or performance reviews. You can filter results by database, schema, or function name, and exclude system functions to focus on custom business logic.</p>
<p>Gets the User Defined Functions for all databases that are not system objects (there can be 100+ system User Defined Functions in each DB)<br></p>
524
+
<p>Gets the User Defined Functions and User Defined Aggregates for all databases that are not system objects (there can be 100+ system User Defined Functions in each DB)<br></p>
0 commit comments