Comparing PL/SQL code from different database

Hi,
I have 3 databases(development, test and production) lying in 3 different servers. I wanted to check if all the databases have the same PL/SQL code.
is there a automatic ways of doing that. If not is there any best practices that can be followed
I use oracle 10g
Thanks,
DJ

Dont you have a Change Management System in place. How do you do your deployment. What is the versoin control system you use?
When you deploy your code in some database dont you store the details some where?
In database source code is available at ALL_SOURCE. You can query that and compare. But its never a good idea.

Similar Messages

  • Data from different databases in the same report.

    Hi Everyone,
    I am trying to build a reconciliation report in which I need to show the data from the source and target, side by side.
    Source and target are both different databases, although being oracle only
    Whenever a new data model is created, it gets attached to a data source and in the report we need to choose a specific data model.
    Can we have data from different databases in the same report ?

    Yes, it is possible.
    One way Is to use dataTemplates. There you can make queries from any number of different databases (The max I have done is 5).
    It looks something like that:
    <dataTemplate name="NameOfTemplate">
    <dataQuery>
         <sqlStatement name="Q1" dataSourceRef="Connection1">
              <![CDATA[     select * from table1]]>
         </sqlStatement>
         <sqlStatement name="Q2" dataSourceRef="Connection2">
              <![CDATA[     select * from table2]]>
         </sqlStatement>
      </dataQuery>
      <dataStructure>
         <group name="RESULT1" source="Q1">
              <element name="P_FIRST_NAME" value="P_FIRST_NAME"/>
         </group>
         <group name="RESULT2" source="Q2">
              <element name="P_DATE" value="P_DATE"/>     
         </group>
      </dataStructure>
    </dataTemplate>dataStructure is very important when you get data from different places, if you don't define those elements, then only the result from Q1 is shown.
    The second possible way is to make as two different data models, each containing their own query and then set Main Data Set as concatenated SQL Data Source.
    Best of luck,
    Evelyn

  • Select data from different database

    hi,
    may I know how to select data from different database?
    for example,
    I've 2 databases, OracleDB and OracleAR
    Connect with OracleAR in SQL*Plus
    select * from OracleDB.TableName
    does Oracle support this kind of query?
    how can I retrieve data from other database while im connecting with
    other database?

    Hi,
    Yes, it's possible. No, your syntax won't work.
    First of all you have to define a DATABASE LINK inside the DB where you are already connected (in this case OracleAR). Read docs how to do that.
    Second thing is the query. It will look like
    SELECT * from TableName@<NameOfDatabaseLink>Greetings,
    Guido

  • Single query to get data from different databases

    i need to capture certain fields from certain tables in database 1 and certain fields from certain tables in database 2 into one file using a single SQL statement.
    i tried searching on the net
    i found that dblinks can help
    but iam not sure if ill be able to create dblinks in my situation which is:
    i need to get data from oracle to be copied to mysql
    this is not a replication acitivity, but i need certain fields from one database and certain from the other
    so what iwas thinking is, if i use an sql query to get all the fields (i need around 40) from the different oracle databases and create a singlefile with one insert per select, i can then read that file into mysql
    instead of creating multiple sql queries for each table and creating separate files and eventually separate tables in mysql.
    can anyone help me here?
    or maybe suggest another approach.
    thanks

    Hi,
    I think dblink is the only option available to get data from different databases. It will work for your case too.
    CREATE DATABASE LINK db_link CONNECT TO user_name IDENTIFIED BY  password USING 'instance_name'you must have the system privilege 'create database link' to create db links. This way you can get the required data and put it in a table in oracle. But i dont know how to put this data from oracle table to Mysql.
    HTH
    Muneer

  • Fetch data from different database tables

    Hi...
    How can i fetch data from different database tables and put it into a internal table and then display it??? Can provide simple short codes as i'm new to ABAP. Thanks.

    Hi,
    Check this sample code..
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            vbeln TYPE vbeln,
            expand,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            vbeln TYPE vbeln,
            posnr TYPE posnr,
            matnr TYPE matnr,
            netpr TYPE netpr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    DATA: s_layout TYPE slis_layout_alv.
    s_layout-subtotals_text            = 'SUBTOTAL TEXT'.
    s_layout-key_hotspot = 'X'.
    s_layout-expand_fieldname = 'EXPAND'.
    SELECT vbeln UP TO 100 ROWS
           FROM
           vbak
           INTO TABLE itab.
    IF NOT itab[] IS INITIAL.
      SELECT vbeln posnr matnr netpr
             FROM vbap
             INTO TABLE itab1
             FOR ALL ENTRIES IN itab
             WHERE vbeln = itab-vbeln.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA: s_keyinfo TYPE slis_keyinfo_alv.
    s_keyinfo-header01 = 'VBELN'.
    s_keyinfo-item01   = 'VBELN'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
              i_callback_program = v_repid
              is_layout          = s_layout
              it_fieldcat        = t_fieldcatalog
              i_tabname_header   = 'ITAB'
              i_tabname_item     = 'ITAB1'
              is_keyinfo         = s_keyinfo
         TABLES
              t_outtab_header    = itab
              t_outtab_item      = itab1
         EXCEPTIONS
              program_error      = 1
              OTHERS             = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks
    Naren

  • Workspace to parse SQL statements from multiple database schema's

    Hi ,
    When go through the following link of workspace admin user :
    Home>HTML DB Workspace Administration>Manage Services>Schema Reports>Workspace Schemas there I saw "Your workspace has the privilege to parse SQL statements using the following database schemas. Note that the terms database schema and database user can be used interchangeably.
    " at the right pane.
    So how can i make my workspace to parse SQL statements from multiple database schema's ?That must be listed there .But i have only one schema in view ? Can i make it multiple ?If then How ?
    Anybody have an idea ?
    ROSY

    Assign as many schemas to your workspace as you want using the administration app. Read about it in the doc.
    Scott

  • Help needed to insert data from different database

    Hi ,
    I have a requirement where i need to fetch data from different database through database link .Depending on user request , the dblink needs to change and data from respective table from mentioned datbase has to be fetched and populated .Could i use execute immediate for this, would dblink work within execute immediate .If not , could pls let me know any other approach .

    What does "the dblink needs to change" mean?
    Are you trying to dynamically create database links at run-time? Or to point a query at one of a set of pre-established database links at run-time?
    Are you sure that you really need to get the data from the remote database in real time? Could you use materialized views/ Streams/ etc to move the data from the remote databases to the local database? That tends to be far more robust.
    Justin

  • Not able to compare PL/SQL body from two different offline database object

    It is not possible to compare two package bodies from two different off line database object in two different off line database and schema.
    JDeveloper display a compare not available message in the middle of the window.
    It is possible to compare the package specification.

    Not able to compare scripts generated from offline database objects too

  • Compare Table Data on 2 different databases having same schema

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

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

  • How to compare PL/SQL source in two databases using some smart trick

    Hi,
    Here is my scenario:
    We have a very big team (>50) of developers working on PL/SQL.
    As and when some new enhancements/bug-fixes are are tested successfully, DBA's migrate the new source code from DEV to QA and then to PROD instance.
    Very often, developers are asked to verify if the source code migrated to the target instance is the correct one. This so, because we use an automated migration tools ...and sometimes DBA's might make mistake by migrating the wrong version (say a beta code).
    So the developers are left with comparing the source manually or using file compare tools...a very time consuming job.
    (I know a strict discipline of keeping a proper header and version history will help; but we have lots of exisiting code that does not adhere to this rules)
    So, is there any way to do it in a "smart" way .... I was thinking about a way to get the HASHCODE/HASHKEY of all the source code lines of a pkg or procedure and then again get the HASHCODE/HASHKEY of all the HASHCODEs/HASHKEYs of the source lines for a particular pkg..to get a single HASHKEY for a pkg ....and then I can compare this HASHKEY of 2 instances ..and it they are same, means the code is same ..else the code is different
    e.g.
    select custom_hashkey_prc(text) from dba_source where name='MY_PKG'
    Thanks.
    Edited by: DT1977 on Jan 19, 2009 3:31 PM

    Using a HASH to check if two sources are the same would be a valid way of doing a quick check although it obviously won't tell you where the differences are.
    In Oracle 10g up you can use the DBMS_CRYPTO package to generate HASH values...
    http://www.psoug.org/reference/dbms_crypto.html
    We use this method ourselves for detecting changes in data where there are CLOB columns (as we can't use SQL's set operators on CLOBs).

  • How to join tables from different databases (DBLink/DB connection )

    Hello,
    i have an issue and i hope you could help me to solve it. My problem is: I want to create native sql select which joins two tables from different DB (both of them are ORACLE, one of them internal, another one - external). I have found several notes and posts, but without any success. Db connection exists in dbcon table, so this part of my problem has been solved.
    I would like something like that:
    select * from table1@xxx inner join table2.
    i can not split this select into two separate ones, because both tables store over 30 mln. entries and i do not want to create any copies of them.
    Br,
    dez

    Hi,
    you might need to create a DB-Link on DB level and use EXEC SQL.
    Lots of stuff on google about this, like
    Oracle DBLink ( external database )
    Volker

  • Calling pl/sql package on different database in process flow

    Hi there
    Have a process flow which calls procedure on different database. This procedure truncates a table on the remote database.
    Please could somebody confirm we would need to set up dblinks from the owf_mgr schema to the remote database.
    New to wokflow - am i Correct in assuming the process flows run on the owf_mgr
    rather than the control center owbrt.
    Many Thanks

    Hi there,
    Thanks for the reply.
    If my understanding is correct I could have a procedure as follows.
    hkeeping.trunc_table@dblinkname('TABLE_NAME');
    Is this the case?
    Another alternative was to call directly the transformation in the process flow
    e.g. we have pl/sql package on remote database whioch truncates the remote table.
    When we try this with same procedure on same databas as owb user exists on then works fine.
    However on remote database get message below. Does this mean anything to you? How could we sort this?
    RPE-01003: An infrastructure condition prevented the request from completing.
      TEMP_PLOW:TRUNC_TABLE
    Error
    RPE-01038: Failed to evaluate expression null. Please modify the expression, redeploy and retry again.
       TEMP_PLOW:TRUNC_TABLE
    Error
    RPE-01003: An infrastructure condition prevented the request from completing.
       TEMP_PLOW:TRUNC_TABLE
    Error
    RPE-02226: Cannot test Control Center user REMOTEUSERNAME. This user must match the login credentials of the deployment location.
       TEMP_PLOW:TRUNC_TABLE
    Error
    ORA-01937: missing or invalid role name
    Many Thanks

  • Dealing with tables from different databases?

    Hi. I'm a newbie to Visual Studio 2012 and stuck on how to interact with different datasets.
    I am building a report that is associated with with two tables, each from a different database. The
    master_flat table with the primary key matter_number is from the first database and it contains all the columns I need that should show up in the report layout I've built. However,
    billing_table with the primary key matter_number contains a flag that I go by which I must use to determine whether each matter should come through in the reporting or not. 
    I've set the master_flat as dataset1 and the billing_table as dataset2. Now, what is the best way in Visual studio 2012 to filter by the matters that has flag "N" in dataset2?
    Thanks

    We are way out of sync.  Lets synchronize.  I'm not sure which question you are refering to.  Is it the "C# or VBnet"  question or is it the "One or two database Question".  It seem like it would be the database question since you
    should know which programming language you are using.
    Open SQL Server Management Studio (SSMS).  After login, there is an explorer where you can browse the databases, tables, and fields in the tables.  You should be able to view how you build the database.  If you right click any tables and then
    "Script Table As : Select To : New Query Editor Window".  There is an execute button to run the query.  You can aslo edit the query.  I usually test all my qeuries in SSMS before actually using them in an application.  I would get a JOIN
    SQL working in SSMS.
    If you let me know if you are using VBnet or C# I will write a simple LINQ.  Even better if you supply me the names of the columns of the two tables.
    jdweng

  • Generate SQL code from a user

    Hi,
    I would like to replicate a user from one database to another.
    Is it possible to generate the SQL code that defines this user, in the purpose of apply this script on another database ?
    Thanks.

    Hi
    You can use DBMS_METADATA package:
    SELECT DBMS_METADATA.GET_DDL('USER', 'GOKHAN') FROM DUAL;
    SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT', 'GOKHAN') FROM DUAL;
    SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT', 'GOKHAN') FROM DUAL;
    SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', 'GOKHAN') FROM DUAL;I put 'GOKHAN' as sample user name.
    Ref: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm
    Best Regards,
    Gokhan Atil
    If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks

  • Select query based on joining of tables from different database is taking too long

    Hi Team,
    Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
    contain close to 1million records.
    Select T1.*
    From DB1.dbo.Table1 T1
    Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
    Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
    And (T1.flg IS NULL OR T1.flg = 'N')
    And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
    How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Thanks.
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    This join is not working with spaces if Rtrim is not used.
    Thanks! Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

Maybe you are looking for