Can I restore a SQL Server instance from file backups only? - sql

Our windows 2016 server failed to restart after a windows update yesterday.
In order to avoid the update that crashed it issue (whatever it was), I'm in the process of rebuilding it clean.
So I've reinstalled Windows Server 2016, and SQL Server 2016 (same version we were using before).
I have a full system backup from a couple of days ago viz Windows SErver Backup.
What I am having a hard time finding is information on
"How do I restore a SQL Server instance directly from Win Backup files?"
I have recreated the same named instance we had before (so that the file paths match, etc.) - but I have no idea how to make that work? Can it possibly be as simple as shutting down SQL Server temporarily - using Windows Backup to restore the necessary C:\Program Files\Microsoft SQL Server\MSSQL13.SOURCEGEARVAULT\?
Or is there more to it than that? If so, where can I find instructions for this?
If I had a true backup of the database - and not simply the filesystem - I would have access to lots of how-to's - I've done that before. But I don't have that - I just have the raw filesystem a day before it died.
Any pointers would be appreciated!
UPDATE: per feedback - moved this to: https://serverfault.com/questions/914463/can-i-restore-a-sql-server-instance-from-file-backups-only

Related

Microsoft SQL Server backup physical_device_name

I've configured 2 backup tasks in Microsoft SQL Server, to have a full and incremental backup of our database. The version of Microsoft SQL Server is 2008 R2.
The problem is, I've configured a location and until a couple of weeks ago everything went fine. The problem is that it currently creates those backups in a location that is not possible to find. If I check the logs, everything went ok. But in the target directory, there's no trace of that backup file.
When I execute the following query, I get a bizarre value in physical_device_name:
SELECT
physical_device_name,
backup_start_date,
backup_finish_date,
backup_size/1024.0 AS BackupSizeKB
FROM msdb.dbo.backupset b
JOIN msdb.dbo.backupmediafamily m ON b.media_set_id = m.media_set_id
WHERE database_name = 'DB_NAME'
ORDER BY backup_finish_date DESC
These are the values that I get for physical_device_name:
{4CAE7525-44D7-4DEF-86A7-F9C7C99C013C}3
{EC6FB844-832G-4A8F-BDDE-12D073383139}3
And so on ...
Any idea why this is and how to resolve it? My initial thought was that those directories are readonly. I changed that, but I saw that one of the backups last night failed again because of the same reason.
Good day,
SQL Server supports virtualization-aware backup solutions that use volume shadow copy (VSS) also named volume snapshots. For example, SQL Server supports Hyper-V and VMware backup. For more information check this document.
When the host backups your system the SQL Server VSS Writer service is used (It should be running when SQL Server is installed on virtual machine).
You should notice that these backups have value 7 in the column "device_type" (7 means Virtual device). These rows are actually very useful, for example it help to know that the Virtual Machine backups are running full database backups on a SQL Server instance. there's no trace of these backup files since they are above the scope of the virtual machine (above the level of your machine) - these are triggered by the host (Hyper-V or VMware for example).
More information here.
Yup - If you look at device_type (in the backupmediafamily table), you will see that it is probably a virtual device (7) and is being backed up by your virtual machine software.

Team Foundation Server 2012 Update 2 - Scheduled Backups Wizard

After applying Update 2 - the Scheduled Backup is now a build-in feature (not requiring Power Tool). I have difficult understanding the required permissions required to dump a backup on a file-share. Even when trying to dump the backup on a local share - \mytfs2012server\c$\Backup - the wizard ends up with a:
TF401002: The SQL Server Database Engine failed to save the database backup to path... Please grant SQL service account read/write access to that folder.
The message is very simple. I have tried different things - without success. With Update 1 + Power Tools I succeeded to use the wizard after some tweaking. Anyone that can list the permissions required for the Scheduled Backup for Update 2?
Edit:
Update 3 did not change anything for me. However it looks like Update 4 will. From this page it looks like Update 4 will include changes regarding backup:
Scheduled Backups configuration is no longer blocked if the SQL Server service for TFS 2012 is running as a virtual account (for example: NT Service\MSSQLSERVER).
In TFS 2012 Update 2 and Update 3, transactional backups record a failure when they try to run while a full or differential backup is running.
Scheduled Backups no longer run transactional backups if a full or differential backup is running. Instead, the job will be suspended until the other backup has finished running.
I had the same Problem.
Infrastuctur: TFS 2012 Update 2, SQL Server 2012
Solution:
I created a simple shared Folder like \BACKUPSERVER\TFS_Backup$ on the DB Backup Server.
I configured the TFS admin and the SQL Admin with Full Control in the Security and Share Permissions.
Now the Backup Job is running.
But now i have an other Problem:
After running a Full Backup the Transaction-Logs were not truncated, does any one have the same Problem or maybe an solution?
Are you using virtual accounts for the server? Something like 'NT Service\MSSQLSERVER'? If so be aware that they aren't supported in the Scheduled Backups Wizard in both TFS 2012.2 & 2012.3.
You either have to create the backup plans manually or switch the SQL service account to a domain account or Network Service.
EDIT:
As per the comments, TFS 2012.4 RC2 and up has removed this restriction

Microsoft SQL Server 2012 Expired

I've been working on this ASP.Net Project for a few months, and today my SQL Server 2012 Management Studio has expired. Completely overlooked that i may have been using a trial version and not the express edition. I can not access SQL management studio as it says the evaluation has expired.
Is there a way i can downgrade to the express edition (Free), without losing any databases?
Is there a way i can still backup/export the database i have been working on? Ive tried using the import/export 64 bit tool, but ive forgotten my sql server password. I had just been using the default all this time.
Thanks
Backup database: You can get close backup of your databases by copying the data and log files from your Data directory. You can do this just using Windows copy and paste command.
Re-install from trail version: I faced this problem for SQL Server 2008 trial version. When SQL Server 2008 expired, I was able to re-install it as follows:
a) Remove or uninstall all tools of SQL Server completely from Control Panel > Programs and Features.
b) Then, re-install SQL Server as a new fresh tool.
c) After completing the installation successfully, Cope and paste those backup data and log files into new data directory of new installation.
d) Open SQL Server Mgmt Studio and attach the data file to re-create your old database. Your database will be resumed in this way.
I believe you can do this procedure for your SQL Server 2012 trial version too.

Raven backup on windows server 2003

Has anyone got Raven backup/restore working on Server 2003? I am using 1.0.616.0 of Raven.backup.exe to backup and Raven.Server.exe to restore.
Problem is the restore seems to corrupt Raven so it won't start.
There's an open query with ManagedEsent on codeplex: http://managedesent.codeplex.com/discussions/405020
If I get a response then I'll post back here with it.
It doesn't look like this is possible at the moment, however future versions of Raven backup may support Server 2003.
For the present we are just going with a volume snapshot-based solution which is only temporary as we'll be rolling onto Server 2008R2/2012 very soon.

SQL Server 2008 Version Problem [duplicate]

I am getting following error.
Restore failed for Server
I have recently upgraded SQL Server 2005 Express to SQL Server 2008 Express.
I have taken a Backup on Production Server, having SQL Server 2008
Backup was good and I tried restoring Backup on Production Server, that works great.
Than I downloaded that backup file in .Zip format with FileZila Software (And that is good too).
But when I tried to restore that file I am getting following error.
Restore failed for Server
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ ADDITIONAL INFORMATION:
The media family on device 'C:\go4sharepoint_1384_8481.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476
Things I tried which didn't worked
Attempt 1
Try to take backup using following command
BACKUP DATABASE go4sharepoint_1384_8481
TO DISK='C:\HostingSpaces\dbname_jun14_2010_new.bak' with FORMAT
And tried restore that file.
Attempt 2
Somebody wrote to test Version of my SQL Server.
When I tried to run following command in SQL Server 2008
Select ##Version
It is giving following output
Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6002: Service Pack 2)
My Production Database is in SQL Server 2008, and I am trying to restore DB in SQL Server 2008 but above version is showing as if i am using SQL Server 2005.
Any idea how can I restore SQL Server 2008 DB.
Many Thanks.
Is it possible that, instead of upgrading your 2005 instance to 2008, you instead installed 2008 side-by-side with 2005, and you're connecting to your existing 2005 instance? Look for other instances on your machine.
You cannot restore a backup from a higher SQL Server version on a lower version - this has never been able in SQL Server.
If you have a SQL Server 2008 backup, you can only restore that on a SQL Server 2008 (or later) machine - but not on a 2005 box. No trick, no workaround, no way to do it.
You have 2 options here.
Use WITH REPLACE while using the RESTORE command. This will overwrite the existing database and restore the database state represented by the backup files.
Delete the database to which you are trying to restore to and restore again using RESTORE command. This will create a new database with the state represented by the backup files.
Please note that in both these options you will lose the existing data of the database you are trying to restore to.
Make sure it is installed correctly - in your program files\microsoft sql server directory there whould be a 100/150 folder. Check out the install log in setup bootstrap\log.
As described above the reason for this behaviour is that by default SQL Server doesn't allow restoring a database backup to an older version of SQL Server, regardless of the compatibility level of the database the backup was taken from.
You can try to:
Start SQL Server Management Studio and connect to the instance where the database resides
In the database context menu navigate to Tasks | Generate Scripts…. This will invoke the Generate and Publish Scripts wizard
In the Introduction step of the wizard click Next
In the Choose Objects step of the wizard make sure that the Script entire database and all database objects option is selected and click Next
In the Set Scripting options step of the wizard:
Select the Save scripts to a specific location option
Specify whether the database objects and data will be scripted to a single file multiple files, as well as the path and encoding of the generated scripts
Click Advanced
In the Advanced Scripting Options dialog that will appear:
Specify the version of the SQL Server you need the database restored to in the Script for Server Version option
In the Script for Server Version option specify Schema and data
Set the following options to True:
Script Logins
Script Full-Text Indexes
Script Triggers
Click OK
Click Next
In the Summary step of the wizard click Next
In the Save or Publish Scripts step of the wizard click Finish
Execute the generated SQL script(s) against the older SQL instance
Although the procedure listed above should work:
1. It doesn’t migrate all of the database objects (e.g. sequences or queues)
2. It might fail if your database contains dependencies which SQL Server fails to recognize (e.g. dependencies to databases residing on linked servers)
You can take a look at the rest of the article on Solution center. There is also third party tools you can take in consideration.