We would like to use the Edition Based Redifinition feature with Oracle.
Does anybody have experience creating updates with liquibase using this feature from Oracle?
I've checked in another forum https://forum.liquibase.org/topic/how-to-do-an-alter-session and the test they did, it was not solved.
Did somebody solve this and manage to use this feature from Oracle within liquibase?
Finally we managed to solve it with liquibase.
We're executing a sqlFile changeset that executes ALTER SESSION SET EDITION = and aftewards the changes we want to do.
It looks like the connection is properly changed and that we're able to do the changes in the proper version.
Related
I'm evaluating Flyway and want to know if it can check for the presence of any externally made changes? I.e. if someone makes a change directly to the database, outside of Flyway, can I catch that?
I tried validate and info but it doesn't seem to notice.
No, it can't. Flyway expects you to make all changes to what you want it to manage (structure, reference data, ...) via Flyway.
Here at Redgate we support the concept of a schema snapshot. If you use either SQL Server or Oracle (as these are the database we have best support for) then you can take a snapshot after deployment and later compare this artifact with target database the next time you deploy to make sure that it hasn't "drifted". Our tools can also output a candidate Flyway migration script that will ensure Flyway is consistent with the actual target. If you're interested in this approach I can send you sample scripts of how this is achieved. But remember, this only works with Oracle and SQL Server.
I looked at the Flyway samples and documentation and tried to understand if it is useful in my environment.
The following conceptual detail is unclear to me: How does Flyway manage the changes between database versions? It obviously does NOT compare database life-instances (see answer here:Can Flyway find out and generate migration files from datamodel?)
In detail my setup looks like this:
I create SQL create and insert scripts when coding (automatically and manually). This means every version of my database is represented by a number of insert/create statements.
In my world I execute these scripts through a database tool (sqlplus from Oracle). Each run would setup the database _from_scratch_ (!).
Can I put these very same scripts 1 to 1 inside the "migration" path of Flyway? What happens if the target database is way older than the last "migration step" I did (or flyway did not yet exist when it was installed)?
Update:
I got some input from another Flyway user:
It seems like each "migration" (version of the database) has to be hand-written SQL/Java code and contains only "updates" from the previous "migration" of database.
If this is true, I wonder how this can be used with traditional coding technics: in my world SQL statements are generated automatically and contain all database init/create statements, not just "updates" to some previous version. If my SQL code generator could do that, then I wouldn't even need a tool like Flyway :-).
Your question about "how to handle a DB that has a longer history than there are migration scripts?" You need to create a V1_ migration/sql script that matches/recreates your latest DB schema. Something that can take a blank DB to what you have today. Create/generate that sql script using your existing DB tools and then put it in flyways migration directory. (And test V1 by using flyway against a clean DB and see if you get what you expect.) http://flywaydb.org/documentation/existing.html
After that point in time, all later versions must be added in as you work. When you decide you need a new table, in your dev environment, write a new V*_.sql that modifies your schema to the way you need it.
This blog goes over this situation for a Spring/SQL application. https://blog.synyx.de/2012/10/database-migration-using-flyway-and-spring-and-existing-data/
I know this is a long shot but I am trying to find someone who had dealt with the same kind of problem. Person component on our PS Application ( CRM 8.90.00.000 ) is not saving any data changes on the component except level 0 (Which is RD_PERSON). This is happening after the tools upgrade to 8.52. We do not have Application support from oracle.
If you have faced this kind of issue before, please let me know what caused it and how it was fixed.
Thank You.
Try a SQL trace as a starting point and see if there are any rollbacks occurring in that SQL trace which may be causing the component to save to a certain point, hit an error and rollback changes. Perhaps a table doesn't exist or it doesn't match the record definition in App Designer.
Also have you run the relevant post-upgrade/install reports to look for any issues? E.g. DDDAUDIT and SYSAUDIT? Check the upgrade manual for how to do that.
Try running an alter audit too if you suspect there may be tables in the database that do not match their record definitions: http://peoplesoft.wikidot.com/alter-audit
I am new to Flyway and I am using Flyway 2.1 code base for migration and execution of SQL statements on a previous schema version using Flyway. Once i execute my newer SQL statements the version entry in the metadata table is incremented.
But before I migrate my new version of the schema (i.e before I migrate/ execute the newer SQL statements on the database schema), I would like to capture all the new SQLs in another preview.sql file, so that the DBAs can see the SQLs before they proceed with the migrate.
I plan to do this by adding a flyway.preview() method to the Flyway.java file. Could you please let me know what other files would need to be changed to accomplish this?
Also, I only want to do this if the new version is > current schema version currently in the database. I checked the 2.1 code but the SchemaVersion class has been deprecated in 2.1 and I am not sure how to obtain the current version from the database.
I would appreciate your help or any suggestions that would correct my approach.
Thank you
The necessary abstractions are not in place yet to support this, but I plan on adding them over the next few weeks to support batch updates in 2.2. Once that is done, it should be much easier to implement this.
As for querying the state of the DB, you have the Flyway.info() to assist you.
I've got a data source in Visual Studio. Is there any way to view the SQL that it generates before it sends it to the database?
I don't just want to see the SelectComand, InsertCommand properties which are part of the asp:SqlDataSource, I want to see the query once the parameters have been filled. Is it possible to do this from Visual Studio?
Don't know the answer, but for such debugging I use SQL profiler.
Edit:
For the Oracle, check TKPROF tool. Documentation is here.
You might also need to
alter session set events '10046 TRACE NAME CONTEXT FOREVER, LEVEL 12';
It doesn't seem to be possible. See the other answer for a possible work around.