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
Copy file name to clipboardExpand all lines: support/sql/database-engine/backup-restore/schedule-automate-backup-database.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,13 +36,13 @@ This article describes how to use a Transact-SQL script together with Task Sched
36
36
37
37
You have to follow these four steps to back up your SQL Server databases by using Windows Task Scheduler:
38
38
39
-
### Step 1: Create stored procedure to back up your databases
39
+
### Step 1: Create a stored procedure to back up your databases
40
40
41
41
Connect to your SQL express instance and create sp_BackupDatabases stored procedure in your master database using the script at the following location:
The `sqlcmd` utility lets you enter Transact-SQL statements, system procedures, and script files. In SQL Server 2014 and lower versions, the utility is shipped as part of the product. Starting with SQL Server 2016, `sqlcmd` utility is offered as a separate download. For more information, review [sqlcmd Utility](/sql/tools/sqlcmd-utility).
> The SQLLogin should have at least the Backup Operator role in SQL Server.
76
76
77
-
#### Example 3: Log backups of all databases in local named instance of SQLEXPRESS by using Windows Authentication
77
+
#### Example 3: Log backups of all databases in the local named instance of SQLEXPRESS by using Windows Authentication
78
78
79
79
```cmd
80
80
// Sqlbackup.bat
@@ -96,25 +96,25 @@ Follow these steps:
96
96
97
97
1. On the computer that is running SQL Server Express, select **Start** and type **Task Scheduler** in the text box.
98
98
99
-
:::image type="content" source="media/schedule-automate-backup-database/task-scheduler.png" alt-text="Screenshot of the Task Scheduler Desktop app option in the search bar of Start menu." border="false":::
99
+
:::image type="content" source="media/schedule-automate-backup-database/task-scheduler.png" alt-text="Screenshot of the Task Scheduler Desktop app option in the search bar of the Start menu." border="false":::
100
100
101
101
1. Under **Best match**, select **Task Scheduler** to launch it.
102
-
1. In **Task Scheduler**, right-click on **Task Scheduler (Local)** and select **Create Basic task…**.
103
-
1. Enter the name for the new task (for example:**SQLBackup**) and select **Next**.
102
+
1. In **Task Scheduler**, right-click **Task Scheduler (Local)** and select **Create Basic task**.
103
+
1. Enter the name for the new task (for example,**SQLBackup**) and select **Next**.
104
104
1. Select **Daily** for the Task Trigger and select **Next**.
105
105
1. Set the recurrence to one day and select **Next**.
106
106
1. Select **Start a program** as the action and select **Next**.
107
-
1.select**Browse**, select the batch file that you created in [Step 3](#step-3-create-a-batch-file-using-a-text-editor), and then select **Open**.
108
-
1.Check the box **Open the Properties dialog for this task when I click Finish**.
109
-
1. In the **General** tab,
107
+
1.Select**Browse**, select the batch file that you created in [Step 3](#step-3-create-a-batch-file-using-a-text-editor), and then select **Open**.
108
+
1.Select the **Open the Properties dialog for this task when I click Finish** checkbox.
109
+
1. In the **General** tab:
110
110
111
111
- Review the **Security options** and ensure the following for the user account running the task (listed under **When running the task, user the following user account:**)
112
112
113
-
The account should have at least Read and Execute permissions to launch sqlcmd utility. Additionally,
113
+
The account should have at least Read and Execute permissions to launch the `sqlcmd` utility. Additionally,
114
114
115
-
- If using Windows authentication in the batch file, ensure the owner of the task permissions to do SQL Backups.
115
+
- If using Windows Authentication in the batch file, ensure the task owner has permission to do SQL backups.
116
116
117
-
- If using SQL authentication in the batch file, the SQL user should have the necessary permissions to do SQL Backups.
117
+
- If using SQL Authentication in the batch file, the SQL user should have the necessary permissions to do SQL backups.
118
118
119
119
- Adjust other settings according to your requirements.
120
120
@@ -127,7 +127,7 @@ Be aware of the following requirements when you use the procedure that is docume
127
127
128
128
- The Task Scheduler service must be running at the time that the job is scheduled to run. We recommend that you set the startup type for this service as **Automatic**. This makes sure that the service will be running even on a restart.
129
129
130
-
- You must create sufficient amount of space on the drive where the backups are written. We recommend that you clean old files in the Backup folder regularly to make sure that you don't run out of disk space. The script doesn't contain the logic to clean up old files.
130
+
- You must create sufficient space on the drive where the backups are written. We recommend that you clean old files in the **Backup** folder regularly to make sure that you don't run out of disk space. The script doesn't contain the logic to clean up old files.
0 commit comments