core:Generate Backup Script: Difference between revisions

From eStream Software
(Created page with "==Introduction== SQL application may backup database via Command Line Switches operation. The command line operation may backup all databases or...")
 
 
(17 intermediate revisions by 5 users not shown)
Line 2: Line 2:
SQL application may backup database via [[core:Command Line Switches|Command Line Switches]] operation. The command line operation may backup all databases or specified database store in DCF file with proper switches.
SQL application may backup database via [[core:Command Line Switches|Command Line Switches]] operation. The command line operation may backup all databases or specified database store in DCF file with proper switches.


The command line backup script may generated via context menu command in DCF: "Generate Backup Script".  The script may execute in console or batch file.
The command line backup script may generated via context menu command in DCF: <code>Generate Backup Script</code>.  The script may execute in console or batch file.


A common usage of backup script is execute the script in Windows Task Scheduler to backup database periodically.  This action automate backup operation to ease administrator's task.  Tasks added to Task Scheduler starts each time you start Windows, and runs in the background.  With Task Scheduler, you can schedule a backup databases task to run daily, weekly, monthly, or at certain times (such as system startup).
A common usage of backup script is execute the script in Windows Task Scheduler to backup database periodically.  This action automate backup operation to ease administrator's task.  Tasks added to Task Scheduler starts each time you start Windows, and runs in the background.  With Task Scheduler, you can schedule a backup databases task to run daily, weekly, monthly, or at certain times (such as system startup).
This command line backup script is only applicable for '''Windows 7''' & above only.


==Generate Backup Script in Database Group==
==Generate Backup Script in Database Group==
* To generate backup script for all the databases under the selected database group
* To generate backup script for all the databases under the selected database group
* Right click the database group that you want to generate backup script
* Right click the database group that you want to generate backup script
[[File:Scheduler.Database.Group.jpg|550px]]
[[File:Scheduler.Database.Group.jpg|600px]]


==Generate Backup Script in Database Item==
==Generate Backup Script in Database Item==
* To generate backup script for single database
* To generate backup script for single database
* Right click the database that you want to generate backup script
* Right click the database that you want to generate backup script
[[File:Scheduler.Database.jpg|550px]]
[[File:Scheduler.Database.jpg|600px]]


==Generate Backup Script==
==Generate Backup Script==
Line 24: Line 26:
* Test Email: Click to test whether email sent successfully to receiver email accounts
* Test Email: Click to test whether email sent successfully to receiver email accounts
* Copy: The command text will be automatically copy to your clipboard, it is ready to paste in window Task Scheduler (there is a shortcut "Launch Window Task Scheduler")
* Copy: The command text will be automatically copy to your clipboard, it is ready to paste in window Task Scheduler (there is a shortcut "Launch Window Task Scheduler")
[[File:Scheduler.Entry.fm.jpg|550px]]
[[File:Scheduler.Entry.fm.jpg|600px]]


===Email setting for TMNet===
===Email setting for TMNet===
Line 34: Line 36:


===Email setting for Gmail===
===Email setting for Gmail===
     SMTP Host: '''smtp.gmail.com'''
     SMTP Host: '''smtp.gmail.com'''
   SMTP Port No: '''465'''
   SMTP Port No: '''465'''
     SMTP User: '''e.g.: <your-account>@gmail.com'''
     SMTP User: '''e.g.: <your-account>@gmail.com'''
  SMTP Password: *******
  SMTP Password: ******* <app password>
       Use SSL: '''True''' (or ticked)
       Use SSL: '''True''' (or ticked)
[https://support.google.com/accounts/answer/185833?hl=en Guide to create & use app password] or <br>
[https://myaccount.google.com/apppasswords Google AppPassword]
[[File:Scheduler-GMail1.jpg|600px]]
[[File:Scheduler-GMail2.jpg|600px]]


===Email setting for Yahoo! Mail===
===Email setting for Yahoo! Mail===
Line 61: Line 68:


==Add Backup task to Window 7 Task Scheduler==
==Add Backup task to Window 7 Task Scheduler==
1. Click window menu Start -> Accessories -> System Tools -> Task Scheduler
#Click window menu <code>Start -> Accessories -> System Tools -> Task Scheduler</code>
 
#Click <code>Action -> Create Basic Task</code><br>[[File:Scheduler.Task1.jpg|600px]]
2. Click Action -> Create Basic Task
#Enter Task name<br>[[File:Scheduler.Task2.jpg|600px]]
 
#Click next, choose when you want to trigger the task (e.g Daily)<br>[[File:Scheduler.Task3.jpg|550px]]
[[File:Scheduler.Task1.jpg|550px]]
#Click next, choose the start date and start time and recur every 1 day<br>[[File:Scheduler.Task4.jpg|600px]]
 
#Click next, choose Start a Program<br>[[File:Scheduler.Task5.jpg|600px]]
3. Enter Task name
#Click next, paste all the backup script text that you copied just now into "Program/Script"<br>[[File:Scheduler.Task6.jpg|600px]]
 
#Set the Start in(optional) path to the Exe folder (eg. '''C:\Estream\SQL Accounting''')
[[File:Scheduler.Task2.jpg|550px]]
#Click next, a dialog prompted and click '''Yes'''<br>[[File:Scheduler.Task7.jpg|600px]]
 
#Click Next
4. Click next, choose when you want to trigger the task (e.g Daily)
#Tick the option ''Open the Properties dialog for this task when I click Finish''<br>[[File:Scheduler.Task8.jpg|600px]]
 
#Click Finish<br>[[File:Scheduler.Task9.jpg]]
[[File:Scheduler.Task3.jpg|550px]]
#Select the option ''Run whether user is logged on or not''
 
#Click ''Triggers'' tab at top<br>[[File:Scheduler.Task11.jpg]]
5. Click next, choose the start date and start time and recur every 1 day  
#Click ''Edit...'' button<br>[[File:Scheduler.Task12.jpg]]
#Change the time to run
[[File:Scheduler.Task4.jpg|550px]]
#Click OK 2 times<br>[[File:Scheduler.Task10.jpg]]
 
#Enter the window User Name & Password
6. Click next, choose Start a Program
#Click Ok
 
[[File:Scheduler.Task5.jpg|550px]]
 
7. Click next, paste all the backup script text that you copied just now into "Program/Script"
 
[[File:Scheduler.Task6.jpg|550px]]
 
8. Click next, a dialog prompted and click Yes
 
[[File:Scheduler.Task7.jpg|550px]]


9. Click Next and click Finish
==Recommendations==
* Try to set the backup schedule timer after working hours,eg. mid-night start from 1.00am.
* Do not shutdown the server while running the auto backup.
* You can set the schedule to shutdownn and wake-up the server during weekend.


[[File:Scheduler.Task8.jpg|550px]]
<br />

Latest revision as of 10:29, 17 March 2023

Introduction

SQL application may backup database via Command Line Switches operation. The command line operation may backup all databases or specified database store in DCF file with proper switches.

The command line backup script may generated via context menu command in DCF: Generate Backup Script. The script may execute in console or batch file.

A common usage of backup script is execute the script in Windows Task Scheduler to backup database periodically. This action automate backup operation to ease administrator's task. Tasks added to Task Scheduler starts each time you start Windows, and runs in the background. With Task Scheduler, you can schedule a backup databases task to run daily, weekly, monthly, or at certain times (such as system startup).

This command line backup script is only applicable for Windows 7 & above only.

Generate Backup Script in Database Group

  • To generate backup script for all the databases under the selected database group
  • Right click the database group that you want to generate backup script

Scheduler.Database.Group.jpg

Generate Backup Script in Database Item

  • To generate backup script for single database
  • Right click the database that you want to generate backup script

Scheduler.Database.jpg

Generate Backup Script

  • Database (optional): If database is not specified, all databases under the database group will be backup
  • Backup to: Choose backup to directory
  • Admin Password(s): Admin user passwords that login to the database(s). If database group contains more databases with different admin passwords, please separate each passwords with comma. The button beside this field is to toggle show password in plain text or asterisk
  • Send Mail: Tick if need to receive notification email of backup status
  • Zip Backup: Compress backup into zip file
  • Test Email: Click to test whether email sent successfully to receiver email accounts
  • Copy: The command text will be automatically copy to your clipboard, it is ready to paste in window Task Scheduler (there is a shortcut "Launch Window Task Scheduler")

Scheduler.Entry.fm.jpg

Email setting for TMNet

    SMTP Host: smtp-proxy.tm.net.my
 SMTP Port No: 25
    SMTP User: n/a. Leave empty
SMTP Password: n/a. Leave empty
      Use SSL: False (or unticked)

Email setting for Gmail

    SMTP Host: smtp.gmail.com
 SMTP Port No: 465
    SMTP User: e.g.: <your-account>@gmail.com
SMTP Password: ******* <app password>
      Use SSL: True (or ticked)

Guide to create & use app password or
Google AppPassword

Scheduler-GMail1.jpg Scheduler-GMail2.jpg

Email setting for Yahoo! Mail

    SMTP Host: smtp.mail.yahoo.com
 SMTP Port No: 465
    SMTP User: e.g.: <your-account>@yahoo.com
SMTP Password: *******
      Use SSL: True (or ticked)

Email setting for private mail server

The following a sample setting. Configure according to your private mail server setting.

    SMTP Host: <your-mail-server>
 SMTP Port No: 587
    SMTP User: e.g.: <your-account>
SMTP Password: *******
      Use SSL: True or False

Email setting for MSN live mail or Hotmail

Unsupported

Add Backup task to Window 7 Task Scheduler

  1. Click window menu Start -> Accessories -> System Tools -> Task Scheduler
  2. Click Action -> Create Basic Task
    Scheduler.Task1.jpg
  3. Enter Task name
    Scheduler.Task2.jpg
  4. Click next, choose when you want to trigger the task (e.g Daily)
    Scheduler.Task3.jpg
  5. Click next, choose the start date and start time and recur every 1 day
    Scheduler.Task4.jpg
  6. Click next, choose Start a Program
    Scheduler.Task5.jpg
  7. Click next, paste all the backup script text that you copied just now into "Program/Script"
    Scheduler.Task6.jpg
  8. Set the Start in(optional) path to the Exe folder (eg. C:\Estream\SQL Accounting)
  9. Click next, a dialog prompted and click Yes
    Scheduler.Task7.jpg
  10. Click Next
  11. Tick the option Open the Properties dialog for this task when I click Finish
    Scheduler.Task8.jpg
  12. Click Finish
    Scheduler.Task9.jpg
  13. Select the option Run whether user is logged on or not
  14. Click Triggers tab at top
    Scheduler.Task11.jpg
  15. Click Edit... button
    Scheduler.Task12.jpg
  16. Change the time to run
  17. Click OK 2 times
    Scheduler.Task10.jpg
  18. Enter the window User Name & Password
  19. Click Ok

Recommendations

  • Try to set the backup schedule timer after working hours,eg. mid-night start from 1.00am.
  • Do not shutdown the server while running the auto backup.
  • You can set the schedule to shutdownn and wake-up the server during weekend.