How to transfer local sql server or database to another computer - sql-server-2008

I'm working on a project with 4 other guys, and we are developing an android app with a DB. Now, we are going to use a localhost for our SQL Server, I want to be able to take the database from my laptop and copy it to the other guys' computers. I"m using SQL Server 2008 Management Studio.
Any ideas of how to do it? I don't mind to copy the entire localhost server if we can do that.
BTW, I tried to backup the DB on my laptop by right-click on the DB (created .bak file) but there is no restore option on the other computer.
Thanks

Backup your data base and restore in the other machines
edit
If you dont find the restrore option, please try using sql script
ex:
RESTORE DATABASE nwind_new FROM DISK = 'c:\backups\northwind\nwind.bak'
WITH
MOVE 'northwind' TO 'd:\Program Files\Microsoft SQL
Server\Data\nwind_new.mdf'
MOVE 'northwind_log' TO 'd:\Program Files\Microsoft SQL
Server\Data\nwind_new_log.ldf'
You can try

See these links about backup and restore:
http://technet.microsoft.com/en-us/library/cc966495.aspx
and
http://blogs.msdn.com/b/sreekarm/archive/2009/09/11/move-a-database-from-one-server-to-another-server-in-sql-server-2008.aspx
To restore your database see this useful link:
http://msdn.microsoft.com/en-us/library/ms177429(v=sql.100).aspx

its weird you dont see the restore option. You could try deattaching the DB from its location, copy the files (DB and LOG) to the new location and attach it there.
MSDN

Related

Making a local copy of a database

Currently I'm connecting to mysql databases on a dev server, but I want to make a copy of those databases on my local machine that I can connect to without connecting to the dev server. Is there an easy way to do this? I'm using DataGrip.
Thanks.
You can dump your schema from the context menu like on the picture
I'm not familiar with DataGrip, but if you're using MYSQL, just log in on the website and go to your phpmyadmin, from there you can select the database you want, and click the EXPORT button, and you can choose the type of file to save it as. If DataGrip is a database tool, you should be able to save as an SQL file, otherwise maybe save as a CSV.

Convert a .bak file to .sql file

I have a asp script that I'm intending to write it with PHP so I have to get its database and use it.
I have the database as .bak file which I understood that it's a backup and I wanna change it to be .sql to import it in phpMyAdmin
I read about this matter in the web but I didn't find an accurate tutorial that goes through the whole process.
They are talking about mssql database but I didn't even reach this step..
Any help will be highly appreciated. Thanks in advance :)
Note, all of this applies to MS SQL because .bak is a usually a MS SQL backup.
A .bak can't be converted to SQL directly -- it contains a backup of a database which does not have a clear relationship to SQL.
You could restore the backup and then use SQL Server tools and then use that to make some SQL to recreate the SQL server objects but not the dat.
From SQL Server Management Studio: Datbases item, right click "Restore
Database" then from datbase right click script database.
This won't script the data.
The other option is to use RedGate's excellent tools, which should do everything you want.
http://www.red-gate.com/products/sql-development/sql-toolbelt/
Most probably the .bak file is indeed a binary backup of a Microsoft SQL Server database (which is something completely different than MySQL).
So you will first need to install Microsoft SQL Server (Express) together with the SQL Server Management studio (I think there is a bundled download "SQL Server Express including Tools".
In the Management Studio you can then import the .bak file into a new database. Once the import is finished you can use it to create SQL script out of the database.

Restore SQL database from disc copy backup

I have managed to drop an SQL express 2008 database, that I accessed using SQL Management studio.
I don't have a backup of the database created through Management Studio or SQL, but I do have a disc copy of my entire c: drive made prior to a machine rebuild 4 weeks ago (A previous installation of the dropped database did exist at this stage). The disc backup contains all the databases (2) and versions, that I require.
Can I restore the databases from copies of raw files form a backup disc? If so is this complicated?
Which files would I need to be copy and to where?
Thanks in advance. Your help is appreciated.
Should be pretty easy:
(if needed) re-install SQL Server (Express) - you should make sure to install the version with the Management Studio
Copy the "raw" files (*.mdf and *.ldf) to the default data directory
In SQL Server Management Studio (Express), in the Object Explorer, go to the Database node and right-click and pick Attach...
Find your *.mdf file in question and select it
That should be all there is!
If you have the old .mdf and .ldf files you can use the "attach database" option rather than restore.

where to find MyDataBase.BAK file on SQL server 2008?

where to find MyDataBase.BAK file on SQL server 2008 ?
and how i can restore this file to my DataBase ?
thank's in advance
Did you back it up using SQL only without specifing a full path, e.g.
BACKUP DATABASE MyDataBase TO DISK='MyDataBase.BAK'
GO
I think by default your backup will get placed in the Backup folder in the SQL Server install, i.e. C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup or similar. You can restore it using
RESTORE DATABASE MyDataBase FROM DISK='MyDataBase.BAK'
GO
but if the orginal files are still there you'll need to specify alternate paths for the restore, e.g.
RESTORE DATABASE MyDataBaseTestRestore FROM DISK='MyDataBase.BAK'
WITH MOVE 'MyDataBase' TO 'C:\Temp\TestRestore.mdf',
MOVE 'MyDataBase_Log' TO 'C:\Temp\TestRestore_log.ldf'
GO
but it's so much simpler if you use management studio for all of this stuff.

I accidentally deleted all the logins in my SQL DB, now I am unable to connect

Is there anyway to get in the server and recreate them?
I actually found a much simpler solution to this here:
http://blogs.msdn.com/b/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx
The short version (in case that link dies) is that if you restart the sql server in single user mode "net start mssqlserver /m" then a member of the local machine's administrator group will be able to connect with windows authentication. You can then change the sa password, add new accounts, or whatever you need.
You'll have to reinstall the server as there is no "grip" available to run anything to restore the accounts or create new ones.
Since you can't backup your databases either (again, no way to get there from here) you'll want to stop the SQL Server service (MSSQLSERVER) in the Services panel so that it releases its exclusive lock on your database files. Next, navigate to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data and copy all of the MDF and LDF files to a safe spot.
Next, uninstall and re-install SQL Server (you may be able to just reinstall). Once you are up and running again, copy the MDF/LDF files back (NOT the model, msdb or master databases!! Just the ones that YOU have created) and "attach" them in a SQL window. You'll do all of this with the Windows integrated account.
Does the surface area configuration tool still work? If so you could attempt to use that to add another admin to the instance.