Comparing two Oracle sources
Hi,
I need to compare two diffrent Oracle datadictionary sources and need its report.
Is there any tool available for this purpose. This is for one of our datawarehousing projects. So, data dictionary migt be bigger.
Please help
Sony
How can I ceck two schamas uisng TOAD, Can you please explain this.
which option i need to take.
Similar Messages
-
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 -
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.
ThanksCreate 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. -
Tool or script to compare two oracle Reports?
Hi:
Anybody knows any tool or script to compare or conciliate two Oracle reports?
The idea is to detect the differences to impact then in the older report.
I tried comparing each .REX with a text file comparing tool (like a Unix diff), but the differences I found were bassed in tables and fields used when we save the report to the database. The main problem using that is how to impact the differences found in the Report Builder.
The following are 2 examples of diferences found, which I dont know how to impact them in the Reports Builder
DEFINE ROSSTRINGS
BEGIN
groupid = 15453
stringid = 0
lfid = 0
cs = 31
len = 7
str = (BINARY)
<<"
5020426f 6f6b0000
">>
END
DEFINE SRW2_LAYOUT
UITAG = 18039
HDR_CHAR_HGT = 65
I'll thanks a lot yours suggestion or ideas.
Sincerily, Sebastian BarbieriMay beu2026 Business Object u2013 Crystal Reports can explain us how is a report built and how we can find the u201Cdata sourcesu201D. If it can beu2026 I will be able to make a program to compare the u201Cdata fieldsu201D in two, three, four,u2026 reports.
It will be very useful to compare if two reports have the same u201Cdata fieldsu201D or, two directories have the same number of reports and everyone in the first folder have the consequent in the second folder.
Of course, when I talking about folders, Iu2019m want to say two folders who contains reports but each folder have reports linked to different DBMS (Oracle, SQL Server,u2026).
Edited by: Carles Hernández on Jan 13, 2009 5:03 PM
Edited by: Carles Hernández on Jan 13, 2009 5:05 PM -
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,
DivI'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 merge/compare two workflows.
Hi there!
Is there a way to merge or compare two Oracle Workflows - to find potential differences?
If you use a regular text compare, it's pretty hard to get an overview over what's been done..
Kind Regards, HenrikPost your query in Workflow forum to expect response. Follow URL
Workflow -
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 AMYou 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. -
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
KrishnaThis can help for this question
Re: Help needed ! How to find out 'XML Difference' using XDK -
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. -
No question. Just a comment with code example.
Yesterday I was having issues comparing two Calendar dates. They looked equal in my println statement, but they failed the test. The solution evaded my cafeine intensified brain for hours. Then it hit me. Print out the time in milliseconds and see if the numbers were the same. Nope. Why?
The problem was that in the real world, you get dates from all over the place, not just cooked up for a text book example. (Don't you just hate those text book examples in their unrealistic world?) Anyway, I was getting a date from an HTML form and a data from a database and comparing the two once I had converted them both to a Calendar object. This seemed a reasonable choice.
Well, the java.sql.Date that the Oracle driver returned which was converted to a java.util.Date was fine. I ran this into a Calendar with the call calS.setTime(dbDate). The form date was split into fields and put into a difference Calendar obj with the call calF.set(fYear, fMonth, fDay, 0, 0, 0). This too seemed reasonable. Then a call to calS.equls(calF) resulted in a false even though the actual dates were in fact the same.
The problem was with the time. The java.sql.Date (calS) had a time of 00:00:00 which was fine. The calendar from the form also had 00:00:00 for a time since I initialized it with zeros. Hummmmm. Now what? As mentioned before, I decided to print out the actuall time in milliseconds and that gave me my answer. The two calendars were off by only milliseconds, but that's why. You see, the equals method of Calendar compares two dates/time in milliseconds. You can see this in the source for yourself. It's not difficult to read at all. Download and open the api source file, src.zip, and locate Calendar.java in the java.util directory.
The fix was to add calF.set(Calendar.MILLISECOND, 0) and calS.set(Calendar.MILLISECOND, 0) to zero out the milliseconds in each Calendar object. That did the trick. Here's example code of the problem (test1) and the solution (test2). I tried to simulate as close to real world as possible. If you have a better solution or I've made some error, please let me know. I'm always looking for better ways.
Main.java
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
public class Main {
private int fYear = 2003;
private int fMonth = 3; // march
private int fDay = 14;
public static void main(String[] args) {
Main main = new Main();
main.test1();
main.test2();
public void test1() {
SimpleDateFormat df = new SimpleDateFormat();
// get the date from the form
Calendar calF = Calendar.getInstance();
calF.set(fYear, fMonth-1, fDay, 0, 0, 0); // month starts at 0 - so march would be 2
System.out.println("From form date: [" + df.format(calF.getTime()) + "] [" + calF.getTimeInMillis() + "]");
// simulate other activity in the app
try {
Thread.sleep(5000);
catch (Exception ex) {
ex.printStackTrace();
// get the Date from the shared object which comes from a database (java.sql.Date)
// the return is java.util.Date
// convert to a Calendar
SharedObject so = new SharedObject();
Date myDate = so.getTheDate();
Calendar calS = Calendar.getInstance();
calS.setTime(myDate);
System.out.println("Shared Object date: [" + df.format(calS.getTime()) + "] [" + calS.getTimeInMillis() + "]");
// compare the two calendars for equality
if (calS.equals(calF)) {
System.out.println("The same");
else {
System.out.println("NOT the same");
public void test2() {
SimpleDateFormat df = new SimpleDateFormat();
// get the date from the form
Calendar calF = Calendar.getInstance();
calF.set(fYear, fMonth-1, fDay, 0, 0, 0);
calF.set(Calendar.MILLISECOND, 0); // the magic bean
System.out.println("From form date: [" + df.format(calF.getTime()) + "] [" + calF.getTimeInMillis() + "]");
// simulate other activity in the app
try {
Thread.sleep(5000);
catch (Exception ex) {
ex.printStackTrace();
// get the Date from the shared object which comes from a database (java.sql.Date)
// the return is java.util.Date
// convert to a Calendar
SharedObject so = new SharedObject();
Date myDate = so.getTheDate();
Calendar calS = Calendar.getInstance();
calS.setTime(myDate); // just to be safe
calF.set(Calendar.MILLISECOND, 0);
System.out.println("Shared Object date: [" + df.format(calS.getTime()) + "] [" + calS.getTimeInMillis() + "]");
// compare the two calendars for equality
if (calS.equals(calF)) {
System.out.println("The same");
else {
System.out.println("NOT the same");
SharedObject.java
public class SharedObject {
public java.util.Date getTheDate() {
java.util.Date d = null;
try {
java.sql.Date s = java.sql.Date.valueOf("2003-3-14"); // this march is converted internally
d = (java.util.Date)s;
catch (Exception ex) {
ex.printStackTrace();
return d;
} The output
From form date: [3/14/03 12:00 AM] [1047621600296]
Shared Object date: [3/14/03 12:00 AM] [1047621600000]
NOT the same
From form date: [3/14/03 12:00 AM] [1047621600000]
Shared Object date: [3/14/03 12:00 AM] [1047621600000]
The sameSo your post boils down to the fact that Calendar's set(year, month, day, hour, minute, second) method doesn't change the milliseconds fraction?
Given that there is this method, I guess it would be nice if there was a method that simultaneously set all fields, but the API does state:
Previous values of other fields are retained. If this is not desired, call clear() first. -
How can i compare two excel files with different no. of records.
Hi
I am on to a small project that involves us to compare two excel files. i am able to do it but am struck up at a point. When i compare 2 different .csv files with different no. of lines i am only able to compare upto a point till when the number of lines is same in both the files.
Eg. if source file has 8 lines and target file has 12 lines. The difference is displayed only till 8 lines and the remaining 4 lines in source lines are not shown.
Can you help me in displaying those extra 4 lines in source file. I am attaching my code snippet below..
while (((strLine = br.readLine()) != null) && ((strLine1 = br1.readLine())) != null)
String delims = "[;,\t,,,|]";
String[] tokens = strLine.split(delims);
String[] tokens1 = strLine1.split(delims);
if (tokens.length > tokens1.length)
for (int i = 0; i < tokens.length; i++) {
try {
if (!tokens.equals(tokens1[i])) {
System.out.println(tokens[i] + "<----->" + tokens1[i]);
out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + tokens1[i]);
out.println();
sno++;
} catch (Exception exception)
out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + "");
out.println();
Thanks & RegardsA CSV file is not an Excel file.
But apart from that your logic makes no sense.
If the 2 files are of different sizes the files are different by definition, so further comparison isn't needed, you're done.
If you want to compare individual records, you need to compare all records from one file with all records from the other, unless the order of records is important in which case your current system might work.
That system however is overly complicated for comparing CSV files.
As you assume a single record per line, and if one can assume those records to have identical layout (so no leading or trailing whitespace in or between columns in one file that's not in the other) comparing records is simply a matter of comparing the entire lines. -
Error while running code template mapping between two oracle tables
Hello All
Iam getting the following error while running code template mapping between two oracle tables. Using OWB 11gR2 and oracle 11gR2 DB.
java.sql.SQLException: ORA-20001: The active workspace is not valid as a target for this mapping
c: at "OWBSYS.WB_RT_MAPAUDIT_UTIL", line 1065
ORA-06512: at "OWBSYS.WB_RT_MAPAUDIT_UTIL", line 1087
ORA-06512: at "SOURCE.FILENET_EX_UNIT_3", line 555
ORA-06512: at line 4
Job 51 error: java.sql.SQLException: ORA-20001: The active workspace is not valid as a target for this mapping
ORA-06512: at "OWBSYS.WB_RT_MAPAUDIT_UTIL", line 1065
ORA-06512: at "OWBSYS.WB_RT_MAPAUDIT_UTIL", line 1087
ORA-06512: at "SOURCE.FILENET_EX_UNIT_3", line 555
ORA-06512: at line 4
Quick help is highly appreciated.Dera Dallan
its only a target user for the workspace where you are deploying the mapping from.
I have two repositories for two different projects. each repositary has its own workspace.
ex:-
Project 1
Work space bpms_rep_owner
Repositary owner bpms_rep_owner
Repositary user bpms_rep_user
Project 2
Work space dem_rep_owner
Repositary owner dem_rep_owner
Repositary user dem_rep_user
Reg
S.Gyazuddin -
OBIEE 11g - Combine data from two Oracle tables
Good day!
I tried to combine data from two Oracle tables as fact data, but it doesn't work.
My steps: I created SCOTT.EMP2 table from SCOTT.EMP table, update EMPNO and ENAME values of EMP2 table to distinguish data of my tables. Then I imported physical tables DEPT, EMP and EMP2 to BIEE 11g, created joins DEPT-EMP and DEPT-EMP2 in physical diagram. Then I dragged DEPT and EMP tables to BMM, and EMP2 table to EMP as second LTS. In Content tab for EMP and EMP2 I checked "This source should be combined with other sources at this level" checkboxes. Then I renamed logical tables EMP and DEPT to Employees and Departments and dragged them to Presentation area. In Answers I created Analysis with columns DNAME and ENAME.
The problem is that data on results tab is only from one physical table EMP or EMP2 (depending on the order of sources EMP and EMP2 of LT Employees) and not from both.
Can anybody help? Am I missed something?
Al.Hi Al,
I think you have to define the content of the LTS.
http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_BusModSetup16.html
You have to specify the content of the different fragments.
http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_SetUpAggNav3.html#wp1005333
Maybe you have to add an additional column 'Source' ('EMP1', 'EMP2')
Good Luck,
Daan Bakboord
http://obibb.wordpress.com -
How to compare two excel reports and find the difference in BI Publisher
Hi All,
I have a requirement that needs to compare two excel reports in XML Publisher 5.6.2. or BI publisher 10.1.3.4
If anybody has an idea about this pls help us.
Thanks,Since our customer wants to have this comparison only with BI reports....here is the scenario how the comparison should be..
Now,we have a parameters called Customer name and version id. Version id list will be refreshed based on the customer selection.
User can generate the report based on the selected customer name and version id. These data are fetch from the oracle database and we are using Data Template in the BI Publisher.
Now the requirement is customer wants to compare two version id data. for example, v1.2 and v1.3
Now they wanna to see both the reports while generating in the same work sheet, like, v1.2report should display in the left side and the v1.3report has to display in the right hand side of the same work sheet.
Now...If there is any addition happened in v1.3 report,then that cell/data should display as a green color in that report.
If any deletion happened in v1.3report then that should be in the red color.
If any modification happened in v1.3 then that should be in the yellow color.
If there is no difference then that should display as it is.
the thing is that, the both the reports (v1.2 and v1.3)should display side by side in the same worksheet with the format and everything........only the difference should be highlighted.
Template is same for both the reports..
To display the data for both versions i think i can generate the template side by side of both in the same worksheet.
Now, My question is how to find the difference of data in the RTF Template for both the versions
Can anybody assist me?
Thanks,
Edited by: user753355 on Jun 9, 2009 12:03 AM
Edited by: user753355 on Jun 9, 2009 12:06 AM
Edited by: user753355 on Jun 9, 2009 12:16 AM
Edited by: user753355 on Jun 10, 2009 3:59 AM -
How to bring BO knowledge (Oracle source) to SAP BI/BW/ECC (source)
Hi,
I currently took a BO XI R2 class but they did not have SAP BI/BW (ECC 6/ R3) and therefore, they used only Oracle DB as the relational database i.e. the source system of data.
Do you have any help for me on how to transition my acquired knowledge into the SAP environment?
I am an SAP BW/BI consultant.
i.e.
Any info on how link BO to SAP BI Cubes/DSO since class did not discuss those?
For example, I saw a requirement, "BO experience with atleast one implementation in ECC6.0" .
I will appreciate any hints to help be bring the two together i.e. BO knowledge (Oracle source) to SAP BI/BW/ECC (source)
Thankswrong location
Maybe you are looking for
-
Is it necessary to have idt audio software?
i want to ask 2things. 1st - is it necessary to have the idt audio driver? even if i dont install it the media player vlc etc work but the mute button remains orange. 2nd - i updated my os to windows 7 64bit. so if i do need the idt driver then shud
-
Video no longer streaming since update
Apple TV will no longer stream movies from my iTunes Library since the update. The only way I can see new movies is if I physically Sync them over to the Apple TV Hard Drive. This not only seems to invalidate the entire friggin' point of having an Ap
-
Safari...it keeps quiting on me
when i run safari it will go fine, fast and all that but, several minutes in it will just randomly cut-off, for no apparent reason. i then get a pop up saying that safari has closed unexpectedly and that it has not affected any other app's. How can i
-
Usage of - BAPI_POSRVAPS_SAVEMULTI3
Hello Frnds, Im using this above mentioned BAPI to create Stock Transfer Requisition in APO and send it to R3. Presently I could successfully create an Order in APO but it is not ciffing across to R3 automatically. I have to manually reconcile the or
-
Hi friends, I am Aakash Kumar, new on adobe forum. As i am new candidate ,i dont know enough info about this site. But i found i can get my answers related to adobe photoshop and designing. So now coming to main point, I jusy have co