GithubHelp home page GithubHelp logo

sql_backupremote's Introduction

SQL backup to remote pc

Checks a file location for disk space before creating a .bak backup. Subsequently proceed to check remote pc file storage space before sending .bak over. This is an extension to the Reference link mentioned with the extension of transfering the backup and checking for folder/file space, edit as accordingly.

Table of Contents


How to use

git clone https://github.com/jnre/SQL_backupremote.git

Restore the 2 jobs:

  1. open SQL Server Management Studio
  2. On the File menu, open the file containing the scripted job
  3. Execute the script to create the job

There would be 2 jobs that needs to be created in Microsoft SQL server under SQL server Agent, a full transaction backup that happens everyday at 12am(daily backup script) and a transaction backup that happens every 2 hour(transaction log backup script). the file transfered over will be removed depending on the days to Keep parameter

sql server agent

Under Job properties General, specifed parameters in the description are used, edit the parameters for your use , namely:

  • @db0, the database targeted
  • @fileLocation, where local database will be first created
  • @remoteFileLocation, another server filelocation which you wish to store the database
  • @daysToKeep,[only for dailybackup], no of days to keep for both transac and full backup on remote.

Important to keep ; at the back of each parameters, edit them for your own use

job description

3 steps would be created in the job:

  • Check for disk space, powershell script
  • Create local copy of database, transact-SQL script
  • copy to remote pc, powershell script (delete local copy only in daily full backup script)

job steps

DO note that deleting the local copy is scheduled in the daily backup script job for BOTH transaction and full logs.

Permissions

Create a Credentials in SQL server > Security > Credentials called 'backupRemote' with your user account and password.

Create a Proxy in SQL server > SQL Server Agent > PowerShell with the 'backupremote' credential, this is so it allows you to access the remote pc to check its file space, may not be required depending on your server permissions

Webhooks

webhooks were created to notify user which has been edited. current channel wont work.

File Size

file size are subjected to your disgresstion, current limit is 20 MB, changes can be made in powershell script

Reference

https://solutioncenter.apexsql.com/how-to-create-and-manage-database-backup-chains-in-sql-server/

https://www.sqlshack.com/understanding-log-sequence-numbers-for-sql-server-transaction-log-backups-and-full-backups/

sql_backupremote's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.