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

Similar Messages

  • 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.

  • 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.

  • 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

  • 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.

  • 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

  • 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.

  • Compare two text box values????

    Hello All,
    I do have one logic, but not sure where to write it so want your guys help for the same.
    The logic is:-
    if (&P13_NEW_PASSWORD. == &P13_CONFIRM_NEW_PASSWORD.) then
    insert into tbuser (password) values (&P13_NEW_PASSWORD.);
    else
    dbms_output.line_('Both the text boxes should be same!!')
    P13_NEW_PASSWORD and P13_CONFIRM_NEW_PASSWORD are two text boxes, where in above statment I'm comparing two text box values, if yes than insert that values into the DB tables otherwise displaying else messges.
    so can anybody tell me where should i write the above logic to make it work perfect..!!!
    thanks
    regards,
    Kumar

    Kumar,
    I'm glad you asked! Here's a great blog post on a custom auth scheme that hashes passwords:
    http://djmein.blogspot.com/2007/07/custom-authentication-authorisation.html
    I would suggest a few changes to the "get_hash" function. First, the DBMS_OBFUSCATION_TOOLKIT has been deprecated in favor of DBMS_CRYPTO:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
    http://www.psoug.org/reference/dbms_crypto.html
    DBMS_CRYPTO offers Message Authentication Code (MAC) functions which are keyed hashes. If you use a non-keyed function such as MD5 (which is VERY well known), someone can easily generate a table of all possible passwords within reason and their matching hash, which essentially allows them to get the passwords. MAC functions take in the data (password in this case) and a key. You can probably just use a big random string for your key. Now someone would need to the key as well to generate a hash table. In short, just use DBMS_CRYPTO.MAC where Duncan used DBMS_OBFUSCATION_TOOLKIT.md5.
    Tyler

  • BUG? BRIDGE statement to compare two tables

    Hello,
    I tried to compare two tables in different dbs and remembered a post about Cross Connectin Queries
    http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)
    (SELECT * FROM temparb
    MINUS
    SELECT * FROM arb
    UNION ALL
    (SELECT * FROM arb
    MINUS
    SELECT * FROM temparb
    );I would expect to get the differences between the table arb in my current schema and the table arb alias temparb in the other db. Yet it seems, that in this case only the table in my current schema is read.
    I materialize the BRIDGE table with
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)and select the value I know to be only in the remote schema
    SELECT id FROM temparb WHERE id = 2562;
    SELECT id FROM arb WHERE id = 2562;Both times I get no result. I even tried to use aliases on the table, same result. Tested in 3.0 and 3.1 EA3.
    Has anyone tried this before?
    Regards
    Marcus

    Hi Marcus,
    Have you tried it without the double quotes around the connection name?
    I have a connection called
    system_local
    which I run the following command in
    drop table testbridge_remote;
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (1);
    insert into testbridge values (2);
    insert into testbridge values (3);
    commit;
    I have a connection called
    Connection Name With Space
    which I run the following in
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (4);
    insert into testbridge values (5);
    insert into testbridge values (3);
    commit;
    Then in the system_local connection/worksheet I can run the following statement
    BRIDGE testbridge_remote as Connection Name With Space(select * from testbridge)
    +(SELECT * FROM testbridge_remote+
    MINUS
    SELECT * FROM testbridge
    +)+
    UNION ALL
    +(SELECT * FROM testbridge+
    MINUS
    SELECT * FROM testbridge_remote
    +);+
    It works ok.
    Returning rows in the remote table not in the local table , and rows in the local table not in the remote table .
    Regards,
    Dermot
    SQL Developer Team.

  • How to compare two XSD files programmatically

    Hi
    I want to compare two XSD files programmatically to find out whether one XSD is a sub set of another XSD(Means checking all the elements and attributes of one schema to be present in another schema).
    Please let me know how this can be done in an efficient way.
    Thanks in advance.
    Mithun K

    Or simply apply an oracle text index on your pdf column:
    SQL>  create table t (id integer primary key, bl blob)
    Table created.
    SQL>  declare
    bf bfile := bfilename('TEMP','b32001.pdf');
    bl blob;
    begin
    dbms_lob.createtemporary(bl,true);
    dbms_lob.open(bf,dbms_lob.lob_readonly);
    DBMS_LOB.LOADFROMFILE(bl, bf,dbms_lob.getlength(bf));
    insert into t values (1,bl);
    commit;
    dbms_lob.close(bf);
    dbms_lob.freetemporary(bl);
    end;
    PL/SQL procedure successfully completed.
    SQL>  create index t_idx on t (bl) indextype is ctxsys.context parameters ('filter ctxsys.auto_filter')
    Index created.
    SQL>  declare
       mklob   clob;
    begin
       ctx_doc.filter ('t_idx', '1', mklob, true);
       dbms_output.put_line (substr (mklob, 1, 250));
       dbms_lob.freetemporary (mklob);
    end;
    Oracle® Database
    Release Notes
    11
    g
    Release 1 (11.1) for Linux
    B32001-04
    November 2007
    This document contains important information that was not included in the
    platform-specific or product-specific documentation
    PL/SQL procedure successfully completed.This generates a text only version of your pdf and standard text comparison methods can be applied ....

  • Compare two XML files: Analysis and Design

    Hi, Java/XML/JDOM experts,
    I realised that an open source of Java utility to compare two XML is still missing. So I would like to write one for my JDOM excises.
    I plan to do it in three steps:
    1.Define the problem domain.
    2.Design the classes to be developed.
    3.Coding
    Below is the problem domain. Would you review it and tell me if it is fine?
    Best regards,
    AG
    Compare two XML files
    Schema assumption:
    The xml files used for the comparison must have the same schema.
    Definition:
    1. Two elements of simple type are said equal if their name and value are identical.
    2. Two elements of complex type are said comparable if their name, attributes are identical.
    3. Two elements of complex type are said equal if they are comparable and their children elements are identical.

    Hi,
    Thanks for reviewing my idea.
    The xml files used for the comparison must have the
    same schema.Including not having a schema at all? And if they do
    have a schema, must they be valid according to the
    schema?I will only support schema based xml files. To include a schema is a good practice. So I will valid them agaisnt schema (is this possible with JDOM? I am testing ...)
    >
    2. Two elements of complex type are said comparableif
    their name, attributes are identical.
    3. Two elements of complex type are said equal ifthey
    are comparable and their children elements are
    identical.Do you plan to require child elements to appear in the
    same order for the two documents to be equal? (Note
    that XML specifically says that the order of
    attributes is not significant.)No. The order is not significant as I use the attributes as the keys to find comparable element counterpart.
    Here is the sample code already tested. Any comments are welcome!
    The next step is to define the "delta xml schema" that will guide me to store the comparasion results. Do you have any suggestions?
    Regards.
    AG
    public static boolean comparable(Element element1, Element element2)
         boolean returnValue=false;
         if (element1.getName()!=element2.getName()) {
              return returnValue;
    } else {
              returnValue=true;
                        System.out.println ("place 2");
         List attributeList=element1.getAttributes();
         Iterator attributeIterator=attributeList.iterator();
         Attribute workingAttribute=null;
         while (attributeIterator.hasNext()) {
                             if (!workingAttribute.getValue().equals(
                             element2.getAttribute(workingAttribute.getName(), workingAttribute.getNamespace()).getValue()))
                                  returnValue=false;
                                  break;
         return returnValue;

  • Explain plans diffrent of two schemas

    Hi,
    We have two schema e.g A & B.
    If i run the query select * from test; It gives me immediate output.
    GRANT ALL ON A.TEST TO B;
    If I run the same query from B Schema select * from a.test;
    My session got hanged after ran above query.I checked explain plan of both the queries.
    Both explain plans are diffrent.
    Experts please suggest/advice me to resolve the issue.
    Regards,
    Praful K

    My suggestions are
    - You stop posting questions which boil down to 'My car is broke, please fix it'
    - On each and every post you include the four digit version number of the database involved. You also include platform information
    - You include the contested explain plans embedded by the tag, to preserve formatting.
    - You compare the number of records involved.
    Each and every post which demonstrates you didn't do any research prior to posting, boiling down to just *dumping* your work in a forum of volunteers, I will consider that as *abusing this forum*, and I will follow up accordingly.
    Sybrand Bakker
    Senior Oracle DBA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to compare two databases, without dblink?

    Hi all,
    I need to compare two differents databases, but I can't create a database link, and for make this task worse, I need to do this using a shell script, because it will run directly in the server.
    Anybody can help me?
    Tx,
    Everson
    null

    Hi Justin,
    I made the script, and it was working pretty well, but when I was running in the production environment, I get the information that I need to connect with one user and get the ddl to another user, ok, I change the script but now I'm receving the error ORA-31603.
    SQL> show user
    User is "tstsge3"
    SQL> select dbms_metadata.get_ddl('TABLE','INTBD_INS_ACIONAMENTO','TSTINTBD3') ddl from dual;
    select dbms_metadata.get_ddl('TABLE','INTBD_INS_ACIONAMENTO','TSTINTBD3') ddl from dual
    ORA-31603: object "INTBD_INS_ACIONAMENTO" of type TABLE not found in schema "TSTINTBD3"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA", line 2805
    ORA-06512: at "SYS.DBMS_METADATA", line 4333
    ORA-06512: at line 1
    SQL> select table_name from all_tables where owner = 'TSTINTBD3' and table_name = 'INTBD_INS_ACIONAMENTO';
    TABLE_NAME
    INTBD_INS_ACIONAMENTO
    SQL>
    I took a look on the internet and metalink, and saw some notes about grant SELECT_CATALOG_ROLE to the connect user, but I can't do this in my customer.
    Is ther another solution?
    Tx,
    Everson

  • Procedure/Package to compare User Schemas

    Hello,
    I'm looking for a way to compare the schema of two users. We have a group of developers that have their own schemas, and we need a way that we can find the differences between them.
    I would greatly welcome any help or guidance provided.

    The simplest I have been using is selecting everything from the views you wanna compare (user_objects, user_tables, user_indexes etc. etc.), spool the complete result to a different file per user and do a diff on unix (make sure you order by something). Although I wouldn't be surprised if there are more sofisticated tools to do this...
    An example I used: (I only wanted to know object and constraint differences. The script assumes differences between multiple users on 2 different instances, but it should be easy to rewrite):
    sqlplus $1 <<___EOF
    set lines 100
    set echo off
    set feedback off
    set heading off
    set timing off
    set long 40
    col table_name a40 truncated
    col constraint_type a8 truncated
    col owner format a8 truncated
    col object_type format a10 truncated
    col object_name format a40 truncated
    spool dbdiff1.lst
    select owner, object_type, object_name from dba_objects where owner in
    ('USER1','USER2','USER3')
    order by owner,object_type, object_name
    select owner, table_name, constraint_type, search_condition from dba_constraints where owner in
    ('USER1','USER2','USER3')
    order by owner,table_name, constraint_type, constraint_name
    spool off
    ___EOF
    sqlplus $2 <<___EOF
    set lines 100
    set echo off
    set feedback off
    set heading off
    set timing off
    set long 40
    col table_name a40 truncated
    col constraint_type a8 truncated
    col owner format a8 truncated
    col object_type format a10 truncated
    col object_name format a40 truncated
    spool dbdiff2.lst
    select owner, object_type, object_name from dba_objects where owner in
    ('USER1','USER2','USER3')
    order by owner,object_type, object_name
    select owner, table_name, constraint_type, search_condition from dba_constraints where owner in
    ('USER1','USER2','USER3')
    order by owner,table_name, constraint_type, constraint_name
    spool off
    ___EOF
    diff dbdiff1.lst dbdiff2.lst > dbdiff.out

Maybe you are looking for