| Author |
Message |
kraades
Joined: 23 Oct 2012 Posts: 5
|
Posted: Fri Nov 30, 2012 10:45 am Post subject: Restore db from SSC from command line |
|
|
At the moment we restore our test database from a SQL backup file.
We would like to store the test database (schema and data) in TFS using SSC and restore it using the command line or using an API.
What are the possibilities?
Current:
SQL backup file --> SQL database
Requirement:
SSC --> SQL backup file --> SQL database
or if this is not possible:
SSC --> SQL database |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6346 Location: Red Gate Software
|
Posted: Mon Dec 03, 2012 4:27 pm Post subject: |
|
|
You can use SQL Compare to check out the database scripts from TFS and create a new test database from that.
Before that can happen, though, you'll probably want to use SQL Source Control to get the database *into* TFS as a set of SQL scripts. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
david.proctor
Joined: 23 Nov 2012 Posts: 2
|
Posted: Tue Dec 04, 2012 2:16 pm Post subject: |
|
|
Like Brian says, your best option is probably to check the scripts out and run a command like the following:
| Code: |
| SQLCompare.exe /scripts1:"C:\ScriptsFolder" /s2:targetserver /db2:targetdatabase /include:staticdata /sync |
However, you can also get SQL Compare to check it out of SQL Source Control for you using the
switch. Using
checks out the most recent copy of the database.
| Code: |
| SQLCompare.exe /s1:sourceserver /db1:SourceDatabase /version1:HEAD /s2:targetserver /db2:targetdatabase /include:staticdata /sync |
Just to be clear, it doesn't actually compare against the source database, it compares against the scripts folder of the source database that it checks out.
To store the data as well as the schema you'll want to make sure you've linked all the tables as static data. More about this is here: http://www.red-gate.com/supportcenter/content/SQL_Source_Control/help/3.1/SSC_Source_Controlling_Data
Let me know if this is useful and if you need any more help. _________________ David Proctor
Technical Author,
Red Gate Software |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group