Category Archives: Learn SQL

Incremental MySQL Server Backup via Binary Log

Making backups is important and necessary. However, if your database is large, then creating a backup will load the server, and the backup itself will consume storage space. In light of these considerations, many make backups once a day at night, or even worse, once a week on weekend! However, a failure can lead to losing data for a period of many hours. What if you want to make backups more often without overloading the server? Incremental backups can help you with this. Continue reading Incremental MySQL Server Backup via Binary Log

How to backup remote SQL Server database using SqlBak

With the help of SqlBak, you can backup your remote SQL Server databases according to your schedule. A standard BACKUP DATABASE command doesn’t work on a remote SQL Server, only scripts can be generated. If there is a choice between scripts generation or performing backups in *.bak files, it is always recommended to run the standard BACKUP DATABASE command to get *.bak files. Scripts have some drawbacks: they are larger and do not support differential and transaction log backups. A more detailed explanation about remote backups can be found in the following blog post.

Continue reading How to backup remote SQL Server database using SqlBak

How to backup and restore Amazon RDS SQL Server

Amazon RDS SQL Server is a cloud database from Amazon. The way RDS SQL Server performs backups is the main difference between this and classic SQL Server. It offers the following: snapshots, restore point-in-time, Export Data-tier Application, and native backup to S3, instead of native T-SQL BACKUP DATABASE construction.
Continue reading How to backup and restore Amazon RDS SQL Server

How to Copy SQL Server Database from Windows to Linux

After Microsoft has launched SQL Server for Linux, even if your main tech stack is tied to Windows Server you may need to copy the database to another SQL Server located on a Linux computer.

For example, this can come in handy if you want to provide developers with a database for testing without buying a Windows Server license. 

There are a few ways to tackle this task. This article examines the following methods to copy SQL Server database from Windows to Linux:

  1. Using T-SQL’s BACKUP DATABASE and RESTORE DATABASE commands;
  2. Generation of T-SQL database script (such as mysqldump);
  3. Creating BACPAC;
  4. SqlBak service.

Continue reading How to Copy SQL Server Database from Windows to Linux

MS SQL Server DBMS – /bin/sh: 1: /opt/mssql-tools/bin/sqlcmd

If you get the following error message during SqlBak set up on Linux or during a backup job:

MS SQL Server DBMS – /bin/sh: 1: /opt/mssql-tools/bin/sqlcmd

it means that SqlBak app could not find the path to the msql executables. By default, SqlBak searches for mssql files in the /opt/mssql-tools/bin/sqlcmd directory. Continue reading MS SQL Server DBMS – /bin/sh: 1: /opt/mssql-tools/bin/sqlcmd

PostgreSQL DBMS – /bin/sh: 1: /usr/bin/psql: not found

If during setting up of SqlBak on Linux or during a backup job one of the following errors occurs:

PostgreSQL DBMS – /bin/sh: 1: /usr/bin/psql: not found
or
PostgreSQL DBMS – /bin/sh: 1: /usr/bin/pgdump: not found

it means that SqlBak app could not find the path to postgresql executables. By default, SqlBak looks for postgresql files in the /usr/bin/psql directory.  Continue reading PostgreSQL DBMS – /bin/sh: 1: /usr/bin/psql: not found

How to Automate MySQL Database Backups in Linux

Automated backup of MySQL databases can be a serious task. The proper way to automate backups involves the following steps:

  1. Create a database backup
  2. Zip the backup
  3. Encrypt the compressed file
  4. Send the backup to storage over the Internet, FTP, Dropbox, AWS, Google Drive, etc.
  5. Receive email notifications concerning backup results
  6. Create a backup schedule
  7. Delete old backups

Continue reading How to Automate MySQL Database Backups in Linux