Running SQL

Hi all

Database Version: 11g

I'm running a custom application request which is to invoke a few packages, and it takes a long time because of the huge amount of data processing.
I am able to see my session from v$ session table and corresponding procedure call package based on sql_id v$ sql table.

But my requirement is to see the sql that it is running in the procedure in question. This procedure has written many sql queries. V $ sql, I see only a procedure like anonymous block call. Is it possible to see the running sql code?

Thanks in advance.

Kind regards

You might want to try to equip your code.

You can use dbms_application_info for this.

that is dbms_application_info.set_action ('start merge');

Then, you just do a simple query on v$ session to find out what your code is doing.

Tags: Database

Similar Questions

  • Running SQL scripts on different databases

    Hello!

    At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

    So my question may be separated into 2 sections:

    1 - is possible to let users SQL scripts run directly from the application?

    I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

    is 2 - possible to let users choose what database to run these scripts?

    Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

    Thank you!

    Fallen_Kaede wrote:

    Thanks for the quick response. I confirm that we are talking about databases on a server.

    The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

    It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

    1 - is possible to let users SQL scripts run directly from the application?

    Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

    The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

    is 2 - possible to let users choose what database to run these scripts?

    The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

  • Try to run a SQL statement through the window of OEM 12 c run SQL.  Statement fails

    All,

    I have a 11g database.  When it is initially installed, I installed it in $ORACLE_BASE = / orabin/app/oracle/product and $ORACLE_HOME = $ORACLE_BASE/11gDB_R2.  This is the version 11.2.0.1 to give birth to 11.2.0.3.

    Recently, I installed 11.2.0.4 in $ORACLE_BASE/11.2.0.4.  Then, I upgraded my database at 11.2.0.4.  Everything works fine.

    All my scripts on the linux host logon changed to point my environment at $ORACLE_BASE/11.2.0.4 House and my $PATH when I connect to the linux host is: /orabin/app/oracle/product/11.2.0.4/bin:/orabin/app/oracle/product/11.2.0.4/OPatch:/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin

    On my OEM Console, the database appears as 11.2.0.4 and me can manage very well.

    However, when I try to use the window of the OEM Console to execute SQL to execute any type of SQL statement, it fails.

    The failure error is:

    Could not launch/orabin/app/oracle/product/11gDB_R2/bin/sqlplus-s/nolog: no such file or directory

    It would be a mistake since the 11gDB_R2 directory tree (the 11.2.0.3 software) has been removed from the host, now that the database is set to level and working as 11.2.0.4.

    I wonder if somewhere in the OEM software, there is always a pointer to the old ORACLE_HOME?  I can't find anything in the .bashrc or other shell scripts that are executed when a Shell session on the host computer which were still the reference to the old directory of 11gDB_R2 so I'm a bit puzzled.

    I have 8 guests, and all have been improved in the same way at 11.2.0.4.  For some databases, the OEM window run SQL is executing the SQL code.

    Someone has some ideas on this?

    Go to the Configuration of the analysis of the database (when you set the password) and update of the Oracle home.   Also do this for all targets listener on this host as well.

  • Run SQL through batch file, with parameters

    Hi all

    I run SQL through Batch files before, but I am a little confused with the execution of the sql with parameters. For example, if I have a named sql file:
    insert.sql
    
    Insert into TableA
     select * from TableB
     where service_dt >= '&&x_start_dt' and service_dt <= '&&x_end_dt';
    I can run this problem normally, but including the substitution variables, as in the batch (.bat) file called Execute_insert.cmd is a bit annoying... I played a little with it and cannot operate.

    Any help would be appreciated.

    Thank you
    Ed

    Change your insert.sql to something more like:

    Insert into TableA
     select * from TableB
     where service_dt >= TO_DATE('&1', 'format mask') and
           service_dt <= TO_DATE('&2', 'format mask');
    

    Then, would you call it:

    sqlplus user/password @insert.sql 01-oct-2012 31-oct-2012
    

    John

  • running sql * more

    Hello all;

    I know this question has been asked several times but I'm still a little confused. I installed oracle database 10g express edition on my computer for the practice of the school. It works fine if I go to the homepage of database icon... However, there is another icon which evokes SQL * who I am trying to use to run sql on my computer but nothing happens when I type in a simple sql statement. I was just wondering how to make sql * more correctly installed on my pc so that I can use PL/SQL instructions for the code, packages, and triggers as well.

    You must copy the entry in the tnsnames.ora file for the installation of xe, which is located in
    C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
    on Windows

    XE =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST =host.xx.xxx.net)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = XE)
        )
      )
    

    and edit the tnsnames.ora file from where you are running more than SQL.

    For example, I have a client installed 10g, which has its own file tnsnames.ora but I also 11g XE installed.
    This entry must exist in the customer 10g tnsnames.ora file if I want to connect with the version of windows
    SQL Plus to Database 11g XE.

    Moreover, why don't you upgrade to 11g xe?
    http://www.Oracle.com/technetwork/database/Express-Edition/downloads/index.html

    The final version was released earlier this month.

  • FN: BEA run sql error return

    Hello

    I am trying to use run function sql in OSB.

    Here's the statement I used.

    FN - bea: run sql('jdbc/MW_DB_DS', 'select value from GLOBALVARIABLES where Variable=?','ISDown')

    name of database - jdbc/MW_DB_DS
    Name of the column - ISDown

    I get the error when I try to use the function below


    Transformation runtime error: line 1, column 1: {bea - err} RDBW0001: [jdbc/MW_DB_DS]: [IsDown]: error getting connection to database ' jdbc/MW_DB_DS': could not resolve "jdbc. MW_DB_DS'. 'Jdbc' solved

    I tested the data source of the weblogic Server console and its fine.

    I checked the syntax of the SQL execute and I could see as

    FN - bea: run sql($datasource-string, $rowElemName, $sql-string, $params...)


    So I tried this


    FN - bea: run sql('jdbc/MW_DB_DS', 'rec','select * from GLOBALVARIABLES where Variable=?','ISDown')
    I still get the same error. Is this something to do with the data source? I checked the conenctivity and tried increasing the max connections, but still I'm getting the same erorr.


    Any suggestions on this?

    Yes, it worked after will project the data source to the admin time and the managed server. Thanks for your reply.

  • Running SQL you leave a page

    Hi all

    I would like to run sql to remove the contents of a table, whenever you leave a specific page. Possible?

    Thank you very much

    It's easy.

    Go to your list of point (shared-> list-> list entry components) and write INIT (or whatever you want, it's freetext) in the field titled 'request '.

    This generates a URL like this: http://tryapexnow.com/apex/f?p=12345:52:3997328169542393:INIT

    brgds,
    Peter

    -----
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at

  • Run SQL failed with the authentication failure

    Hi all, I have access to a large grid control to manage my small group of data, I'm not super user, I am only a dba user access to databases in mi cluster. Then, when I try to run SQL using "execute SQL" link I get a message that says "LOG: Local Authentication failed...". PAM attempt authentication... "WFP has failed with the error: authentication failure.

    But, when I use the 'SQL Worksheet' link to run the same SQL that works very well, is not possible to run SQL using the other link? What's wrong? Thanks in advance.

    You have not set up the setting with agent PAM, please follow the notes 422073.1 and check.

  • How to run SQL "Issued" BI answers using a query tool?

    How take the 'SQL Issued' in the tab 'Advanced' in demand in BI answers and run its equivalent on the tables of the database, by using a tool like in SQL Developer?

    For example, BI answers shows "SQL to show" of:

    SELECT Team2. Team2 PIF"saw_0, an2. "' Year ' saw_1, Cube2.Hr saw_2
    OF 'AW_BALL2 Cube2.
    WHERE Year2.Decade = '2000's
    ORDER BY saw_0, saw_1, saw_2

    How translate this into something that will run in SQL Developer and show me the same data that takes demand? Thank you.

    the SQL code that you quoted is the SQL logic.
    It was sent to presentation services through ODBC to the BI server, which translates using the RPD in 'real' SQL, which is fire to the database.
    As said, you need for the level of logging to see the 'real' SQL that runs the BI server... This in the administration in respect of security tool. See the Administration Guide for more information.

    FWIW, if you really want to run SQL that you mentioned and then launch an ODBC client (Microsoft query, TOra, etc.) and direct him to a system DSN you set type Oracle BI pointing to your Oracle BI server.

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • Run sql with via bash script...

    How to run the below sql of the bash. get the below error.

    If sqlplus "/ as sysdba" < < EOF > status.log

    fixed lines 200

    Comment by col for a60

    Col ACTION_TIME to a30

    version col to a20

    COMMENT by col to a30

    Col BUNDLE_SERIES to a13

    Select * FROM (SELECT d.name "DB_NAME", r.ACTION_TIME, r.ACTION, r.VERSION, r.ID, r.COMMENTS, r.BUNDLE_SERIES, row_number() over (order by r.ACTION_TIME desc): the nurse OF ")

    registry\\$ r history,.

    v\\$ d database) WHERE the rn < = 3;

    "exit";

    EXPRESSIONS OF FOLKLORE

    $ cat status.log

    registry\ r,

    *

    ERROR on line 2:

    ORA-00911: invalid character

    Try changing

    registry\\$ r history,.

    v\\$ d database) WHERE the rn<=>

    TO

    registry\$ r history,.

    v$ database d) WHERE the rn<=>

    just a backslash ().

  • vCAC6 IaaS installation fails with configuration wizard - cannot run SQL Create User command

    Kia Ora.

    Put together the first poc vCAC6. The devices are in place and works fine, now up to IaaS Win2k8r2 with local SQL Express and this install fails. Pre-Reqs work. Installed and patched .NET 4.5 (not 4.5.1) as well.

    I installed as a local administrator on the server arrived at the field of IaaS. Installation running. EXE using run as administrator.

    The installation creates the database in SQL Express premises. I slowly raised privileges to solve the problems, but the same lines are written to the LOG file and there is an installation failed.

    News: 2014-01-15 09 49 58 588 h: construction project is "C:\Program Files (x86)\VMware\vCAC\Server\Database\DeployVMPS.xml" (BuildDB Target.

    News: 2014-01-15 09 49 58 604 h: build succeeded.

    News: 2014-01-15 09 49 58 604 hours: 0 warning (s)

    News: 2014-01-15 09 49 58 604 h: error (s) 0

    News: 2014-01-15 09 49 58 620 hours: time 00:03:35.12

    News: 2014-01-15 09 49 58 667 hours: CREATE USER [serverName\Administrator] to [NVCACIAAS\Administrator] CONNECT

    News: 2014-01-15 09 49 58 682 hours: EXEC sp_addrolemember 'db_owner', 'serverName\Administrator. "

    Error: 2014-01-15 09 49 58 854 h: error: vCAC Configuration Wizard is unable to run the Sql CREATE USER [serverName\admin] FOR LOGIN [serverName\Administrator] command.

    Error: 2014-01-15 09 49 58 854 h: error: vCAC Configuration Wizard is unable to run the Sql CREATE USER [serverName\Administrator] FOR LOGIN [serverName\Administrator] command.

    Is not not a SQL guru, I tried to elevation of privileges and exchanged between using SQL and Microsoft connection. tried to hook up with a new SQL and AD security with rights to MSDB db_owner account. Also as a 'Microsoft authenticated. " each re - run provides the same statements without worrying if the localMachine\Administrator account exists or not.

    Any help much appreciated.

    Thank you and happy new 2014!

    Hi there.

    I added the administrator account of the local computer in the security of SQL Express to the sysadmin role and installation is complete. ?!? Although I tried to use the SA account to install and the same messages of error and success in this file as well newspapers runs.

    Now these lines look like this;

    News: 2014-01-15 10 21 50 978 hours: Service NVCACIAAS\Administrator account is the same account that creates the database.  Task of grant of role of ignored by the database owner.

    News: 2014-01-15 10 21 50 994 hours: Service NVCACIAAS\Administrator account is the same account that creates the database.  Task of grant of role of ignored by the database owner.

    If it is installed, but I don't know why I need to raise the local Sysadmin role administrator account so he could complete or why to create the user account wrong localMachine\Administrator in installation because there was.

    I've rolled back to a previous snapshot and was able to repeat the failure until I added this user account to the Sysadmin role.

    Her go configuration and usage vCAC now. I'll repeat the installation at a later stage.

    see you soon

  • After running sql of the lot, it is disconnected

    Hi all

    I wrote a batch program to run a pl/sql procedure. But after running, it disconnects.

    But I want to continue in the same session

    echo exec tracer.trace_pck.start_('alter session set sql_trace=true') | sqlplus hr/hr
    

    Output:

    Press a key to activate tracing

    SQL * more: Production of liberation 11.2.0.2.0 Thu Oct 10 15:59:56 2013

    Copyright (c) 1982, 2010, Oracle.  All rights reserved.

    Connected to:

    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

    SQL >

    PL/SQL procedure successfully completed.

    SQL > disconnected from Oracle Database 11 g Express Edition Release 11.2.0.2.0.

    Production

    Trace enabled successfully. Press a key for entry you sql

    If you use a batch file, I assume you are using windows OS.

    Essentially, what you need to do is call a sql file in the batch file and then download the sql file to call all the other files.

    Batchfile test.bat file test.sql sql calls

    sqlplus /password @test.sql

    test. SQL calls test1.sql and test2.sql and stops

    @test1.sql;

    @test2.sql;

    "exit";

    test1. SQL displays the current sid and serial No. FRO our name and our session

    Select 'test1', sid, serial # in session $ v

    where audsid = userenv ('sessionid');

    test2. SQL displays the current sid and serial for our name and our session No.

    Select "test2", sid, serial # in session $ v

    where audsid = userenv ('sessionid');

    When you run this you get t output similar to the following: (your SID and serial will be different)

    ' TEST SID SERIAL #.

    ----- ---------- ----------

    771 97 Test1

    ' TEST SID SERIAL #.

    ----- ---------- ----------

    771 97 test2

    It shows two separate sql files have been called, but are always in the same session

  • Unable to run SQL Developer

    Whenever I try to start SQL Developer (using a shortcut on my desktop), I get a dialog box asking for the location of the java.exe file. When I select the file in Program Files (x 86) > Java > jre > bin, I get the following popup error message: "could not find a J2SE SDK installed to the path: C:\Program Files (x 86) \Java\jre7.

    I receive the error message even if I use the path Program Files > Java > jre > bin to locate the jave.exe file.

    The related shortcut on my desktop has the following path: 'C:\Users\mamontgo\My Documents\sqldeveloper64-3.2.20.09.87-no-jre\sqldeveloper '.

    NOTE: I also get the following popup error whenever I start up my laptop: "could not start the Virtual Machine Java", but I don't know if this related to SQL Developer.

    I use a laptop Dell E6420, running Windows 7.

    Published by: user568537 on February 19, 2013 06:51

    Developer SQL 3.2.2 does not work on Java 7 - there need to Java 6. : Pei see the Release Notes.

  • Problem with the process running sql

    I created a pricess that deletes a file off of the table apex_application_files

    When I run the following statement:
    delete apex_application_files whose name like "resume.pdf" it works without problem

    When I run the following statement:
    delete apex_application_files whose name like ': P4_PDF_DISPLAY' he does not. what I have to do.

    I changed the: p4_pdf_display to be a single item displayed on the page
    With the help of the P4_PDF_DISPLAY can view the file in a query sql and beable to view the file to download, but am unable to delete
    Help!

    Hello
    >
    I created a pricess that deletes a file off of the table apex_application_files

    When I run the following statement:
    delete apex_application_files whose name like "resume.pdf" it works without problem

    When I run the following statement:
    delete apex_application_files whose name like ': P4_PDF_DISPLAY' he does not. what I have to do.

    I changed the: p4_pdf_display to be a single item displayed on the page
    With the help of the P4_PDF_DISPLAY can view the file in a query sql and beable to view the file to download, but am unable to delete
    >

    What is this point of P4_PDF_DISPLAY? It is the name of the file, as it is supposed to be in your delete statement? Or, view the article PDF?
    Verify session state to display the value of the element. You see the name in it?

    See you soon,.

Maybe you are looking for