Comparison of schemas across different database Instances

Hi All,
I need to compare around 8 schemas across 4 different instances. We expect them to be same (atleast constraints and indxes) but we have some exceptions. Don't have any database link. I tried using PL/SQL developer , it gives only changes for source db vs target db. Which is the best tool for this purpose?

Here is for remote Schema comparison:
compareRemoteSchemaDDL.sql
This script compares the database tables and columns between
two schemas in separate databases (local schema and a remote
schema).
This script should be run from the schema of the local user.
A database link will need to be created in order to compare
the schemas.
column sid_name new_value local_schema
column this_user new_value local_user
select substr(global_name, 1, (instr(global_name, '.')) - 1) sid_name, user this_user
from global_name;
select db_link from user_db_links;
define remote_schema=&which_db_link
spool &spool_file
set verify off
column len format 999
column cons_column format a20 truncate
column object_name format a30
break on table_name nodup skip 1
set pages 999
set lines 110
prompt ********************************************************************
prompt *
prompt * Comparison of Local Data Base to Remote Data Base
prompt *
prompt * User: &local_user
prompt *
prompt * Local Data Base: &local_schema
prompt * Remote Data Base: &remote_schema
prompt *
prompt ********************************************************************
prompt **** Additional Tables on Local DB &local_schema ****
Select table_name from user_tables
MINUS
Select table_name from user_tables@&remote_schema
order by 1;
prompt **** Additional Tables on Remote DB &remote_schema ****
Select table_name from user_tables@&remote_schema
MINUS
Select table_name from user_tables
order by 1;
prompt **** Additional Columns on Local DB &local_schema ****
Select table_name, column_name from user_tab_columns
MINUS
Select table_name, column_name from user_tab_columns@&remote_schema
order by 1, 2;
prompt **** Additional Columns on Remote DB &remote_schema ****
Select table_name, column_name from user_tab_columns@&remote_schema
MINUS
Select table_name, column_name from user_tab_columns
order by 1, 2;
prompt **** Columns Changed on Local DB &local_schema ****
Select c1.table_name, c1.column_name, c1.data_type, c1.data_length len
from user_tab_columns c1, user_tab_columns@&remote_schema c2
where c1.table_name = c2.table_name and c1.column_name = c2.column_name
and ( c1.data_type <> c2.data_type or c1.data_length <> c2.data_length
or c1.nullable <> c2.nullable
or nvl(c1.data_precision,0) <> nvl(c2.data_precision,0)
or nvl(c1.data_scale,0) <> nvl(c2.data_scale,0) )
order by 1, 2;
prompt **** Additional Indexes on Local DB &local_schema ****
Select decode(substr(INDEX_NAME,1,4), 'SYS_', 'SYS_', INDEX_NAME) INDEX_NAME
from user_indexes
MINUS
Select decode(substr(INDEX_NAME,1,4), 'SYS_', 'SYS_', INDEX_NAME) INDEX_NAME
from user_indexes@&remote_schema
order by 1;
prompt **** Additional Indexes on Remote DB &remote_schema ****
Select decode(substr(INDEX_NAME,1,4), 'SYS_', 'SYS_', INDEX_NAME) INDEX_NAME
from user_indexes@&remote_schema
MINUS
Select decode(substr(INDEX_NAME,1,4), 'SYS_', 'SYS_', INDEX_NAME) INDEX_NAME
from user_indexes;
prompt **** Additional Objects on Local DB &local_schema ****
Select object_name, object_type from user_objects
where object_type in ( 'PACKAGE', 'FUNCTION', 'PROCEDURE', 'VIEW', 'SEQUENCE' )
MINUS
Select object_name, object_type from user_objects@&remote_schema
where object_type in ( 'PACKAGE', 'FUNCTION', 'PROCEDURE', 'VIEW', 'SEQUENCE' )
order by 1, 2;
prompt **** Additional Objects on Remote DB &remote_schema ****
Select object_name, object_type from user_objects@&remote_schema
where object_type in ( 'PACKAGE', 'FUNCTION', 'PROCEDURE', 'VIEW', 'SEQUENCE' )
MINUS
Select object_name, object_type from user_objects
where object_type in ( 'PACKAGE', 'FUNCTION', 'PROCEDURE', 'VIEW', 'SEQUENCE' )
order by 1, 2;
prompt **** Additional Triggers on Local DB &local_schema ****
Select trigger_name, trigger_type, table_name from user_triggers
MINUS
Select trigger_name, trigger_type, table_name from user_triggers@&remote_schema
order by 1;
prompt **** Additional Triggers on Remote DB &remote_schema ****
Select trigger_name, trigger_type, table_name from user_triggers@&remote_schema
MINUS
Select trigger_name, trigger_type, table_name from user_triggers
order by 1;
Prompt **** Additional Constraints on Local DB &local_schema ****
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
CONSTRAINT_TYPE
from USER_CONSTRAINTS
MINUS
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
CONSTRAINT_TYPE
from USER_CONSTRAINTS@&remote_schema
order by 1, 2, 3;
Prompt **** Additional Constraints on Remote DB &remote_schema ****
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
CONSTRAINT_TYPE
from USER_CONSTRAINTS@&remote_schema
MINUS
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
CONSTRAINT_TYPE
from USER_CONSTRAINTS
order by 1, 2, 3;
Prompt **** Additional Constraints Columns on Local DB &local_schema ****
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
COLUMN_NAME cons_column
from USER_CONS_COLUMNS
MINUS
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
COLUMN_NAME cons_column
from USER_CONS_COLUMNS@&remote_schema
order by 1, 2, 3;
Prompt **** Additional Constraints Columns on Remote DB &remote_schema ****
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
COLUMN_NAME cons_column
from USER_CONS_COLUMNS@&remote_schema
MINUS
Select TABLE_NAME,
decode ( substr (CONSTRAINT_NAME,1,5), 'SYS_C', 'SYS_C',
CONSTRAINT_NAME ) CONSTRAINT_NAME,
COLUMN_NAME cons_column
from USER_CONS_COLUMNS
order by 1, 2, 3;
prompt **** Additional Public Synonyms on Local DB &local_schema ****
Select owner, synonym_name from dba_synonyms
where owner = 'PUBLIC'
and table_owner = UPPER('&local_user')
MINUS
Select owner, synonym_name from dba_synonyms@&remote_schema
where owner = 'PUBLIC'
and table_owner = UPPER('&local_user')
order by 1;
prompt **** Additional Public Synonyms on Remote DB &remote_schema ****
Select owner, synonym_name from dba_synonyms@&remote_schema
where owner = 'PUBLIC'
and table_owner = UPPER('&local_user')
MINUS
Select owner, synonym_name from dba_synonyms
where owner = 'PUBLIC'
and table_owner = UPPER('&local_user')
order by 1;
spool off
Daljit Singh

Similar Messages

  • Reuse Dimdate across different database for different data models

    Hi,
    I am designing a new data model for a data mart. I need to add dimdate dimension in this data model. I noticed that dimdate already exists in another database and being used by another
    data model. Is it possible to re-use the existing dimdate table for my new data model? If so, what about the foreign key constraints? Normally we link the date columns from fact table to the dimdate keys. How would we achieve that in case we are using the
    same table across different databases?
    Any opinion on this will be highly appreciated.
    Thanks in Advance.
    Cheers!!

    You can create a copy of dimdate table to your new data warehouse.
    If both data marts were in a single data warehouse, then you don't required to copy. but as these are in two different databases then you just copy that.
    regarding FK relationship. you can connect any fact table to you date dimension. even if you want to use more than one instance of your date dimension, it would be simply adding multiple FK columns in your fact table (role playing dimension).
    For date dimension be sure that your date dimension covers most of the attributes required. here is an example of date dimension:
    http://www.rad.pasfu.com/index.php?/archives/156-Script-to-Generate-and-Populate-Date-Dimension-Version-2-Adding-Multiple-Financial-Years.html
    Regards,
    Reza
    SQL Server MVP
    Blog:  
    http://rad.pasfu.com  Twitter:
      LinkedIn:
    SQL Server Integration Services 2012 Tutorial Videos:
    http://www.radacad.com/CoursePlan.aspx?course=1

  • Connecting to two different database instances from a swing application.

    Hi All,
    I am developing a swing application which needs to interact with two different database instances of two different weblogic servers.
    More eloborately,
    I have some data in DB_Instance1 running on[b] Weblogic_Server1 and I need to insert the same data into DB_instance2 running on Weblogic_server2. Is it possible. Could some explain me how to do that..
    Thanks in advance...
    Sreekanth.

    Hi Rick,
    Try logging onto both Server first. You'll have to use either 2 separate ODBC DSN's or 2 separate OLE DB connections. Set them both for Trusted Authentication, you'll have to configure that on the Server also.Then try your query.
    If that doesn't work then you'll have to create a Stored Procedure or View that can link the 2 Server side.
    Thank you
    Don

  • Work repository on different database configuration

    Hello there,
    I am trying to set my work repository to be a schema on differing database to the source dataserver.
    Currently when I edit the source data server and try to set the work repository I only have the option to select schemas from the source.
    I have my work repository on a different database.
    Can anyone help?
    Regards,
    CM

    I have come to a conclusion that there has been a confusion over the terminologies. What you call "Work Repository" is actually a "Work Schema" in your specific case.
    Then the answer is that Work Schema needs to be on the same data server as your Source Schema.
    Below is a reasoning behind that:
    This schema consists of temporary/intermediate work tables that are generated by ODI knowledge modules.
    These work tables are similar to tables in source schema in terms of data and structure
    Data is moved, copied and compared between source schema and work schema, it makes more sense to store them on the same data server to avoid any network/communication overhead.
    Hence ODI warrants that the source schema and the work schema exist on the same data server.
    P.S. "Work Repository" is the metadata repository that holds the data model definitions, ODI code, packages, interfaces, etc.
    It works in tandem with "Master Repository"
    Hope this helps you.
    If you feel that your question has been answered, please mark the question as answered and all the answers that you have received as helpful or correct.
    Thanks

  • Multiple database instances and JDBC

    The data I need resides in two different database instances. Can I make two jdbc calls to two different instances, in the same java code?Any better suggestions?? Please.

    No, you don't need to close the first before creating the second one.
    The connections will be entirely unrelated unless (as duffy indicates) you need to wrap the operation in a transaction so that they will either complete together, or not at all. If the operations are unrelated, there is no need to do this.
    Dave.

  • Database/Instance VS Schema

    Want to use Oracle DB as the database for virtue hosting for mutiple web applications.
    Option One: Create one database (or Instance) with multiple shema(s), with each Schema for a web application to access.
    Option Two: Each web application has its own database (or Instance)
    The Database will be located in the same machine. In general which option is more feasible in terms of maintenance and speed?
    Thanks.
    Scott
    It appears to me the second option is better, but the memory may become an issue, for so many database instance will be loaded to the RAM. The first option may save some memory. But each shema will be hit by many users (such as hundreds). I wonder if use of the schema is feasible.

    In case of downtime of database all your web application are having downtime and each application are on different database in that case only respective application would be down. so, it would be better to keep each webapplication on different database as per the maintenance perspective.
    If you are expecting hit from "hundreds" users then better invest more memory. at least 500 mb to 1GB SGA per DB.

  • Multiple oracle database instances with different characterset on  the same server

    Hello,
    Is it possible to have 2 database instances running with different charactersets,one with AL32UTF8 and the other with WE8MSWIN1252.?
    Are there any setup requirements to be performed prior to setting up the database instances?
    The 3rd party utility that we want to use does not support AL32UTF8 and insists on using a database with character set WE8MSWIN1252.
    Kindly help.
    Thanks,
    Ram.

    Hello Zhe,
    I guess I posted my question in a wrong forum.  I tried my best to find a suitable forum and thought this was the best and closest I found.  Apparently not.  Can you please let me know the right forum for my question?
    The below is the breif of what we are currently facing:
    We are in the process of finalizing plans to install Automic for our Retail applications to schedule jobs.  In the process came to know that Automic does not support AL32UTF8.
    Right now we have RMS and UC4 (now called Automic) run on the database server as UC4 supports AL32UTF8 and schema for UC4 is inside the RMS database.
    Going forward it is recommended to have a separate database instance on the same server as that of RMS database and with a different characterset which is WE8MSWIN1252.
    Please let me know what forum to post in, I will repost the question.
    Thanks,
    Ram.

  • Difference between Database, instance and schema

    Hi
    I don't know the clear difference between database, instance and schema.. In the broad sense, everything seems to be the same. If anyone can differentiate between them with some example, that will be of great help.
    Thank you.

    Hi,
    In Oracle, people often do use "database" and "instance" interchangeably, or together as one term: "database instance".
    A "schema" is quite different. A schema is a collection of objects (such as tables, indexes or procedures). Every object belongs to exactly one schema, and every schema is a part of exactly one database. (Names may not be unique, however. For example, your database may have one schema named SCOTT, and another schema named USER1. Each of those schemas may have a table named EMP. The EMP table in the SCOTT schema, or SCOTT.EMP, is not the same as the EMP table in the USER1 schema, or USER1.EMP. A different database, my database for example, may also have schemas called SCOTT and USER1, which are completely independent of the SCOTT and USER1 in your database.)

  • How can I connect to a different database schema,other than adobe?

    I'm building an application where I want to use a different database for it,for storing additional data for the users(different from "edcprincipaluserentity" table in "adobe" database stores)..How I can connect to my database schema created in MySQL from Workbench,to assign tasks to my users,using the Process Management/Assign Task service?

    You can only assign task to user that are known by the LiveCycle User Manager.
    When you configure LiveCycle, you can tell it where you want to get the users from. They can be created them locally in the local database, or synchronized from an LDAP directory in which case it'll read the users from LDAP and make a copy of some of the properties to the internal LiveCycle database.
    Bottom line, all users have an id (in the edcprincipalentity table) in the adobe database.
    If you need your users to come from a different database, then you need to customize the SPI (security provider interface) so that you can synchronize the users coming from your external database. Again, this is a customization since out of the box, we don't synchronize against external database. But it is possible, the API is there and other customers have done it.
    I hope this clarifies things a bit.
    Jasmin

  • Compare Table Data on 2 different databases having same schema

    I need to compare data in all the tables in 2 different databases having same schema.
    If there is any difference in data in any table on Database1 and Database2 then I need to update/insert/delete the rows in my table in Database2.
    So Database1 is my source database and Database2 is my sync database. I cannot use expdp tables as I am not having sufficient privileges to the database server.
    Also I cannot drop and recreate the tables as they are huge.
    Can anyone please guide me how to compare data and to write a script to comapre the changes in say Database1.Table1 and Database2.Table1 and then accordingly do inserts/updates/deleted on Database2.Table1?
    Thanks

    Karthick_Arp wrote:
    Do you have a DBLink? If youes you can do this.
    1. Login into the Database-2 and run this code.
    begin
    for i in (select table_name from user_tables)
    loop
    execute immediate 'truncate table ' || i.table_name;
    end loop;
    end;This will empty all the tables in your Database-2. Now what you need is to just populate the data from Database-1This might result in error, if any of the tables have referential integrity on them.
    From 10g documentation :
    Restrictions on Truncating Tables
    You cannot individually truncate a table that is part of a cluster. You must either truncate the cluster, delete all rows from the table, or drop and re-create the table.
    You cannot truncate the parent table of an enabled referential integrity constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.
    If a domain index is defined on table, then neither the index nor any index partitions can be marked IN_PROGRESS.I would go for normal MERGE. Also change the cursor to select table names by first modifying the child tables and then the parent table.

  • TF244069: An error occurred while checking the provisioning status of the reporting database schema for a PWA instance.

    The command TfsAdmin ProjectServer /RegisterPWA causes next error:
    TF244069: An error occurred while checking the provisioning status of the reporting database schema for a PWA instance.
    Project Server returned the following error: "Server was unable to process request. ---> The request failed with HTTP status 401: Unauthorized.".
     (type ProvisionException)
    Exception Stack Trace:    at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionPwaDBSchema.HandleSoapException(SoapException soapException, String errorResourceString)
       at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionPwaDBSchema.IsDBSchemaProvisioned()
       at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionManager.Provision()
    I installed SharePoint 2013 and Project Server 2013 as farm and TFS 2012 and my account has permissions everywhere. I read article
    http://msdn.microsoft.com/en-us/library/gg412653.aspx and gave full permissions for TFS account to SQL and Project, Project app pool account to SQL, but still have an error.
    How can I find out what exactly permissions are not enough???

    The problem was in claims authentication. Changed to Windows and all worked out.

  • Database instance in different host, ECC 6.0 installation

    Hello All,
    i want to install ABAP distributed system (ECC 6.), unfortunately in step Database instance installation i got only one option  - local host name. I need to put database to other server...
    Does anybody has experience with distribiuted ECC 6.0 ABAP system installation? How can i distribute sap instance and DB instance to different servers (sapinst is not offer this option, only for java systems)?
    Thanks a lot.

    Thank you very much Michael,
    your advise resoved my problem, after using sapinst with parameter " DB host name" instalation of DB instance executed correctly. In default.pfl file i have now as SAPGLOBALNAME db host name.
    I am facing at the moment with other problem during db instalation:
    FCO-00011  The step doGrantServiceRights with step key
    FSL-06002  Error 1060 (The specified service does not exist as an installed service.) in execution of a 'SyWinGetSecurityDescriptor' function, line (1296), with parameter (Error in getting security descriptor for 'MSSQLSERVER' NT service).
    Is it known problem to you? if so, how did you resolve it?
    Thanks a lot.

  • Executing the SQL query across 2 different databases of Oracle

    Hello All,
    In Microsoft SQL server we can execute following type of SQL query across 2 different databases:
    select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;
    Here TEST1 and TEST2 are 2 different databases.
    Can we do the same in Oracle?

    yes you can, but first one has to setup a database link
    Look up CREATE DATABASE LINK and then take things from there!
    P;

  • Foreign Keys involving two different databases/schemas

    Hi -- I'm wondering if it's possible to set a foreign key that involves tables that live in different databases/schemas. And, if it is possible, is it a horrible design idea?
    Thanks,
    ~Christine

    cav0227, you have asked two different two part questions.
    1 - Is it possible to set up FK that span owners and is this good design?
    Yes, it is possilbe and there if the data is related then yes it is good design. We like to minimize the number of object owners in our system and use a table naming standard where the first two or three letters of the table name represent a system code: ap, ar, gl for accounts receivable, accounts payable, and general ledger. Other may prefer to have an AP owner, AR owner, and a GL owner.
    Ownership has no direct bearing on quality of design. If the tables are related then you should define the FK no matter who the owner is.
    2 - Is it possible to define FK to remote (distributed) tables and is the good design? The answer is no. FK cannot reference remote objects. To enforce referencial integrity accross databases via the database, rather than in the application, requires the use of table triggers.
    As far as good design that depends on why the data is remote and why the tables need to be linked. There are issues related to availability, recovery, and performance when data is distributed. Having such a relationship could be good design or bad design depending on if all the inter-related factors have been considered.
    IMHO -- Mark D Powell --

  • Clone A Database Instance on a different mount point.

    Hello Gurs,
    I need you help as I need to clone a 11.1.0.7 database instance to a NEW mount point on the same host. The host is a HP-UX box and my question is do I need to install oracle database software in this new mount point and then clone ?? or cloning to the NEW MOUNT point itself will create all the necessary software?. Please provide me any documents that will be helpful for the process.
    Thanks In Advance.

    882065 wrote:
    Hello Gurs,
    my question is do I need to install oracle database software in this new mount point and then clone ??No.
    or cloning to the NEW MOUNT point itself will create all the necessary software?.No: cloning a database on same host means cloning database files : it does not mean cloning Oracle executables. You don't need to clone ORACLE_HOME on same host.
    Please provide me any documents that will be helpful for the process.
    Try to use : http://www.oracle-base.com/articles/11g/DuplicateDatabaseUsingRMAN_11gR2.php
    Thanks In Advance.Edited by: P. Forstmann on 29 nov. 2011 19:53

Maybe you are looking for

  • Occasionally got ORA-12545 error

    I have 2-node Oracle 10g RAC set up. From a remote client, i run my sample program to retrieve scott.emp data. Occasionally i got ORA-12545 connection error. Using cpp app and Perl DBI app for tested it. And I got the same problem. ./mysample Environ

  • Reg Error in adstrtal in linux

    Hi when entering the command /dten/w01/oracle/dtencomn/admin/scripts/DTEN_oraapps/adstrtal.sh apps/apps in Secure shell it shows the error You are running adstrtal.sh version 115.16 /dten/w01/oracle/dtencomn/util/jre/1.1.8/bin/../lib/i686/green_threa

  • Just got back from exchanging my Touch

    So I had the negative screen issue with a 737 model of the Touch. I just exchanged it and they gave me a 736 one. Should I just not even open it and wait until i can get a 738? Has anyone got a 736 without an issue? Thanks in advanced.

  • Advise using sql in java?

    Hello, Could anyone offer some advise, about adding records to mysql using java. I managed all the connection, and understand some sql. The database has two tables: table author: authid lastname firstname table isbn: authid isbn When adding values to

  • HtmlLoader and local content problems

    I'm having trouble with the HtmlLoader class and loading/displaying local content that contains flash files. As example, I load a local page with a flash video player and no video, but it's ffine if the file isn't local. Or a page with a flash google