Quantcast
Channel: SQLBackupAndFTP's blog
Viewing all 198 articles
Browse latest View live

How to migrate to SqlBackupAndFtp 11 from the previous versions

$
0
0

If you want to migrate to SqlBackupAndFtp 11 you can simply install the new version over the previous one. All scheduled backups will be automatically imported and you should not do anything else.

How to import my old .jobx files to SQLBackupAndFTP 11?

If you have some backup job (.jobx file) that is was not scheduled but you want to have it in the new version then you can take advantage of the Import feature:

SQLBackupAndFTP (Import)

If you prefer a clean installation, you can uninstall the previous version of SqlBackupAndFtp and only then install the new one, but in this case, you will have to manually import all your backup jobs as we described in the previous paragraph.

How to upgrade my old license key to SQLBackupAndFTP 11?

To upgrade your license key go through the following steps:

  1. Open https://sqlbackupandftp.com/upgrade/ and  scroll down to the “Upgrade/Update SQLBackupAndFTP License” section
  2. Enter your current license key into the “To start, enter your current license key:” box and click “Continue”
  3. In the opened window select the version you need and select the payment method
  4. If you own the Lifetime version then the new key will be free for you

SQLBackupAndFTP Upgrade

What to do if I lost my license key?

If you forgot your license key do the following:

  1. Go to https://sqlbackupandftp.com/support/
  2. Click “Resend my license keys and links to download my older version” link
  3. Enter the email you used for the purchase and click “Send” button

SQLBackupAndFTP Resend License key

How to enter a license key to SQLBackupAndFtp 11?

To enter your new license key click Help>License…

SQLBackupAndFTP New License Key

The post How to migrate to SqlBackupAndFtp 11 from the previous versions appeared first on SQL Backup and FTP.


How to backup and restore Microsoft Azure Cloud SQL Database

$
0
0

Microsoft Azure SQL Database is a managed cloud database designed by Microsoft which are widely used by app developers. It works as a service and runs on a cloud computing platform. Here is a step-by-step guide on how to backup Microsoft Azure SQL Database with the help of SQLBackupAndFTP.

How to backup Microsoft Azure Cloud SQL Database

1. Connect SQLBackupAndFTP to the logical SQL Server in the Azure

Go to your “Microsoft Azure Dashboard” page and choose the logical SQL Server in the Azure:

Azure SQL Server SQLBackupAndFTP

You can find your SERVER’s NAME and SERVER ADMIN LOGIN information at the “Properties” section:

Properties Microsoft Azure SQLBackupAndFTP

Run SQLBackupAndFTP and click plus button to create a new backup job. The “Connection to SQL Server” window will be opened automatically where you should specify the name of the server, select “SQL Server Authentication” and enter your User name and Password that you have specified during the Azure logical SQL Server creation:

Connect to Azure logical SQL Server

2. Create a job for regular Azure SQL Database backup

After you have established the connection to your Azure SQLServer select the databases you want to backup. To find the database’s list click on the gear button at the “Selected Databases” section and check off databases you need to backup.

Select databases SQLBackupAndFTP

Then go down to the “Store backups in selected destinations” section and click the plus button to select a place where you prefer to store your Azure SQL Database backups. Assume, you prefer to store the backups in Azure Storage. Choose “Windows Azure Storage” from the list:

Select a place where the backups will be stored

Once you click “Azure Storage” the “Windows Azure Storage Settings” window opens where you need to enter your credentials. You can find your Azure Storage credentials in “Microsoft Azure Dashboard page“.

Microsoft Azure Dashboard SQLBackupAndFTP

Click “Access keys” and copy the primary access key:

Manage keys Microsoft Azure SQLBackupAndFTP

Select or create a new container if necessary:

SQLBackupAndFTP Microsoft Azure select a container

Now open SQLBackupAndFTP, paste the primary access key and specify the container’s name. To check the connection click “Test”, then press “Save & Close” button to apply all settings.

Windows Azure Storage Settings

Turn on “Schedule backups”  to create a backup schedule. Click on the gear button to find additional settings SQLBackupAndFTP Backup Schedule

That’s it. You have just set up scheduled Azure SQL Database backups!

How to restore Microsoft Azure Cloud SQL Database

The restore process is even easier than the backup process! Find the backup you need to restore from the list on the right side of the application. Click on the button next to backup and select “Restore from Backup…”.

SQLBackupAndFTP Restore Microsoft Azure Cloud SQL Database

In the opened window click on “Restore” button

Restore Microsoft Azure Cloud SQL Database with SQLBackupAndFTP

After the restore  process is completed, you’ll receive the following message:

Restore Microsoft Azure Cloud SQL Database with SQLBackupAndFTP Success

Here you are! You have just restored Azure SQL Database in a few clicks.

The post How to backup and restore Microsoft Azure Cloud SQL Database appeared first on SQL Backup and FTP.

Recommendation on how to Backup Large Databases with SQLBackupAndFTP

$
0
0

If you backup large SQL Server databases with the help of SQLBackupAndFTP then we want to give you some useful recommendations that may speed up the backup process. 

1. Track the Free Space on your Local Disk

Before backup large SQL Server databases make sure that you have enough free space on your local drive. It is necessary to remember that even if you prefer to store your backups in the cloud, during the backup process SQLBackupAndFTP keeps the temporary backup files on your local drive. If your local drive is divided into several partitions, we highly recommend you to use the biggest one.

To select the temporary folder for your backups, run SQLBackupAndFTP application and go to the “Temporary folder” section.

SQLBackupAndFTP Temp Folder

2. Use 7 zip compression

We recommend you to compress your SQL Server backups with the help of 7-zip compression to reduce a backup file size. You can select 7-zip compression at the “Compression” section. Just select 7-zip (.7z) from the drop down list at “Archive format”. SQLBackupAndFTP 7 zip

The another benefit is that you can speed up the compression procedure. To do it click at the gear button and enter the following command at the special box:

-m0=LZMA2 -mmt=on

SQLBackupAndFTP Speed up Compression

Please remember, if you make a decision to apply this command you have to know that it loads CPU higher.

3. Backup one DB, send, repeat – option

This option will be useful for those who have to backup many databases and their total size is very large. In that case, we recommend you to use “Backup one DB, send, repeat (as opposite to backup all, then send all)” option, which is located at the “Backup options” section. If that option is checked, then SQLBackupAndFTP will backup each database one by one in the next way:

  • Backup SQL Server database
  • Compress SQL Server database
  • Send the backup to the destinations
  • Remove the backup from the temporary folder

SQLBackupAndFTP Backup one DB, send, repeat option

This option is unchecked by default and SQLBackupAndFTP backup and compress all databases first, send on destinations and only then remove them from the temporary folder.

The post Recommendation on how to Backup Large Databases with SQLBackupAndFTP appeared first on SQL Backup and FTP.

40% OFF for xSQL users

SqlBackupAndFTP v11 is live

$
0
0

After several years of development the completely reworked v11 is now live. If you have used the previous version – start by reading:
SqlBackupAndFtp v11 – What’s New?

As before, you have several editions including free, but there are a few differences. See:
How SqlBackupAndFtp 11 differs from the previous versions?

For upgrade options from the previous version  see:
How to migrate to SqlBackupAndFtp 11 from the previous versions

Also see:

Why do I Need the “Updates, Web Log & Support” subscription?
Web Log – see backup history on the web
How Tos – SqlBackupAndFtp

If you need help – go to Support Forum

Why do I Need the “Updates, Web Log & Support” subscription?

$
0
0

SqlBackupAndFtp is a standalone application. Once you bought a license it never expires and you can use the version you’ve purchased forever. What is the “Updates, Web Log & Support” subscription then and why do you need it?

When you buy a license you get an option to buy the subscription for a yearly recurring fee. “If you skip this option, only 1 month is included. It is highly recommended to get the Updates, Web Log & Support subscription because:

  1. To always use the latest version of SQLBackupAndFTP  Are automatic updates that important? 
  2. To have an option to see backup history on the web (web log – coming soon)
  3. Receive direct email support from our team Can I receive support if I don’t have a subscription?
  4. Use our mail servers for sending backup notifications What is the benefit of automatic emails feature?

From the opposite end, if your Update & Support subscription has expired, then:

  1. Auto-updates will stop and you will continue using the version of SQLBackupAndFTP that was live on a date when your subscription has expired.
  2. You will not be able to see backup history from the web
  3. You will not get direct email support from our team and will have to rely on the community forum
  4. You will have to use your own email server to send emails

Are automatic updates that important?

SQLBackupAndFTP communicates with your SQL Server, FTP and multiple cloud storage services (Dropbox, Azure, Box, OneDrive, GoogleDrive, etc). As all of these services evolve, they change their API, standards, update security settings. To keep up with these changes we regularly release new versions with fixes and improvements.  During the whole period of subscription, your application will be regularly and automatically updated to the latest stable and secure version. You don’t have to worry about updates, they will be downloaded and applied silently and automatically.

To be more detailed – these are the reasons why we recommend our customers to be subscribed for regular updates:

  1. As backups protect your valuable data, we try to keep our software secure, stable and reliable and it is crucial from your side to stay updated to patch all discovered vulnerabilities.
  2. There were cases when cloud storage services (like Dropbox,  Google Drive, Amazon, etc.) changed the way SqlBackupAndFtp communicates with them (API). We track those changes and update our product, but if you don’t have the subscription your old version may suddenly stop working properly and your backups will not be saved.
  3. We always listen to our customer’s feedbacks to make our software reliable and usable. Sometimes we make dozens of different useful improvements per week and in order to be sure that you use the best version you need to be subscribed for updates.
  4. While we test our software thoroughly, in some circumstances some hidden bugs may become apparent. We always try to address such issues as soon as possible, but you need to have a valid subscription to received those fixes in time.

Can I receive support if I don’t have a subscription?

Yes. If your subscription has expired, you can still search our community forum for a solution and ask questions there. But in this case we can not guarantee prompt replies.
If your business relies on backups, you want to make sure that your questions are answered promptly and this is possible only with an active subscription.

What is the benefit of automatic emails feature?

Everybody likes to simply type their email address to a field and have emails delivered without any additional configuration:Email confirmation fields

The Update & Support subscription allows you to take advantage of “Automatic email configuration” feature when you have nothing to configure and you do not need to go to email settings at all.

If you don’t have a subscription, then you would need to fill the following fields (hidden under the gear icon) to use your own mail servers for sending backup success/failure emails:SMTP configuration

What if I opt out of the subscription during purchase?

All new customers receive 1 month of free subscription. So even if you don’t include a subscription to your purchase you will still be able to receive the initial support while you get acquainted with the program and update it to new versions during a month.

Nevertheless, we highly recommend to include the subscription into your order as there is a 50% discount for the first year subscription if it is purchased along with the license.

 

How to run SqlBackupAndFtp v11 from a command line

$
0
0

SqlBackupAndFtp runs database backups automatically and most of the users schedule it via windows interface/GUI. But you can also start a backup job manually via a command line interface. One of the examples when you may need it is a complex scheduling scenario when the options provided in the program interface are not enough. In this case you may build more complicated schedule with Windows Schedule.

Hopefully starting from v11.1.4 we made it possible to run your backups jobs from a command line. Here is the syntax:

SqlBak.Job.Cli.exe -runJob -jobName "<job-name>" -backupType "<backup-type>"
  • <job-name> is the name of a job you want to run (as it shown in the right pane of SqlBackupAndFtp’s window)
  • <backup-type> specifies what kind of backup you need to make this time, it can be one of the following values:
    • Full – full backup
    • FullCopy – full copy-only backup
    • Diff – differential backup
    • TranLog – transaction log backup
    • TranLogCopy – transaction log copy-only backup

That’s it. And, by the way, if you run a job from a command line you will still be able to see it is executing in the GUI window as well.

Web Log – see backup history on the web

$
0
0

Attention! The web log is currently under development with ETA in Sep 2017.

SqlBackupAndFTP is a desktop application that is installed on SQL server computers. If you open the app on the computer where it is installed, you can see the history of database backups.

However, if you need to check the backup history remotely – it is easier to see it on the web – we call this feature web log. Moreover, if you have multiple installation, instead of checking each computer separately, it is much simpler to see backup history for every computer on a single web log page on SqlBackupAndFTP.com.

How to make web log work?

  1. You need an active Updates, Web Log & Support subscription with Standard, Professional or Lifetime edition.
  2. In SqlBackupAndFTP application the option “See backup history the web” should be checked (default ON)
  3. Go to sqlbackupandftp.com/weblog to see your backup history

Can I edit my backup jobs from the web?

Not in SqlBackupAndFTP. Web log gives you a read-only log of your backups.

To edit SQL backup jobs from the web you can use our web-based backup service SqlBak (this is independent from SQLBackupAndFTP). Not only it allows you to see the backup history, but also configure all of the jobs on the web and monitor SQL server performance.


Dropbox has stopped the support of API v1

$
0
0

If you use SQLBackupAndFTP v 10 or lower and send backups to Dropbox, then starting from June 28, 2017 (update: Dropbox have extended the API v1 cutoff date until September 28th, 2017), you will see with the following error message:

"Sorry, Dropbox has stopped the support of API v1. Please upgrade to the latest version of the application to work with the new Dropbox API."

The reason is that on that date Dropbox has turned off API v1 and older versions of SQLBackupAndFTP can not work with the latest Dropbox API. As a result there is no way to send backups to Dropbox using SQLBackupAndFTP v10 or lower.

If you plan to continue sending backups to Dropbox, please upgrade your license to the latest version of SQLBackupAndFTP v11 that supports all of the latest APIs.

How to send SQL Backup confirmations through my GMail, Hotmail or Yahoo account

$
0
0

If you want SqlBackupAndFtp to send success and failure notifications via your email account hosted on these popular providers you need to

  1. Open Advanced email settings dialog
  2. Switch to the Custom mode
  3. Specify the SMTP Settings

custom smpt settings

Here you can find settings values for different email providers:

GMail

SMTP mail Server: smtp.gmail.com
Port: 587
My server requires authentication: Checked
Enable SSL: Checked
Username: your GMail e-mail
Password: the password you use to login to your GMail account

Hotmail

SMTP mail Server: smtp.live.com
Port: 587
My server requires authentication: Checked
Enable SSL: Checked
Username: your Hotmail e-mail
Password: the password you use to login to your Hotmail account

Yahoo

Yahoo does not provide this service for free accounts, but only for Yahoo! Mail Plus.

SMTP mail Server: plus.smtp.mail.yahoo.com
Port: 465
My server requires authentication: Checked
Enable SSL: Checked
Username: your Yahoo Mail Plus email
Password: the password you use to login to your Yahoo Mail Plus account

The post How to send SQL Backup confirmations through my GMail, Hotmail or Yahoo account appeared first on SQL Backup and FTP.

Frequently Asked Questions about SQLBackupAndFTP

$
0
0
Here we tried to answer the most asked questions. If you couldn’t find an answer here you can ask your question on the community forum. If you have an active subscription you can contact support.


Features

What can I do with SQLBackupAndFTP?

You can run scheduled backups of SQL Server databases (full, differential or transaction log), run file/folder backup, zip and encrypt the backups, store them on a network, FTP server, Dropbox, Amazon S3 or Google Drive, send yourself an e-mail confirmation on job success of failure.

How can I start with SQLBackupAndFTP?

It’s simple, see the SQLBackupAndFTP tutorial.

How can I restore backups?

You can restore SQL Server backups right from SQLBackupAndFtp app as long as those backups were made by the program and all logs related to those backup are available. The program will correctly process the backup chain (including full, differential and transaction log backups).

If the logs are not preserved or you want to restore an arbitrary SQL Server backup, you can do it manually (as it is a standard SQL server backup in a common zip file) or using our simple One-Click SQL Restore utility.

Do you provide the storage?

No. It is up to you where to store the backups, we just provide the tool. If don’t know where to start – get a free account on Dropbox.

Can SQLBackupAndFTP do Remote Backups?

No, it needs to be installed on the same computer with SQL Server.

Does it run as a service? Does it need to be started?

The backups started automatically by SqlBak.Service set up on your computer. You don’t need to need SQLBackupAndFtp running and the service is started automatically when your computer reboots.

Does SQLBackupAndFTP have a command line interface?

Yes, see this blog post.

Can I change the default [DatabaseOrFolderName]YYYYMMDDhhmm.zip backup file format?

No, while you could do it in the previous versions, in v11 we removed this option. See this thread.

Can it run on more than one SQL instance?

Yes, just create a separate job for each SQL instance.

Is it possible to run the backup while the database is being used?

Yes, the backup usually has just a minor effect on a performance.

Encryption

What kind of Zip file encryption is supported?

SQLBackupAndFTP provides 2 encryption methods (available in Professional version only):

1. ZIP compatible
It supports a simple password-based symmetric encryption. Note that it provides basic encryption only and is vulnerable to known-plaintext attacks. You can use built-in Windows compressor to open backups encrypted using ZIP compatible encryption method.

2. WinZip AES
AES is a strong encryption standard adopted by the U.S. government. Built-in Windows compressor does not support AES files, so you have to use 7Zip (freeware) or WinZip 9.0 (or higher) to open backups encrypted using WinZip AES encryption method.

Also, note that backup files over 2 GB are zipped using Zip64 format.
The built-in Windows compressor does not support Zip64, so use 7Zip (freeware) or other software to uncompress it.

Licensing

Can I use SQLBackupAndFtp for free?

Yes, you can use it for no charge as long as you need, but you will be limited to 2 databases, full backups only, no cloud destinations and AES encryption. See all features for more details.

Is there a way to try features not available in the free version?

When you install SqlBackupAndFtp you are given a 14-day trial of the full-featured (professional) version. After those 14 days, you will be switched to the free version.

Do I need to pay for a license once or it’s a subscription-based model?

Once you bought a license it never expires and you can use the version you’ve purchased forever. However, you can additionally buy annual Updates, Web Log & Support subscription that allows you to receive support from our team, update your app to the latest release, access the web log, and more (read about all benefits here). Professional Lifetime edition has lifetime subscription included into its price.

When you purchase a license you can get 1 year of the subscription for half-price. If you opt not to do this you will be given just 1 month of the subscription.

Can I install SQLBackupAndFtp on several computers?

When you purchase a license you can specify what number of computers it will be used on. If you exceed this number you will need to either buy a new license or disconnect some computers in your account. The free version can be installed on any number of computers.

Can I distribute SQLBackupAndFTP with my own software product?

It depends. You can distribute unmodified paid version as long as 1 license is active on 1 computer. Contact us for OEM discounts, customization, and private label options.  You can distribute the free version with your software provided that you put a permanent direct link to https://sqlbackupandftp.com on a public page of your website with a brief description of how it is being used. Please let us know about this link prior to distributing our product.

Sending E-mails

What is “Automatic mode” e-mail settings option?

In paid editions on the Advanced email settings form, you can select “Automatic” option. If it is selected, all of the confirmation emails will be sent through our web service, freeing the user from configuring any e-mail settings other than recipient’s e-mail.

Can I send email confirmations through my GMail/Hotmail/Yahoo account?

Yes, see this post.

Can I send e-mail confirmations to multiple e-mails?

Yes, just separate emails by a comma.

Troubleshooting

I cannot connect to my database. What is wrong?

Use SQL Server Management Studio to connect, and once successful – use the same parameters for SQLBackupAndFTP.

I cannot connect to my FTP server

Try unchecking “Use Passive FTP mode” in FTP Settings form. Also, check your firewall/antivirus settings.

I get Timeout error while backing up a large database

Increase the database timeout in advanced settings

My temporary folder is too small, can I change its location?

In advanced settings change the temp folder location (to another drive).

“Unable to relay” error when sending emails?

You Email server settings are incorrect. The specified SMTP server could not authenticate you as a legitimate user. See more.

“ERROR: Script execution failed: Incorrect syntax near ‘GO’.” error when executing custom SQL script?

You should not use GO commands in custom SQL scripts. See more.

The post Frequently Asked Questions about SQLBackupAndFTP appeared first on SQL Backup and FTP.

Customize backup file name

$
0
0

In SQLBackupAndFTP v10 we used to have an option to customize backup file names like the form below. Because of multiple user requests we will be adding back custom naming formats to v11. This should go live in the next few weeks at the end of Oct 2017.

We won’t have DayOfMonth and DayOfWeek, but we’ll have the rest – in addition to the default format we will add YYYYMMDD and no date formats.

Note that full backups have no suffix, Differential end like ***diff.zip and Transaction Log backup files end like ***log.zip

Limitations

By using custom backup file names you are breaking a few things, so before you do that, make sure you are very clear of the trade offs.

  1. Auto-delete won’t work with “no date” format because it needs a date in the file name to understand when it is a time to delete it. It will still work if you have YYYYMMDD format
  2. Tran log backups should not be used with any custom format because they’d overwrite each other.
  3. overwrite the full backup file made on the same day and would make the restore impossible. Only basic full backups should be used.
  4. The automated restore (the one done through our interface) would work only in basic full backup restore scenarios.

Basically, you have to know what you are doing if you are using custom formats.

Why use custom formats?

If you want to use it to overwrite the old files – you shouldn’t. There’s auto-delete section  in destination settings that allows you to set auto-delete for old files after a specified number of month/days.

If you store files in Dropbox or other cloud storage that supports versioning, you may choose no date format so that the new file overwrites the old, but Dropbox takes care of storing all the versions of the file.

If you use a script to restore a database on another server, than you may want to use no date file naming. Note however that very soon we will be releasing “Restore job” functionality that allows to set up replication without custom file names.

How we fell for an affiliate scam

$
0
0

We were scammed out of few thousand dollars last month by a fake “affiliate”. Here’s how.

Summary

Like many other sites, we have an affiliate program that  offers 20% commission on any purchases done by customer’s referred by the affiliate. One fake “affiliate” have used stolen credit cards to buy our SQL Server backup software and we have sent real money to him as a commission.

More details

In Sep 2017  LUIS COLMENARES ANGEL (probably not a real name) with email edyelajandro_teran@outlook.es has signed up as our affiliate. In the period from 9/22/2017 to 10/27/2017 we had 27 purchases made by people that we thought he has refereed. We have transferred him a few thousand dollars as commission through PayPal when we started noticing that few of his clients filed chargebacks claiming “Unauthorized transaction”. We took a closer look at his account and became quite certain that all of these transactions were fraudulent and have used stolen credit cards. So basically all of the money we have received were fake, but we have paid him real money that we have little hope of getting back from PayPal.

What we did

People and banks are protected and it is usually a merchant like us who takes a loss on stolen credit cards. Without waiting for chargebacks we have refunded all the money for these 27 purchases. We have sent an urgent email about this fraud to PayPal. (And in their usual speedy manner they have replied that they will get back to us in 9 days). We have added CVV code to the page where we accept credit cards. We will be monitoring our affiliates much closer to make sure that they are real people and we won’t fall for this again. And we are writing this article to make other companies aware of this fraud.

How to Deploy Free Azure SQL Server on Ubuntu

$
0
0

This step-by-step guide helps a user having a Microsoft Azure account to create Microsoft Azure SQL Server on Linux (Ubuntu) with no charge and to use the free SQL server on Ubuntu with SSH terminal.

Prerequisites

  • SSH terminal;
  • Account on Microsoft Azure.

Note: Microsoft Azure SQL Server on Ubuntu is free of charge (as for November 2017) although when installing it on Azure it says at first that it costs some money.

How to Create Azure Linux Virtual Machine with SQL Server

Step 0

Use your account’s dashboard (see below) to start creating a new Microsoft Azure entity.

NEW Dashboard Microsoft Azure

Click on “New” (see above), then see a menu (see below).

New SQL Server Linux Microsoft Azure

Choose “Compute” section and type “SQL Server Linux” in the search field (see above).

After the search is done see a list of SQL servers available (see below).

Find SQL Ubuntu Microsoft Azure

Find in the list above “Free SQL Server License: SQL Server 2017 Developer on Ubuntu Server 16.04 LTS” and click on it.

Then there will be a picture like this:

CREATE Free SQL Server 2017 Developer on Ubuntu Server 16.04 LTS Microsoft Azure

See where the red arrow is and change the “Resource Manager” to simple “Classic” there.

Push the “Create” button to create SQL Server 2017 Developer on Ubuntu following the steps below.

Step 1

CREATE Basics SQL Ubuntu Microsoft Azure

Name the SQL server, choose the User name, Password, etc.

Step 2

SIZE SQL server Ubuntu Microsoft Azure

Choose the size of your SQL server on Ubuntu.

Don’t pay attention to pricing; this is not the case, this one goes for free of charge.

Push “Select” button.

Step 3

See the parameters there and change them, if you want, then click on “OK” button.

Step 4

See the Summary and check the options, names, etc.

Summary SQL server Ubuntu Microsoft Azure

Push “OK” button.

That’s it!

Note: if you are waiting here too much, then just refresh the screen (sometimes it helps).

Now you should have Microsoft Azure SQL server on Ubuntu at your disposalsee the Overview of the SQL server on Ubuntu:

OVERVIEW SQLserverUbuntu Microsoft Azure

How to connect to Azure SQL Server on Linux (Ubuntu)

Connecting SSH Terminal to Ubuntu Server (Ubuntu Virtual Machine)

Take parameters for the SSH terminal connection to Linux (Ubuntu) server from the parameters list of your Ubuntu virtual machine (Ubuntu server) created according to the previous chapter of this article.

For example, take “DNS name” from your Azure “SQL Server on Ubuntu” screen shown at the previous picture and copy it to the “Host” field in the Xshell New Session Properties window, if you use Xshell terminal.

Preparing Azure SQL Server on Ubuntu

Type the following Microsoft instructions into your SSH terminal window:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"

sudo apt-get update

After the last command there should be a long list like the following.

List after update AZURE SQL on Ubuntu

Continue typing.

sudo apt-get install -y mssql-server

sudo /opt/mssql/bin/mssql-conf setup

systemctl status mssql-server

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"

sudo apt-get update

After entering the last command there should be a long list similar to one from the above black-and-white window.

Continue typing.

sudo apt-get install -y mssql-tools unixodbc-dev

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

source ~/.bashrc

sudo /opt/mssql/bin/mssql-conf setup

After entering the last (“setup”) command from the list you will be asked for two things.

(1) The first thing (see the following text in black-and-white):

Choose an edition of SQL Server:
 1) Evaluation (free, no production use rights, 180-day limit)
 2) Developer (free, no production use rights)
 3) Express (free)
 4) Web (PAID)
 5) Standard (PAID)
 6) Enterprise (PAID)
 7) Enterprise Core (PAID)
 8) I bought a license through a retail sales channel and have a product key to enter

Choose your option (Developer for this case).

(2) The second thing:

Enter the SQL Server system administrator password:

Type in the password.

Note: the password here must contain CAPITAL letters, small letters, numbers and other (non-alphanumeric) symbols, although the system doesn’t say it clearly. 8 characters is the minimal length for the password.

Now the connection to the SQL server on Ubuntu should work.

Check its version just in case to see that the server is really up and running.

SELECT @@VERSION

The result text should be like this:

Microsoft SQL Server 2017 (RTM-CU1) (KB4038634) - 14.0.3006.16 (X64)
 Oct 19 2017 02:42:29
 Copyright (C) 2017 Microsoft Corporation
 Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)

Now the SQL server on Linux (Ubuntu) is ready to use.

Testing SQL Server on Linux (Ubuntu)

A user can start using Microsoft Azure SQL Server on Linux (Ubuntu) by means of sqlcmd  command-line tool.

Note: sqlcmd tool has been installed during preparations.

See below the final command to start to use the SQL server on Ubuntu:

sqlcmd -S localhost -U SA -P '<SQL Server system administrator password>'

Note: <SQL Server system administrator password> is the same “SQL Server system administrator password” that you defined above answering the above question (2).

If successful, you should get to a sqlcmd command prompt from the Microsoft Azure SQL Server on Ubuntu:

1>

Note: any command typed after the prompt transforms the above “1>” to “2>”, then to “3>” and so on,  but the counting stops when you type “GO” (then the counter starts from “1>” again).

A user may follow instructions from the above Microsoft site, having sqlcmd prompt at the beginning of each command from the following command sequence.

CREATE DATABASE TestDB

SELECT Name from sys.Databases

GO

Here you have to have the following text on your screen (the list of databases available).

Name
--------------------------------------------------
master
tempdb
model
msdb
TestDB

(5 rows affected)

There is a way to continue testing.

USE TestDB

CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)

INSERT INTO Inventory VALUES (1, 'banana', 150);

INSERT INTO Inventory VALUES (2, 'orange', 154);

SELECT * FROM Inventory WHERE quantity > 152;

GO

Note: DON’T FORGET TO USE “GO” AT THE END OF A COMMAND SEQUENCE YOU WANT TO EXECUTE.

The resulting text should be like this:

id     name                quantity
------ ------------------- --------
     2 orange                   154

(1 rows affected)

SqlBackupAndFtp Discount Coupon

$
0
0

If you’re looking for a promo code for SqlBackupAndFtp you can use the following one:

 SBF10OFF

It will give you 10% off all editions of SqlBackupAndFtp.


Cloud Databases for Busy People

$
0
0

This post will give you a bird’s eye view explanation of what “cloud database” is and what kinds of cloud databases the market offers us today.

Let’s start with a short definition. Cloud database” is a remote and outsourced database (remote” means “accessed by users through the Internet or an intranet”, “outsourced” means rented by many users from an external supplier, so-called “cloud service provider”).

It is a relatively new (and not very popular right now) approach, but it grows fast and seems to be very promising.

Terminology

Database here means a set of: 
(1) database data (users’ data),
(2) database software for managing (1),
(3) database computer(s) for managing (2).

The above definition of cloud database tells about “remote renting” of (2) or (2) & (3) together.

Database software (2) is called as a database management system (DBMS), they consider (2) & (3) together as a database system.

So, in other words, cloud database can be defined basically as a set of computers connected to a network with a database software that are (both or software only) rented by many users for their data and accessed by the users through the network.

What Is a General Idea behind the “Cloud Database”?

The basic idea is just outsourcing of database software or the whole database system, i.e. this is to help users to focus on how to use their data (1) and NOT to think about how to keep their database systems (2&3) up and running. Remote access (through a network) to a database system is what is needed for convenient outsourcing, which (outsourcing) is the main thing.

To use a cloud database is like to use a taxi service instead of buying or renting a car or hiring a chauffeur. For example, using a taxi a user doesn’t need to think about, say, how to fix an engine of a taxicab or even how to drive, a user just chooses a car and tells its driver where to go.

Why “Cloud”?

Because often a cloud database is distributed over a number of computers connected to each other, so nobody knows exactly where the database is located, and so the database is located like “inside a vague cloud inside of computers”.

Do People Really Use “Cloud Database Software”?

“Cloud database” management systems (cloud DBMSs) are not too popular right now, but probably they have a great future. Their popularity (as for the last 4 years) has increased tremendously (more than tenfold)  from ~ 0.1% (in 2013) to ~ 1.6% (in 2017).

YearPopularity
2013 ~0.1%
2017 ~1.6%

(The popularity here is measured as a percentage of the overall popularity of all DBMSs.)

How to Choose “Cloud Database Software”?

User’s data type (the way of how the user’s data look like) has to correspond to a database software model (the way of how the database software looks like).

The following table provides an overall look at database software (DBMSs) models.

SQLSQL or Relational
(based on tables)
NoSQLKey-value Store
(phone directory - 2-rows table)
Document Store
(set of questionnaires --- only the whole table can be retrieved)
Wide Column Store
(dictionary - rows having different sets of columns)
Graph
(map for truck transportation company with its customers’ locations together with roads between them)

NOTE: some database software can contain a mixture of all of them.

Let’s have a closer look at database software (DBMS) models.

SQL (Relational)

This is about just tables. It is the most popular one.

Example:

column 1column 2column 3
row 1cell 1 1cell 1 2cell 1 3
row 2cell 2 1cell 2 2cell 2 3

A user basically can separately get (retrieve) any rows inside any table.

NoSQL

NoSQL database stands for “Not Only SQL” and implies that the data is stored in a different form than tables of rows and columns. There are tree main types of NoSQL databases: key-value, document-oriented, wide column store, and graph-like database. Let’s consider them separately with examples.

Key-value Store (phone directory)

The simplest one. A user gets a person’s phone number (value) if the user knows a person’s name (key).

Example:

KeyValue
Bob+7(123) 456-7890
Jane+2(234) 567-8901
Tara+388(345) 678-9012

This is a kind of the smallest table possible just with only two rows.

Document Store (catalog of predefined questionnaires)

This kind of a NoSQL database contains a set of documents (sets of data) that can be composed of different fields.

A user can get (retrieve) a document (a table) as a whole only, not a part of the document.

Wide Column Store (dictionary)

Based on complicated tables, that are called ‘column families’ for whatever reasons. These tables can have a different set of columns in different rows of the same table.

Example 1: A dictionary.

 

A column family (table) containing many words and their meanings. One word (in one row) can have many meanings and comments (many columns).

Example 2: Users’ personal data.

A column family (table) containing 3 rows. Each row contains its own set of columns.

Graph

Car transportation company map of its customers’ locations together with roads between them. Illustration:

That is it, let’s repeat the above list in short:

  • SQL (tables)
  • Key-value Store (simple 2-row tables like phone directory)
  • Document Store (tables as a whole, set of questionnaires)
  • Columns Store (tables with different rows inside one table, language dictionary)
  • Graph (like a map of a transportation company).

Reminder: a user can have data which look differently in different parts, so different database software can be used for different parts of the data.

Who offers Cloud Database Services?

There are four biggest players on the market of cloud database management systems:  

Company Market Share
Amazon ~50%
Microsoft ~30%
Google ~10%
IBM ~10%

There are also many other products like Cassandra, MongoDB, ArangoDB and etc, but here we will focus on the bigest ones. These DBMSs differ with respect to a database model.

Amazon - Amazon SimpleDB - Key-value store
- Amazon DynamoDB - Document store
- Amazon Redshift - Relational
- Amazon Aurora - Relational
Microsoft- Microsoft Azure SQL Database - Relational
- Microsoft Azure Cosmos DB - Document store, Wide column store, Key-value store, Graph
- Microsoft Azure SQL Data Warehouse - Relational, Key-value store
Google - Google BigQuery - Relational
- Google Cloud Datastore - Document store
- Google Cloud Bigtable - Wide column store
- Google Cloud Firestore - Document store *** beta
IBM - Cloudant - Key-value store

The following is the table of DBMS models against the products.

Company and Model
Google CloudAmazon Microsoft AzureIBM
Relational (SQL)BigQueryRedshift
Aurora
SQL Database
SQL Data Warehouse
X
Document Datastore
Firestore (beta)
DynamoDBCosmos DBCloudant
Wide column BigtableXCosmos DBX
Key-valueXSimpleDB Cosmos DB
SQL Data Warehouse
X
GraphXXCosmos DBX

Amazon

NameAmazon SimpleDB
DescriptionSimple cloud database service
Primary database modelKey-value store
NameAmazon DynamoDB
DescriptionCloud database service, backed by SSDs
Primary database modelDocument store
NameAmazon Redshift
DescriptionLarge scale data warehouse service for use with business intelligence tools
Primary database modelRelational
Additional database modelsKey-value store
NameAmazon Aurora
DescriptionMySQL-compatible
Primary database modelRelational
Additional database modelsDocument store
Key-value store

Microsoft

NameMicrosoft Azure SQL Database
DescriptionDatabase as a Service offering with high compatibility to Microsoft SQL Server.
It also integrates with Active Directory and Microsoft System Center and Hadoop
Primary database modelRelational
Additional database modelsDocument store
Key-value store
NameMicrosoft Azure Cosmos DB
DescriptionGlobal, large multi-model database service.
It builds upon and extends the earlier Azure DocumentDB
Primary database modelDocument store
Graph DBMS
Key-value store
Wide column store
NameMicrosoft Azure SQL Data Warehouse
DescriptionLarge warehouse service with high compatibility to Microsoft SQL Server
Primary database modelRelational DBMS
Additional database modelsKey-value store

Google

NameGoogle BigQuery
DescriptionLarge warehouse service with analytics and with append-only tables
Primary database modelRelational DBMS
Additional database modelsKey-value store
NameGoogle Cloud Datastore
DescriptionDatabase as a Service
Primary database modelDocument store
Name
Google Cloud Bigtable
DescriptionBig Data database service.
It's the same database that powers many core Google services, including Search, Analytics, Maps, and Gmail.
Primary database modelWide column store
NameGoogle Cloud Firestore
DescriptionBeta database for mobile and web apps...
offers integration with other Firebase and Google Cloud Platform products
Primary database modelDocument store

IBM

NameCloudant
DescriptionDatabase as a Service.
Cloudant's distributed CouchDB service is used the same way as standalone CouchDB, with the added advantage of data being redundantly distributed over multiple machines.
Primary database modelDocument store

Backup SQL Server on the network

$
0
0

SQLBackupAndFTP  creates standard *.bak files when it runs locally on the same computer where SQL Server is. For remote SQL Server computer backups SQLBackupAndFTP creates backup script files (*.sql). Whenever possible, you should always opt for *.bak backups against *.sql backup files.

Here we will show you how to backup a SQL Server on the network to the standard *.bak file even when SQLBackupAndFTP runs on a different computer from where SQL server is. The main requirement in this case is that both SQL server and SQLBackupAndFTP have access to the same shared network folder.

1. Connect to SQL Server on the network

Test your connection in SSMS first – connecting to SQL Server on the network is not always trivial and is a separate subject that is not specific to SQLBackupAndFTP. Then run SQLBackupAndFTP on your local computer, click “Connect to Server”, select “Local SQL Server” as a Server type and enter the same server name, user name and password you’ve used in SSMS.

2. Use a UNC Path as a temporary folder

Specify a UNC path (like \\myserver\shared\) in the Temporary folder section:

This folder should be accessible by both the SQL Server account and by SQLBackupAndFTP. Note that the remote share should only be accessed via UNC name. Mapped drives may not be consistently visible to the SQL Service.

3. Set the rest of SQL backup options

As usually in SQLBackupAndFTP select databases to backup, where store the backups (network, NAS, FTP, Dropbox, Amazon S3, Google Drive, OneDrive, Azure, etc), when to schedule Full, Differential and transaction log backups, where to send email confirmations, encryption and other desired options.

4. Run the backup

Press Run Now button to test. If it runs without errors – SQL Server has enough permissions and SQLBackupAndFTP should run without issues on schedule as well.

Important – Permissions!

If you experience problems with this solution, chances are they are related to permissions. The SQL Server service needs to run it under a domain-level account that has FULL CONTROL rights to the file system folder and to the share. SQL server often runs under “Local System” account that does not have access to the network. To change the SQL Server account:

  1. Open Services app
  2. Find the SQL Server service name (like “SQL Server (SQLEXPRESS)”)
  3. Right Click > Properties, Select the Log On tab
  4. Instead of Local Account, choose “This account” and specify the account with permissions as described earlier

SQLBackupAndFTP account should have the same access rights. – it is simpler if it is running under your personal account (in Advanced settings set “Run scheduled jobs as” to your personal account)

How to backup remote SQL Server database

$
0
0

MS SQL Server backup on a remote SQL Server can not be done using the standard BACKUP DATABASE command. SQLBackupAndFTP allows to automate the creation of backups scripts on remote SQL servers. Scripts are inferior to *.bak files because are larger, do not support differential backups and should be used only if you do not have an option to create *.bak files.

Local SQL servers

When installed locally on the same machine where SQL server is (this is the recommended way of installation), SQLBackupAndFTP backs up databases using a standard BACKUP DATABASE command. For each database you get a single *.bak file that you can restore using the standard RESTORE DATABASE command.

Network SQL servers

If you run SQLBackupAndFTP on your computer and want to backup a SQL Server somewhere on the same network, SQLBackupAndFTP can still produce the standard *.bak file as long as both SQL Server and SQLBackupAndFTP can access the same shared network location – see details on how to make it happen.

Remote SQL server backups

For remote or hosted SQL Server instances you can not use the BACKUP DATABASE command, since this command would create a *.bak file somewhere on the local drive. And you generally do not have access to that location so getting the backups file to you local PC is problematic.  So in the case of remote SQL server instances SQLBackupAndFTP backs up databases by creating script *.sql files. The files consist on T-SQL statements like CREATE and INSERT that re-create database objects and the data wherever the script is run.

What hosting providers are supported? Basically if they allow remote connection to SQL Server and you can connect to your hosted database from your local computer using SQL Server Management Studio – you should be able to back up your databases using SQLBackupAndFTP.

The most difficult task is to connect to your remote SQL Server. Check your hosting provider on how to connect remotely and use SSMS first to check that connection works.  Then run SQLBackupAndFTP on your local computer, click “Connect to Server”, select “Remote SQL Server” as a Server type and enter the same server name, user name and password you’ve used in SSMS.

After successful connection you can configure the rest of SQLBackupAndFTP options: what databases to backup, where store the backups (network, NAS, FTP, Dropbox, Amazon S3, Google Drive, OneDrive, Azure, etc). Schedule when to run and where to send email confirmations.

How to restore SQL server backup scripts?

Restoring scripts is very simple. To restore on the same server where the backups were taken, in the History & restore section of SQLBackupAndFTP select the backup you want to restore, click the dots button on that line, select “Restore from Backup…” and follow the steps.

To restore an any other SQL server, just run the script like you would run any on SQL command and it will recreate the database.

How to Backup SQL Database Automatically Using SSMS

$
0
0

If you are looking for the tutorial on how to backup SQL database automatically with SSMS just follow the instructions below. Note however that there are better ways to backup SQL Server database than SSMS. This is especially true when you are running MS SQL Server Express that lacks SQL Server Agent – just use SQLBackupAndFTP instead of the method below.

  1. Log into SQL Server Management Studio (SSMS) and connect to the database. Go to the Object Explorer window (located on the left) and make sure that your SQL Server Agent is running.
  2. Open the folder named Management and find the Maintenance Plan folder. Then right-click Maintenance Plan folder and select New Maintenance Plan. How to Backup SQL Database Automatically
  3. Enter the name of the Maintenance Plan you are going to create. Press on the calendar icon on the top right highlighted section on the job schedule screen. It will bring up the job schedule screen. In the opened window set up all necessary backup schedule. How to Backup SQL Database Automatically
  4. Now choose from the bottom left side of the screen select the Backup Database Task to set up the backup process, and drag the element onto the right window as shown in the picture. How to Backup SQL Database Automatically
  5. Few more steps and you will know how to backup SQL database automatically with the help of SSMS. Now you need double-click on the database task. In the opened window set up, the configuration related to the database backup.How to Backup SQL Database Automatically
  6. Specify the databases you are going to backup. Also, you can pick the files to expire after a certain number of days or on a specific date. How to Backup SQL Database Automatically

That is all, your backup plan is ready and all your backups will be made according to the specified schedule. Now you know how to backup SQL database automatically.

How to automate SQL Server database backups

$
0
0

The question “How to automate SQL Server database backups” has a few good answers. Here we will review all the best options. But first let’s define what the SQL Server database backup automation means. We define it as a process that includes the following basic steps:

    1. Run SQL Server backup for selected databases on schedule
    2. Compress & encrypt the backups
  1. Upload the backup to a remote destination – network, NAS, FTP on one of the cloud storages (Dropbox, AWS, OneDrive, SkyDrive, etc..)
  2. Send email notification on backup success or failure

The most popular SQL Server backup automation options that we review here are:

SQLBackupAndFTP
Microsoft SQL Server Management Studio & SQL Server Agent
T-SQL
Ola Hallengren script
or you can just jump to the Conclusion

 

Notes to keep in mind before we begin

Note that if you do not have access to the file system of a remote SQL server like it often happens in hosted SQL servers, you will need to use different SQL backup methods described in how to backup remote SQL database article. Here we will only cover most common option of a SQL Server running on local, network, dedicated or virtual server.

SQL Server Express does not have a built-in way to schedule backups because the SQL Server Agent is not included. SQL Server Agent has a horrible overblown interface and we recommend using something else disregarding the SQL Server edition you are using.

Do not overlook how difficult it is to restore. We’ve included short references on how to do it for every tool below. For more details – read How to restore SQL Server backup.

Note also, that you don’t have to backup the whole database, especially if it’s quite big. You can backup only those changes that had place since the previous backup. For more information read about Full vs Differential backups.

How to schedule SQL Server database backups using SQLBackupAndFtp

SQLBackupAndFTP is the simplest tool to automate database backups. It is MS SQL Server backup software that runs scheduled backups (full, differential or transaction log) of SQL Server or SQL Server Express databases (any version), runs file/folder backup, zips and encrypts the backups, stores them on a network or on an FTP server or in the cloud (Amazon S3, Google Drive, Dropbox, OneDrive, Box, Amazon S3, Azure Storage), removes old backups, and sends an e-mail confirmation on the job’s success or failure.

There are few simple steps to set it up:

  1. First download, install it, run and connect to your SQL Server. Then select the databases to backup.

select database to backup

  1. Then select where to store the backups.

database backup destination

In this case, we’ve selected a network folder. Press “Test” to check the connection, then click “Save & Close”.

  1. To create a backup schedule turn on “Schedule backups” and set the time to backup for simple full daily backups. Or click the gear button to open “Advanced backup schedule” for Differential and Transaction log backup and other options.

database backup schedule

  1. Compression is set by default and you can set encryption if you want to
  1. Press “Run Now” to test the whole job. Then just the program – the job will run on schedule.

run database backup now

  1. If you need to restore on the same computer – just select one of the  backups from the “History & restore” section, click on the 3-dot icon and click “Restore”:

database backup history & restore

To restore on a different computer, install SQLBackupAndFTP there, select “Restore” in the menu and use the interface to select the backup to restore from.

Or you can just download the backup through SQLBackupAndFTP or file manager or the cloud destination client, unzip the file and use the standard RESTORE DATABASE command.

How to schedule SQL Server database backups using Microsoft SQL Server Management Studio and SQL Server Agent

There are following steps you need to take to create .bak file (a backup) using SSMS:

  1. Open your SQL server Management Studio
  2. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance
  3. Expand Databases and then right-click one of the databases you want to backup
  4. Tasks -> Create backup
    General Page
    1. In the Database drop-down list, verify the database name.
    2. The Recovery model text box is for reference only.
    3. In the Backup type drop-down list, select Full (after creating a full database backup, you can create a differential database backup)
    4. In the Destination section, use the Backup to drop-down list to select the backup destination.

    Backup Options Page

    1. To view or select the backup options, click Backup Options in the Select a page pane.
    2. In the Name text box either accept the default backup set name, or enter a different name for the backup set.
    3. Specify when the backup set will expire and can be overwritten without explicitly skipping verification of the expiration date.
    4. In the Compression section, use the Set backup compression drop-down list to select the desired compression level.
    5. In the Encryption section, use the Encrypt backup checkbox to decide whether to use encryption for the backup.
  5. Press OK and if everything is OK you will see a notification that a backup of selected database is finished

To schedule backups using a SQL Server Agent job

To automate and schedule a backup with SQL Server Agent:

  1. In the Object Explorer pane, under the SQL Server Agent node, right click Jobs and select New job from the context menu
  2. In the New Job dialog enter a job’s name
  3. Under the Steps tab click on the New button and create a backup step by inserting a T-SQL statement. In this case the CHECKSUM clause has to be included in T-SQL code.
  4. Click ok to add a step, and click OK to create a job
  5. To schedule a job, in the New Job dialog, under the Schedule tab click New.
  6. In the Job Schedule select an occurring frequency, duration and a start date and click OK:
  7. To check a created job in the Object Explorer pane and under the SQL Server Agent ➜ Jobs node right click the job create above and select the Start job at step option:

You can find even more detailed explanations on backups with SSMS in this article.

How to schedule SQL Server database backups using Transact-SQL

Transact-SQL (T-SQL) is Microsoft’s and Sybase’s proprietary extension to the SQL (Structured Query Language) used to interact with relational databases. All applications that communicate with an instance of SQL Server do so by sending Transact-SQL statements to the server, regardless of the user interface of the application.

Generally, T-SQL command to generate a full backup may look like:

BACKUP DATABASE MyDatabase
TO backup_destination [ ,...n ]
[ WITH with_options [ ,...o ] ]

Where MyDatabase is a SQL Server database you wish to backup. backup_destination is a place where you want to write a backup. WITH with_options is a command you may use to apply different options to a backup such as a compression or an encryption or a description and so on. To find more information about backup options you may read an article.

As an example you may use next code to create a full backup to a disc device:

USE MyDatabase;
GO
BACKUP DATABASE MyDatabase
TO DISK = 'C:\SQLServerBackups\MyDatabase.Bak'
WITH FORMAT,
MEDIANAME = 'C_SQLServerBackups',
NAME = 'Full Backup of MyDatabase;
GO

To schedule the backups using Transact-SQL and Windows Task Scheduler follow these steps (from original article):

    1. Use SQL Server Management Studio or Sqlcmd to create the following stored procedure in your master database:
      USE [master]
      GO
      SET ANSI_NULLS ON
      GO
      SET QUOTED_IDENTIFIER ON
      GO
      CREATE PROCEDURE [dbo].[sp_BackupDatabases]
             @databaseName sysname = null,
             @backupType CHAR(1),
             @backupLocation nvarchar(200)
      AS
      SET NOCOUNT ON;
          DECLARE @DBs TABLE (
            ID int IDENTITY PRIMARY KEY,
            DBNAME nvarchar(500)
          )
      
      INSERT INTO @DBs (DBNAME)
      SELECT Name FROM master.sys.databases WHERE state=0 AND name=@DatabaseName OR @DatabaseName IS NULL ORDER BY Name
      
      -- Declare variables
      DECLARE @BackupName varchar(100)
      DECLARE @BackupFile varchar(100)
      DECLARE @DBNAME varchar(300)
      DECLARE @sqlCommand NVARCHAR(1000)
      DECLARE @dateTime NVARCHAR(20)
      
      -- Database Names have to be in [dbname] format since some have - or _ in their name
      SET @DBNAME = '[DBNAME]'
      
      -- Set the current date and time n yyyyhhmmss format
      SET @dateTime = REPLACE(CONVERT(VARCHAR, GETDATE(),101),'/','') + '_' +  REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
      
      -- Create backup filename in path\filename.extension format for full,diff and log backups
      SET @BackupFile = @backupLocation+REPLACE(REPLACE(@DBNAME, '[',''),']','')+ '_FULL_'+ @dateTime+ '.BAK'
      
      -- Provide the backup a name for storing in the media
      SET @BackupName = REPLACE(REPLACE(@DBNAME,'[',''),']','') +' full backup for '+ @dateTime
      
      -- Generate the dynamic SQL command to be executed
      SET @sqlCommand = 'BACKUP DATABASE ' +@DBNAME+  ' TO DISK = '''+@BackupFile+ ''' WITH INIT, NAME= ''' +@BackupName+''', NOSKIP, NOFORMAT'
      
      -- Execute the generated SQL command
      EXEC(@sqlCommand)
    2. In a text editor, create a batch file that is named Sqlbackup.bat, and then copy the text from the following example into that file:
      sqlcmd -S .\SQLEXPRESS -E -Q "EXEC sp_BackupDatabases @backupLocation='D:\SQLBackups\', @databaseName=’USERDB’, @backupType='F'"
    3. Schedule a job by using Windows Task Scheduler to execute the batch file that you created in step 2. To do this, follow these steps:
      1. On the computer that is running SQL Server Express, click Start, point to All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.
      2. Double-click Add Scheduled Task.
      3. In the Scheduled Task Wizard, click Next.
      4. Click Browse, click the batch file that you created in step B, and then click Open.
      5. Type SQLBACKUP for the name of the task, click Daily, and then click Next.
      6. Specify information for a schedule to run the task. (We recommend that you run this task at least one time every day.) Then, click Next.
      7. In the Enter the user name field, type a user name, and then type a password in the Enter the password field.
      8. Click Next, and then click Finish.
      9. Execute the scheduled task at least one time to make sure that the backup is created successfully.

How to schedule SQL Server database backups using Ola Hallengren script

If sometimes you need to create a backup without complex settings it’s enough to use one of the options described above. But if you want regularly maintain your database you need a maintenance plan. One of the most common ways that DBAs create database maintenance plans is to use the Maintenance Plan Wizard from within SSMS. While it is possible to create a decent database maintenance plan using the Maintenance Plan Wizard, the tool is not very flexible. As your database environment grows, the built-in tools in the SQL maintenance toolbox may prove insufficient.

Ola Hallengren has developed a series of stored procedures which together provide a maintenance solution with the additional flexibility and features required to manage your databases.

Getting started with the SQL Server Maintenance Solution is easy. Follow these steps.

  1. Download MaintenanceSolution.sql.
  2. Open that script in SQL Server Management Studio
  3. In the script, find this line:
    SET @BackupDirectory = N'C:\Backup'

    and replace C:\Backup with the path to your backup directory.

  4. In the script, find this line:
    SET @CleanupTime = NULL

    and replace NULL with your cleanup time. The cleanup time is the number of hours after which the backup files are deleted.

  5. Execute MaintenanceSolution.sql.

You could find more details on Ola’s site.

Conclusion

There are a number of ways to automate SQL Server backups.

SQLBackupAndFTP is by far the simplest and includes built-in encryption and a variety of destinations.

Traditional SSMS method is cumbersome, does not work in SQL Server Express and is limited in destinations.
T-SQL method is just bare bones lacking compression, encryption, notifications, and destinations.

Ola’s script is just a more advanced version of T-SQL method.

SQLBackupAndFTP is a good solution to create SQL Server backups on a regular basis with different options. It is a simple tool outwardly and complex inwardly at the time. It will take you not so much.

Viewing all 198 articles
Browse latest View live