Solved

SQL Express 2014 - Script to backup transactions

Posted on 2016-08-30
8
42 Views
Last Modified: 2016-09-05
WE have a SQL Express installation for a product and we need to find a way to backup the logs every 2 hours.
What's the best way to achieve this using?

Thanks.
0
Comment
Question by:BJMagill
  • 4
  • 3
8 Comments
 
LVL 32

Accepted Solution

by:
ste5an earned 500 total points
ID: 41777641
Use scheduled tasks to run a backup script using sqlcmd or PowerShell. See Back Up a Transaction Log (SQL Server).
0
 
LVL 3

Expert Comment

by:Daniel Jones
ID: 41777959
0
 
LVL 32

Expert Comment

by:ste5an
ID: 41778032
@Daniel: SQL Express has no SQL Server Agent who executes scheduled jobs.
0
 

Author Comment

by:BJMagill
ID: 41784377
ste5an, outstanding reply however I'd like to be able to apply a date and time stamp. Not sure how to accomplish this using the Powershell script:

Here's what I have..
Backup-SqlDatabase -ServerInstance uuaesrv01\sqlexpress -Database AstaPP -BackupAction Log

Thanks,
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 32

Expert Comment

by:ste5an
ID: 41784383
How do you invoke it? Do you get any error messages?

btw, does your database run in full or bulk-logged recovery mode?
0
 

Author Comment

by:BJMagill
ID: 41784396
Full mode.....
No error. It just writes the backup file as below:
Details
0
 
LVL 32

Assisted Solution

by:ste5an
ste5an earned 500 total points
ID: 41784565
So you mean by timestamp to add it in the file name?

Use the BackupFile parameter.
0
 

Author Comment

by:BJMagill
ID: 41784594
Yup,

That's the job.

So, for anyone that is interested... here is the finished version.

$currentdate = get-date
$currentdate = $currentdate.ToString('MM-dd-yyyy_hh-mm-ss')
Backup-SqlDatabase -ServerInstance uuaesrv01\sqlexpress -Database AstaPP -BackupAction Log -BackupFile AstaLog$currentdate.log

Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now