Solved

Using SQL Server Management studio - Take my live database and copy it to my test database.

Posted on 2013-01-12
8
493 Views
Last Modified: 2013-01-30
Using SQL Server Management studio - Take my live database and copy it to my test database.
I need my data to be the same in test as it is in live. I want to learn how to do this using the stuido.
I have SQL 2008 R2.
0
Comment
Question by:scottwoltjer
  • 4
  • 3
8 Comments
 
LVL 4

Accepted Solution

by:
Smighty earned 500 total points
ID: 38770635
You can do this three ways:

Either by Exporting/import, Backup/Restore or Detach/Copy/Attach the Database.
The result should be the same.

For the Export:
Right click on your Database > Tasks > Export Database.
Import it on the new Server

For the Backup/Restore:
Right click on your Database > Tasks > Backup (Select a full backup)
Create a new (empty) database with the same name on the new Server
Import the Content from the previously made Backup

If you have the Luxury to Take your Database offline, you could simply do that, Copy the MDF/LDF Files to the new server and attach it anew there. (don't forget to reactivate your database on the source server).
0
 

Author Comment

by:scottwoltjer
ID: 38770875
The export import seems to easy. Any issues with that.
0
 
LVL 4

Expert Comment

by:Smighty
ID: 38771827
Not that I know of. Have fun exporting :)
0
 

Author Comment

by:scottwoltjer
ID: 38772477
Well I cant get these to work.
Import / Export gives me all kinds of errors
Restore from other database errors out as well.

All I want to do is have all the data in my tables and views to be the same. Please help have to have this done today!
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:Smighty
ID: 38772647
Please elaborate on the Errors you get while exporting the Database
0
 

Author Comment

by:scottwoltjer
ID: 38772906
When I import - export I get this:
 Validating (Error)
Messages
Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "TimeStamp".
 (SQL Server Import and Export Wizard)
 
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
 (SQL Server Import and Export Wizard)
 
Error 0xc004706b: Data Flow Task 1: "component "Destination - AbcAnalysis" (79)" failed validation and returned validation status "VS_ISBROKEN".
 (SQL Server Import and Export Wizard)
 
Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
 (SQL Server Import and Export Wizard)
 
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
 (SQL Server Import and Export Wizard)
 
When I restore I get this:
TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server 'sysprosrv'.  (Microsoft.SqlServer.SmoExtended)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The tail of the log for the database "SysproCompanyTest" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
0
 
LVL 10

Expert Comment

by:Monica P
ID: 38787117
Hi

Use this tool to make ur job much easier..I am in Use of this ..

http://sqlbackupandftp.com/?ref=242

Install this ..Take a Backup of local or remote Database and restore it in Remote or local Database

Before restoring create Restoring Database Name and then restore..

Just give a try on thiss
0
 

Author Closing Comment

by:scottwoltjer
ID: 38837078
I have tested what you sent on a differnt database and it worked. The database I needed this on has some files attahed to it that the vendor did not tell me about so it will not copy over with out them doing a list of procedures to unlock these files.

Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now