How is sql query executed in oracle

Hi,
I want to know how is sql executed in oracle engine.
Please provide me the link or the document.
For eg: SQL>select * from emp;
how the execution happens from beginning till end.

>
I want to know how is sql executed in oracle engine.
Please provide me the link or the document.
For eg: SQL>select * from emp;
how the execution happens from beginning till end.If you are interested in databases in general (and for your
edification) you might want to look at the books below.
http://www.amazon.com/Fundamentals-Database-Systems-Ramez-Elmasri/dp/0321122267
http://infolab.stanford.edu/~ullman/dscb.html
Also, for Oracle, look at Tom Kyte (Expert Database Architecture) and to really
get down and dirty look at Jonathan Lewis's book "Cost Based Oracle". Books
on the Oracle Wait Interface (e.g. http://www.amazon.com/Oracle-Wait-Interface-Performance
-Diagnostics/dp/007222729X/ref=sr_1_1?s=books&ie=UTF8&qid=1317990537&sr=1-1 (link wraps).
It's a massive field. Good luck.
Paul...

Similar Messages

  • Reg how an sql query works?

    I am new to Oracle and sql/plsql. What is the background processes happening when an sql query is fired to the database?
    In short how an sql query is actually working?
    what are the steps involved in it?
    pls provide me the links if it is tedious to reply
    Thanks

    Every SQL-Select Statement meets three stages parse, execute, and fetch. To know completely how SQL and PL/SQL work with Oracle, you must have to read the below Oracle Link seriously.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/sqlplsql.htm
    Regards,
    Sabdar Syed.

  • How the SQL Query Parsing is processing inside SQL/PLSQL engine?

    Hi all,
    Can you explain how the SQL Query Parsing is processing inside SQL/PLSQL engine?
    Thanks,
    Sankar

    Sankar,
    Oracle Database concepts - Chapter 24..
    You will find the explanation required under the heading parsing.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/sqlplsql.htm

  • SQL Query Executing longer time

    Hi , The below SQL query executing longer time . Please help to Improve the query performance. The query continuously running for more than 24 hours and failing with roolback segment error. Not getting the final output. Most of the tables are having milions of records.
    Select distinct
    IBS.ADSL_ACCESS_INFO,
    IBS.LIJ ,
    regexp_substr(OBVS.REFERENTIE_A,'[[:digit:]]+') as O_NUMBER,
    DBS.CKR_NUMMER_CONTRACTANT,
    DBS.DNUMBER
    FROM CD.IBS,
    CD.OIBL,
    CD.IH,
    CD.ODL,
    CD.OH,
    CD.DBS,
    CD.OBVS
    Where IBS.END_DT = To_Date('31129999', 'ddmmyyyy')
    AND OIBL.END_DT = to_date('31129999', 'ddmmyyyy')
    AND DBS.END_DT = to_date('31129999', 'ddmmyyyy')
    AND OBVS.END_DT = to_date('31129999', 'ddmmyyyy')
    AND OBVS.REFERENTIE_A LIKE 'OFM%'
    AND OIBL.INFRA_KEY = IH.INFRA_KEY
    AND OIBL.ORDERS_KEY = OH.ORDERS_KEY
    AND IBS.INFH_ID = IH.INFH_ID
    AND ODL.ORDH_ID = OH.ORDH_ID
    AND DBS.DEBH_ID = ODL.DEBH_ID
    AND OBVS.ORDH_ID = ODL.ORDH_ID
    Order By IBS.LIJ
    All the columns which are present in the where condition are having either Index/key (Primary/unique) except END_DT column.
    Please Advise

    Predicate pushing can help when it greatlly restricts the number of rows - you must experiment - might not work with all predicates pushed (as shown here)
    select distinct
           ibs.adsl_access_info,
           ibs.lij,
           obvs.o_number,
           dbs.ckr_nummer_contractant,
           dbs.dnumber
      from (select infh_id,adsl_access_info,lij
              from cd.ibs
             where end_dt = to_date('31129999','ddmmyyyy')
           ) ibs,
           (select infra_key,orders_key
              from cd.oibl
             where end_dt = to_date('31129999','ddmmyyyy')
           ) oibl,
           (select ordh_id,regexp_substr(obvs.referentie_a,'[[:digit:]]+') as o_number
              from cd.obvs
             where end_dt = to_date('31129999','ddmmyyyy')
               and referentie_a like 'OFM%'
           ) obvs,
           (select debh_id,ckr_nummer_contractant,dnumber
              from cd.dbs
             where end_dt = to_date('31129999','ddmmyyyy')
           ) dbs,
           cd.ih,
           cd.odl,
           cd.oh
    where oibl.infra_key = ih.infra_key
       and oibl.orders_key = oh.orders_key
       and ibs.infh_id = ih.infh_id
       and odl.ordh_id = oh.ordh_id
       and dbs.debh_id = odl.debh_id
       and obvs.ordh_id = odl.ordh_id
    order by ibs.lijRegards
    Etbin

  • How do SQL server 2000 and Oracle linked?

    Hi,
    How do SQL server 2000 and Oracle linked?
    Thanks in Advance
    Baloch.

    use the like to setup ODBC and datasource
    http://www.databasejournal.com/features/oracle/article.php/3442661/Making-a-Connection-from-Oracle-to-SQL-Server.htm
    and then create link server in sql server after you test conenction with oracle

  • How can i track the all sql/query executed from application

    How we can track all sql/query that has executed or being executing on oracle database server 10g r2.
    regards
    Prabhaker

    select s.sid,
           s.status,
           s.process,
           s.osuser,
           a.sql_text,
           p.program
    from v$session s,
         v$sqlarea a,
         v$process p
    where s.sql_hash_value = a.hash_value
      and s.sql_address    = a.address
      and s.paddr          = p.addr
      and s.schemaname     = '&1'
      and s.status         = 'ACTIVE'

  • What is the process of oracle when SQL query execute

    hi
    I would like to know about process of oracle engine when we are execute a SQL query
    regards

    You can search that either in the Oracle docs or at fine blog http://antognini.ch/blog/ of Chris or in his book. You may also check SQL Tuning by Dan Tow for that matter.
    regards

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • Oracle sql query execute in the apex

    hi:
    my requirement is, in region i have one text area item and query button.
    in this text area i am typing the any sql query and when i am pressing the query button it should display the query output report..
    pls give solution fast as soon as possible....
    Message was edited by:
    anbarasan

    Hi anbarasan,
    Maybe you can create a report of type "SQL query (PL/SQL Function returning query". Then in the region source, something like:
    DECLARE
    v_sql VARCHAR2 (4000);
    BEGIN
    v_sql := :PX_YOUR_ITEM;
    RETURN v_sql;
    END;
    Paulo Vale
    http://apex-notes.blogspot.com

  • SQL query (Windows) to Oracle (Linux)

    Hi,
    I have an Oracle on Linux, it is an Oracle XE. From Windows 7, I would like to access this Oracle Linux using any SQL query software. So, to do it, I would like to know:
    1) which components do I need to install ?
    2) how can I setup the components or the operating system or Oracle?
    4) where I can download the components? and what would be the name of the components?
    4) which SQL software I can run on Windows  to access Linux directly using the components or some settings on this software?
    5) are there any software that it is free to download?
    tks.

    ac01e371-bc09-4b23-81d2-b251ca9edd1e wrote:
    Hi,
    I have an Oracle on Linux, it is an Oracle XE. From Windows 7, I would like to access this Oracle Linux using any SQL query software. So, to do it, I would like to know:
    1) which components do I need to install ?
    2) how can I setup the components or the operating system or Oracle?
    4) where I can download the components? and what would be the name of the components?
    4) which SQL software I can run on Windows  to access Linux directly using the components or some settings on this software?
    5) are there any software that it is free to download?
    tks.
    Oracle SQL Developer Downloads&lt;/title&gt;&lt;meta name=&quot;Title&quot; content=&quot;Oracle SQL Developer Downloads…
    SQuirreL SQL Client Home Page&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 …

  • SQL Query to detect Oracle version

    Hello,
    For our application, we need to programmatically detect the version of the Oracle instance. Can someone please tell me if there is any SQL query I can run to get the version information?
    Thank you in advance for enlightening me.
    Pradeep

    hi,
    SQL> select substr(banner,instr(banner,'Release')+8,instr(banner,' - ')-instr(banner,'Release')-8) from v$version where banner like 'Oracle%';
    SUBSTR(BANNER,INSTR(BANNER,'RELEASE')+8,INSTR(BANNER,'-')-INSTR(
    7.3.4.5.0
    SQL> conn scott/tiger@lsc65
    Connected.
    SQL> select substr(banner,instr(banner,'Release')+8,instr(banner,' - ')-instr(banner,'Release')-8) from v$version where banner like 'Oracle%';
    SUBSTR(BANNER,INSTR(BANNER,'RELEASE')+8,INSTR(BANNER,'-')-INSTR(
    8.1.7.4.0
    SQL> conn scott/tiger@lsc67
    Connected.
    SQL> select substr(banner,instr(banner,'Release')+8,instr(banner,' - ')-instr(banner,'Release')-8) from v$version where banner like 'Oracle%';
    SUBSTR(BANNER,INSTR(BANNER,'RELEASE')+8,INSTR(BANNER,'-')-INSTR(
    9.2.0.6.0
    SQL> conn scott/tiger@lsc68
    Connected.
    SQL> select substr(banner,instr(banner,'Release')+8,instr(banner,' - ')-instr(banner,'Release')-8) from v$version where banner like 'Oracle%';
    SUBSTR(BANNER,INSTR(BANNER,'RELEASE')+8,INSTR(BANNER,'-')-INSTR(
    10.1.0.3.0
    SQL> HTH
    Laurent Schneider
    OCM DBA

  • How to get this sql query value in oracle query?

    Hi all,
    i am using one query in sql that is
    select @EarlyLeaversMin = DATEDIFF(Minute,@OutTime,@nshiftmax)
    suppose first line query is getting 60 minutes.
    select @EarlyLeaversMin1=DATEDIFF(Minute,@temphrs,@ShiftTime)
    second line query is also getting 60 minutes
    set @EarlyLeaversMin=@EarlyLeaversMin+@EarlyLeaversMin1+1
    and now here it's calculating both variable minutes and storing in @earlyleaversmin that should store like 60+60+1=121 mintes
    select @EarlyLeaverstimeformat = CONVERT(char(8),Dateadd(n,@EarlyLeaversMin,0),108)
    so now it will store in this query that value in this format : 01:21:00
    can i use the same which it's happening here??
    thanks

    Oracle handles dates and time very differently from SQL Server (as I gather others on this forum have already tried to explain to you).
    Anyway, Oracle does not have a TIME datetype, but what it does have are INTERVALs. In this case you would use INTERVAL DAY TO SECOND. It's not completely clear what you mean by "store in this query that value" but we can use INTERVALS as both table columns and PL/SQL variables.
    So your first query would be something like this:
    declare
        interval_var  INTERVAL DAY TO SECOND;
    begin
         select (nshiftmax - outtime) day to second
         into interval_var
         from whatever;We can do arithmetic with interval variables.
         select (nshiftmax - outtime) day to second +  (shifttime - temphrs) day to second
         into interval_var
         from whatever;To add a hard-coded interval such as 1 minute you can use this functionality:
         interval_var := interval_var + to_dsinterval('0 0:1:0');There's loads of info in the Oracle documentation. [url http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements001.htm#sthref115]Find out more.
    Cheers, APC

  • Explain SQL Query execution plan: Oracle

    Dear Masters,
    Kindly help me to understand execution plan for an SQL statement. I have following SQL execution plan for a query in system. How should I interpret it. I thank You in advace for your guidance.
    SELECT STATEMENT ( Estimated Costs = 1.372.413 , Estimated #Rows = 0 )
           5 NESTED LOOPS
             ( Estim. Costs = 1.372.413 , Estim. #Rows = 3.125 )
             Estim. CPU-Costs = 55.798.978.498 Estim. IO-Costs = 1.366.482
               2 TABLE ACCESS BY INDEX ROWID MSEG
                 ( Estim. Costs = 1.326.343 , Estim. #Rows = 76.717 )
                 Estim. CPU-Costs = 55.429.596.575 Estim. IO-Costs = 1.320.451
                 Filter Predicates
                   1 INDEX RANGE SCAN MSEG~R
                     ( Estim. Costs = 89.322 , Estim. #Rows = 60.069.500 )
                     Search Columns: 1
                     Estim. CPU-Costs = 2.946.739.229 Estim. IO-Costs = 89.009
                     Access Predicates
               4 TABLE ACCESS BY INDEX ROWID MKPF
                 ( Estim. Costs = 1 , Estim. #Rows = 1 )
                 Estim. CPU-Costs = 4.815 Estim. IO-Costs = 1
                 Filter Predicates
                   3 INDEX UNIQUE SCAN MKPF~0
                     Search Columns: 3
                     Estim. CPU-Costs = 3.229 Estim. IO-Costs = 0
                     Access Predicates

    Hi Panjak,
    Yeahh, there's a huge unperformatic SQL statment, what I can see from this acces plan is:
    1 DBO decided to start the query on index R on MSEG, using only part of the index (only one column) with no good uniqueness, accessing disk IO-Costs for this (60mi records), and expecting many interactions (loops) in memory to filter, see CPU-Costs.
    So with the parameters you gave to SQL, they start in a very bad way.
    2 After that program will access the MSEG commanded by what was found on First step, also with a huge loading from DB and filtering (another where criteria on MSEG fields, not found on index R), reducing the result set to 76.717 rows.
    3/4 With this, program goes direct to primary key index on MKPF with direct access (optimized access) and follow to access database table MKPF.
    5 At last will "loop" the result sets from MSEG and MKPF, mixing the tuplas generating the final result set.
    Do you want to share your SQL, the parameters you are sending and code which generate it with us?
    Regards, Fernando Da Ró

  • SQL Query Executing on Column Selection

    All,
    I have a table displayed based on a VO whose query is something like this
    SELECT * FROM (SELECT apps.xxoqt_system_items_v1.SEGMENT1, apps.xxoqt_system_items_v1.DESCRIPTION,
    apps.xxoqt_item_stock_v.ORGANIZATION_NAME, apps.xxoqt_item_stock_v.ORGANIZATION_CODE,
    apps.xxoqt_system_items_v1.RETAIL_PRICE, apps.xxoqt_item_stock_v.ORGANIZATION_ID,
    apps.xxoqt_item_stock_v.RESERVABLE_QTY as OnHand_QTY, apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,
    apps.xxoqt_system_items_v1.PC_CODE, apps.XXOM_SPA_OQT_PKG.GET_NET_PRICE(apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,:bAccountId) as NetPrice,
    apps.xxoqt_system_items_v1.pack_qty, apps.xxoqt_system_items_v1.box_qty, apps.xxoqt_system_items_v1.case_qty
    FROM apps.xxoqt_system_items_v1 ,apps.xxoqt_item_stock_v
    WHERE apps.xxoqt_system_items_v1.INVENTORY_ITEM_ID = apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID AND 1=1) QRSLT  ORDER BY RETAIL_PRICEI have 3 View Criteria defined and they are called pro grammatically through the code. (the 3 VCs have rest of the 2 bind variable one is segment other is organizationCode)
    I have 3 bind variables and all are marked as required.
    I pass all the 3 bind parameter values from my method. All is well and i can see records displayed in the table on the UI.
    The issue is when i click on the column sorting, i get the error
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: segmentIf i remove the required attribute form the 2 bind variables (segment and orgcode), when i click on column sorting my query doesn't take accountID and runs indefinitely long
    SELECT * FROM (SELECT apps.xxoqt_system_items_v1.SEGMENT1, apps.xxoqt_system_items_v1.DESCRIPTION,
    apps.xxoqt_item_stock_v.ORGANIZATION_NAME, apps.xxoqt_item_stock_v.ORGANIZATION_CODE,
    apps.xxoqt_system_items_v1.RETAIL_PRICE, apps.xxoqt_item_stock_v.ORGANIZATION_ID,
    apps.xxoqt_item_stock_v.RESERVABLE_QTY as OnHand_QTY, apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,
    apps.xxoqt_system_items_v1.PC_CODE, apps.XXOM_SPA_OQT_PKG.GET_NET_PRICE(apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,:bAccountNumber) as NetPrice,
    apps.xxoqt_system_items_v1.pack_qty, apps.xxoqt_system_items_v1.box_qty, apps.xxoqt_system_items_v1.case_qty
    FROM apps.xxoqt_system_items_v1 ,apps.xxoqt_item_stock_v
    WHERE apps.xxoqt_system_items_v1.INVENTORY_ITEM_ID = apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID AND 1=1) QRSLT  ORDER BY RETAIL_PRICE DESC
    Oct 9, 2011 3:19:16 PM com.awrostamani.view.TracingViewObjectSqlQueryExecution logQueryStatementAndBindParameters
    INFO: BindVars:(bAccountNumber=null)I am a bit confused here as it looks like the entire query is getting executed for sorting.
    Can someone please tell me what is the issue here ?
    thnks
    Jdev 11.1.1.5
    Edited by: in the line of fire on Oct 9, 2011 2:07 PM
    Edited by: in the line of fire on Oct 9, 2011 3:19 PM

    @Timo, the moment i add the line in the VO create() also tried it adding to the constructor but
    I am getting this error.
    java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis
    However my issue is not with QRSLT but the issue is the query getting fired on column sorting, and in the process bind values are being set as null
    my base query on which table is built is
    SELECT apps.xxoqt_system_items_v1.SEGMENT1, apps.xxoqt_system_items_v1.DESCRIPTION,
    apps.xxoqt_item_stock_v.ORGANIZATION_NAME, apps.xxoqt_item_stock_v.ORGANIZATION_CODE,
    apps.xxoqt_system_items_v1.RETAIL_PRICE, apps.xxoqt_item_stock_v.ORGANIZATION_ID,
    apps.xxoqt_item_stock_v.RESERVABLE_QTY as OnHand_QTY, apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,
    apps.xxoqt_system_items_v1.PC_CODE, apps.XXOM_SPA_OQT_PKG.GET_NET_PRICE(apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID,:bAccountNumber) as NetPrice,
    apps.xxoqt_system_items_v1.pack_qty, apps.xxoqt_system_items_v1.box_qty, apps.xxoqt_system_items_v1.case_qty
    FROM apps.xxoqt_system_items_v1 ,apps.xxoqt_item_stock_v
    WHERE apps.xxoqt_system_items_v1.INVENTORY_ITEM_ID = apps.xxoqt_item_stock_v.INVENTORY_ITEM_ID AND 1=1On click on a button i set the bind parameters value and reexecute the VO. So i get lets say 2 records. Ifi now sort the column, i see the base query is getting fired and the parameter (accountNumber being passed as null, if i unmark the rest of the bind parametes to not required else i get the error message required bind parameter dose not appear in the SQL)
    Edited by: in the line of fire on Oct 9, 2011 5:51 PM
    Edited by: in the line of fire on Oct 9, 2011 6:04 PM

  • SQL Query executing late

    Hi gurus,
    I heard interview question like:
    today a sql statement is execution getting too late than yesterday.
    then what you will take necessary steps. explain.
    could you please full fill the answer
    thanks a lot....

    A sql is a live entity, yesterday it take 10 sec today 10 minutes, it would be, if hash plan value doesn't change, a problem the I/O concurrency (more things running in the database), more data to process, older statistics because a big load of delete in any table of the query, etc. You must to examine the differences from between yesterday and today (using grid control, statspack).
    HTH
    Antonio NAVARRO

Maybe you are looking for