Compare two schemas in oracle 11g

Hi All,
Can any one please help me how to compare two schemas in oracle 11g.
Thanks
Edited by: 793914 on Oct 22, 2010 9:33 AM

You can do it with gridcontrol. Look for dictionary comparisons and dictionary baselines.
If you don't have gridcontrol, you can also use SQLDeveloper (free download on otn).
There are two ways to do it with SQLDeveloper.
1) Use Tools->Database Diff. However, you need a change management license to use this functionality. I've never used this.
The free way is to...
2) Use Tools->Database Export. Run it once for each schema and make sure the "Show Schema" option is NOT checked before exporting the schema. Also make sure you don't export data. You can choose which types of objects to export as well.
Once you have the two export files for the two schemas then simply run a diff tool on your platform. Use the diff command line for linux or winDiff or something similar in windows.

Similar Messages

  • How to compare two schemas in Oracle sql developer

    Hello,
    I need to compare both the data and schemas details (columns etc) between two schemas on different databases (connections).
    What is the easiest and most efficient way to do this? Hopefully in Oracle Sql Developer or Sql Plus?
    Thanks.

    In SQL Developer go to Tools -> Schema Diff !
    in SQL* Plus you will need to write PL/SQL for this.
    Amardeep Sidhu

  • Tool for comparing two schemas....

    Do we have any tool avalilable in oracle that compares two different schemas and find out the differences between two so that we can validate a schema against a standard one?

    Hi.
    Toad have option that is called just like that , compare schemas, and when used to compare two schemas it outputs diferences between them.
    I dont know about any other tool.

  • Creation of two databases in oracle 11g on linux

    HI,
    I need to create two databases in oracle 11g on linux.
    how to set SID'S in .bash_profile and change the init.ora file.
    pls anyone let me know
    thanks
    srinivas

    If you have different databases on same node you could choose to not set ORACLE_SID in shell init file but use instead interactive oraenv Oracle script to set the right ORACLE_SID.
    Please read Configuring the Operating System Environment Variables in http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/em_manage.htm#ADMQS12369
    To create easily a database (ie without using your own scripts) try to use DBCA that will automatically take care of database initialization file: http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/install.htm#BABEIAID
    Edited by: P. Forstmann on 5 août 2011 12:01

  • Compare two schema

    Hi all
    I need to compare two schema structures. I tried to do so using the utility in OEM in Change Management Pack. I am unable to create the baseline, it is giving me following error.
    VBO-1508:An error has occurred and the server object could not be initialized. Please disconnect and try again. ORA-06552: PL/SQL:Compilation unit analysis terminated ORA-06553:PLS-553:character set name is not recognized
    This error is occuring while it is trying to read metadata of synonyms.
    Kindly guide me to resolve the error.
    Awaiting your timely replies.
    Regards
    Vijay Kumar

    I think you have a mismatch in the characterset
    Doc ID: Note:286964.1
    Have a look into that document

  • How to compare two xmltypes in oracle 10g ?

    Hi,
    I have a requirement that i have to compare two xmltypes of a table.
    Is there any function available in oracle 10g that compares two xmltypes.
    Regards
    Krishna

    This can help for this question
    Re: Help needed !  How to find out 'XML Difference' using XDK

  • Importing a few Oracle 10g schemas into oracle 11g database

    Hi,
    I have the task to import a few schemas that are on oracle 10g database (10.2.0.4) into oracle 11gR2 database (11.2.0.2). Now I have only oracle 10g export and import utility (the 11g server is in not where I am given the import rights).
    Can I do the export of the 10g schemas using the 10g export utility and then import into 11g database using the 10g import utility? I ran a test to do that and found it works but would also like to have expert opinion on it.
    Also another question is: if the source schema is 11g - suppose- in that case can the 10g export/import utility still work? I mean export the schema from say db1 (which is 11g) using 10g export utility and import them into 11g database db2 (which is again 11g) using 10g import? I am asking because I don't have access to 11g server and trying to find what I can do with the 10g utilities.
    Thanks,

    set up a database link to the 10gR2 version database in the 11gR2 database.
    Now using the 11gR2 client impdp utility use
    impdp network_link=<link to 10gR2 database>
    Done.
    Your 'objection' you don't have access to 11gR2 doesn't count as you can install a 11gR2 client.
    Also generally speaking you should not use a lower version imp to imp to a higher version database
    Also exp and imp are deprecated in 10g and higher.
    Sybrand Bakker
    Senior Oracle DBA

  • Compare tables in two schemas for the table with particular column & value

    Hello All,
    I have a query to find out the list of table from a given schema to extract all the tables having a search column .
    ex :
    SELECT OWNER, TABLE_NAME, COLUMN_NAME FROM
    ALL_TAB_COLUMNS WHERE OWNER='<SCHEMA_NAME>'
    AND COLUMN_NAME='<COLUMN_NAME>'
    I want to compare two schemas for the same above query .
    Can we wirte a query on this - I am using SQL DEVELOPER , which has menu item - TOOL - database differneces to find the diffenence between two schemas but my requirement is to find the differences in two schemas for all the tables matching for a particular column ( as given in quer).
    Appreciate your help.
    thanks/Kumar
    Edited by: kumar73 on 29 Nov, 2012 1:50 PM

    Hi, Kumar,
    This is the SQL and PL/SQL forum. If you have a question about SQL Developer, then the SQL Developer is a better place to post it. Mark this thread as "Answered" before starting another thread for the same question.
    If SQL Developer has a tool for doing what you want, don't waste your time trying to devise a SQL solution. The SQL Developer way will probably be simpler, more efficient and more reliable.
    If you do need to try a SQL solution, then post some sample data (CREATE TABLE and INSERT statements for a table that resembles all_tab_columns; you can call it my_tab_columns) and the results you want from that data.

  • Dropping sample schemas like scott,hr,bi  from Oracle 11g Database.

    Hi Friends,
    Do any one have the query to drop all the sample schemas from Oracle 11g Database.Any steps need to be
    performed to drop all the schemas.
    Best regards,

    Hi;
    Please see:
    drop all objects owned by schema
    drop all objects owned by schema
    Regard
    Helios

  • Oracle 11g performance issue ( BITMAP CONVERSION TO ROWIDS)

    I have two instance of oracle 11g.
    in both instance i fired same query.
    one instance returns the result in 1sec but other instance returns the result in 10 sec
    following is explain plan for bot instance
    instance 1
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 143 | 59 (2)| 00:00:01 |
    | 1 | HASH GROUP BY | | 1 | 143 | 59 (2)| 00:00:01 |
    | 2 | VIEW | VM_NWVW_2 | 1 | 143 | 59 (2)| 00:00:01 |
    | 3 | HASH UNIQUE | | 1 | 239 | 59 (2)| 00:00:01 |
    | 4 | NESTED LOOPS | | | | | |
    | 5 | NESTED LOOPS | | 1 | 239 | 58 (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    | 6 | NESTED LOOPS | | 1 | 221 | 57 (0)| 00:00:01 |
    | 7 | NESTED LOOPS | | 1 | 210 | 55 (0)| 00:00:01 |
    | 8 | NESTED LOOPS | | 1 | 184 | 54 (0)| 00:00:01 |
    | 9 | NESTED LOOPS | | 1 | 158 | 53 (0)| 00:00:01 |
    | 10 | NESTED LOOPS | | 1 | 139 | 52 (0)| 00:00:01 |
    | 11 | NESTED LOOPS | | 1 | 105 | 50 (0)| 00:00:01 |
    |* 12 | INDEX RANGE SCAN | year_field | 1 | 29 | 2 (0)| 00:00:01 |
    | 13 | SORT AGGREGATE | | 1 | 8 | | |
    | 14 | INDEX FULL SCAN (MIN/MAX)| idx_bf_creation_date | 1 | 8 | 2 (0)| 00:00:01 |
    |* 15 | TABLE ACCESS BY INDEX ROWID| OHRT_bugs_fact | 1 | 76 | 48 (0)| 00:00:01 |
    |* 16 | INDEX RANGE SCAN | idx_bf_creation_date | 76 | | 1 (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 17 | TABLE ACCESS BY INDEX ROWID | OHRT_all_time_dimension | 1 | 34 | 2 (0)| 00:00:01 |
    |* 18 | INDEX UNIQUE SCAN | unique_alltime_bug_instance_id | 1 | | 1 (0)| 00:00:01 |
    | 19 | TABLE ACCESS BY INDEX ROWID | OHRT_all_time_dimension | 1 | 19 | 1 (0)| 00:00:01 |
    |* 20 | INDEX UNIQUE SCAN | unique_alltime_bug_instance_id | 1 | | 1 (0)| 00:00:01 |
    |* 21 | INDEX RANGE SCAN | bugseverity_instance_id_ref_id | 1 | 26 | 1 (0)| 00:00:01 |
    |* 22 | INDEX UNIQUE SCAN | unique_alltime_bug_instance_id | 1 | 26 | 1 (0)| 00:00:01 |
    | 23 | INLIST ITERATOR | | | | | |
    |* 24 | TABLE ACCESS BY INDEX ROWID | OHMT_ANL_BUCKET | 1 | 11 | 2 (0)| 00:00:01 |
    |* 25 | INDEX UNIQUE SCAN | SYS_C0053213 | 5 | | 1 (0)| 00:00:01 |
    |* 26 | INDEX RANGE SCAN | FK_BUCKET_TYPE | 6 | | 0 (0)| 00:00:01 |
    |* 27 | TABLE ACCESS BY INDEX ROWID | OHMT_ANL_BUCKET | 1 | 18 | 1 (0)| 00:00:01 |
    instance 2
    Plan
    SELECT STATEMENT ALL_ROWS Cost: 22 Bytes: 142 Cardinality: 1
    32 HASH GROUP BY Cost: 22 Bytes: 142 Cardinality: 1
    31 VIEW VIEW SYS.VM_NWVW_2 Cost: 22 Bytes: 142 Cardinality: 1
    30 HASH UNIQUE Cost: 22 Bytes: 237 Cardinality: 1
    29 NESTED LOOPS
    27 NESTED LOOPS Cost: 21 Bytes: 237 Cardinality: 1
    25 NESTED LOOPS Cost: 20 Bytes: 219 Cardinality: 1
    21 NESTED LOOPS Cost: 18 Bytes: 208 Cardinality: 1
    19 NESTED LOOPS Cost: 17 Bytes: 183 Cardinality: 1
    17 NESTED LOOPS Cost: 16 Bytes: 157 Cardinality: 1
    14 NESTED LOOPS Cost: 15 Bytes: 138 Cardinality: 1
    11 NESTED LOOPS Cost: 13 Bytes: 104 Cardinality: 1
    3 INDEX RANGE SCAN INDEX REPORTSDB.year_field Cost: 2 Bytes: 29 Cardinality: 1
    2 SORT AGGREGATE Bytes: 8 Cardinality: 1
    1 INDEX FULL SCAN (MIN/MAX) INDEX REPORTSDB.idx_bf_creation_date Cost: 3 Bytes: 8 Cardinality: 1
    10 TABLE ACCESS BY INDEX ROWID TABLE REPORTSDB.OHRT_bugs_fact Cost: 13 Bytes: 75 Cardinality: 1
    9 BITMAP CONVERSION TO ROWIDS
    8 BITMAP AND
    5 BITMAP CONVERSION FROM ROWIDS
    4 INDEX RANGE SCAN INDEX REPORTSDB.idx_OHRT_bugs_fact_2product Cost: 2 Cardinality: 85
    7 BITMAP CONVERSION FROM ROWIDS
    6 INDEX RANGE SCAN INDEX REPORTSDB.idx_bf_creation_date Cost: 2 Cardinality: 85
    13 TABLE ACCESS BY INDEX ROWID TABLE REPORTSDB.OHRT_all_time_dimension Cost: 2 Bytes: 34 Cardinality: 1
    12 INDEX UNIQUE SCAN INDEX (UNIQUE) REPORTSDB.unique_alltime_bug_instance_id Cost: 1 Cardinality: 1
    16 TABLE ACCESS BY INDEX ROWID TABLE REPORTSDB.OHRT_all_time_dimension Cost: 1 Bytes: 19 Cardinality: 1
    15 INDEX UNIQUE SCAN INDEX (UNIQUE) REPORTSDB.unique_alltime_bug_instance_id Cost: 1 Cardinality: 1
    18 INDEX UNIQUE SCAN INDEX (UNIQUE) REPORTSDB.unique_alltime_bug_instance_id Cost: 1 Bytes: 26 Cardinality: 1
    20 INDEX RANGE SCAN INDEX REPORTSDB.bugseverity_instance_id_ref_id Cost: 1 Bytes: 25 Cardinality: 1
    24 INLIST ITERATOR
    23 TABLE ACCESS BY INDEX ROWID TABLE OPSHUB.OHMT_ANL_BUCKET Cost: 2 Bytes: 11 Cardinality: 1
    22 INDEX UNIQUE SCAN INDEX (UNIQUE) OPSHUB.SYS_C0040939 Cost: 1 Cardinality: 5
    26 INDEX RANGE SCAN INDEX OPSHUB.FK_BUCKET_TYPE Cost: 0 Cardinality: 6
    28 TABLE ACCESS BY INDEX ROWID TABLE OPSHUB.OHMT_ANL_BUCKET Cost: 1 Bytes: 18 Cardinality: 1
    in both explain plan only difference is
    9 BITMAP CONVERSION TO ROWIDS
    8 BITMAP AND
    5 BITMAP CONVERSION FROM ROWIDS
    but is bitmap degrading performance lot?
    or suggest me what other parameter i can see so 2nd instance gives me better performace.

    I see more differences.
    In plan 1:
    * 16      INDEX RANGE SCAN      idx_bf_creation_date      76           1 (0)     00:00:01
    in Plan 2:
    1 INDEX FULL SCAN (MIN/MAX) INDEX REPORTSDB.idx_bf_creation_date Cost: 3 Bytes: 8 Cardinality: 1
    So this is not about "bitmap" good/bad, it about the access strategy which changed due to differences in data statistics etc. To analyze more, I'd help a LOT if those plans would be formated in a good and same way, use around it to do so.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to Migrate Postgres DB Schema to Oracle 11 g???

    hi,
    how to Migrate Postgres DB Schema to Oracle 11 g??? Any idea or tool that you want to refer for migration of postgres Schema to Oracle 11g .
    Regards,

    Pl see possible solutions here - http://www.oracle.com/technetwork/database/migration/index-084442.html
    Pl also see previous discussions on this topic
    https://forums.oracle.com/forums/search.jspa?threadID=&q=postgres+AND+oracle&objID=c18&dateRange=all&userID=&numResults=15&rankBy=10001
    HTH
    Srini

  • How to compare two oracle database schemas

    hi all,
    i want to compare and find out differences between two oracle databases. The comparison should be made on between table definition,table data,primary and foreign keys, packages and functions.
    Is there any management console or tool embedded in the oracle enterprise manger?
    it is really appreciate if anyone can point me towards wright direction asap.

    Hi ,
    This script would help u a lot in comparing 2 schemas and generate a report on them.
    Script:
    This script will compare two Oracle schemas and generate a report of
    discrepencies and this script has been used against Oracle 7.3.4, 8.0.5,
    REM and 8.1.7 databases, but it should also work with other versions.
    REM
    REM Please note that the following schema object types and attributes are
    REM not compared by this script at this time:
    REM
    REM cluster definitions
    REM comments on tables and columns
    REM nesting, partition, IOT, and temporary attributes of tables
    REM snapshots/materialized views, logs, and refresh groups
    REM foreign function libraries
    REM object types
    REM operators
    REM indextypes
    REM dimensions
    REM auditing information
    REM new schema attributes added for Oracle 9i
    REM
    REM Version 02-04-2002
    REM
    PROMPT
    PROMPT Schema Comparison
    PROMPT =================
    PROMPT
    PROMPT Run this script while connected to one Oracle schema. Enter the Oracle
    PROMPT username, password, and SQL*Net / Net8 service name of a second schema.
    PROMPT This script will compare the two schemas and generate a report of
    PROMPT differences.
    PROMPT
    PROMPT A temporary database link and table will be created and dropped by
    PROMPT this script.
    PROMPT
    ACCEPT schema CHAR PROMPT "Enter username for remote schema: "
    ACCEPT passwd CHAR PROMPT "Enter password for remote schema: " HIDE
    ACCEPT tnssvc CHAR PROMPT "Enter SQL*Net / Net8 service for remote schema: "
    PROMPT
    ACCEPT report CHAR PROMPT "Enter filename for report output: "
    SET FEEDBACK OFF
    SET VERIFY OFF
    CREATE DATABASE LINK rem_schema CONNECT TO &schema IDENTIFIED BY &passwd
    USING '&tnssvc';
    SET TRIMSPOOL ON
    SPOOL &report
    SELECT SUBSTR (RPAD (TO_CHAR (SYSDATE, 'mm/dd/yyyy hh24:mi:ss'), 25), 1, 25)
    "REPORT DATE AND TIME"
    FROM SYS.dual;
    COL local_schema FORMAT a35 TRUNC HEADING "LOCAL SCHEMA"
    COL remote_schema FORMAT a35 TRUNC HEADING "REMOTE SCHEMA"
    SELECT USER || '@' || C.global_name local_schema,
    A.username || '@' || B.global_name remote_schema
    FROM user_users@rem_schema A, global_name@rem_schema B, global_name C
    WHERE ROWNUM = 1;
    SET PAGESIZE 9999
    SET LINESIZE 250
    SET FEEDBACK 1
    SET TERMOUT OFF
    PROMPT
    REM Object differences
    REM ==================
    COL object_name FORMAT a30
    PROMPT SUMMARY OF OBJECTS MISSING FROM LOCAL SCHEMA
    SELECT object_type, COUNT (*)
    FROM
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects@rem_schema
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects
    GROUP BY object_type
    ORDER BY object_type;
    PROMPT SUMMARY OF EXTRANEOUS OBJECTS IN LOCAL SCHEMA
    SELECT object_type, COUNT (*)
    FROM
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects
    WHERE object_type != 'DATABASE LINK'
    OR object_name NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects@rem_schema
    GROUP BY object_type
    ORDER BY object_type;
    PROMPT OBJECTS MISSING FROM LOCAL SCHEMA
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects@rem_schema
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects
    ORDER BY object_type, object_name;
    PROMPT EXTRANEOUS OBJECTS IN LOCAL SCHEMA
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects
    WHERE object_type != 'DATABASE LINK'
    OR object_name NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects@rem_schema
    ORDER BY object_type, object_name;
    PROMPT OBJECTS IN LOCAL SCHEMA THAT ARE NOT VALID
    SELECT object_name, object_type, status
    FROM user_objects
    WHERE status != 'VALID'
    ORDER BY object_name, object_type;
    REM Table differences
    REM =================
    PROMPT TABLE COLUMNS MISSING FROM ONE SCHEMA
    PROMPT (NOTE THAT THIS REPORT DOES NOT LIST DISCREPENCIES IN COLUMN ORDER)
    SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
    FROM user_tab_columns@rem_schema
    WHERE table_name IN
    SELECT table_name
    FROM user_tables
    MINUS
    SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
    FROM user_tab_columns
    UNION ALL
    SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
    FROM user_tab_columns
    WHERE table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    MINUS
    SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
    FROM user_tab_columns@rem_schema
    ORDER BY 1, 2;
    COL schema FORMAT a15
    COL nullable FORMAT a8
    COL data_type FORMAT a9
    COL data_length FORMAT 9999 HEADING LENGTH
    COL data_precision FORMAT 9999 HEADING PRECISION
    COL data_scale FORMAT 9999 HEADING SCALE
    COL default_length FORMAT 9999 HEADING LENGTH_OF_DEFAULT_VALUE
    PROMPT DATATYPE DISCREPENCIES FOR TABLE COLUMNS THAT EXIST IN BOTH SCHEMAS
    SELECT table_name, column_name, 'Remote' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns@rem_schema
    WHERE (table_name, column_name) IN
    SELECT table_name, column_name
    FROM user_tab_columns
    MINUS
    SELECT table_name, column_name, 'Remote' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns
    UNION ALL
    SELECT table_name, column_name, 'Local' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns
    WHERE (table_name, column_name) IN
    SELECT table_name, column_name
    FROM user_tab_columns@rem_schema
    MINUS
    SELECT table_name, column_name, 'Local' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns@rem_schema
    ORDER BY 1, 2, 3;
    REM Index differences
    REM =================
    COL column_position FORMAT 999 HEADING ORDER
    PROMPT INDEX DISCREPENCIES FOR INDEXES THAT EXIST IN BOTH SCHEMAS
    SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
    WHERE A.index_name IN
    SELECT index_name
    FROM user_indexes
    AND B.index_name = A.index_name
    AND B.table_name = A.table_name
    MINUS
    SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes A, user_ind_columns B
    WHERE B.index_name = A.index_name
    AND B.table_name = A.table_name
    UNION ALL
    SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes A, user_ind_columns B
    WHERE A.index_name IN
    SELECT index_name
    FROM user_indexes@rem_schema
    AND B.index_name = A.index_name
    AND B.table_name = A.table_name
    MINUS
    SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
    WHERE B.index_name = A.index_name
    AND B.table_name = A.table_name
    ORDER BY 1, 2, 6;
    REM Constraint differences
    REM ======================
    PROMPT CONSTRAINT DISCREPENCIES FOR TABLES THAT EXIST IN BOTH SCHEMAS
    SET FEEDBACK OFF
    CREATE TABLE temp_schema_compare
    database NUMBER(1),
    object_name VARCHAR2(30),
    object_text VARCHAR2(2000),
    hash_value NUMBER
    DECLARE
    CURSOR c1 IS
    SELECT constraint_name, search_condition
    FROM user_constraints
    WHERE search_condition IS NOT NULL;
    CURSOR c2 IS
    SELECT constraint_name, search_condition
    FROM user_constraints@rem_schema
    WHERE search_condition IS NOT NULL;
    v_constraint_name VARCHAR2(30);
    v_search_condition VARCHAR2(32767);
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_constraint_name, v_search_condition;
    EXIT WHEN c1%NOTFOUND;
    v_search_condition := SUBSTR (v_search_condition, 1, 2000);
    INSERT INTO temp_schema_compare
    database, object_name, object_text
    VALUES
    1, v_constraint_name, v_search_condition
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_constraint_name, v_search_condition;
    EXIT WHEN c2%NOTFOUND;
    v_search_condition := SUBSTR (v_search_condition, 1, 2000);
    INSERT INTO temp_schema_compare
    database, object_name, object_text
    VALUES
    2, v_constraint_name, v_search_condition
    END LOOP;
    CLOSE c2;
    COMMIT;
    END;
    SET FEEDBACK 1
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Remote' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints@rem_schema A, temp_schema_compare B
    WHERE A.table_name IN
    SELECT table_name
    FROM user_tables
    AND B.database (+) = 2
    AND B.object_name (+) = A.constraint_name
    MINUS
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Remote' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints A, temp_schema_compare B
    WHERE B.database (+) = 1
    AND B.object_name (+) = A.constraint_name
    UNION ALL
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Local' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints A, temp_schema_compare B
    WHERE A.table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    AND B.database (+) = 1
    AND B.object_name (+) = A.constraint_name
    MINUS
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Local' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints@rem_schema A, temp_schema_compare B
    WHERE B.database (+) = 2
    AND B.object_name (+) = A.constraint_name
    ORDER BY 1, 4, 2;
    REM Database link differences
    REM =========================
    PROMPT DATABASE LINK DISCREPENCIES
    COL db_link FORMAT a40
    SELECT db_link, 'Remote' schema, username, host
    FROM user_db_links@rem_schema
    MINUS
    SELECT db_link, 'Remote' schema, username, host
    FROM user_db_links
    UNION ALL
    SELECT db_link, 'Local' schema, username, host
    FROM user_db_links
    WHERE db_link NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT db_link, 'Local' schema, username, host
    FROM user_db_links@rem_schema
    ORDER BY 1, 2;
    REM Sequence differences
    REM ====================
    PROMPT SEQUENCE DISCREPENCIES
    SELECT sequence_name, 'Remote' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences@rem_schema
    MINUS
    SELECT sequence_name, 'Remote' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences
    UNION ALL
    SELECT sequence_name, 'Local' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences
    MINUS
    SELECT sequence_name, 'Local' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences@rem_schema
    ORDER BY 1, 2;
    REM Private synonym differences
    REM ===========================
    PROMPT PRIVATE SYNONYM DISCREPENCIES
    SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
    FROM user_synonyms@rem_schema
    MINUS
    SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
    FROM user_synonyms
    UNION ALL
    SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
    FROM user_synonyms
    MINUS
    SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
    FROM user_synonyms@rem_schema
    ORDER BY 1, 2;
    REM PL/SQL differences
    REM ==================
    PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
    PROMPT THAT EXIST IN BOTH SCHEMAS
    SELECT name, type, COUNT (*) discrepencies
    FROM
    SELECT name, type, line, text
    FROM user_source@rem_schema
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects
    MINUS
    SELECT name, type, line, text
    FROM user_source
    UNION ALL
    SELECT name, type, line, text
    FROM user_source
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects@rem_schema
    MINUS
    SELECT name, type, line, text
    FROM user_source@rem_schema
    GROUP BY name, type
    ORDER BY name, type;
    PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
    PROMPT THAT EXIST IN BOTH SCHEMAS (CASE INSENSITIVE COMPARISON)
    SELECT name, type, COUNT (*) discrepencies
    FROM
    SELECT name, type, line, UPPER (text)
    FROM user_source@rem_schema
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects
    MINUS
    SELECT name, type, line, UPPER (text)
    FROM user_source
    UNION ALL
    SELECT name, type, line, UPPER (text)
    FROM user_source
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects@rem_schema
    MINUS
    SELECT name, type, line, UPPER (text)
    FROM user_source@rem_schema
    GROUP BY name, type
    ORDER BY name, type;
    REM Trigger differences
    REM ===================
    PROMPT TRIGGER DISCREPENCIES
    SET FEEDBACK OFF
    TRUNCATE TABLE temp_schema_compare;
    DECLARE
    CURSOR c1 IS
    SELECT trigger_name, trigger_body
    FROM user_triggers;
    CURSOR c2 IS
    SELECT trigger_name, trigger_body
    FROM user_triggers@rem_schema;
    v_trigger_name VARCHAR2(30);
    v_trigger_body VARCHAR2(32767);
    v_hash_value NUMBER;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_trigger_name, v_trigger_body;
    EXIT WHEN c1%NOTFOUND;
    v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
    v_trigger_body := UPPER (v_trigger_body);
    v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (1, v_trigger_name, v_hash_value);
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_trigger_name, v_trigger_body;
    EXIT WHEN c2%NOTFOUND;
    v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
    v_trigger_body := UPPER (v_trigger_body);
    v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (2, v_trigger_name, v_hash_value);
    END LOOP;
    CLOSE c2;
    END;
    SET FEEDBACK 1
    SELECT A.trigger_name, 'Local' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 1
    AND A.table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    MINUS
    SELECT A.trigger_name, 'Local' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 2
    UNION ALL
    SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 2
    AND A.table_name IN
    SELECT table_name
    FROM user_tables
    MINUS
    SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 1
    ORDER BY 1, 2, 5, 3;
    REM View differences
    REM ================
    PROMPT VIEW DISCREPENCIES
    SET FEEDBACK OFF
    TRUNCATE TABLE temp_schema_compare;
    DECLARE
    CURSOR c1 IS
    SELECT view_name, text
    FROM user_views;
    CURSOR c2 IS
    SELECT view_name, text
    FROM user_views@rem_schema;
    v_view_name VARCHAR2(30);
    v_text VARCHAR2(32767);
    v_hash_value NUMBER;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_view_name, v_text;
    EXIT WHEN c1%NOTFOUND;
    v_text := REPLACE (v_text, ' ', NULL);
    v_text := REPLACE (v_text, CHR(9), NULL);
    v_text := REPLACE (v_text, CHR(10), NULL);
    v_text := REPLACE (v_text, CHR(13), NULL);
    v_text := UPPER (v_text);
    v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (1, v_view_name, v_hash_value);
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_view_name, v_text;
    EXIT WHEN c2%NOTFOUND;
    v_text := REPLACE (v_text, ' ', NULL);
    v_text := REPLACE (v_text, CHR(9), NULL);
    v_text := REPLACE (v_text, CHR(10), NULL);
    v_text := REPLACE (v_text, CHR(13), NULL);
    v_text := UPPER (v_text);
    v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (2, v_view_name, v_hash_value);
    END LOOP;
    CLOSE c2;
    END;
    SET FEEDBACK 1
    SELECT A.view_name, 'Local' schema, B.hash_value
    FROM user_views A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 1
    AND A.view_name IN
    SELECT view_name
    FROM user_views@rem_schema
    MINUS
    SELECT A.view_name, 'Local' schema, B.hash_value
    FROM user_views@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 2
    UNION ALL
    SELECT A.view_name, 'Remote' schema, B.hash_value
    FROM user_views@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 2
    AND A.view_name IN
    SELECT view_name
    FROM user_views
    MINUS
    SELECT A.view_name, 'Remote' schema, B.hash_value
    FROM user_views A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 1
    ORDER BY 1, 2;
    REM Job queue differences
    REM =====================
    COL what FORMAT a30
    COL interval FORMAT a30
    PROMPT JOB QUEUE DISCREPENCIES
    SELECT what, interval, 'Remote' schema
    FROM user_jobs@rem_schema
    MINUS
    SELECT what, interval, 'Remote' schema
    FROM user_jobs
    UNION ALL
    SELECT what, interval, 'Local' schema
    FROM user_jobs
    MINUS
    SELECT what, interval, 'Local' schema
    FROM user_jobs@rem_schema
    ORDER BY 1, 2, 3;
    REM Privilege differences
    REM =====================
    PROMPT OBJECT-LEVEL GRANT DISCREPENCIES
    SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
    FROM user_tab_privs@rem_schema
    WHERE (owner, table_name) IN
    SELECT owner, object_name
    FROM all_objects
    MINUS
    SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
    FROM user_tab_privs
    UNION ALL
    SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
    FROM user_tab_privs
    WHERE (owner, table_name) IN
    SELECT owner, object_name
    FROM all_objects@rem_schema
    MINUS
    SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
    FROM user_tab_privs@rem_schema
    ORDER BY 1, 2, 3;
    PROMPT SYSTEM PRIVILEGE DISCREPENCIES
    SELECT privilege, 'Remote' schema, admin_option
    FROM user_sys_privs@rem_schema
    MINUS
    SELECT privilege, 'Remote' schema, admin_option
    FROM user_sys_privs
    UNION ALL
    SELECT privilege, 'Local' schema, admin_option
    FROM user_sys_privs
    MINUS
    SELECT privilege, 'Local' schema, admin_option
    FROM user_sys_privs@rem_schema
    ORDER BY 1, 2;
    PROMPT ROLE PRIVILEGE DISCREPENCIES
    SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
    FROM user_role_privs@rem_schema
    MINUS
    SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
    FROM user_role_privs
    UNION ALL
    SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
    FROM user_role_privs
    MINUS
    SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
    FROM user_role_privs@rem_schema
    ORDER BY 1, 2;
    SPOOL OFF
    SET TERMOUT ON
    PROMPT
    PROMPT Report output written to &report
    SET FEEDBACK OFF
    DROP TABLE temp_schema_compare;
    DROP DATABASE LINK rem_schema;
    SET FEEDBACK 6
    SET PAGESIZE 20
    SET LINESIZE 80

  • Comparing two XML Schemas

    Hi All,
    I want to compare two versions of the same XML Schema. I am working with Oracle 10g XML DB. I think we have something in 11g but I am constrainted to 10g.
    Requirement:
    1. I start afresh and register the XML Schema and also insert XML documents compliant to that schema in my XMLTYPE table.
    2. Now after some time, I need to add a new element. So, I modify the XML Schema and write the XSLT for its addition to XML documents and do a CopyEvolve(). Let us assume, I have a script for this.
    3. Now if accidentally, I rerun the script, I may run into errors as the element is already there.
    So, I thought I should find the differences between the new version of the schema and the old version and if there are differences apply the XSLT and also evolve the schema. How do we do this?
    Also, Can we generate the XSLT automatically based on the two versions of XML Schema?
    Thanks
    Ramesh

    XML Schemas are just XML documents.
    Compare the XML Schemas using the XDK's XMLDiff class and generate the XSLT from the differences.
    http://www.devx.com/Java/Article/30943

  • Migrate an schema from oracle 8i to 11g

    Hello,
    I am struggling to find all the requirement to upgrade one schema running on oracle db 8i installed on an sparc server non-global solaris 8 zone to a oracle 11g running on solaris 10 x86 non-global zone.
    there are changes in architecture.
    what I know is:
    export using exp utiliy from oracle 8i
    import in oracle 11g using exp utility of 11g if still available.
    I only need to migrate two schemas respectively of 1gb and 2gb
    here are the schemas and the sizes:
    Total
    Schema Schema Name Size (Mb)
    CLAIMS                2851.07031    
    ARCCLAIMS           1290.9375
    can you someone tell me what is the best way to perform this.. this is what I think i should do.
    I have to set the character set NLS_Lang of the source db both in source and target machine. both server do not have the same character set. oracle 8i has WE8ISO8859P1  and oracle 11g has WE8MSWIN1252
    then perform execute the catsql.exp script
    perform the exp
    exp sys/******* owner=CLAIMS file=CLAIMS.dmp
    for the imp do i have to create the user or it will be created automatically should I create the timespaces amd user manually?
    what would be the command to be used to import?
    thank you.
    Mario

    Hi,
    Export/Import / Please check Oracle support id : Note:132904.1 Compatibility Matrix for Export And Import Between Different Oracle Versions
    Thank you

  • How to compare two xml schemas

    Hello guys,
    How to compare two xml schemas? is there any tool for that?
    Thanksinadvance
    kavita//

    XML Files may be compared with the oracle.xml.differ.XMLDiff class.
    A file consisting of the differences in the xml files gets generated. An XSLT to convert one file to the other also gets generated.

Maybe you are looking for

  • Need sample code to get handle of Selected rows from ADF Table

    Hi, I am new to ADF. I have an ADF table based on VO object.On some button action,I need to get handle of selected rows in application module. If anybody is having sample code to do this then please share with me. Thanks, ashok

  • How to save excel file as *.csv

    Hi. I must upload excel file and next save as *.csv. How can i do it?

  • Thomson Speedtouch USB modem installation

    Hi All, I gave my Mac Mini to my parents and they have an ADSL connection at home. Unfortunately, it's a USB modem, which meant that I had to download drivers for it and try to get it configured. Here's what I did so far: 1. Downloaded and installed

  • What are the keyboard commands to control Front Row

    I'm new to Front Row and running it on a 17" G4 PC. Since it isn't remote-control compatible how can I navigate and operate Front Row with just the keyboard. I need to know what key strokes to use to do stuff.

  • P.O print o/p in PDF Formate

    Hi, We are using std. O/P type NEU and one customize ZNEU  O/P paper is 12 inch paper  i want to know how to convert this Po o/p in pdf copy to save the document . regards, zafar