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
description: Learn how log shipping applies the transaction log from every insertion, update, or deletion made on the primary database to the secondary database.
4
4
author: MikeRayMSFT
5
5
ms.author: mikeray
6
-
ms.date: "03/14/2017"
6
+
ms.date: "04/11/2023"
7
7
ms.service: sql
8
8
ms.subservice: log-shipping
9
9
ms.topic: conceptual
@@ -24,7 +24,7 @@ helpviewer_keywords:
24
24
For information about recovering databases involved in replication without any need to reconfigure replication, see [Back Up and Restore Replicated Databases](../../relational-databases/replication/administration/back-up-and-restore-replicated-databases.md).
25
25
26
26
> [!NOTE]
27
-
> We recommend using database mirroring, rather than log shipping, to provide availability for the publication database. For more information, see [Database Mirroring and Replication (SQL Server)](../../database-engine/database-mirroring/database-mirroring-and-replication-sql-server.md).
27
+
> Use Always On availability groups, rather than log shipping, to provide availability for the publication database. For more information, see [Configure replication with Always On availability groups](../availability-groups/windows/configure-replication-for-always-on-availability-groups-sql-server.md).
28
28
29
29
## Requirements and Procedures for Replicating from the Secondary If the Primary Is Lost
30
30
Be aware of the following requirements and considerations:
@@ -107,7 +107,5 @@ helpviewer_keywords:
107
107
108
108
## See Also
109
109
[SQL Server Replication](../../relational-databases/replication/sql-server-replication.md)
[Configure replication with Always On availability groups](../availability-groups/windows/configure-replication-for-always-on-availability-groups-sql-server.md)
Copy file name to clipboardExpand all lines: docs/relational-databases/security/authentication-access/getting-started-with-database-engine-permissions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,11 +192,11 @@ For a graphic showing the relationships among the [!INCLUDE[ssDE](../../../inclu
192
192
193
193
- The permissions granted to users and user-defined fixed database roles can be examined by using the `sys.database_permissions` view.
194
194
195
-
- Database role membership can be examined by using the `sys. sys.database_role_members` view.
195
+
- Database role membership can be examined by using the `sys.database_role_members` view.
196
196
197
197
- Server role membership can be examined by using the `sys.server_role_members` view. This view isn't available in [!INCLUDE[ssSDS](../../../includes/sssds-md.md)].
198
198
199
-
- For additional security related views, see [Security Catalog Views (Transact-SQL)](../../../relational-databases/system-catalog-views/security-catalog-views-transact-sql.md).
199
+
- For additional security related views, see [Security Catalog Views (Transact-SQL)](../../../relational-databases/system-catalog-views/security-catalog-views-transact-sql.md).
|**name**|**sysname**|Name of the principal. Is unique within a server.|
29
29
|**principal_id**|**int**|ID number of the Principal. Is unique within a server.|
30
-
|**sid**|**varbinary(85)**|SID (Security-IDentifier) of the principal. If Windows principal, then it matches Windows SID.|
31
-
|**type**|**char(1)**|Principal type:<br /><br /> S = SQL login<br /><br /> U = Windows login<br /><br /> G = Windows group<br /><br /> R = Server role<br /><br /> C = Login mapped to a certificate<br /><br /> E = External Login from Azure Active Directory<br /><br /> X = External group from Azure Active Directory group or applications<br /><br /> K = Login mapped to an asymmetric key|
32
-
|**type_desc**|**nvarchar(60)**|Description of the principal type:<br /><br /> SQL_LOGIN<br /><br /> WINDOWS_LOGIN<br /><br /> WINDOWS_GROUP<br /><br /> SERVER_ROLE<br /><br /> CERTIFICATE_MAPPED_LOGIN<br /><br /> EXTERNAL_LOGIN<br /><br /> EXTERNAL_GROUP<br /><br /> ASYMMETRIC_KEY_MAPPED_LOGIN|
30
+
|**sid**|**varbinary(85)**|SID (Security-IDentifier) of the principal.|
31
+
|**type**|**char(1)**|Principal type:<br /><br /> S = SQL login<br />R = Server role<br /><br /> E = External Login from Azure Active Directory<br /><br /> X = External group from Azure Active Directory group or applications<br />|
32
+
|**type_desc**|**nvarchar(60)**|Description of the principal type:<br /><br /> SQL_LOGIN<br /><br /> SERVER_ROLE<br /><br /> EXTERNAL_LOGIN<br /><br /> EXTERNAL_GROUP<br />|
33
33
|**is_disabled**|**int**|1 = Login is disabled.|
34
34
|**create_date**|**datetime**|Time at which the principal was created.|
35
35
|**modify_date**|**datetime**|Time at which the principal definition was last modified.|
|**is_fixed_role**|**bit**|Returns 1 if the principal is one of the built-in server roles with fixed permissions. For more information, see [Server-Level Roles](../../relational-databases/security/authentication-access/server-level-roles.md).|
41
41
42
42
## Permissions
43
-
Any login can see their own login name, the system logins, and the fixed server roles. To see other logins, requires ALTER ANY LOGIN, or a permission on the login. To see user-defined server roles, requires ALTER ANY SERVER ROLE, or membership in the role.
44
-
45
-
Azure SQL Database: only members of the server role **##MS_LoginManager##** or the special database role loginmanager in `master` or the Azure AD admin and server sdmin can see all logins.
46
-
43
+
Any login can see their own login name, the system logins, and the fixed server roles. Only members of the server role **##MS_LoginManager##** or the special database role loginmanager in `master` or the Azure AD admin and server Admin can see all logins.
44
+
47
45
48
46
[!INCLUDE[ssCatViewPerm](../../includes/sscatviewperm-md.md)] For more information, see [Metadata Visibility Configuration](../../relational-databases/security/metadata-visibility-configuration.md).
47
+
48
+
> [!NOTE]
49
+
> The permissions of fixed server roles do not appear in sys.server_permissions.
49
50
50
-
## Examples
51
-
The following query lists the permissions explicitly granted or denied to server principals.
52
-
53
-
> [!IMPORTANT]
54
-
> The permissions of fixed server roles (other than public) do not appear in sys.server_permissions. Therefore, server principals may have additional permissions not listed here.
[!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] provides two features that track changes to data in a database: [change data capture](#Capture) and [change tracking](#Tracking). These features enable applications to determine the DML changes (insert, update, and delete operations) that were made to user tables in a database. Change data capture and change tracking can be enabled on the same database; no special considerations are required. For the editions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] that support change data capture and change tracking, see [Editions and supported features of SQL Server](../../sql-server/editions-and-components-of-sql-server-2019.md).
26
26
27
-
Change tracking is supported by [!INCLUDE[ssazure_md](../../includes/ssazure_md.md)]. Change data capture is only supported in [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] and Azure SQL Managed Instance.
28
-
29
27
## Benefits of using change data capture or change tracking
30
28
31
29
The ability to query for data that has changed in a database is an important requirement for some applications to be efficient. Typically, to determine data changes, application developers must implement a custom tracking method in their applications by using a combination of triggers, **timestamp** columns, and additional tables. Creating these applications usually involves a lot of work to implement, leads to schema updates, and often carries a high performance overhead.
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CTP 1.1, the data_file can be in Azure Blob Storage. For examples, see [Examples of Bulk Access to Data in Azure Blob Storage](../../relational-databases/import-export/examples-of-bulk-access-to-data-in-azure-blob-storage.md).
158
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], the data_file can be in Azure Blob Storage. For examples, see [Examples of Bulk Access to Data in Azure Blob Storage](../../relational-databases/import-export/examples-of-bulk-access-to-data-in-azure-blob-storage.md).
160
159
161
160
> [!IMPORTANT]
162
161
> Azure SQL Database only supports reading from Azure Blob Storage.
163
162
164
163
#### BULK Error handling options
165
164
166
165
##### ERRORFILE
166
+
167
167
`ERRORFILE` ='*file_name*' specifies the file used to collect rows that have formatting errors and cannot be converted to an OLE DB rowset. These rows are copied into this error file from the data file "as is."
168
168
169
169
The error file is created at the start of the command execution. An error will be raised if the file already exists. Additionally, a control file that has the extension .ERROR.txt is created. This file references each row in the error file and provides error diagnostics. After the errors have been corrected, the data can be loaded.
Is a named external data source pointing to the Azure Blob storage location of the error file that will contain errors found during the import. The external data source must be created using the `TYPE = BLOB_STORAGE` option added in [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CTP 1.1. For more information, see [CREATE EXTERNAL DATA SOURCE](../../t-sql/statements/create-external-data-source-transact-sql.md).
174
+
175
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], is a named external data source pointing to the Azure Blob storage location of the error file that will contain errors found during the import. The external data source must be created using the `TYPE = BLOB_STORAGE`. For more information, see [CREATE EXTERNAL DATA SOURCE](../../t-sql/statements/create-external-data-source-transact-sql.md).
176
176
177
177
##### MAXERRORS
178
+
178
179
`MAXERRORS` =*maximum_errors* specifies the maximum number of syntax errors or nonconforming rows, as defined in the format file, that can occur before OPENROWSET throws an exception. Until MAXERRORS is reached, OPENROWSET ignores each bad row, not loading it, and counts the bad row as one error.
179
180
180
181
The default for *maximum_errors* is 10.
@@ -185,22 +186,29 @@ The default for *maximum_errors* is 10.
185
186
#### BULK Data processing options
186
187
187
188
##### FIRSTROW
189
+
188
190
`FIRSTROW` =*first_row*
191
+
189
192
Specifies the number of the first row to load. The default is 1. This indicates the first row in the specified data file. The row numbers are determined by counting the row terminators. FIRSTROW is 1-based.
190
193
191
194
##### LASTROW
195
+
192
196
`LASTROW` =*last_row*
197
+
193
198
Specifies the number of the last row to load. The default is 0. This indicates the last row in the specified data file.
194
199
195
200
##### ROWS_PER_BATCH
201
+
196
202
`ROWS_PER_BATCH` =*rows_per_batch*
203
+
197
204
Specifies the approximate number of rows of data in the data file. This value should be of the same order as the actual number of rows.
198
205
199
206
`OPENROWSET` always imports a data file as a single batch. However, if you specify *rows_per_batch* with a value > 0, the query processor uses the value of *rows_per_batch* as a hint for allocating resources in the query plan.
200
207
201
208
By default, ROWS_PER_BATCH is unknown. Specifying ROWS_PER_BATCH = 0 is the same as omitting ROWS_PER_BATCH.
An optional hint that specifies how the data in the data file is sorted. By default, the bulk operation assumes the data file is unordered. Performance might improve if the order specified can be exploited by the query optimizer to generate a more efficient query plan. Examples for when specifying a sort can be beneficial include the following:
206
214
@@ -210,22 +218,26 @@ An optional hint that specifies how the data in the data file is sorted. By defa
210
218
- Using the rowset as a source table in the FROM clause of a query, where the sort and join columns match.
211
219
212
220
##### UNIQUE
221
+
213
222
`UNIQUE` specifies that the data file does not have duplicate entries.
214
223
215
224
If the actual rows in the data file are not sorted according to the order that is specified, or if the UNIQUE hint is specified and duplicates keys are present, an error is returned.
216
225
217
226
Column aliases are required when ORDER is used. The column alias list must reference the derived table that is being accessed by the BULK clause. The column names that are specified in the ORDER clause refer to this column alias list. Large value types (**varchar(max)**, **nvarchar(max)**, **varbinary(max)**, and **xml**) and large object (LOB) types (**text**, **ntext**, and **image**) columns cannot be specified.
218
227
219
228
##### SINGLE_BLOB
229
+
220
230
Returns the contents of *data_file* as a single-row, single-column rowset of type **varbinary(max)**.
221
231
222
232
> [!IMPORTANT]
223
233
> We recommend that you import XML data only using the SINGLE_BLOB option, rather than SINGLE_CLOB and SINGLE_NCLOB, because only SINGLE_BLOB supports all Windows encoding conversions.
224
234
225
235
##### SINGLE_CLOB
236
+
226
237
By reading *data_file* as ASCII, returns the contents as a single-row, single-column rowset of type **varchar(max)**, using the collation of the current database.
227
238
228
239
##### SINGLE_NCLOB
240
+
229
241
By reading *data_file* as UNICODE, returns the contents as a single-row, single-column rowset of type **nvarchar(max)**, using the collation of the current database.
230
242
231
243
```sql
@@ -253,9 +265,10 @@ Specifies the code page of the data in the data file. CODEPAGE is relevant only
253
265
|*code_page*|Indicates the source code page on which the character data in the data file is encoded; for example, 850.<br /><br /> **Important** Versions prior to [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] do not support code page 65001 (UTF-8 encoding).|
Specifies a comma separated values file compliant to the [RFC 4180](https://tools.ietf.org/html/rfc4180) standard.
270
+
271
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], specifies a comma separated values file compliant to the [RFC 4180](https://tools.ietf.org/html/rfc4180) standard.
259
272
260
273
```sql
261
274
SELECT*
@@ -266,20 +279,21 @@ FROM OPENROWSET(BULK N'D:\XChange\test-csv.csv',
266
279
```
267
280
268
281
##### FORMATFILE
282
+
269
283
`FORMATFILE` ='*format_file_path*'
270
284
Specifies the full path of a format file. [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] supports two types of format files: XML and non-XML.
271
285
272
286
A format file is required to define column types in the result set. The only exception is when SINGLE_CLOB, SINGLE_BLOB, or SINGLE_NCLOB is specified; in which case, the format file is not required.
273
287
274
288
For information about format files, see [Use a Format File to Bulk Import Data (SQL Server)](../../relational-databases/import-export/use-a-format-file-to-bulk-import-data-sql-server.md).
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CTP 1.1, the format_file_path can be in Azure Blob Storage. For examples, see [Examples of Bulk Access to Data in Azure Blob Storage](../../relational-databases/import-export/examples-of-bulk-access-to-data-in-azure-blob-storage.md).
290
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], the format_file_path can be in Azure Blob Storage. For examples, see [Examples of Bulk Access to Data in Azure Blob Storage](../../relational-databases/import-export/examples-of-bulk-access-to-data-in-azure-blob-storage.md).
Specifies a character that will be used as the quote character in the CSV file. If not specified, the quote character (") will be used as the quote character as defined in the [RFC 4180](https://tools.ietf.org/html/rfc4180) standard.
295
+
296
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], specifies a character that will be used as the quote character in the CSV file. If not specified, the quote character (") will be used as the quote character as defined in the [RFC 4180](https://tools.ietf.org/html/rfc4180) standard.
The following example uses an external data source that points to a container in an Azure storage account and a database scoped credential created for a shared access signature.
507
+
Beginning with [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)], the following example uses an external data source that points to a container in an Azure storage account and a database scoped credential created for a shared access signature.
495
508
496
509
```sql
497
510
SELECT*FROM OPENROWSET(
@@ -569,7 +582,7 @@ SINGLE_CLOB
569
582
570
583
### L. Use OPENROWSET to access several parquet files using S3-compatible object storage
0 commit comments