Trace queries from abap to a custom oracle database via dblink

I' m
connecting to a database by dblink (name magiap).
I
would like to know if somewhere I can trace all the queries from abap to oracle
in this specific session , to dbs ='MAGIAP'.
For istance, i would like that the query
"SELECT "DESPARTY1"
into :v_DESPARTY1
FROM "T040PARTY"
WHERE "CODPARTY" = '305142941' will
be stored some where (in a file??).
I would like that parameters - w_CODPARTY- will be substituted and stored in the trace
file with the value (305142941), as shown in the previous
Here
is the piece of code ..(a very short example of course)..
DATA : dbs LIKE dbcon-con_name,
v_CODPARTY(15),
v_DESPARTY1(60).
data : w_CODPARTY(15) value '305142941'.
dbs = 'MAGIAP'.
TRY.
EXEC SQL.
CONNECT TO :dbs
ENDEXEC.
IF sy-subrc <> 0.
EXEC SQL.
CONNECT TO :dbs
ENDEXEC.
ENDIF.
IF sy-subrc <> 0.
* RAISE err_conn_aea.
ENDIF.
EXEC SQL.
set connection :dbs
ENDEXEC.
EXEC SQL .
SELECT "DESPARTY1"
into :v_DESPARTY1
FROM "T040PARTY"
WHERE "CODPARTY" =
:w_CODPARTY
ENDEXEC.
IF sy-subrc NE 0.
* rc = 4.
ENDIF.
EXEC SQL.
DISCONNECT :dbs
ENDEXEC.
ENDTRY.

Hi Silvana,
The SQL statements have been stored in the SQL Cursor Cache, on the database and they will be available until they have been invalidated. You can access the statements at the 'MAGIAP' side and see the last executed queries in the cache.
You can access bind variables by query on the V$SQL_BIND_CAPTURE table, also.
On the other hand, you can activate the trace by the statement, below;
ALTER SYSTEM SET sql_trace = true SCOPE=MEMORY;
Then, the sql statements will be available in the usertrace file. Please note that you should execute and investigate all the statements that I noted above, at the remote side. Plus, as far as I know that it is not able to distinguish the records by the "dblink name". You should check all the statements and try to figure out what queries have been executed remotely.
Best regards,
Orkun Gedik

Similar Messages

  • Tracing queries from abap to a custom database via dblink

    I' m connecting to a database by dblink (name magiap).
    I would like to know if somewhere I can trace all the queries from abap to oracle in this specific session , to dbs ='MAGIAP'.
    For istance, i would like that the query "SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" = '305142941' will be stored some where (in a file??).
    I would like that parameters - w_CODPARTY- will be substituted and stored in the trace file with the value (305142941), as shown in the previous
    Here is the piece of code ..(a very short example of course)..
    DATA : dbs LIKE dbcon-con_name,
    v_CODPARTY(15),
    v_DESPARTY1(60).
    data : w_CODPARTY(15) value '305142941'.
    dbs = 'MAGIAP'.
    TRY.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    IF sy-subrc <> 0.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    ENDIF.
    IF sy-subrc <> 0.
    * RAISE err_conn_aea.
    ENDIF.
    EXEC SQL.
    set connection :dbs
    ENDEXEC.
    EXEC SQL .
    SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" = :w_CODPARTY
    ENDEXEC.
    IF sy-subrc NE 0.
    * rc = 4.
    ENDIF.
    EXEC SQL.
    DISCONNECT :dbs
    ENDEXEC.
    ENDTRY.

    Hi Silvana,
    The SQL statements have been stored in the SQL Cursor Cache, on the database and they will be available until they have been invalidated. You can access the statements at the 'MAGIAP' side and see the last executed queries in the cache.
    You can access bind variables by query on the V$SQL_BIND_CAPTURE table, also.
    On the other hand, you can activate the trace by the statement, below;
    ALTER SYSTEM SET sql_trace = true SCOPE=MEMORY;
    Then, the sql statements will be available in the usertrace file. Please note that you should execute and investigate all the statements that I noted above, at the remote side. Plus, as far as I know that it is not able to distinguish the records by the "dblink name". You should check all the statements and try to figure out what queries have been executed remotely.
    Best regards,
    Orkun Gedik

  • How to export the data from an excel file to Oracle database by using macro

    Hi,
    I want to export data from an excel file into Oracle database.There is one method that by creating the macros through excel we are able to do this.
    can anybody please send me the code to create macros?
    Thanks in advance.
    Regards,
    Surendra.V

    There are several resources on the web, but you could start analyzing if this code fits your needs --> VBA Macro for Excel 2003 Export of Text File with Comma and Quote Delimiters.
    ~ Madrid

  • Read data from Excel and write into oracle database

    Hi
    I want  to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
    Thanks and Regards
    Neeta

    Hai,
    I am suggesting the solution.
    I will try out and let u know soon.
    Make a coma separated file from your excel file.
    Assuming that your requirement allows to make a csv file.
    This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
    You do not want to  go via sql Loader?
    For reading the excel file itself do you want java?

  • "Error while accessing porting layer for ORACLE database via getSessionId()

    Hi,
    My ejb3.0 Entity is created from Emp table in scott/tiger schema of an Oracle 10g database. I am guessing I made some mistake creating the datasource or uploading the driver, because when I run my application, I get a long exception stack trace. The bottom-most entry in the stack trace is:
    Caused by: com.sap.sql.log.OpenSQLException: Error while accessing porting layer for ORACLE database via getSessionId().
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:148)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.createPooledConnection(DirectConnectionFactory.java:527)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.createDirectPooledConnection(DirectConnectionFactory.java:158)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.createDirectPooledConnection(DirectConnectionFactory.java:118)
         at com.sap.sql.connect.factory.PooledConnectionFactory.createPooledConnection(PooledConnectionFactory.java:119)
         at com.sap.sql.connect.factory.DriverPooledConnectionFactory.getPooledConnection(DriverPooledConnectionFactory.java:38)
         at com.sap.sql.connect.datasource.DBDataSourceImpl.createPooledConnection(DBDataSourceImpl.java:685)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.matchPool(DBDataSourcePoolImpl.java:1081)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.matchPooledConnection(DBDataSourcePoolImpl.java:919)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.getConnection(DBDataSourcePoolImpl.java:67)
         at com.sap.engine.core.database.impl.DatabaseDataSourceImpl.getConnection(DatabaseDataSourceImpl.java:36)
         at com.sap.engine.services.dbpool.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:123)
         ... 90 more

    Actually, now (after the GRANT described in my reply before) the Exception has changed to:
    Caused by: com.sap.sql.log.OpenSQLException: Error while
    accessing porting layer for ORACLE database via
    <b>getDatabaseHost</b>().
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException
    (Syslog.java:148)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.
    createPooledConnection(DirectConnectionFactory.java:527)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.
    createDirectPooledConnection(DirectConnectionFactory.java:158)
         at com.sap.sql.jdbc.direct.DirectConnectionFactory.
    createDirectPooledConnection(DirectConnectionFactory.java:118)
         at com.sap.sql.connect.factory.PooledConnectionFactory.
    createPooledConnection(PooledConnectionFactory.java:119)
         at com.sap.sql.connect.factory.DriverPooledConnectionFactory.
    getPooledConnection(DriverPooledConnectionFactory.java:38)
         at com.sap.sql.connect.datasource.DBDataSourceImpl.
    createPooledConnection(DBDataSourceImpl.java:685)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.
    matchPool(DBDataSourcePoolImpl.java:1081)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.
    matchPooledConnection(DBDataSourcePoolImpl.java:919)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.
    getConnection(DBDataSourcePoolImpl.java:67)
         at com.sap.engine.core.database.impl.DatabaseDataSourceImpl.
    getConnection(DatabaseDataSourceImpl.java:36)
         at com.sap.engine.services.dbpool.spi.
    ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:123)
         ... 90 more

  • Regarding parallel queries in ABAP same as in oracle 10g

    Hi,
       Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.Kindly see below;
    alter table emp parallel (degree 4);
    select degree from user_tables where table_name = 'EMP';
    select count(*) from emp;
    alter table emp noparallel;
    SELECT /*+ PARALLEL(emp,4) / COUNT()
    FROM emp;
    The idea here is to distribute the load of select query in multiple CPUs for load balancing & performance improvement.
    Kindly advise.
    Thanks:
    Gaurav

    Hi,
    >    Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.
    sure. Since it is just a hint...
    SELECT *
      FROM t100 INTO TABLE it100
      %_HINTS ORACLE 'PARALLEL(T100,4)'.
    will give you such an execution plan for example:
    SELECT STATEMENT ( Estimated Costs = 651 , Estimated #Rows = 924.308 )
           4 PX COORDINATOR
               3 PX SEND QC (RANDOM) :TQ10000
                 ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                 Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                   2 PX BLOCK ITERATOR
                     ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                     Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                       1 TABLE ACCESS FULL T100
                         ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                         Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
    PX = Parallel eXecution...
    But be sure that you know what you do with the parallel execution option... it is not scalable.... .
    Kind regards,
    Hermann

  • Call of BW queries from ABAP code

    Has anybody information about how is it possible to call a BW query from ABAP code with parametrization (specifying characteristics) ? In our development project it's a crucial part, beacuse we have to provide interim function modules to carry out some conversion routine on BW provided data, before we put it on the screen embedded in a Visual composer Iview.

    Have a look at this:
    Calling BW queries programatically (also posted on BW forum)
    Hope it helps.
    Regards

  • Important performance metrics from Tivoli, MOM, etc. into Oracle database

    Hi,
    I'm brand new with all of this stuff. I'm trying to grab performance data from a bunch of performance tools (MOM, Tivoli, Load Runner, custom client tools, etc.) and import it into one big file in an Oracle database (the performance data would have to map). Then, ideally, I'd like to be able to link that data up to Excel somehow and make graphs from it. Is this feasible? Where can I go for information to help me out with this?
    Thanks!

    Everything you've written is wrong. Well not just wrong but horribly wrong.
    Here are my thoughts in no particular order.
    1. Since are brand new you should push yourself back from the keyboard and educate yourself before you proceed. Is there anyone in your organization you can ask for help?
    2. Your entire concept around "import it into one big file" is not a complete non sequitur it is essentially impossible. A relational database such as Oracle stores information in logical segments called tables. You need to design a table with columns that correspond with your data and comply with normalziation rules.
    http://www.psoug.org/reference/normalization.html
    3. Unless you are not under any governmental restrictions with respect to auditing and compliance you've go not business ever taking data out of a database and putting it into a toy like Excel. Get a report writer such as one of the tools Oracle sells or Crystal Reports, or Cognos, etc.
    Where can you go for information? I'd suggest you start with the Oracle DBA who is managing the database. Buy him or her lunch and ask for help. Then go to your manager and ask for training.
    My apology if this sounds harsh but sitting here reading this was roughly equivalent to watching two cars at 100kph heading toward each other on a one-lane road.

  • Uploading Data from a Flat file into Oracle Database

    Hi,
    I am a novice to Java . SO, please bear with me. I have a reqiurement where I have a flat file or excel file from which I need to read the data and insert into Oracle Database. The falt file will exist on the client machine. I have been reading and I see this can be done through I/O Streams. Correct me if I am wrong. I am looking for a sample code to get started. Any Java expert has an answer for it, I will appreciate it.
    Thanks

    Try UploadBean. It allows to upload files (from a browser) in Oracle.
    http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
    You will find JSP and servlet samples.

  • How do I import the data from Excel (.xls) file into Oracle Database table

    I have an excel file with 5 columns of 5000 rows.
    I have to import 5000 rows of data into my oracle table with
    same column names & Data types.
    What is the best advise for this ?
    Thanks.
    Srini

    You can connect to Oracle from Excel directly. I know you can read data but am not sure if you can export data.
    Other option is to import the data into Access.
    Create an ODBC connection for Oracle
    Use the to connect to Oracle from Access
    Export data to Oracle from Access
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for DBAs and Developers

  • Move pictures in Jpg from a server to SAP (Oracle database) in BLOB

    Hi SAP Friends,
    We would like to know if this is possible.
    We have pics in jpg/jpeg format in one server. We want to move these pics automatically once every hour to SAP Oracle database in BLOB format. The server has the capability to push these jpg files into BLOB format of Oracle database. We need to know if it is possible to send to SAP's Oracle database and store in BLOB format. If so, pl let us know how.
    Pl let us know.
    Niranjan

    You are facing two things here:
    a) Licensing issue
    Check Note 581312 - Oracle database: licensing restrictions:
    As of point 3, it follows that direct access to the Oracle database is only allowed for tools from the areas of system administration and monitoring. If other software is used, the following actions, among other things, are therefore forbidden at database level:
    Creating database users
    Create database objects
    Querying/changing/creating data in the database
    Using ODBC or other SAP external access methods
    This depends on the contract and where you bought which licenses for Oracle.
    b) Technical issues
    It´s not a good idea to insert data into a SAP database without using SAP tools. Even if it´s a separate table(space) or "isolated" in a SAP understanding. You never know, how upgrades behave with that table, you may see the table in sense of SAP-DDIC consistency (Table without DDIC reference) etc.
    If you want to insert JPEGs easily,  you can use transaction CSADMIN, create a repository and write a small program, that uploads the data to the database using SAP standard interfaces. This will insure DATA integrity and will make sure, the data is accessible even after database/SAP system upgrades.
    Markus

  • HY000 error retrieving CLOB-data from oracle database via ODBC

    Hello,
    I get error HY000 [Oracle][ODBC][ORA] ORA-00932: inconsistent datatype when I want to show a CLOB column in my crystal report. The type of the field in the report is memo - in the database it is CLOB.
    How to retrieve CLOB-data from an Oracle 11GR2 database via ODBC in Crystal Report Version 12.3.0.601?
    Thanks in advance for any help.
    kind regards
    Monika Anna

    Hello,
    Who's ODBC driver are you using?
    Try our DataDirect drivers - https://smpdl.sap-ag.de/~sapidp/012002523100008666562008E/cr_datadirect53_win32.zip
    Thank you
    Don

  • Importing data from Microsoft excel file to Oracle Database with Multiple Data Tables. Need expert advice and guidance

    I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
    I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
    Can someone help or direct me to an expert that can help me on this

    e90f478a-c529-4c48-b189-51eebeaed477 wrote:
    I posted a query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). I got some answer and reference from the forum.
    I presented to my Oracle consultant and representative from Oracle Malaysia. They said impossible. I do not believe what they said. I do believe can be done.
    Can someone help or direct me to an expert that can help me on this
    We don't know the "query on Importing data from Microsoft Excel to Oracle Database (Multiple Data Tables). "
    We don't know where you posted said query.
    We don't know what "some answer and reference" you received "from the forum."
    We don't know what it was that your "Oracle consultant and representative from Oracle Malaysia" said was "impossible".
    So on what basis are we supposed to "help or direct" to "to an expert that can help "?

  • Customizing Oracle Database Error Message Using Oracle JVM

    Avi (that everybody on this forum knows) has just written the following article:
    http://www.oracle.com/technology/tech/java/jsp/parameterized_custom_messages.html
    Check it out, Kuassi

    I got blank space when try to access Oracle Database Error Messages 11g release 2 pdf version. Not sure if it is because of my browser or not. I'm using firefox 6.0.2 in Slackware 13 64 linux.I do not see any PDF link for "Oracle Database 11gR2 Error Messages" Guide, only the HTML version is available.
    Error Messages
    http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e17766/toc.htm
    11gR2 Docs
    http://www.oracle.com/pls/db112/homepage

  • Access vba problem with ORACLE database via ODBC

    I get a problem when using MS-Access 2007 DAO recordset built on table hosted by an Oracle database 10g and connected thru an ODBC link (the id is generated by a sequence/trigger associated to the table).
    The code I use is :
    Private Sub Commande0_Click()
    Dim rs As DAO.Recordset2
    Dim bm As Variant
    'Set rs = CurrentDb.OpenRecordset("select * from table1", dbOpenDynaset, dbSeeChanges, dbPessimistic)
    Me.Recordset.AddNew
    Me.Recordset!libelle = CStr(Rnd)
    Me.Recordset!code = “”
    Me.Recordset!actif = True
    Me.Recordset!idCollege = 1
    Me.Recordset.Update
    Me.Recordset.MoveFirst
    Me.Recordset.Bookmark = Me.Recordset.LastModified
    Dim idtemp As Long
    idtemp = Me.Recordset.idPartenaire
    Me.Requery
    Me.Recordset.FindFirst "idPartenaire = " & idtemp
    Set rs = Nothing
    End Sub
    When I run this code, I get an error 3167 (current record is deleted) on the line :
    idtemp = Me.Recordset.idPartenaire
    If I change the ligne :
    Me.Recordset!code = “”
    By :
    Me.Recordset!code = “xxxx”
    Or if I comment this line, the error does not appear and I get the right value in idtemp variable.
    I tried also with the same table in a SQL Server database table. In this case it works fine in all cases.
    So, I seems that the problem is due to the Oracle ODBC driver.
    I search on Internet but I have not found any explanation or solution.
    Does anybody experiment the same problem (and find a solution)?
    Gilles Roussel.

    There is a dediacted forum for Oracle ODBC driver issues.
    Please post your problem at:
    http://forums.oracle.com/forums/categoryHome.jspa?categoryID=84

Maybe you are looking for