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

Similar Messages

  • How to install two oracle database on one system

    i want to install two oracle databases on single system how it is possible
    how i can manager oracle home and is this possible to install two different version of oracle in single home or single system forexample oracle 9 and oracle 8 .
    A.R

    Hi,
    yes, u can have more databases on a single machine and they can be of different versions.
    You have to use and initialize the correct ORACLE_HOME to create the DB of the version U use.
    For ex, u have 2 homes:
    C:\Oracle\Ora817 8i home and C:\Oracle\ora920 9i home
    Normally, using OFA, imagine that You want create 2 db, TEST_8I for 8i home and TEST_9I for the 9i home, You shold have:
    C:\Oracle\Admin\TEST_8I\<<OFA DIRS>> and C:\Oracle\Oradata\TEST_8I for 8i DB adn C:\Oracle\Admin\TEST_9I\<<OFA DIRS>> and C:\Oracle\Oradata\TEST_9I for the 9i version.
    It is important, when You create the DB, that u use the executables of C:\Oracle\Ora817\bin to create 8i db and C:\Oracle\Ora920\bin for the 9i one.
    Then U can use the 9i listener to manage both instances
    Hope this helps
    Max

  • How to Compare Two Oracle 10g Form(FMB) file.

    Hi,
    One developer had done some changes in one file called N004 version 2. I have done some changes in N004 version 3. If I like to see difference between two Oracle Form Version(FMB) then How can we see them..?
    Thanks,
    Div

    I'd convert it to xml before, as you can't be sure that two fmb's which are exact the same could look different in a text editor; first form got compiled with forms compiler and the second not => should not differ in functional way but I'm pretty sure that the files itself look diffrerent.
    regards

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

  • 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

  • ??how to compare two resultsets??

    hi all!
    i need to find out whether two resultsets contain the same data.
    the only way i know how to do it in java is to put them into a while loop and fetch the contents first and then compare the contents.
    but is there an easier way to compare resultsets?
    does anyone know how to compare two resultsets without extracting the data?
    the code example here executes two identical queries on an oracle database, compare and print the resultsets.
    public ResultSet getResultset(String query)
    ResultSet rs=null;
    try { rs=Stmt.executeQuery(query); }
    catch(Exception e) { e.printStackTrace(); }
    return rs;
    public static void main(String[] args) {
    ResultSet r1=null;
    ResultSet r2=null;
    try {
    database db = new ddatabase();
    r1=db.getResultset("Select 'name' from person");
    r2=db.getResultset("Select 'name' from person");
    if (r1 == r2) {
    System.out.println("ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    else {
    System.out.println("not ok");
    System.out.print(r1);
    System.out.println();
    System.out.print(r2);
    jdbc.cleanup();
    catch(Exception e) {e.printStackTrace();}
    and here is the output:
    F:\java rs_compare
    not ok
    oracle.jdbc.driver.OracleResultSetImpl@4413ee
    oracle.jdbc.driver.OracleResultSetImpl@786e64
    as you can see the resultsets are different though the data they contain have to be the same.
    so the 'if(resultset#1 == resultset#2)' does not work.
    thanks for any help
    best regards
    5ithl0rd

    Don't cross-post.
    I'll bet ResultSet implementations don't override equals() to provide "deep equals" behavior, in which case it'll be no different than using "==".
    It's a bad idea to compare two ResultSets this way. You'll have to load both into objects or data structures and compare those in a "deep" way.
    Besides, the ONLY way two ResultSets could be different, given the same query, would be if there were multiple clients that could write to the table between queries and change the underlying data. If your two queries are sufficiently isolated, I'd say that the same query will return the same ResultSet.
    %

  • How to compare two stored procedure

    I have two oracle database and each database have stored procedure
    How to compare two stored procedure?
    What is the command to compare the stored procedure?

    select line, text
    from user_source
    where name='....'
    minus
    select line, text
    from user_source
    where name='....'
    should do nicely.
    Or: get the procedure text to a file using dbms_metadata.get_ddl (9i and higher) and run diff (Unix) or fc (Windhoze) on it.
    You are a bit scarce on details.
    Better still: implement source control.
    Sybrand Bakker
    Senior Oracle D.B.A.

  • How to compare two PDF files through PLSQL

    Hi,
    Can any body help that how to compare two PDF files through PLSQL programing and gives the differences as output.
    Thanks,

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

  • Two Oracle databases on one AIX Server - Note working, Pls Help

    Dear Friends,
    I have installed Two SAP systems with Two Oracle Databases on one AIX machine, The Installation of both the systems went fine without any errors, and also i have been able to login to both the systems seperately. (that means i cant start both the systems at a time, its one at a time)
    But the problem is of the Oracle Listener, i am not able to start both the systems with single Oracle Listener processes(tnslistener). I tried all the possible scenarios as mentioned in note 98252 but nothing seems to be of any use so far.
    the thing is i can start either one of the SAP Systems, But my objective is to start both the SAP Systems with one listener processes (LISTENER) and one listener port (1527)
    Or
    you can say i am also ready to keep two different listeners for TWO seperate Oracle databases, I tried doing so as per one of the sap notes in which you have to keep different names of listener and different numbers for listener port for second ORACLE database. I tried doing exactly mentioned in the note but yet unsuccessful...
    Now i am completely lost as what is to be done since its critical i want you to immediately look into it and suggest me the appropriate solution so that i can set up both of my DEVELOPMENT and QUALITY system running...
    To troubleshoot this if you require anything from my side then please feel free to ask me since our functional consultants have to soon start working on the SAP systems.
    Regards
    Ayush

    The note you specified talk about 2 database instances not 2 databases... (I was starting to wonder how you deploy 2 databases), you can have multiple database instances on a DB. The note also give you detailed explanation of the configuration of listener.ora
    Now, if this is the case and you have installed 2 instances (not databases) on the same host and configured the listener according to the note, then you should be able to call R3trans -d from both SID's.. if the R3trans fails please post the contents of trans.log here.
    the thing is i can start either one of the SAP Systems, But my objective is to start both the SAP Systems with one listener processes (LISTENER) and one listener port (1527)
    Then, the configuration of your listener.ora file must be incorrect.
    Regards
    Juan

  • Can't access tables in other Oracle database schemas

    Hi. We got our Oracle database admin to install APEX in our Oracle database. She created a login and schema for my Oracle database user so that I could work with APEX a little. Here's the information on the version of APEX we have installed:
    Database Version Information
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    I've found that my user is only able to access Oracle tables within my own Oracle database schema. Most of our main tables are in 3 other schemas and I'd need access to all tables in all these schemas. Right now whenever I encounter a drop list of values for Schema, only by own schema is available in the list of values.
    Is there something our Admin can do to make these tables in other schemas available to my user account?

    Sharpe,
    This documentation should point you in the right direction. It will show you how to add multiple schemas to a workspace.
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21678/adm_mg_wrkspc.htm#CHDBDCCJ
    Cheers,
    Tyson Jouglet

  • How to create a oracle database by java code?

    how to create a oracle database by java code?
    please give some ways then that way's code

    I'm not sure what you mean with "database". Do you mean an Oracle instance or an Oracle user/schema (probably the latter, because that's the equivalent to a MS SQL Database).
    Creating an instance is definitely not possible from within Java. To create a new user this should be possible, as this can be done with SQL:
    GRANT connect,resource TO <newuser> IDENTIFIED BY <password>;
    I'm always cautious with questions like this. In 90% of the cases there is something wrong with the initial design. Creating a database shouldn't be something the application is doing.
    Thomas

  • Compare two oracle db's

    Hi All,
    We have two oracle databases and I would like to compare the structure changes in tables, views, procedures, functions etc.
    I found a very good tool (i.e. DBDiff for Oracle) but its Demo and only doing first five structure changes.
    Does anyone know any other tool or aware of some scripts which solves the above purpose.
    Thanks

    Create a database link between the two databases. Then run:
    SELECT OWNER, OBJECT_NAME, OBJECT_TYPE from DBA_OBJECTS
    minus
    SELECT OWNER, OBJECT_NAME, OBJECT_TYPE from DBA_OBJECTS@the_db_link_u_created
    That will show you the objects that are on the local database that are not on the db_link database. Just reverse the select@ to show results the other way.

  • Export oracle database schema without data

    Hi All,
    cany any one tell me how to export oracle database schema without data using exp command not datapump command.

    step 1
    type exp help=y
    step 2
    read the output
    step 3 now run exp ... rows=n
    Life can be so easy when you aren't lazy. You don't waste time asking to be spoon fed by others if you can do something yourself in 2 seconds.
    Sybrand Bakker
    Senior Oracle DBA

  • RE: Creation of two oracle database in Single ASM Disk group

    IS it possible to create two oracle database in Single ASM Disk group. if it is possible how?.
    Giri

    All you have to do is to create a tablespace at the most minimumlevel and your db would become a client of the disk group. Other than that, you can migrate your db tothe disk group and it would be then start using the same disk group shared by another database for its use also.
    HTH
    Aman....

  • How to compare two Objects !!!!

    Hi All,
    I know that this question has been asked 100 times till now. But trust me I have checked all of them but couldn`t find answer. Here is my question:
    I have an objecs. In that object I am setting (Id,Name,DOJ). Now I want to check whether the object I am trying to save in database already exists or not. If exists then I need to check whether all the setters are same for the two objects. Now can anyone tell me ,how to compare two objects directly without comparing the setters individually.
    Thanks in advance.

    pavan13 wrote:
    That is pretty good idea. However I have a query. Does that code actually compare all the setters in a two beans. I don`t want to check each setter seperately.Well, it's pretty meaningless to talk about "comparing setters", setters are methods, they don't have values to compare. Because equals is inside the class, you can simply compare the fields that get set by the setters. "Properties" is probably a better name.
    In principal you could write something that tried to find all relevant fields and compare them, using reflection or bean info stuff. The resulting code would be about 50 times longer and take about 50 times longer to run. It's hardly asking a lot to put three comparisons between && operators.
    Remember, though, not to compare string fields with ==, you should call .equals on the string fields.
    p.s. don't let the bean terminology confuse you. Beans are just ordinary objects which follow a few rules. Personally I wish the term had never been coined.
    Edited by: malcolmmc on Dec 6, 2007 4:15 PM

Maybe you are looking for

  • Error while creating a view and creating navigation link

    Hi, i created one view with one button and on click of button it has to navigate to DeleteOperationview.This is the exception i am getting while running. can u plz tell me where the problem might beee... com.sap.tc.webdynpro.services.exceptions.Creat

  • ITunes 10.5.1 multible cover art not showing

    How Can i display different covers I stored with a song? In earlier versions of iTunes in the little artwork viewer in the bottom left corner of the iTunes window there were left and right arrows on the top in case you added more than one picture to

  • HT1689 Can anything be done if my iPod was stolen, and I still have it registered under my account?

    I never unregistered my iPod from my account, and it was recently stolen.. If I still have the serial code, can anything be done? and how do I go about getting it back if I find where it is? All passwords have been changed, and I DID NOT have iCloud

  • Deployment Error with jdk 5 and oc4j_extended_101320.zip

    Hello, I get the following error when I try to deploy my application using jdk 5 and oc4j (oc4j_extended_101320.zip) . I am sure no references of jdk1.4 are being used anywhere. I also tried deleting the persistence directory to make sure there are n

  • Os x 10.5.8 mac mini

    i have this software for my mac mini but i need at least 10.6 to play fm 14. will my mac mini be able to install the software or do i need to get more memory or a sound card etc