If we need the PC Name Based Query ::
select * from v$session where TERMINAL =’Name of user’s Computer’
Query for when we know the Object Name and we need to close the session based upon Object::
SELECT * FROM v$session WHERE SID IN (SELECT UNIQUE SID FROM v$access WHERE OBJECT=’&OBJECT_NAME’);
OR you may use below query and output of below query will give ready made statements to kill these locks and you can directly use it…
SELECT ‘alter system kill session ”’||SID||’,’||serial#||”’;’
FROM v$session
WHERE TERMINAL =’prashku4′
and SID IN (SELECT UNIQUE SID
FROM v$access)
WHERE OBJECT=’&OBJECT_NAME’);
select * from v$access
Example:
alter system kill session ‘8542,2456258’;
· Never do a calculation on an indexed column (e.g., WHERE salary*5 > :myvalue)
· Whenever possible, use the UNION statement instead of OR conditions
· Avoid the use of NOT IN or HAVING in the WHERE clause. Instead, use the NOT EXISTS clause
· Always specify numeric values in numeric form and character values in character form (e.g., WHERE emp_number = 565, WHERE emp_name = ?Jones?)
· Avoid specifying NULL in an indexed column
· Avoid the LIKE parameter if = will suffice. Using any Oracle function will invalidate the index, causing a full-table scan
· Never mix data types in Oracle queries, as it will invalidate the index. If the column is numeric, remember not to use quotes (e.g., salary = 50000). For char index columns, always use single quotes (e.g., name = ?BURLESON?)
· Remember that Oracle’s rule-based optimizer looks at the order of table names in the FROM clause to determine the driving table. Always make sure that the last table specified in the FROM clause is the table that will return the smallest number of rows. In other words, specify multiple tables with the largest result set table specified first in the FROM clause
· Avoid using sub-queries when a JOIN will do the job
· Use the Oracle decode function to minimize the number of times a table has to be selected
· To turn off an index you do not want to use (only with a cost-based optimizer), concatenate a null string to the index column name (e.g., name||’) or add zero to a numeric column name (e.g., salary+0). With the rule-based optimizer, this allows you to manually choose the most selective index to service your query
· If your query will return more than 20 percent of the rows in the table, use a full-table scan rather than an index scan
· Always use table aliases when referencing columns
· Understand the data. Look around table structures and data. Get a feel for the data model and how to navigate it.
· If a view joins 3 extra tables to retrieve data that you do not need, don’t use the view!
· When joining 2 views that themselves select from other views, check that the 2 views that you are using do not join the same tables!
· Avoid multiple layers of view. For example, look for queries based on views that are themselves views. It may be desirable to encapsulate from a development point of view. But from a performance point of view, you loose control and understanding of exactly how much task loading your query will generate for the system.
· Look for tables/views that add no value to the query. Try to remove table joins by getting the data from another table in the join.
· WHERE EXISTS sub-queries can be better than join if can you reduce drastically the number of records in driver query. Otherwise, join is better.
· WHERE EXISTS can be better than join when driving from parent records and want to make sure that at least on child exists. Optimizer knows to bail out as soon as finds one record. Join would get all records and then distinct them!
· In reports, most of the time fewer queries will work faster. Each query results in a cursor that Reports has to open and fetch. See Reports Ref Manual for exceptions.
· Avoid NOT in or NOT = on indexed columns. They prevent the optimizer from using indexes. Use where amount > 0 instead of where amount != 0.
· Avoid writing where project_category is not null. Nulls can prevent the optimizer from using an index.
· Consider using IN or UNION in place of OR on indexed columns. OR’s on indexed columns causes the optimizer to perform a full table scan.
· Avoid calculations on indexed columns. Write WHERE approved_amt > 26000/3 instead of WHERE approved_amt/3 > 26000.
· Avoid this: SUBSTR(haou.attribute1,1,LENGTH(‘:p_otc’)) = :p_otc). Consider this: WHERE haou.attribute1 like :p_otc||’%’
· Talk to your DBA. If you think that a column used in a WHERE clause should have an index, don’t assume that an index was defined. Check and talk to your DBA if you don’t find any.
· Consider replacing outer joins on indexed columns with UNION. A nested loop outer takes more time than a nested loop un-joined with another table access by index.
· Consider adding small frequently accessed columns (not frequently updated) to an existing index. This will enable some queries to work only with the index, not the table.
· Consider NOT EXISTS instead of NOT IN.
· If a query is going to read most of the records in a table (more than 60%), use a full table scan.
· Try to group multiple sub queries into one.
· If you want to actually understand what you are doing, here are a few things that you need to start playing with:
· Get into EXPLAIN_PLAN. There are multiple way of doing this. The less user friendly is to simply issue this in SQL*Plus: explain plan set statement_id = ‘HDD1’ for ;
· Look at the trace from Oracle Reports. It tells you how much time it spends on each query.
· Use the SQL Trace by issuing an alter session set sql_trace=true; then look at it with TKPROF .trc
· Do not use functions on indexed columns in WHERE clauses Unless specifically using a function based index.
· Beware of implicit datatype conversions occuring on indexed columns (e.g. comparing a character column with a number expression will invoke an implicit
TO_NUMBER operation on the indexed column, preventing use of the index – in this case it would be better to us an explicit TO_CHAR operation around thenumber expression being compared against
· Make sure that you have the correct indexes on the tables:-
· Ensure that the first column of the index is selective ( e.g. more than around 15 distinct values with a near uniform distribution
· Avoid using insufficiently selective indexes (i.e. each index value applies to at least 15% of the rows). In this case, a full table scan will be more efficient.
· Aim to have no more than 4 indexes per table. ( each insert into the table has to also modify data in the indexes )
· To use compound indexes ensure that the WHERE clause includes conditions on the leading column(s) of the index
· NEVER use SELECT * FROM. in application code
· Try to avoid use of the DISTINCT clause as it always requires a sort operation. Excessive use of DISTINCT clause may point to an underlying data model problem (e.g a missing table).
Because of the complex business scenario in the Modern time organization want to control which customer are allowed to order which product.
Consider below scenarios:
• If a company is developing customer specific items, then specific item shall be sold to specific customer only.
• Few products may be banned in specific region.
• Few items may be sold thru specific channel only. Example: Online, Distributors, franchises, Sales Executive etc.
Now Order management Provide a new utility in R12.1.1 to define the rule to restrict the Item to be sold, based on rules, this utility is name as Item Orderability Rules. It allows user to Order the Item based on the Rules. Item Orderability rules are defined at Operating Unit (OU) Level.
Now let’s have a deeper look at Item Orderability:
Level at which rule can be built:
As of Now Oracle has provided rules to control only at 11 attributes
01. Customer
02. Customer Class
03. Customer Category
04. Region
05. Order Type
06. Ship To
07. Bill To
08. Deliver To
09. Sales Channel
10. Sales Representative
11. End Customer
Rule can be defined based on any combination of above attributes:
Example:
The OR condition is applicable when evaluating multiple conditions. In the example above, either the ‘Customer Category’ OR ‘Customer’ OR ‘Sales Channel’ is taken into consideration.
Criteria for the rule:
Criteria can be ‘Item’ or ‘Item Category’
If you select Category as a criterion then you will see “Item Categories
Codes” from the Category Set which is assigned as ‘Default Category Set’
for Order Entry functional area for that OU.
Example:
In our case ‘Order Entry’ has ‘Inv.Item’ category set assigned so we
will be able see category codes from ‘Inv.Item’ Category set only.
Item Validation Organization is referred to validate ‘Item + Category’ combination
Generally Available Flag:
We can set up rules to define when an item or item category is generally not available (the Generally Available box is unselected)
with the conditions available for that rule. For example, Item X is
generally not available, however, since you have set up conditions at
the Rule Level, it is available for a particular customer, or region or
customer class.
Conclusion:
Generally Available box is unselected: Oracle will allow putting order for Criteria + ruling combination
Generally Available box is Selected: Oracle will not allow putting order for Criteria + Rule combination
This is illustrated in the example below:
Case 1: Unselect Generally Available
This means, Item ‘AS54999’ is generally not available for all, but you want to sell it to Customer ‘A. C. Networks’ only.
So this rule allows putting order for Customer + Item combination.
Case 2: Select Generally Available
This means, Item ‘AS54999’ is generally available but you do not want Customer ‘A. C. Networks’ to order it.
So this rule does not allow putting order for Customer + Item combination
Effect of “OM: Use Materialized View for Items LOV (Honors Item Orderability Rules)”
(Honors Item Orderability Rules) is set to Yes, then the Ordered Item
LOV displays only those items which are based on the rules defined. The
Ordered Item LOV is then dynamically populated based on Item
Orderability Rules and the current attribute values on the line.
If the value of the profile option OM: Use Materialized View for Items LOV
(Honors Item Orderability Rules) is set to No, then the Ordered Items
LOV lists all the items of the item validation organization of the
current operating unit. This doesn’t consider the defined item
orderability rules, however if there is a defined rule that prevents the
item from being ordered, then an error message is displayed while
saving the order. You will not be able to save the order. Below is
Simple test case for Item Orderability feature.
Steps to Define the Item Orderability Rule-
- Select the Criteria (Item or Category. And Generally Available or not)
- Select criteria values (Item Number / Category Code)
- Select the Rules Level/s (by selecting any combinations of above 11 attributes)
- Select Rules Level value.
Latest Posts
- R12 – How to Handle NULL for :$FLEX$.VALUE_SET_NAME In Oracle ERPAugust 25, 2023 - 1:20 pm
- R12 – How to Delete Oracle AR TransactionsMarch 22, 2019 - 8:37 pm
- How to Define Custom Key Flexfield (KFF) in R12January 19, 2018 - 5:43 pm
- AutoLock Box Concepts In R12November 10, 2017 - 8:30 am
- R12 – java.sql.SQLException: Invalid column type in OAFSeptember 15, 2017 - 9:39 am
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Recent Comments