SQL Server Backup to Azure Storage Issues - sql-server

We are currently backing up SQL Server databases to an Azure URL as a page blob. SQL Server version is 2012 SP3. At times I need to get the backups to our Dev, Beta, and Test environments to be restored. I'm having an issue with a large backup (~50 GB). There are several smaller backups that are copied and restored okay but the one large backup is the problem. I've tried using PowerShell scripts and AzCopy. When attempting to restore it using the GUI, the backup is not recognized. When attempting to RESTORE VERIFYONLY, I get the error - Msg 3013 (VERIFY DATABASE is terminating abnormally.)
If I do a restore verify from URL, the backup is valid. If I try to restore from URL, it restores but takes forever (almost 6 hours).
Has anybody else had this problem?

The problem is that the backup is not being completely copied because the AzCopy program is interrupted.
After doing a little research, I discovered there are many options to AzCopy. One of them is the capability to resume the copy if it is interrupted. This is handled through a PowerShell script.
AzCopy has great help - AzCopy.exe /?.

Related

SQL Server Copy database to different server

I'm trying to take a copy of a database into another server. I usually been making backup, copy the backup file to another server and restore it. But the backup is 90GB, and the space left after copying the backup to the destination folder is only 26GB. As you probably understand by now I'm not able to restore the database as it doesn't have enough space. So my question is is possible to restore database by replacing backup file? Any other suggestions? Increasing the disc space is not an option as this is just a testing server and the space will be enough after restoring. Thank you
Depending on your SQL Server version have you tried enabling compressing during backup. You would be surprised by how small the backup file can get after compression. Also if your database is set to SIMPLE recovery you could look to reduce the log file size before you backup.
You can find some steps on how to enable compression during backup here
https://sqlbak.com/blog/how-to-configure-backup-compression/

Automating a SQL Restore - but delayed by 24 hours

I need to be able to script the following process and would be grateful for any guidance in achieving it!
We have a live database which is backed up every night (SQL 2008 R2). We have a 3rd party which requires access to the database but management have decided they can have access to a time-delayed copy instead. So I have been tasked with restoring the previous nights backup to another SQL instance, complete with login information to which the 3rd party can access without impacting the live database.
I believe a script could perform the task, except the backup file name is not constant (i.e databasename_2015_02_15_223005_3661110) and I can't figure out a way of automating a restore without knowing the backup name. We keep 3 days of full backups on the server before they are archived.
Instead should I be looking at either snapshots or replication to produce the 24 hour delayed copy?

Moving more than 200 SQL Server 2008 Databases to another machine

I have a server which is running SQL Server 2008R2 SP1 and there are more than 200 online databases with their specific login and I want to move all of these databases to another machine with the same software SQL Server 2008R2 SP1.
I can afford downtime up to 8 hours so I'm not looking for complex solution like database mirroring and logshipping.
I have tried Backup & Restore, it work fine but trouble me in two ways :
1- I couldn't transfer login to new server so all of my users will have to create their user again which will my users to get angry.
(I have tried to script all of the logins from the security section but since I have realize the hash algorithm between two system maybe different, I cannot transfer my logins in this way)
2 - I have to backup & restore each database one by one which is so time consuming.
I have also tried copy wizard, but I have encountered with following error message at the final stage :
"SQL Server schedule job" job failed the job was invoked by user sa step to run was step 1.
Since mysource server is running based on windows server 2003, I cannot use the powershell V3 solution.
I have done many searches but all I found was a solution to transfer one database to another server.
But since I'm looking for a solution to transfer mass databases, this situation is being hair pulling and so difficult So I wil be very appreciated if you can provide me an easy and practical solution.
for moving logins between servers
https://support.microsoft.com/en-us/kb/918992
[moving logins][1]
then backup and restore all databases in that migraton day using pre built restore script if the db size is small , later restore the differential backups and make it online. if the size is an issue then implement log shipping or mirroring

Recovering transaction log from corrupt SQL Server database

We have a database that is backed up weekly in simple mode. Yesterday, we had a crc error corrupt the mdf file and we were unable to save it. I restored the backup from last week, but now we have a gap from the time of the backup to the time of the restore. Since I have the ldf file from that database, is there any way to "replay" that transaction log to fill in the gap?
I have tried reattaching the ldf file to the recovered mdf file, but SQL Server will not allow me to do that. (It just creates a new ldf file with a different name when I reattach the database.)
Any ideas would help. This is a lot of data to lose and although it is not critical data, I'd like to get it back (as well as learn as well as learn how to do it.)
If you follow the instructions from MSDN -How to: Restore to a Point in Time (SQL Server Management Studio) you should be good. I will not reproduce them here as they are quite long. There is also MSDN - How to: Restore a Transaction Log Backup

SQL Server online backup with MozyPro

Anyone using MozyPro to backup SQL Server databases?
I'm concerned about the way it does the backup. It just copies data files the way they are. Not using the backup database command.
Is it safe?
MozyPro uses the Volume Shadow Service (VSS) to create backups for SQL Server. SQL Server 2005 has been engineered so that VSS backups are consistent. So this is definitely a valid way to back up SQL Server databases.
Here is a white paper on how the SQL Server 2005 SQL Writer works with VSS.
Microsoft® SQL Server™ 2005 provides
support for creating snapshots from
SQL Server data using Volume Shadow
Copy Service (VSS). This is
accomplished by providing a VSS
compliant writer (the SQL writer) so
that a third-party backup application
can use the VSS framework to back up
database files. This paper describes
the SQL writer component and its role
in the VSS snapshot creation and
restore process for SQL Server
databases. It also captures details on
how to configure and use the SQL
writer to work with backup
applications in the context of the VSS
framework.
Here is the MozyPro manual (PDF), which describes how to restore SQL Server backups that were made using VSS.
That being said, if you don't trust this method, there is nothing stopping you from setting up a backup job and just having Mozy backup your *.bak files.
Judging by the hell I am currently going through with Mozy.. NO NO NO!
The backups work, in theory, just not the restore part. Mozy's extreme incremental backup system results in restores that can take weeks. Apparently. I'm still waiting despite talking their top level tech support, over 10 days have passed.
https://github.com/candera/hobocopy
WHY DOES HOBCOPY USE THE VOLUME SHADOW SERVICE?
Because HoboCopy copies from a VSS snapshot, it is able copy even
files that are in locked by some other program. Further, certain
programs (such as SQL Server 2005) are VSS-aware, and will write their
state to disk in a consistent state before the snapshot is taken,
allowing a sort of "live backup". Files locked by VSS-unaware programs
will still be copied in a "crash consistent" state (i.e. whatever
happens to be on the disk). This is generally a lot better than not
being able to copy the file at all.

Resources