Synchronize oracle ddl changes - oracle

I am using oracle with sqldeveloper and have two remote schemas: Schema A and Schema B. I need to update schema B according to schema A. Currently I am using database copy feature of sqldeveloper to manually copy any ddl changes such as a new table, a new constraint added to schema A. Is there a way I can automate the process like have schema B updated automatically every time a ddl change occurs in A? I went through some replication tools but they had quite complex procedures and were not free.

Related

Oracle DB Export does not preserve order or dependencies

I'm trying to export an Oracle DB using Oracle SQL Developer having tables, sequences, view, packages, etc. with dependencies on each other.
When I use Tools -> Database Export and select all DDL options, unfortunately the exported SQL file does not preserve the other that is some DB objects should be created before some other.
Is there a way to make the DB export utility preserve object dependencies/order? Or Is there any other tool do you use for this task?
Thank you
Normally expdp does a pretty good job. Problems arise when there are dependencies on objects/users that are not part of the dump. This is because the counter part, impdp, does not add grants on objects that are not created by impdp. I call that the 'not created by me syndrome' that impdp has.
If you have no external dependencies (external meaning to schema's that are not part of the dump), expdp/impdp do a good job for you. You might not be able to use it if you can not have access to the database server since expdp writes it's files on the database server.
If you happen to have access to a database server that is able to connect to the original database, you could pull the data over into your local database using a database link.

Can I use a dblink connecting DB2 and Oracle be used for DML operations on DB2?

I have a database link that connects a DB2 database and an ORACLE database. My prime intention is to migrate data from the source (DB2) to the target (ORACLE). Now, after the migration, the discrepant records on my target needs to be sent back to the source for further actions. Can this be done using the same DBLINK??
Of course you can do that, unless you want to insert, update, delete data in an readonly object. But take care at the types differences between tve two (https://docs.oracle.com/cd/E39885_01/doc.40/e18460/oracle_db2_compared.htm#RPTID114).
You could also federate Db2 to Oracle and pull the data back again...
https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.data.fluidquery.doc/topics/tlsorc01.html

Cloning a Oracle Database Schema

I have an Oracle 12c Instance with a scheme 'wadmin' user, this instance has tables, view, data, triggers, sequences etc.
For quick spinning of docker images, I need to clone the db schema as fast as possible , so that I can create another user 'wadmin1' link it to new docker and start my testing.
Any CLI/tools for the same, does oracle provide any options?
I do not know if this is exacly what you are looking for but you can export your Oracle schema using ORACLE DataPump tool. This involves storing exported schema in the Oracle directory. While exporting schema to file you can transform the schema name, omit unnecessary tables or data etc. Exported files with database schema can be later used for imported to new database instance. More information regarding Oracle DataPump you can find here. https://oracle-base.com/articles/10g/oracle-data-pump-10g#SchemaExpImp.
Alternatively you can have scripts that create the database stored in the Git repository and integrate your builds with too called Flyway https://flywaydb.org/ which can be used to automatize of database schema creation. This is also really convenient from source control point of view. All changes on the schema are pull requested.
In my team we use OracleDataPump when we want to recreate the database together with the data, Flyway is used as a part of our continues integration.

Oracle database migration from 11g to 12c

I need to do a database migration from Oracle 11g to 12c. But I cannot do a direct export and import kind
of a migration since there are a lot of schema changes which are going to happen. I already have the column mappings
in a sparedsheet with old columns and new columns with all details such as data type, constraints, etc.
There are new columns added to many tables are the default values that should be populated are also known.
So what should be the best approach to do this migration?
There are more ways to do this. Start with getting a dba involved.
To minimize production downtime, you could check if making a logical standby database is feasible in your situation. In that case, make the target database a 12c one, that saves for upgrade time.This target database is in sync with the source database at all times and makes it very valuable. Clone the target database and use that clone to test the migration steps. If the migration fails, you can easily re create a new clone to correct the migration process on.
Working in this way could even enable bi-directional replication, replication from the migrated database back to the source database that could make it possible to revert to the original database in the unlikely event that after production start on the new database things don't work as expected.
Start with adding a dba to the project, a good dba can help minimize downtime and reduce risk.

Import and Export Data plus schema using SQLDeveloper 3.0.04

i am newbie to oracle and i like to export database from remote database and import it on local machine. eOn both machines i have oracle 10.2.
I need to know how to export/import schema and data from oracle 10.2 using SQLDeveloper 3.0.0.4.
To export from remote database, i have used export Tool-> Database Export -> export wizard.
and at the end i have got only sql file with DDL and DML statements but somewhere in file it is written
"Cannot render Table DDL for object XXX.TABLE_NAME with DBMS_METADATA attempting internal generator error.
I have ignored previously mentioned message and tried to run those DDL and DML statements but all this ended up with errors.
Is it possible that all this tied with read-only database user? More over, i dont find any table under tables but also tables under other users in SqlDeveloper.
Thanks in advance
As a test, can you select one object in the tree, and navigate to the script panel? SQLDEV also uses DBMS_METADATA to generate those scripts.
Also, as a work-around, try using DataPump to export and import your data. It will be much more efficient for moving around larger schemas.
Your note about not seeing tables under indicates your schema doesn't actually own any tables. You may be working with synonyms that allow you to query objects as if they are in your account. You could be running into a privilege issue, but your error message doesn't indicate that. Error messages often come in bunches, and the very first one is usually the most important.
If you could try using the EXPORT feature say against a very simple schema like SCOTT as a test, this should indicate whether there is a problem with your account settings or with the software.
I'm not sure with SQL Developer 3.0 but with version 3.1 you can follow this:
SQL Developer 3.1 Data Pump Wizards (expdp, impdp)

Resources