SQL Server "BAK" bloated file size - sql-server

I created a backup file of my SQL Server 2012 (not Express edition) database on PC1. The file size of the resulting .BAK file was 531 MB.
Then I copied that .BAK file to PC2 that had SQL Server 2012 Express edition.
I restored the database from that .BAK file.
Then immediately created .BAK from that newly created DB on PC2.
Surprisingly, the new .BAK file's size was 3 GB.
Can someone please educate me why the newly created .BAK file is way too big?
Ozair

Related

Can I retrieve data without .bak file

Due to some reason I have lost .bak backup file of my project from a SQL Server database.
Can I restore database of the project with .MDF & .LDF files?

Restoring SQL Server 2008 R2 *.bak databases on SQL Server 2014 Express

I recently changed my SQL Server 2008 R2 (10.50.1600.1) to SQL Server 2014 Express (12.0.4100.1 - with service pack 1). Now I would like to restore *.bak files that I have created on SQL Server 2008 R2.
First of all I can't see my *.bak files in the Backup directory (C:\Program Files\Microsoft SQL Server\MSSQL12.RALTECH\MSSQL\Backup). I copied all my backup files there.
When I try to type backup file location at a push like this (one of my backup file is called RMP) I can see that Management Studio recognize the file :
The file (backup) size is 2201 KB and the database file is 2245632 (Size column in Management Studio - I don't know what unit is it MB or KB ...) However it's not bigger then acceptable size in SQL Server Express edition. So that's not the problem.
When I click ok to restore I get this error :
TITLE: Microsoft SQL Server Management Studio
Restore of database 'RMP' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The operating system returned the error '5(Access denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.RALTECHSQL\MSSQL\DATA\RMP.mdf'. (Microsoft.SqlServer.SmoExtended)
What I can do with this ? How can I restore my databases on SQL Server 2014 Express from SQL Server 2008 R2 *.bak files ? What is strange for me my backup files (*.bak) have padlock icon. Could that be a problem ?
Thanks
Your problem is not permissions on the backup folder, it's the folder you're trying to get SQL server to create the new database files in.
As you backed it up from the old instance, SQL Server will default to trying to put the database files back into the folder they were originally in (In this case C:\Program Files\Microsoft SQL Server\MSSQL10_50.RALTECHSQL\MSSQL\DATA)
You don't want this to happen because your new 2014 server doesn't have permissions to create files in this folder (plus they probably already exist, unless you deleted the DBs from the old instance), what you need to do is choose a new location for the files, so before you click restore, click on the files section of the restore dialog and choose a new location for the files, based on your folders shown it should be something like C:\Program Files\Microsoft SQL Server\MSSQL12.RALTECH\MSSQL\DATA\
Your 2014 instance will have permissions to create files in here and the restore should work.

SQL Server database backup file cannot restore

In SQL Server 2008, I have a database which exceeds 10GB in size. I cleaned up the database and took a backup from it. Backup file size is 160MB.
Once I try to restore this backup file to SQL Server 2008 R2, an error popups.
I have already done this process earlier with same server-different database.
But that database size was smaller.
Please help me to restore database.

How can I import all databases from my development server to my local SQL Server 2008 R2?

I am working on a development server developSQL where there are 5 databases. I want to copy all those databases to my laptop (local server).
How can I do this process without using backup files or there is only one option of doing backup files and using that backup file to restore how can I do this?
Thanks in advance.
you can stop sql server, copy the all the mdf and ldf ( data and log files) and attach the copies to the sql server on your laptop
You can either attach them using a script or with management studio
http://technet.microsoft.com/en-us/library/ms190209.aspx

How to move database and attach it to SQL Server 2008

I am not able to attach a database to a SQL Server 2008 on different machine. I moved the .mdf and .ldf files after detaching the database from one computer to another. When I try to attach the database on new machine the database does not show up on the file location.
If I browse manually I can see the files (.mdf and .ldf). There are no hidden files under the MSSQL > DATA folder which contains all the other database files.
Also is there a way to backup the database, move it to new machine and add under SQL Server? If yes then how can I do so? Please advise.
If you see the MDF and LDF files via file explorer, but not in SQL Server Management Studio, your SQL Server Management Studio login might have insufficient permissions
If the SQL Server version is the same for both original and destination instance, there should be no problems to attach the MDF and LDF files
Right-click the Databases node in Object Explorer
Select Attach...
3.Click Add
4.Navigate to the folder the MDF and LDF files are stored. make sure the SSMS login has enough privileges for the files/folders
5.Select the MDF file and click OK
The patch for the LDF file will be automatically added if it's in the same folder. If not, add it manually, the same way you added the MDF file
To backup and restore the backup into a new database, see these articles:
Create a Full Database Backup (SQL Server)
Restore a Database Backup (SQL Server Management Studio)

Resources