I have a sample SQL Server database backup that is ~12gb. Too large for me to restore in SQL Server Express (10gb limit). I downloaded the Developer version of SQL Server (on my home PC) and was able to restore the instance there, but the machine I need to test this database on is 32-bit and I can't find a 32-bit SQL Server Developer edition.
Is there an easy way for me to reduce the database size by a couple of GB by truncating some tables I'm not using in order to get under the 10gb limit so I can restore it to a 32-bit version of SQL Server Express?
I've already cleared out the data I don't need, But when I make a full backup, it's like ~50gb! Is there a way to get a smaller backup after removing some data? what settings should I use to backup?
This data is just for testing with a Windows form app I'm creating so it's most important that I get the schema and stored procedures over anyways. I've tried to generate scripts and run them on the new SQL server instance, but there's these dependencies to some .mdf file that I can't move that causes it to fail.
Let me know if I can provide any additional helpful information.
Any help would be appreciated - thanks!
In Developer Edition, right-click Database Name, select Reports > Standard Reports > Disk Usage by Top Tables. That will show which tables are taking up the most room.
Remove what you can, then shrinking your data and log files using:
Right-Click Database Name > Tasks > Shrink > Files:
Do this twice, once for File Type: Data and second for File Type: Log
Create new backup and see if it's within limit.
Related
I am really really new to SQL Server, I know how to do a query and other simple stuff and recently my company was bought by another one, we had a Cube Server which was accessed by a excel file via olap using the analysis services from sql server 2008 it was updated by an .abf file, first day after the sale the former server was retired, and everything I have access to is this .abf file used to update the cube, I installed sql server 2008 enterprise edition and I'm trying to restore the file to a new database via the analysis services since the only instructions I received from the old IT department is that is needed to be restored via analysis services. I searched online for some solutions and came across several articles and none of the steps worked for me because they required a already configured database and they were only restoring a backup. I'm thinking I need the .mdf file first so I can recreate the database as is and then I can update it via the .abf file, can someone point me in the right direction?
Since you have the .ABF file, there are a couple options to restore this as a new database. You can either create a new database with the same name, then restore this database from the .ABF file with the AllowOverwrite option set to true. You can also restore directly to a new database by right-clicking the SSAS instance and selecting Restore... From here, specify the backup file name and just enter the name of the database and this will be created as a new cube. This name must be a new database name, as if an existing cube is specified it will be overwritten. Either approach can be done through an XMLA command in SSMS and an example of this is below.
<Restore xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<File>C:\YourFilePath\YourCubeBackupFile.abf</File>
<DatabaseName>TargetOrNewDatabaseName</DatabaseName>
<AllowOverwrite>true</AllowOverwrite>
</Restore>
Try attaching the database with the mdf file in the sql server 2008.
I have a database in SQL Server 2008, which I want to copy to another computer.
How do I make such a copy?
Once this is done, what should I do at the other computer to build the database once again from my copy?
Using SQL Server Management Studio, here are the steps:
1.Right-click the database and select Tasks | Backup
2.Make sure that the Backup type is Full
3.Click Add and specify the location and backup name
4.Copy the created backup file to another computer
5.In SQL Server Management Studio on another computer, right-click the SQL Server instance and select Restore Database
6.Select Device and click the elipsis button to navigate to the copied backup file
Simple Answer: Back it up, then restore it on the other computer.
Have a look here: http://technet.microsoft.com/en-us/library/cc966495.aspx
There's a lot of stuff there, but essentially, right click on the database, Tasks > Backup. Fill in the options to perform a full backup to somewhere.
Once it has created the backup (one big file, by convention with a BAK extension), on the second computer, right click the Databases folder, Restore Database and follow the prompts.
You can do it as well in SQL if you wish:
Backup: http://msdn.microsoft.com/en-us/library/ms186865.aspx
Restore: http://msdn.microsoft.com/en-us/library/ms186858.aspx
There might be times when it's better to detach and move, but this approach always feels a bit safer!
This will copy both structure and the data in the database.
Use TSQL backup and restore. This should help http://www.sqlmag.com/article/tsql3/use-t-sql-to-back-up-and-restore-sql-server-user-databases
One of the easiest ways to do this is back up and restore.
http://msdn.microsoft.com/en-us/library/ms187048.aspx
Another option you have is detaching your database from SQL Server, copying the MDF and LDF files to the target machine, and re-attaching there. Note, if you want to keep a copy of the database on the original server, you will also need to attach there too.
http://msdn.microsoft.com/en-us/library/ms190794.aspx
You can dump the content of your database and restore it on another machine. The same mechanism can be used also for backup purposes. Check the backup&restore functionality of MS SQL.
I'm trying to backup a live database to my computer and I can't find the option to do it. I'm connecting to it using Microsoft SQL Server Management Studio 2008 R2. I'm a MySQL monkey, so I'm used to being able to backup to .sql files and move them around.
Anyone have any idea how I can create a file backup of the database? I've found the backup option which only backs up on the server, or the export, which seems to only allow a single table, or code an SQL query, which I'm not too sure on, short of putting in something like SHOW TABLES;
Anyone have any ideas? I'm limited to readonly access for various reasons, nothing bad, promise!
You will only be able to backup the database to a location the service account for SQL has access to. If you have access to a central share on the server/network that you can access and the service can, you might backup to that location and then browse from your computer to pull it down.
If you are just wanting the database structure you could script the database out to a file. This would let you save it locally. If you also want the data though doing a full backup is the quickest way I know of.
EDIT
I would use the T-SQL BACKUP comand and include WITH COPY_ONLY to backup the database, since you stated this is a "live" database. If a scheduled job is performing backups against the database and you break in to do an additional one you will effect the backup recovery chain of the database. Using the COPY_ONLY will allow you to get a backup of the database without requiring it in the event of a recovery need.
You can also create sql dumps with Management Studio.
Right-click the database and select Tasks - Generate Scripts. This will open a wizard that allows you to select what the dump should include (e.g. tables, indices, views, ...).
Make sure you set "Script Data" to true if you want your dump to include inserts.
You can enter a valid UNC path in the Backup option.
I've got a backup made using the regular SQL Server 2005 backup command. Is there a way to restore just a single table, not the whole DB?
Restore the whole database to another machine (or temporary database), then copy the table seems like the easiest to me.
This is not natively supported in SSMS but it’s possible using third party tools.
Apart from Red Gate (great tools btw) you can try SQL Diff (restore object) and SQL Data Diff (restore data) from ApexSQL.
Disclaimer: I’m not affiliated with ApexSQL but we are their customers and use their tools
The unit of backup and recovery in SQL Server is the database (it is the outer boundary of referential integrity).
Red Gate has some pretty good tools for row-level restore (SQL Data Compare and SQL Backup), but they come at a price.
Detach the current database then restore the database with the date of the tbl you need to a new location (make a sub folder) to put it in keep it separate from your production databases, then restore the database to that sub folder, when completed find the tbl you need and script it to a create script file save to a file, your done with the database delete it then reattached the original one, now scroll down to the tbl you want to restore and script it to a create file (this is a backup only) now delete the tbl, make sure your database is selected and the active one next load the the scripted file you just created with the other database in the query analyzer and run it, it should report successful now check to see if your tbl has been replaced. your done
I need to copy about 40 databases from one server to another. The new databases should have new names, but all the same tables, data and indexes as the original databases. So far I've been:
1) creating each destination database
2) using the "Tasks->Export Data" command to create and populate tables for each database individually
3) rebuilding all of the indexes for each database with a SQL script
Only three steps per database, but I'll bet there's an easier way. Do any MS SQL Server experts out there have any advice?
Given that you're performing this on multiple databases -- you want a simple scripted solution, not a point and click solution.
This is a backup script that i keep around.
Get it working for one file and then modify it for many.
(on source server...)
BACKUP DATABASE Northwind
TO DISK = 'c:\Northwind.bak'
(target server...)
RESTORE FILELISTONLY
FROM DISK = 'c:\Northwind.bak'
(look at the device names... and determine where you want the mdf and
ldf files to go on this target server)
RESTORE DATABASE TestDB
FROM DISK = 'c:\Northwind.bak'
WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'
GO
Maybe the easiest is to detach/reattach. Right-click in the server manager on the DB, tasks --> detach. Then copy the MDF/LDF files to the new server and then reattach by clicking on the server icon and tasks-->attach. It will ask you for the MDF file - make sure the name etc is accurate.
In order of ease
stop server/fcopy/attach is probably easiest.
backup/restore - can be done disconnected pretty simple and easy
transfer DTS task - needs file copy permissions
replication - furthest from simple to setup
Things to think about permissions, users and groups at the destination server esp. if you're transferring or restoring.
There are better answers already but this is an 'also ran' because it is just another option.
For the low low price of free you could look at the Microsoft SQL Server Database Publishing Wizard. This tool allows you to script the schema, data or data and schema. Plus is can be run from a UI or command line <- think CI process.
Backup -> Restore is the simplest, if not to use the replication.
If you use the Backup/Restore solution you're likely to have orphaned users so be sure to check out this article<microsoft> on how to fix them.
Another one to check out that is quick and simple:
Simple SQL BULK Copy
http://projects.c3o.com/files/3/plugins/entry11.aspx
Backup the databases using the standard SQL backup tool in Enterprise Manager, then when you restore on the second server you can specify the name of the new database.
This is the best way to maintain the schema in its entirety.
use backups to restore the databases to the new server with the new names.
Redgate SQL Compare and SQL Data Compare. The Comparison Bundle was by far the best investment a company I worked for ever made. Moving e-training content was a breeze with it.
Check those links:
For multiple db's backup
and single db restore