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
The integer value of the log you want to view. *@p1* is **int**, with a default of `0`. The current error log has a value of `0`. The previous is `1` (`ERRORLOG.1`), the one before previous is 2 (`ERRORLOG.2`), and so on.
39
43
40
-
Is the integer (int) value of the log you want to view. The current error log has a value of 0, the previous is 1 (Errorlog.1), the one before previous is 2 (Errorlog.2), and so on.
44
+
#### [@p2 = ]*p2*
41
45
42
-
#### [@p2 = ] 'product ID'
46
+
The integer value for the product whose log you want to view. *@p2* is **int**, with a default of `NULL`. Use `1` for SQL Server or `2` SQL Server Agent. If a value isn't specified, the SQL Server product is used.
43
47
44
-
Is the integer (int) value for the product whose log you want to view. Use 1 for SQL Server or 2 SQL Server Agent. If a value isn't specified, the SQL Server product is used
48
+
#### [@p3 = ] N'*p3*'
45
49
46
-
#### [@p3 = ] 'string_to_search'
50
+
The string value for a string you want to filter on when viewing the error log. *@p3* is **nvarchar(4000)**, with a default of `NULL`.
47
51
48
-
Is the string value for a string you want to filter on when viewing the error log. This value is **nvarchar(4000)** and has a default of NULL.
52
+
#### [@p4 = ] N'*p4*'
49
53
50
-
#### [@p4 = ] 'string_to_search'
54
+
The string value for an additional string you want to filter on to further refine the search when viewing the error log. *@p4* is **nvarchar(4000)**, with a default of `NULL`. This parameter provides an extra filter to the first string search *@p3*.
51
55
52
-
Is the string value for an additional string you want to filter on to further refine the search when viewing the error log. This value is **nvarchar(4000)** and has a default of NULL. This provides an additional filter to the first string search @p3.
56
+
## Return code values
53
57
54
-
## Return Code Values
58
+
None.
55
59
56
-
No return code
57
-
58
-
## Result Sets
60
+
## Result set
61
+
62
+
Displays the content of the requested error log. If filter strings are used, only the lines that match those strings are displayed.
59
63
60
-
Displays the content of the requested error log. If filter strings are used only the lines that match those strings are displayed.
61
-
62
64
## Remarks
63
65
64
-
Every time [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] is started, the current error log is renamed to **errorlog.1**; **errorlog.1** becomes **errorlog.2**, **errorlog.2** becomes **errorlog.3**, and so on. **sp_readerrorlog** enables you to read any of these error log files as long as the files exist.
65
-
66
+
Every time [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] is started, the current error log is renamed to `ERRORLOG.1`; `ERRORLOG.1` becomes `ERRORLOG.2`, `ERRORLOG.2` becomes `ERRORLOG.3`, and so on. `sp_readerrorlog` enables you to read any of these error log files as long as the files exist.
67
+
66
68
## Permissions
67
69
68
-
Execute permissions for **sp_readerrorlog** are restricted to members of the **sysadmin** fixed server role.
69
-
70
+
Execute permissions for `sp_readerrorlog` are restricted to members of the **sysadmin** fixed server role.
71
+
70
72
## Examples
71
73
72
-
The following example cycles the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log.
74
+
The following example cycles the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log.
73
75
74
76
### A. Read the current SQL Server error log
75
77
76
-
```sql
77
-
EXEC sp_readerrorlog;
78
-
```
79
-
78
+
```sql
79
+
EXEC sp_readerrorlog;
80
+
```
81
+
80
82
### B. Show the previous SQL Server Agent error log
81
83
82
84
```sql
83
-
exec sp_readerrorlog 1, 2;
85
+
EXEC sp_readerrorlog 1, 2;
84
86
```
85
87
86
88
### C. Find log messages that indicate a database is starting up
This stored procedure refreshes the remote monitor tables with the latest information from a given primary or secondary server for the specified log shipping agent. The procedure is invoked on the primary or secondary server.
The primary ID for backup or the secondary ID for copy or restore. *agent_id* is **uniqueidentifier** and cannot be NULL.
39
-
40
-
`[ @agent_type = ] 'agent_type'`
41
-
The type of log shipping job.
42
-
43
-
0 = Backup.
44
-
45
-
1 = Copy.
46
-
47
-
2 = Restore.
48
-
49
-
*agent_type* is **tinyint** and cannot be NULL.
50
-
51
-
`[ @database = ] 'database'`
52
-
The primary or secondary database used by logging by backup or restore agents.
53
-
54
-
`[ @mode ] n`
55
-
Specifies whether to refresh the monitor data or clean it. The data type of *m* is tinyint, and the supported values are:
56
-
57
-
1 = refresh (This is the default value.)
58
-
59
-
2 = delete
60
-
61
-
## Return Code Values
62
-
0 (success) or 1 (failure)
63
-
64
-
## Result Sets
65
-
None.
66
-
67
-
## Remarks
68
-
**sp_refresh_log_shipping_monitor** refreshes the **log_shipping_monitor_primary**, **log_shipping_monitor_secondary**, **log_shipping_monitor_history_detail**, and **log_shipping_monitor_error_detail** tables with any session information that has not already been transferred. This allows you to synchronize the monitor server with primary or a secondary server when the monitor has been out of sync for awhile. Additionally, it allows you to clean up the monitor information on monitor server if necessary.
69
-
70
-
**sp_refresh_log_shipping_monitor** must be run from the **master** database on the primary or secondary server.
71
-
72
-
## Permissions
73
-
Only members of the **sysadmin** fixed server role can run this procedure.
This stored procedure refreshes the remote monitor tables with the latest information from a given primary or secondary server for the specified log shipping agent. The procedure is invoked on the primary or secondary server.
The primary ID for backup or the secondary ID for copy or restore. *@agent_id* is **uniqueidentifier**, with no default, and can't be `NULL`.
43
+
44
+
#### [ @agent_type = ]*agent_type*
45
+
46
+
The type of log shipping job. *@agent_type* is **tinyint**, and can't be `NULL`. *@agent_type* must be one of these values:
47
+
48
+
| Value | Description |
49
+
| --- | --- |
50
+
|`0`| Backup |
51
+
|`1`| Copy |
52
+
|`2`| Restore |
53
+
54
+
#### [@database = ] N'*database*'
55
+
56
+
The primary or secondary database used by logging by backup or restore agents. *@database* is **sysname**, with a default of `NULL`.
57
+
58
+
#### [@mode = ]*mode*
59
+
60
+
Specifies whether to refresh the monitor data or clean it. *@mode* is **tinyint**, and can be one of these values:
61
+
62
+
| Value | Description |
63
+
| --- | --- |
64
+
|`1` (default) | Refresh |
65
+
|`2`| Delete |
66
+
67
+
## Return code values
68
+
69
+
`0` (success) or `1` (failure).
70
+
71
+
## Result set
72
+
73
+
None.
74
+
75
+
## Remarks
76
+
77
+
`sp_refresh_log_shipping_monitor` refreshes the `log_shipping_monitor_primary`, `log_shipping_monitor_secondary`, `log_shipping_monitor_history_detail`, and `log_shipping_monitor_error_detail` tables with any session information that isn't already transferred. `sp_refresh_log_shipping_monitor` allows you to synchronize the monitor server with primary or a secondary server when the monitor is out of sync for some time. Additionally, it allows you to clean up the monitor information on monitor server if necessary.
78
+
79
+
`sp_refresh_log_shipping_monitor` must be run from the `master` database on the primary or secondary server.
80
+
81
+
## Permissions
82
+
83
+
Only members of the **sysadmin** fixed server role can run this procedure.
0 commit comments