SQL & PL/SQL :: How To Get Full Query Based On SQL_ID

Jun 27, 2013

I want to get the SQL queries based on SQL_ID.I have tried the following query,but I am not getting full query.

SET linesize 132 pagesize 999
column sql_fulltext format a60 word_wrap
break on sql_text skip 1
SELECT REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
FROM dba_hist_sqltext s
WHERE s.sql_id = '7tvurftg8zryb';

One of my friend said use grid to get full query text. how to use grid ,else any other method to get the full query based on SQL_ID.

View 3 Replies


ADVERTISEMENT

Getting Query To Do Full Table Scan?

Aug 18, 2012

I�m Using Oracle 11.I have a table with 16 million rows and an index (let's call it the employee table with an index on department). I need to select all the employees whose departments are located in the uk. I achieve this by selecting all the department numbers from departments where location = 'UK' in a sub select then plug this into the main query as follows:

SELECT *
FROM employees
WHERE department IN (SELECT department from departments where location = 'UK');

It takes ages, 25 seconds or more, the explain plan shows its doing a full table scan on emplyees. I need it to use the index. The sub query is instant and returns only 5 rows. If I explicitly put the 5 numbers in the IN clause the query uses the index and executes in 0.04 seconds. See below:

SELECT *
FROM employees
WHERE department IN (1,2,3,4,5);

I need it to use the subquery once and then use the index on the main table.

View 2 Replies View Related

Find All Executions Of Particular Sql_id?

Jul 19, 2012

Do you have a query to find all the executions and the elapsed time of a particular sql_id?I have a query, but I don't find it very practical

set pages 1000 lines 4000
col sql_profile for a32
select executions_total,
trunc(decode(executions_total, 0, 0, rows_processed_total/executions_total)) rows_avg,
trunc(decode(executions_total, 0, 0, fetches_total/executions_total)) fetches_avg,

[code]...

View 4 Replies View Related

Multiple Execution Plans For Sql_id From AWR

Aug 23, 2012

multiple execution plns for the sql_id from AWR,i have following questions

1.which plan is opimizer tcurrently using ?
2.how to make sure optimizer to pick right plans

SQL> select * from table(dbms_xplan.display_awr('fb0p0xv370vmb')) ;
PLAN_TABLE_OUTPUT
SQL_ID fb0p0xv370vmb
[code]....

View 8 Replies View Related

Performance Tuning :: Full Table Scan - Query Without Where Clause?

Jul 11, 2013

Below query is degrading the performance of database. As we know that, without where clause, query do full table scan.Now, it is written to generate the sequence no.

SQL> explain plan for
2 SELECT NVL(MAX(P.NUM_SERIAL_NO), 0) + 1 FROM CNFGTR_IRDA_ENVELOPE_DTLS P
3 /
Explained.
SQL> select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Plan hash value: 3345343365
------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------

[code].....

Index is not created on the column.

View 6 Replies View Related

Server Administration :: ORA-01555 / Unable To Find Sql_id

Jan 25, 2012

I am getting below ORA-01555 error in alert log everyday.

ORA-01555 caused by SQL statement below (SCN: 0x09ad.86a4562a):
Sat Jan 21 08:39:45 2012
SELECT (NVL(MAX(BLOCK_ID + BLOCKS ),0) * :b1 ) / 1024
FROM DBA_EXTENTS WHERE TABLESPACE_NAME = :b2 AND FILE_ID = :b3

I cannot able to find the sql_id here. So how can I find from which process or session this query is firing? before increasing the undo size, I need to analyze as why it is occuring?

undo_management string MANUAL
undo_retention integer 900
undo_suppress_errors boolean FALSE
undo_tablespace string

View 9 Replies View Related

Performance Tuning :: Sql_id And Sql_child_id Are Not Null For SQL Statement

Apr 10, 2012

i am trying to analyze a query i have and noticed that it does not show the sql_id in v$session.

preparing a test case:

create table t1(a number, b varchar(10));
insert into t1 values(123 , 'value1');

when i execute

select count(*) from dual;
select * from dual;
select count(*) from t1;

i can see the sql_id by running

select
sql_id sql_id_,
sql_child_number sql_child_num,
module module_,
action action_,
logon_time lgtime,

[code]....

however, when i'm running

select * from t1

sql_id and sql_child_id in v$session appears to be null, and i can't analyze it.

why those columns are NULL?

View 6 Replies View Related

Visual Studio :: Set Query Window Default Date Format To Full Date?

Oct 24, 2013

When I run a query form the the Query Window in Visuial Studios 2012 all the date fields truncated to 'mm/dd/yyyy', but i need the full date returned. I am able to get full date from  TO_char(MyDateField, 'yyyy-mm-dd hh24:mi:ss'), but if I do TO_DATE(MyDateField, 'yyyy-mm-dd hh24:mi:ss')  it only returns  'mm/dd/yyyy'. I'm sure this is a simple setting in Visual studios but I cant find it to save my life. Is there there a way to have the full date returned by default?

View 0 Replies View Related

SQL & PL/SQL :: Query Based On Date Filter Is Not Working

Aug 14, 2011

is the definition of my table :

CREATE TABLE DATEFETC
(
ID VARCHAR2(10 BYTE),
DT DATE
)

And these are the data that are available,(select * from DATEFETC)

IDDT

00108-09-2011
00208-10-2011
00308-11-2011

That's fine.
Now i am executing this query ,but this is returning no rows.Why ?

select * from datefetc where dt between to_date('08-08-2011','mm-dd-yyyy') and to_date('08-12-2011','mm-dd-yyyy')

View 1 Replies View Related

SQL & PL/SQL :: How To Sort Query Based On Financial Year

Jun 12, 2012

Haw to sort the data based on financial year.

For example Indain Fiscal year 01-Apr-2010 to 31-Mar-2011

Apr2010 -1
May2010 -2
.
.
.
.
Feb2011-11
Mar2011-12

I had given a query..for Quarter idendification

SELECT distinct
'Qtr'
|| CASE
WHEN PERIOD BETWEEN TO_DATE ('01-04-2010', 'DD-MM-YYYY')
AND ADD_MONTHS (TO_DATE ('01-04-2010', 'DD-MM-YYYY')-1, 3)

[code].....

View 2 Replies View Related

SQL & PL/SQL :: Update Query Based On Join Condition

Jun 16, 2011

I have two tables. By joining these two tables, I need to update a field in table1.

UPDATE table1
SET table1.FLAG = 'Fixed'
where table2.lastname = table1.lastname
and table2.status in ('fulltime','parttime')

I keep getting error 'table1.lastname' is invalid identifier.

I can't understand the error message. I made sure that the fields exist.

View 5 Replies View Related

SQL & PL/SQL :: Nested Query Based On Value Of Dependent Column?

Sep 10, 2013

In the below Table Structure, TB_Vehicles is the Master table and TB_Cars, TB_Bikes, TB_Cars are Satellite tables which hold more info about respective vehicles.

I want users to search using the Name. So, when users enter Name as 'Access', my query should give all information about that vehicle, including that from Satellite Tables (using both TB_Vehicles and TB_Scooters).

SELECT *
FROM TB_Vehicles
WHERE V_NAME = 'Access';

Similarly, if user enters 'Linea', it should give info from TB_Vehicles and TB_Cars tables.

So, with V_NAME as input, I'll find V_TYPE from TB_Vehicles table, and using that, I need to identify which satellite table, I need to join to retrieve more info.

Do I need to use CASE or DECODE to achieve this?

View 25 Replies View Related

Query Not Picking Function Based Index

Apr 3, 2012

One of our query is not using function based index, the required priv is granted to the user executing the query and also tables stats are gathered? what could be the reason for the query to not to pick the FBIndx? the table is a huge one having million of records, is it that CBO thinks that not picking FB indx is the best execution plan? let me know how can we make the query use the FB indx, also there is a restriction that we cannot force it using hints.

View 3 Replies View Related

Query To Exclude All Rows Based On Single Row Filter?

Jun 10, 2011

I'm using Oracle 10g.

Question: How can I write query to return just ID only if all the codes for that ID end in 6.

If I use
SQLselect id from table_a where code like '%6'
then I also get ID=1, which I don't want.

TABLE_A
ID code
=======
1 100
1 106
2 206
3 306
3 336
4 400

Desired Result
ID
==
2
3

View 1 Replies View Related

Query To Split Records Based On Values From Another Table?

Feb 20, 2012

I have a table with following values in a column

Table A

col1
10
35
20
25

I need to form a query which will take these four values in rownum part and split the records into 4 groups in Table B.

Table B- 90 records (10 + 35 + 20 + 25)

Now for example, the Table B is having emp no, order by ascending and i need to split into 4 groups,

with first group having start value -1 and end value -10

second group - start value -11 and end value-45

third group - start value -46 and end value -65

fourth group - start value - 66 and end value-90

one way i can do it by using union and count, which was a bit tedious if the no. of group goes upto 10.

note that the values in Table A is dynamically changing, so not able to hard code values.

View 2 Replies View Related

SQL & PL/SQL :: Find Logic To Query Data Based On A Condition

Aug 18, 2013

find the logic to query data based on a condition like..I am having a table dummy

USERNAME RESP_NAME FUNC_NAME MESSAGE
-------- --------- ------------------ ------------
TEST1 SYS_ADMIN CONCURRENT_PROGRAM AAAAAAAAAAAA
TEST1 SYS_ADMIN % BBBBBBBBBBBB
TEST1 % CONCURRENT_PROGRAM CCCCCCCCCCCC
TEST1 % % DDDDDDDDDDDD
% SYS_ADMIN CONCURRENT_PROGRAM EEEEEEEEEEEE
% SYS_ADMIN % FFFFFFFFFFFF
% % CONCURRENT_PROGRAM GGGGGGGGGGGG
% % % HHHHHHHHHHHH

The above 8 are the possible ways to key in the data using a form.The logic is like based on a particular condition the message should display in the report.If they specify a particular USER and RESP_NAME and FUNC_NAME then it should display AAAAAAAAAAA (This should take priority first). The priority is in order the default should be the last one.

View 22 Replies View Related

SQL & PL/SQL :: Select Query To Get Top Two Rows Based On Status Date

Oct 29, 2012

I want to get top two rows based on ACCT_UNIT & order by status_date, if there is only one row on acct_unit, get one row. IF more than two rows available, want to get the top two rows based on status_date.

SELECT ACTIVE_STATUS, ACCT_UNIT, DESCRIPTION, DIRECTOR, DIRECTOR2, STATUS_DATE, OBJ_ID, STATUS_FLAG, SUR_KEY
FROM STSI

View 10 Replies View Related

SQL & PL/SQL :: Create Select Query That Will Get Data From 18 Months Ago Based On Sysdate?

Sep 9, 2013

I have a table with columns job_id, jan, feb, mar ... , and year

I need to create a select query that will get the data from 18 months ago based on sysdate.

So something like:

Select to_char(add_months(sysdate, -18),'MON') from table1 where job_id = 56947 and year = to_char(add_months(sysdate, -18),'YYYY');

However I need the result of to_char(add_months(sysdate, -18),'MON') to actually act as a column name, not a string result.

View 23 Replies View Related

Application Express :: Interactive Report Based On Dynamic Query

Aug 29, 2012

I am using Apex 4.1 and have a requirement to create an interactive report based on a dynamic query. This option is available in Classic report but in Interactive this feature is not there. Tried using collections or just a view (thought of changing the view definition during "On load", but structure of the report is already defined based on the definition of the view at design time).

Is there any way of achieving this?

View 1 Replies View Related

Write A Query Based On Inventory On Hand Packed Quantity

Jul 18, 2013

which table do I have to use to get the Inventory On Hand Packed Quantity  based on Oracle EBS Suite using backend? 

View 2 Replies View Related

Application Express :: Tabular Form (select List Query Based LOV)

Jul 10, 2012

I have this situation:

a tabular form with two "select list (query based LOV)" fields. The first one must affect elements in the second one. And so the second query based LOV field should has a "where attr1 = first_list_selected_value" in the query.

View 3 Replies View Related

SQL & PL/SQL :: Conditional Select - Query To Returns Results Based On Both City And Country Passed

Sep 17, 2010

Table A

Id Country city
1 US
2 US Boston
3 Boston
4 US Newyork
5 London
6 Japan Tokyo

Im looking for a query which returns results based on both city and country passed.

If i pass country US and city Boston it should return row2 with US and Boston row
If i pass country null and city Boston it should return row3
If i pass country UK and city Boston it should return row3
If i pass country UK and city London it should return row5

i.e. If country/city combination exists in DB return that row Else city row should be returned.

View 5 Replies View Related

TEMP Tablespace Full

Aug 20, 2010

I tried to create an index on a large volume table(approx 9 GB) and I got the below error message:-

ORA-01652: unable to extend temp segment by 128 in tablespace TEMP

The size of our TEMP tablespace is 3GB and currently it is showing as full.

This tablespace is locally managed and we are not running any other operation on this test database at the moment.

We need to delete data from this table based on a column value, so I was planning to create an index on that column.

I saw on the net that one of the proposed solution is :-

alter tablespace TEMP default storage (pctincrease 1);
alter tablespace TEMP default storage (pctincrease 0);
alter tablespace TEMP coalesce;

but it was mentioned that this does not work with Locally Managed Tablespaces.

We are currently using Oracle 9.2.0.7.0 production release installed on Linux platform(Linux 2.6.9-89.0.25.ELsmp #1 SMP i686 i686 i386 GNU/Linux)

I increased the size of TEMP tablespace to 12 GB but the index creation still failed with the same error.

View 1 Replies View Related

Getting Error While Full DB Export

Jul 8, 2013

While making a full db export i have got this error even though my export was completed with this warning. What should i need to do regarding to this error. My oracle version is 10.1.0.2 and Server is windows 2003.

View 4 Replies View Related

SQL & PL/SQL :: Full Outer Join?

Oct 19, 2011

I am trying to use Full Outer Join, here is the DB version and test case

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
create table tab1 (The_Date DATE, x_ID varchar2(4), x_CODE varchar2(10),
r_qty number(8))
create table tab2 (The_Date DATE, x_ID varchar2(4), x_CODE varchar2(10),
o_qty number(8))

tab1 can have multiple records for key fields The_Date + x_ID + x_CODE
insert into tab1
values (to_date(sysdate)-2, '001', 'ABC', 100)
insert into tab1

[code]...

tab2 should have unique record for key fields The_Date + x_ID + x_CODE

insert into tab2
values (to_date(sysdate)-2, '001', 'ABC', 1000)
insert into tab2
values (to_date(sysdate)-2, '001', 'XYZ', 1500)

[code]...

THE_DATE X_ID X_CODE R_QTY
--------- ---- ---------- ---------
17-OCT-11 001 ABC 100
17-OCT-11 001 ABC 100
17-OCT-11 001 ABC 100
17-OCT-11 001 XYZ 1000
18-OCT-11 001 ABC 200
18-OCT-1

[code]...

When I tried my SQL statement as below it is not showing what i expected, but where and what it is? this approach is correct or not

devtest@ Test.DB> select a.the_date,
2 a.x_ID,
3 a.x_code,
4 sum(a.o_qty) o_qty, sum(b.r_qty) r_qty
5 from tab2 a full outer join tab1 b

[code]///

I want output as below:

THE_DATE X_ID X_CODE O_QTY R_QTY
--------- ---- ---------- --------- ---------
17-OCT-11 001 ABC 1000 300 -- here O_QTY should be 1000
17-OCT-11 001 XYZ 1500 1000
18-OCT-11 001 ABC 500 600 -- here O_QTY should be 500
19-OCT-11 001 ABC 500
18-OCT-11 001 XYZ 2000 -- here The_Date, x_ID and x_CODE should appear

EDITED FOR:

devtest@ Test.DB> ed
Wrote file afiedt.buf
1 with data1 as (select the_date, x_ID, x_CODE, sum(o_qty) o_qty
2 from tab2

[code]...

now only the required is values of THE_DATE, X_ID and X_CODE of Last Record.Still asking about, is it correct approach ?

View 3 Replies View Related

PL/SQL :: Table Access Full

Aug 11, 2012

i have query lie below.

select
(SELECT MIC.MICR_BANK_NAME FROM M_ECS_MICR_MST MIC WHERE MIC.PK_MICR_ID = BANK.ECS_MICR_CODE) AS BANKNAME,
, (SELECT PAY.PAYMENTCODE FROM M_ECS_PAYMENT_MODE PAY WHERE TO_CHAR(PAY.ID) = BANK.ECS_FACTORING_HOUSE) AS
[code].....

i have used composite index below column which used in the tbl_bank_statement table.like column name tbl_bank_ statement (policy_ no,ecs_ micr_code,ecs_factoring_house,ecs_mandate_status)

but still this table giving me TABLE ACCESS FULL.

View 3 Replies View Related

PL/SQL :: Full Outer Join?

Aug 21, 2012

I have a couple of questions to ask. see below that I have provided a script to re-create my problem.

Question 1.

I have the following query that will not run when I include columns (see 1.2) in the select but will run when I use the asterix symbol (see 1.1)

*1.1 Runs with no problems*
select *
  from ora full outer join txt on ora.ora_id_y = txt.txt_id_y;*1.2 Returns error.*
select txt.txt_id_y
     , txt.txt_n
   
[code]...

Is it possible to use one query with self joins and using multiple full outer joins to accomplish what I have below which is 6 view to get to the query that I have in Question 1.

CREATE SCRIPT
drop table master;
create table master
( id varchar2 (10 char)
, txt varchar2 (1 char)

[code]...

View 15 Replies View Related

PL/SQL :: Backup Of Full Database Using EXP?

Aug 23, 2012

We are having 5 schemas in one database. Now we need to move Oracle server from one machine to another. I can take schema level back up using Export and Import in new server. I am not a DBA as we don't have a DBA I need to do this myself.

I want to know Is there an option to take full database back up including tablespaces and all the schemas in one shot. I read that RMAN is one option. But any option using EXP/IMP for same?

My plan is

-Take list of Tablespaces and create them in new server
-Take Exports of schemas from original server
-Create schemas and import the data in new server.

View 6 Replies View Related

TEMP Tablespace 100% Full

Jan 11, 2013

most of the time i am seeing temporary tablespace issues like temp tablespace is 100% full.

do we have any procedure to clean up temporary data from tablespaces.

and does it effects to database anything.

share any link

View 6 Replies View Related

Invalid Row ID / Update Full Table With Row By Row

Sep 24, 2010

I am trying to update full table with row by row by using pl/sql blocks but I am getting "INVALID ROW ID" error. FYI. following is the screen shot from sql*plus.

SQL> declare
2 cursor csr is
3 select upc_code from pos.tbk_pos_fact_newslink_bk FOR UPDATE OF upc_code nowait;
4
5 begin
6 For row in csr
[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved