I'm using Visual Studio 2019, 16.11.9, with Oracle Developer Tools for Visual Studio, 19.3.2.0.
I can do a schema compare with my local database, but there are a number of issues I have noticed which I can't have following through to deployment in test or production. I just wondered if I am doing something wrong or if these issues are limitation of the extension.
Using schema compare generated change scripts only ever drop and rebuild an existing table, never alter it. This obviously deletes all the data in the table too. How do I change this?
Whenever I do a database clean build I have to run the schema compare, or build script, multiple times as the tool doesn't order the build based on dependencies. Surely this is my setup as otherwise this is a HUGE oversight!
Any help welcome.
Related
I'm a bit lost in implmementing/using tfs version control with Oracle products. The project I'm on is using visual studio 2012, tfs 2013, an oracle 11g server, a few copies of Oracle SQL Developer, and a few copies of toad.
I was recently looking for a way to do tfs version control through visual studio using oracle developer tools*. Is this a viable approach?
When tooling around with it, I've been able to create a database project with tables, procs, etc and put this under tfs version control. I've also been able to run these procs against my normal database server. However, I have not been able to put my existing database under version control. I have also not been able to run my code against the visual studio database project.
So can tfs be used with oracle developer tools to provide a version control solution?
Alternatively, are there any ways to integrate tfs version control with both Oracle SQL develoeper and toad?
*Oracle Developer Tools - http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index-097110.html
On the oracle developer tools promo page it says
"SQL Script Lifecycle with Source Control Integration: Generate SQL
scripts for Oracle schema objects that your .NET application uses,
manage them in an Oracle Database Project, check them into source
control, edit the scripts in the Oracle SQL Editor, and execute them
with a built in SQL*Plus execution engine."
How does this work? Can I automatically generate the scripts each night and check them in or something?
Yes, after you install Oracle Developer Tools for Visual Studio, you can configure your Oracle Data Connections in the Server Explorer, create a new Oracle Database Project, then drag and drop packages or other items from the Server Explorer to your new project. Then, after editing the .sql files that were generated, you can right-click on the .sql files generated and "Run" or "Run on...". Finally, you can also run subsets of each script by right-clicking on a selection and choosing "Run selection".
You still need the discipline to ensure everyone edits packages via source control and not on the database directly.
SSDT database projects in Visual Studio only support SQL Server.
One option is to try Red Gate Source Control for Oracle, a tool developed by the company I work for. This supports both TFS and Subversion. I'd be interested to know if this is something that might work for you.
You can use Toad to integrate Microsoft TFS changes. Please see : http://www.toadworld.com/products/toad-for-oracle/m/media-library/689.aspx
I have this question... probably is similar to Executing scripts from a database project in visual studio
but i didn't understand the solution given.
So i made a Database Server 2008 project inside visual studio.
Just one table. When i press DEPLOY the database is created inside SQLServer2008 and the table is created.
Now what if i would like to give the project to someone who has SQLServer and he needs to recreate the database and the table in his computer?..
Apart form executing the query from Visual Studio is there any way to create an executable that automatically "deploy" from outside Visual Studio?..
Thanks,
There are different types of Database projects in Visual Studio. The old ones, which were not so feature rich. The 'Data Dude' ones that came with Visual Studio 2010 Team Database Edition and the most recent iteration that comes with the SQL Server Data Tools. All of these can be installed on top of the standard Visual Studio Professional and don't require additional licenses.
SQL Server Data Tools is the latest, and also the best integrated and most powerful variant of the bunch. It can also be used to compare existing schema's and generate upgrade scripts or automatically upgrade the schema in an existing database for you.
During build, a package will be created that holds all the schema information for your database. You can then use the command line tools provided by the SQL Server data tools or MSDeploy to deploy your compressed schema file to a new or an existing database.
This deployment mechanism can also upgrade existing schema if needed.
When I click on Write Updates and then I confirm, VS stops working. What could be the issue here?
I'm trying to update the database project schema directly from the source database using a schema comparison, as it seems it is the absolute best way to sync those, but I seem unable to execute it on the target project. I haven't tried targeting a database.
http://i.stack.imgur.com/lSUpQ.png
The deployment scripts generated by a visual Studio 2010 Database project won't work for me. I need to include them in an MSI that will be shipped to many different customers to both upgrade and create new databases.
Looking through the Microsoft.Data.Schema... namespaces I see many possibilities for customizing the generation of the deployment scripts, DeploymentScriptGenerator, ExtensionManager etc. etc. It really looks like it was designed to be extensible and to support any database.
What I can't find is any sort of "getting started" documentation or samples. Has anyone done something like this?
Visual Studio Data Projects use two phases of deployment.
The deployment files created by building the database project is really just a package of metadata that describes the desired final state of of the database, but with no knowledge of where is going to be deployed or whether it is a new database or existing database.
The second part is actually executing the deployment package against a specific database, either existing or new. To do that, Visual Studio has to run a diff against the database and the deployment package, and determine which changes need to be applied, and generate the script necessary to apply those changes.
So the problem you have is that if you include the first part in your MSI, you need something running on the end user's machine to apply those changes to an unknown number of unknown databases out in the field, and you can't really ship them Visual Studio.
Luckily MS includes a command line too (VSDBCMD.exe) which allows you to take that single deployment package and use it to apply changes to any database. This tool will do the same diff as Visual Studio and generate the SQL script necessary to create/upgrade that database (any actually run the script, if you so choose, based on command line parmaeters). See http://msdn.microsoft.com/en-us/library/dd193283.aspx for information about how to call it from the command line.
So I'd saw you ship that command line tool with your application (just make sure to double check the redistribution license to make sure this is OK) and have a custom action in your MSI (or some other utility) that executes it to apply the database changes. And also check the dependencies for the command line tool, I know it requires the SQL SMO objects, SQL Native Client, and probably a few other things. You'll want to make sure you MSI includes those as prerequisites.
I've added a SQL Server 2008 database project to my Visual Studio 2010 Professional Edition solution in the hope that it might allow me to include my database in version control.
I can commit the schema files for each database object into version control, however these schema files all script objects as create rather than alter, so are not good for colleges getting my changes and updating their databases.
Is this a good way to get my database into source control?
And what would the workflow be for actually using it to update databases to a given revision without losing all the data associated with dropping and re-creating all the tables?
Update: on Premium and Ultimate versions, there is a schema compare tool which makes this easy. This does not exist on Professional. Is there any straightforward manual workaround?
I'm not sure if you can do this in VS 2010 Professional, but in VS 2010 Premium, you can do a schema comparison (Data -> Schema Compare -> New Schema Comparison) between your project and database, and update changes in either direction.
When going from project to database, VS generates a script that copies existing data into a temporary table before dropping the existing one.
The database project has a deploy step (which is present in my Professional copy of VS2010) that will generate a sql script with your sql objects in it.
The key thing here is if you r-click the project, properties, goto deploy and change target database settings to a specific database, when you deploy it will generate a change script for that specific database so it matches the objects in the project (and in theory keep existing data etc).
You can get it to either generate a sql script, or directly update the database. Generating a script is probably a better idea :)