Optim-peek-user-binds - Set To TRUE In Order To Utilize Adaptive Cursor Sharing?

Jul 5, 2012

I am on 11.2.0.2 (RHEL 5.4)

For one of my OLTP table, we have skewed distribution on STATUS column and hence we created frequency histograms. NDV=7 for this column.

My question is : Do we need to have "_optim_peek_user_binds" set to TRUE in order to utilize Adaptive Cursor Sharing ?I have gone through different OTN forum and blogs and it appears that in order to generate different plans, Oracle has to Peek the value of bind variables each time. Without Peeking, how would CBO knows whether to generate new plans or not ?

For xyz reasons, optimpeek_user_binds is set to FALSE in my database and i could not find any sql_id having V$SQL.IS_BIND_AWARE='Y'.

View 9 Replies


ADVERTISEMENT

Performance Tuning :: Adaptive Cursor Sharing VS SPM?

Nov 5, 2013

we are using Release 11.2.0.3.0 of oracle. And have cursor_sharing default setup as 'exact'.

In case of 'sql queries' using bind variable, which suffers performnace issue(unstabilized plan) due to different bind values at runtime addition with skewed columns. In these cases 'adaptive cursor sharing', will monitor major variation in selectivity/cost of multiple available plan(path of execution) and automatically switch to optimum plan during run time query execution.

my question is , considering 'up to date stats for all our database objects' what is the requirement of sql plan baseline(spm)? At which situation ,ACS(adaptive cursor sharing) won't able to stabilize the query plan, so that we have to go for baseline or SPM?

View 2 Replies View Related

Performance Tuning :: Adaptive Cursor Sharing?

Dec 18, 2012

I have a table "t", with a highly skewed ID column
Cursor_sharing=force
select count(*) from t;
--79003
select count(*) from t where id=1;
--79002
select count(*) from t where id=99;
--1

I have a index on id column and since highly skewed data is there in id column therefore histogram is there

SQL> select table_name,column_name,histogram,num_buckets from user_tab_cols where table_name='T';

TABLE_NAME COLUMN_NAME HISTOGRAM NUM_BUCKETS
------------------------------ ------------------------------ --------------- ------------
T ID FREQUENCY 2

When i use literals , explain plan comes up with optimal execution plan
select * from t where id=1;
Full table scan

Select * from t where id=99;
Index range scan

But when i use bind variables,sub optimal execution plan

For id=1, it should use Full table scan but it goes for Index range scan , WHY? why ACS is not getting kicked?

alter system flush shared_pool;
set autotrace traceonly
variable n number;
exec :n=1;
select * from t where id=:n;

[code]...

Why is_bind_sensitive not "Y"?

View 10 Replies View Related

Performance Tuning :: Cursor Sharing Setting In OLTP Environment?

Feb 22, 2011

In an OLTP environment what cursor_sharing setting is preferred?Though typically we retain the original setting for most of the parameters except memory settings etc. I have queries in the following context

No. I am not facing any issue as of now (I am not supporting any Live environment) But I want to know the desgn considerations

First of all in OLTP environment (say one I am referring) we use pl/sql variables which are obviously bind variables Only in case where plan is expected to change we use hard coded values like 'CREDIT' or 'DEBIT' etc. for acc_type column

Again there can be 2 scenario
1) we use the same query for both acc_type values
2) we use 2 different queries
IF v_parameter = 'CR'
select * from accounts where acc_type='CREDIT'...
else
select * from accounts where acc_type='DEBIT'...
end if;

Again suppose the values are skewed and we gather stats with histograms hereIs't it the setting 'cursor_sharing=similar' which will be useful in above case?as with this setting optimizer will 'think' which plan to pick depending upon the values and bind variable peeking is taken care in option 2 above with IF ELSE clause?

BTW
I have carried several tests but not getting conclusive results For example I created following table with skewed data, created index and gather stats with histogram

SQL> select object_id,count(*) from skewed_data_tab group by object_id;

OBJECT_ID COUNT(*)
---------- ----------
5 30
6 2970
7 10797
8 150000
9 300000

SQL> create index i_skewed_tab_data on skewed_data_tab(object_id);

SQL> exec dbms_stats.gather_table_stats(user,'SKEWED_DATA_TAB',cascade=>true,
method_opt=>'for all columns size 254');

Then traced with following options
1) alter session set events '10046 trace name context forever, level 12';

SQL> begin
for i_outer in(select n from ids order by tstamp)
loop
for i_inner in (select /* for exact */ object_id,object_name,object_type
from skewed_data_tab where object_id=i_outer.n)

[code]...

2) set termout off
alter session set events '10046 trace name context forever, level 12';
@/u04/scripts/exact.sql 5
cat /u04/scripts/exact.sql
select /* for exact */ object_id,object_name,object_type from skewed_data_tab where object_id=&1;

But not getting consistent results

View 11 Replies View Related

PL/SQL :: Can User Exist When Cursor Will Using For Cursor

Aug 7, 2013

Can i user exist when cursor will using For Cursor .

View 15 Replies View Related

Utilize Cluster Key To Ensure Uniqueness / Primary Key Constraint

Oct 11, 2010

I am trying to add a primary key constraint to a cluster table on the cluster key columns whitout creating additional indexes.

Example:

CREATE CLUSTER CL1
(A NUMBER)
SIZE 100;

CREATE UNIQUE INDEX CICL1 ON CLUSTER CL1;
gives

ORA-01715: UNIQUE may not be used with a cluster index

CREATE INDEX CICL1 ON CLUSTER CL1;

CREATE TABLE CLT1 (A NUMBER,B NUMBER,primary key (A) using index cicl1) CLUSTER CL1 (A)
gives

ORA-14196: Specified index cannot be used to enforce the constraint.

CREATE TABLE CLT1 (A NUMBER,B NUMBER, primary key (A)) CLUSTER CL1 (A)

creates an additional system generated index SYS_C....

Is there any way to utilize the cluster key to ensure the uniqueness/primary key constraint of the cluster key columns of table CLT1 ?

View 3 Replies View Related

Server Administration :: Utilize Temp Tables As Part Of A Scheduled Job?

Jan 18, 2013

There is a readonly user on our reporting server. Developers want to use global temporary tables with this user. I don't want the user to have permissions other than readonly.I can grant the user CREATE TABLE privilege and did not grant quota on any permanent tablespace, therefore user would not be unable to create permanent tables but still should be able to create global temporary tables.

Question is would a user with such permissions still be able to utilize temp tables as part of a scheduled job?

View 2 Replies View Related

Reports & Discoverer :: Spreadsheet / Delimited - How To Utilize Both Formatted In Report

May 24, 2010

i have a very complex layout which i want to print like delimited as well as spreadsheet.How can i utilize both formatted in my report because i want spreadsheet but it is coming in group while same report in delimited is comming like tabular means same report in tabular spreadsheet i need.

View 1 Replies View Related

PL/SQL :: Two Consecutive  Numbers Are Transposed Function Returns True

Jul 6, 2012

oracle version 11gr2.In the below sample data column a,b if there is Two (2) consecutive numbers are transposed in column B from A it should return string 'true'.

with t as
(
select '123456789' a ,'123476581' b from dual
union all
select '123456789' ,'123465789' from dual
union all
select '332211' ,'332121' from dual
union all
[code]....

View 3 Replies View Related

PL/SQL :: Two Consecutive Number Transformed Return True Or False

Jul 6, 2012

oracle version 11gr2.

In the below sample data column a,b if there is Two (2) consecutive numbers are transposed in column B from A it should return string 'true'.

with t as
(
select '123456789' a ,'123476581' b from dual
union all
select '123456789' ,'123465789' from dual
union all

[Code]....

i need a output as below.

a b val

123456789 123476581 FALSE
123456789 123465789 TRUE
332211 332121 TRUE
54321 54312 TRUE
78901 79801 TRUE
65432 63452 FALSE

View 29 Replies View Related

PL/SQL :: Set Boolean Flag To True If Hire_date Is Greater Than 5 Years

Dec 27, 2012

For Just learning purpose This is an example found in text book but while i try to execute it fails..I am trying to set Boolean flag to true if the hire_date is greater than 5 years otherwise boolean flag to false

DELARE
v_Hire_date date :='12-Dec-2005';
v_five_years BOOLEAN;
BEGIN
IF
[code].....

View 17 Replies View Related

Server Administration :: Deferred Segment Creation - Default True?

Jan 20, 2010

What do you think of this 11.2 parameter? It can give some pretty weird results.

SQL> create tablespace ts1 datafile size 10m;
Tablespace created.
SQL> create table t1 (c1 date) tablespace ts1;
Table created.
SQL> drop tablespace ts1;
Tablespace dropped.
SQL> insert into t1 values(sysdate);
insert into t1 values(sysdate)

[code]...

View 5 Replies View Related

Forms :: How To Dynamically Make Visible True Or False In Menu

Apr 12, 2011

I am unable to hide or make visible a menu item dynamically. I want to show a menu to a bunch of employees only.

I have tried:

On the menu properties, I have done:
Physical-> visible : No
functional -> visible in Menu: No
(Have tried different combinations too)

On the form where this menu is attached, I have written trigger new form instance:

SET_MENU_ITEM_PROPERTY('mymenu.menu_name',visible,PROPERTY_TRUE);

Its working fine when I am trying to enable or disable the same but I have to do it the desired way.

View 4 Replies View Related

Performance Tuning :: Order Of Steps In Execution Path And Order Of Predicates In The Plan

Mar 20, 2012

Which step in the following plan is the first step of execution

I reckon it is "TABLE ACCESS BY INDEX ROWID| BANK_BATCH_STATE"

Is that correct?

In the "Predicate Information (identified by operation id):"

section the predicates - access and filter for the step "TABLE ACCESS FULL | PYMNT_DUES" are displayed first

Isn't there any relation between the order of execution steps and the order in which predicates are displayed?

Execution Plan
----------------------------------------------------------
Plan hash value: 538700484
-------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2364 | 15 (14)| 00:00:01 |
|* 1 | FILTER | | | | | |
| 2 | HASH GROUP BY | | 1 | 2364 | 15 (14)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 | 2364 | 14 (8)| 00:00:01 |
| 4 | NESTED LOOPS | | 1 | 2313 | 13 (8)| 00:00:01 |
| 5 | NESTED LOOPS | | 1 | 2281 | 12 (9)| 00:00:01 |
| 6 | NESTED LOOPS OUTER | | 1 | 2255 | 11 (10)| 00:00:01 |
|* 7 | HASH JOIN | | 1 | 175 | 6 (17)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | INDX_2 | 12 | 612 | 2 (0)| 00:00:01 |
|* 9 | TABLE ACCESS FULL | PYMNT_DUES | 43 | 5332 | 3 (0)| 00:00:01 |
| 10 | VIEW PUSHED PREDICATE | | 1 | 2080 | 5 (0)| 00:00:01 |
| 11 | NESTED LOOPS | | 1 | 154 | 5 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 1 | 103 | 4 (0)| 00:00:01 |
|* 13 | TABLE ACCESS BY INDEX ROWID| BANK_BATCH_STATE | 1 | 32 | 2 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | INDX_BBS_1 | 3 | | 1 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID| DAILY_CHECK | 1 | 71 | 2 (0)| 00:00:01 |
|* 16 | INDEX RANGE SCAN | INDX_SEARCH | 1 | | 1 (0)| 00:00:01 |
|* 17 | INDEX RANGE SCAN | INDX_2 | 1 | 51 | 1 (0)| 00:00:01 |
|* 18 | INDEX RANGE SCAN | INDX_IAM_SR_NO | 1 | 26 | 1 (0)| 00:00:01 |
|* 19 | INDEX RANGE SCAN | INDX_2 | 1 | 32 | 1 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | INDX_2 | 1 | 51 | 1 (0)| 00:00:01 |
-----------------------------------------------------------------

View 3 Replies View Related

SQL & PL/SQL :: Result Order In 2 Table Joins Without Order By

Sep 6, 2011

I have below tables,

describe rpthead

Name Null Type
--------------------------- -------- -------------
RPTNO NOT NULL NUMBER
RPTDATE NOT NULL DATE
RPTD_BY NOT NULL VARCHAR2(25)
PRODUCT_ID NOT NULL NUMBER

describe rptbody

Name Null Type
------------- -------- -------------
RPTNO NOT NULL NUMBER
LINENO NOT NULL NUMBER
COMMENTS VARCHAR2(240)
UPD_DATE DATE

The fact is that we store some header in RPTHEAD and store real data in RPTBODY, the question is that if I use below SQL to query all data for a 'PRODUCT_ID'.

SELECT t0.LINENO, t0.COMMENTS, t0.RPTNO, t0.UPD_DATE
FROM RPTBODY t0 , RPTHEAD rpthead
WHERE
(
t0.RPTNO = rpthead.RPTNO
AND
t0.UPD_DATE>=to_date('1970/01/01 00:00:00','YYYY/MM/DD hh24:mi:ss')
AND
rpthead.PRODUCT_ID IN ('4647')
)

I do not want to have 'ORDER by' clause since data set is too large, the sorting takes long time, is there any way to get the result rows in the order sorted by RPTNO? We have the index for RPTNO on RPTBODY.

View 5 Replies View Related

Application Express :: Multiple Application Setup Using Session Sharing Within Workspace

Jan 24, 2013

I have multiple application set-up using session sharing within the workspace.Technically all works fine, however it does not play nice with user behaviour.

Example:
Users logs into APP_ID:100. Since he isn't authenticated yet, he provides user/pass and the APP_SESSION is authenticated.
Now if the user switches using to another application (using a link provided in application 100) he gets redirect to APP_ID:101:APP_SESSION all is fine.

The session is already authenticated, the application shares the session and the user gains access to app 101 without having to authenticate again. All's fine!

However users don't behave they way. Instead of using an easy link in the application. They will use their own bookmark or type in the url for app 101 manually. That way the next application is either called with f?p=101:1:[SOME OLD SESSIONID FROM BOOMARK] or f?p=101 (with no further page or session info) In both cases instead of using the already authenticated session apex spawns a new session, which of course isn't authenticated yet thus forcing the user to authenticate and come complaining they have to login again.

Similar behaviour problems exists when the user opens a browser and tries to open both applications in each in a tab next to each other.Both tabs fetch there own initial session id and start writing it to the same cookie each in turn invalidating the other tab's session.These can lead to some fanatic ping pong actions. Thus it's impossible to open 2 applications sharing session in the same browser.

Is there any remedy for these situations?Can apex be as smart as for instance first trying to resume the session stored in the cookie and only if that session is invalid, start a new session?

View 2 Replies View Related

Application Express :: 4.2.1 Dynamic Action Definition True Action Settings Not Visible

May 16, 2013

im working with apex 4.2.1 and when i try to define a Dynamic action on any item, if the action type is "Set Value" or execute SQL/Javascript code it should appear a text field that let me define the action taking place. However this wont do..

this is what happens:

And this is what should happen:

I know that patch 4.2.2 solves some issues regarding dynamic actions but in the bug report there's no reference to such a problem.

View 1 Replies View Related

Precompilers, OCI & OCCI :: Pro*C - Cursor Leak With Cursor Array

Sep 7, 2007

I'm dealing with an ORA-1000 error in a Pro*C application where all the cursors are correctly closed (or so it seems to me).

Here is the code for a simple program which reproduces the problem:

Each cursor is opened in a PL/SQL package:

CREATE OR REPLACE PACKAGE emp_demo_pkg AS
TYPE emp_cur_type IS REF CURSOR;
PROCEDURE open_cur(curs IN OUT emp_cur_type, dept_num IN NUMBER);
END emp_demo_pkg;

[Code]....

While testing the initialization parameter open_cursors is set to 50.

It's my understanding that Oracle doesn't close the cursors until it needs the space for another cursor, which in my test case seems to happen when I enter a value of 50 or bigger for "number of loops". To see how oracle is reusing the cursors, while the test program is running I run SQL*Plus and query v$sesstat for the session that's running the test with the following sentence:

select name, value
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and sid = 7
and name like '%cursor%';

Even before I enter a value for number of loops I can see that the session opened 4 cursors and closed 2 of them:

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 4
opened cursors current 2

Entering a value of 5 for number of loops yields

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 11 <----- 7+
opened cursors current 8 <----- 6+

With a value of 30

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 36 <----- 25+ (apparently, Oracle reused at least 5 cursors)
opened cursors current 33 <----- 25+

With a value of 47

NAME VALUE
---------------------------------------------------------------- ----------
opened cursors cumulative 53 <----- 17+
opened cursors current 50 <----- 17+

Now I reached the upper limit set by the initialization parameter open_cursors.

Entering a value of 48, I get the ORA-1000 error.

ORA-01000: maximum open cursors exceeded
ORA-06512: at "SCOTT.EMP_DEMO

Since I open and close the cursor in the same loop iteration, I expect to find in every iterarion 1 explicit cursor and a number of implicit cursors (the PL/SQL call along with the so-called recursive cursors), but I don't expect the sum of all of them to be greater than 50. If my understanding is correct Oracle should be reusing the 50 cursors previously marked as "closeable", not raising the ORA-1000 error.

View 1 Replies View Related

SQL & PL/SQL :: Cursor With Bind Variable And Cursor Record

Feb 25, 2011

Is it possible to:

-define a cursor with bind variables
-get a cursor record from these cursor
-and pass the bind variable in the OPEN clause

Did'nt succeed as shown in the example.

SET SERVEROUTPUT ON SIZE 900000;
DECLARE
--works fine
CURSOR c1 IS SELECT * FROM USER_TABLES WHERE rownum<3;
--doesn't work
--CURSOR c1 IS SELECT * FROM USER_TABLES WHERE rownum<:1;
crec c1%rowtype;
BEGIN
--works fine
OPEN c1;
--isn't possible ?
--OPEN c1 USING 3;

[Code]....

View 3 Replies View Related

SQL & PL/SQL :: Converting Numeric Cursor To Ref Cursor?

Sep 11, 2011

just looking around to use the new feature available in oracle 11g to convert the dbms_sql numeric cursor to reference cursor, how to do it?

parse and execute the sql string first with dbms_sql and then convert it to ref cursor?

View 1 Replies View Related

SQL & PL/SQL :: Open Ref Cursor From Explicit Cursor

Nov 23, 2011

I want to return ref cursor based on explicit cursors

create table jumbo(id number, name varchar2(20));
insert into jumbo values(1,'jumbo');
create table mumbo(id number, name varchar2(20));
insert into mumbo values(1,'mumbo');
commit;

[Code].....

The above procedure has compilation errors when I am trying to open ref cursor

LINE/COL ERROR
-------- --------------------------------------------------------
20/24 PL/SQL: SQL Statement ignored
20/38 PL/SQL: ORA-00942: table or view does not exist
32/24 PL/SQL: SQL Statement ignored
32/38 PL/SQL: ORA-00942: table or view does not exist
SQL>

View 5 Replies View Related

Product User Profile - Restrict User From Running Queries On DB From Third Party Tools

Apr 25, 2011

There is a requirement in my database that I want to restrict the user from directly running queries on database from third party tools such as pl/sql developer and toad.

There is a utility in SQL product_user_profile through which this can be done but it is only restricted if you run the query through sql plus. If I want to restrict and (give suppose select,insert) to a user for directly running queries through PL/SQL.

View 1 Replies View Related

Server Administration :: Externally Authenticated User Login Syntax As Proxy User?

Nov 15, 2010

I created an externally authenticated user in database. And can login without password with below syntax.

SQL> connect / @TESTDB
Connected.
SQL> show user;
USER is "SCOTT"

This scott user has a proxy permission to another DBuser PROXY_USER. Previously I used to login using below syntax.

connect scott[proxy_user]/password_for_scott@TESTDB

So now, what syntax should be used for this "ExternallY Authenticated" user to login as a proxy user?

View 10 Replies View Related

Forms :: User Privileges - Assign Permissions To One User To Add / Delete / Edit Data?

May 28, 2011

how can i assign permissions to one user to add,delete,edit data and other user should be able to perform all functions or selected functions

View 12 Replies View Related

Server Utilities :: User Creation Definition In User Mode Export

Mar 31, 2010

I would like to know if 'user creation definition' is exported in user mode export if export is done with DBA role..If it is Not, does it mean we always need to precreate the user before we import the dump created using 'user mode export'?

View 2 Replies View Related

Security :: Authenticating Oracle User Based On Windows User ID?

Mar 11, 2011

We are trying to implement the following security to our database.

As of now, the access rights are same for all the windows users logging into the Oracle application with the same Oracle user Id.

But now, we want to improve our security by granting different levels of rights to the users based on their Network Id even though they use the same Oracle User Id to log into the application.

We are not looking for the users to be identified externally.

(CREATE USER "OPS$ORACLE-BASE.COMTIM_HALL" IDENTIFIED EXTERNALLY;
GRANT CONNECT TO "OPS$ORACLE-BASE.COMTIM_HALL";
)

View 3 Replies View Related

Forms :: Login User From One CANVAS And Access Second As Per-user Rights?

Oct 20, 2012

- we have user id parameter.can we update the parameter(:parameter.p_userid) before firing "WHEN NEW FORM INSTANCE TRIGGER"(when new form instance trigger contain code for tree node), for login another canvas as per user rights?

- i have created a login form in one canvas.

- also tree node Hierarchy form created on another canvas. now we want to login through login screen, after login only those forms should show in tree Hierarchy which users have rights. for this purpose we want to pass the parameter of userid before connecting to tree node form through the following query

SELECT COUNT (*)
INTO v_count
FROM usersinfo
WHERE usersname = :USERBLOCK.usernames AND passwords = :USERBLOCK.passwords ;

[code]...

Every thing is working but when we click on button in login form at that time parameter.p_userid will return null. because above code is define on button click in login screen, i cannot understand where i need to define the above code .

View 1 Replies View Related

PL/SQL :: User Session Has Expired And Enable User Without Changing The Password

Aug 13, 2012

User session has expired. I have to enable user without changing the password of the user.

View 1 Replies View Related

Security :: User Locked / Track User Who Hit Wrong Password

Dec 21, 2010

We have the database user called c88888 and is locked yesterday. I came to this with the following query.

select * from dba_users where username like 'C88888';

Due to invalid password the user was locked. Can we track who hit the database with the wrong password?

View 5 Replies View Related

PL/SQL :: Create Trigger To Insert Data From One User To Another User In Same Database?

Apr 16, 2013

I Created One Trigger as Follows

CREATE OR REPLACE TRIGGER TRIGGER1
BEFORE INSERT
ON table1
FOR EACH ROW

[code]......

Here , I Want To Insert The Data From My User To Test User . In This Situation When I Execute The Above Trigger It Shows The Error PL/SQL: ORA-00942: table or view does not exist

View 3 Replies View Related







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