Lock in Dual table.
Hi,
I am getting below issue in my production system.
Its showing lock for below query.
SELECT SYSDATE FROM DUAL
Can some one help me to understand how this query can generate lock ?
Thanks,
KriC wrote:
Its showing lock for below query.Define "it". Is "it" a query that you're running? A tool? Something else? If this is a query, post the query. If this is coming from a tool, tell us what tool and what, exactly, it is saying.
What does "showing lock" mean? Are you saying that this query has acquired a lock that is blocking some other session? Or that some other session has acquired a lock that is blocking this query?
SELECT SYSDATE FROM DUAL
Can some one help me to understand how this query can generate lock ?I'm willing to wager that it has nothing to do with any locks. My wager is that you have a query (or a tool) that is telling you that session A holds a lock that session B is blocked waiting on and that session A is currently running (or the last query session A ran) was this SELECT statement. If that's the case, the SELECT statement has nothing to do with the lock that some previous SQL statement run by session A acquired.
Justin
Similar Messages
-
Function module to hold and release lock on MARD table entry
Hi Gurus,
Can you please tell me Function module to HOLD lock on MARD table and the Function Module to release lock on MARD table entry.
Thanks and Regards,
SudiptoLook via SE11 lock objects, use F4 for tables MAR*, the best for your request is on MARC table with object EMMARCS, so use FM ENQUEUE_EMMARCS and DEQUEUE_EMMARCS.
Regards,
Raymond -
How to find out the locks in the table
Any query anybody have to find out locks in any table.
Here is a version with SID and serial# data:
set linesize 150;
set head on;
col sid_serial form a13
col ora_user for a15;
col object_name for a35;
col object_type for a10;
col lock_mode for a15;
col last_ddl for a8;
col status for a10;
break on sid_serial;
SELECT l.session_id||','||v.serial# sid_serial,
l.ORACLE_USERNAME ora_user,
o.object_name,
o.object_type,
DECODE(l.locked_mode,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR(l.locked_mode)
) lock_mode,
o.status,
to_char(o.last_ddl_time,'dd.mm.yy') last_ddl
FROM dba_objects o, gv$locked_object l, v$session v
WHERE o.object_id = l.object_id
and l.SESSION_ID=v.sid
order by 2,3; -
How to implement the shared lock in a table view
Hi,
How to implement the shared lock in a table view.for multiple users to edit on this same table.
Thanks in advance
SwathiHi,
Please refer this link to find solution to your querry.
Hope it helps.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c322c690-0201-0010-fb86-811c52b0acc2.
Regards,
Rahul -
How to return number range from sql (dual table)
in sql plus
I need to display values (numbers)1 to 52 from dual
eg,
1
2
3
4
5
etc...
Is this possible, can you display a range of numbers from an sql statment without creating atble holding the required numbers.
I am trying to display 1 to 52 (week numbers) but I need to do this from the dual table.
Creating a table with values 1 to 52 looks like a waste?
Thanks in anticipation.
SD.If you're running on 9i you may find the solution I posted Re: List all days of a month in single SQL to be useful. Otherwise the general discussion will provide some illumination.
Cheers, APC -
Hi,
below is one query
SQL> select * from dual;
D
XNow from the below Query I came to know that there is one field in the dual table DUMMY which is having VARCHAR2(1)
SQL> desc dual;
Name Null? Type
DUMMY VARCHAR2(1)now my doubt is when I run the below query how it is displaying text more than 1 character
SQL> select 'how are you' from dual;
'HOWAREYOU'
how are youplease explain
thanks in advance.Hi,
What you are SELECTing here nas no relation to any column in the table.
There's nothing special about the dual table regarding literals. Try
SELECT 'Hello'
FROM scott.dept;Notice that scott.dept does not have any 5-character columns, yet a query on scott.dept is producing a 5-character column.
When you query a table, you don't have to SELECT all of the columns in the table. In fact, you don't have to SELECT any of the columns in the table, as you demonstrated.
The query you posted, like the query above, does not refer to any columns in its base table; it's not surprising that the output doesn't resemble any column in the base table. In the case of the query above, which is based on a table that has 3 columns, the one column that we are SELECTing can't have the characteristics of all 3 columns in the table. Which column do you think the output should resemble, and why? 'Hello' is the first column of output; does that mean it has to resemble the first column in the table, which happens to be defined as NUMBER (2)? 'Hello' is also the last column of output; does that mean it has to resemble the last column of the table? 'Hello' is directly in the center of the output; does that mean it has to resemble the column that happens to be in the middle of the table? Of course not!
Once agian, it is perfectly legal, and sometimes extremely useful, to have columns in a result set that have no connection at all to any column in the table. -
Select multiple rows from dual table
Is it possible to select multiple rows from dual table using a single select statement.
i.e., i want the out put to be
column_name
1
2
3
4
Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AMAside from the fact you're responding to an old thread...
1002424 wrote:
While using CONNECT BY, I see it always leave behind one row.
Suppose I have a condition based on which I have to generate constant rows like
SELECT 1 FROM DUAL WHERE ROWNUM < N;
Here if N = 0, still it gives out single row.... you are obviously doing something wrong in your code elsewhere, because that SQL statement does not always return a single row...
SQL> SELECT 1 FROM DUAL WHERE ROWNUM < 0;
no rows selected
SQL> -
As a quick way to grant privileges to almost all the objects in my schema to a role, i created a procedure (Courtesy of user CD from Oracle Forums). But when i executed the below mentioned procedure i got the error :
ORA-01720: grant option does not exist for 'SYS.DUAL'
To avoid granting privileges to sys.dual, I tried adding AND OBJECT_NAME < > 'SYS.DUAL' and AND OBJECT_NAME < > 'DUAL' to the query. But that this didn't help.
But when i query SELECT * FROM DUAL; i can see that DUAL table exists in my schema.
Any thoughts?
Here is what i did
CREATE ROLE newrole;
DECLARE
v_sql VARCHAR2(4000);
BEGIN
FOR obj IN (SELECT object_name
, object_type
, DECODE (OBJECT_TYPE,
'PROCEDURE','EXECUTE',
'FUNCTION' ,'EXECUTE',
'PACKAGE' ,'EXECUTE',
'SYNONYM' ,'SELECT' ,
'SEQUENCE' ,'SELECT' ,
'MATERIALIZED VIEW','SELECT',
'SELECT, INSERT, UPDATE, DELETE') rights
FROM user_objects where object_type IN
('FUNCTION','PROCEDURE','PACKAGE','SYNONYM','SEQUENCE','MATERIALIZED VIEW','TABLE','VIEW'))
LOOP
v_sql := 'GRANT ' || obj.rights || ' ON ' || obj.object_name || ' TO NEWROLE';
dbms_output.put_line(v_sql);
EXECUTE IMMEDIATE v_sql;
END LOOP;
END;
/One of your views must reference DUAL, perhaps indirectly.
If this comes up again you can create an exception to catch the error inside the loop for the current item and continue. Not pretty, but it should work something like (untested)
for record in cursor loop
--block to catch exception
declare
my_error exception;
--substitute proper error number for -000001 below
pragma exception_init(-000001,my_error)
begin
exception
when my_error then
null;
end;
--continue processing with next loop item
end loop; -
Hi,
1. Do dual table take any physical space in the database or it is only logically present?
2. Suppose a table contains 100 rows. Write a query to return 42,43,44 rows.
Thanks,
Mrinmoyuser3001930 wrote:
Hi,
1. Do dual table take any physical space in the database or it is only logically present?Dual table is physically stored. But starting from 10g (I guess) they indroduced the FAST DUAL access path. Which means if you use the DUAL table not to get the value from the table and only to select a constant value then it will not hit the actually table.
2. Suppose a table contains 100 rows. Write a query to return 42,43,44 rows.You can use the analytic function ROW_NUMBER for this purpose. -
Table overflowed when trying to sap locks in the table..
Dear ALL,
when trying to sap locks in the table then its showing table overflowed. can telle the actual reason.
Reagards.
ASHUTOSHHi, ALL
suddenly sap PP persons execute the report, " errors comes as last msg table overflow" whats the main reasons. i konw my self it automatically resize the table.
Regards,
ASHUTOSH -
How to generate multiple records on a single sql from dual table
I wanted to generate ten sequence nos in a single sql statement from dual table.
Is there any way to use that.
I think somebody can help me on this by using level clauseI'm not 100% sure if I understand your requirement: Do you really want to use an Oracle Sequence, as Alex already demonstrated?
Or just a 'one-time-bunch-of-sequential-numbers'.
In the latter case you can just select level:
SQL> select level
2 from dual
3 connect by level <= 10;
LEVEL
1
2
3
4
5
6
7
8
9
10
10 rows selected. -
Use of addImageTheme method with dual table in query
Is it possible to specify a query using the dual table that specifies a BLOB type? I'm trying to specify a image theme dynamically using the bean API. My image is a JPEG.
Hi Jen,
if you create a table with a BLOB to store the image, plus a geometry column with the image MBR, then you can easily build the dynamic image theme using the API. Your SQL on the image theme would be something like: select mbr, image from image_table.
I'm not sure if there is a direct function at the SQL level that takes an image file and generates a BLOB. Maybe someone has done something similar. If this function exists, then you may be able to create an image theme issuing a SQL with dual table.
Joao -
Hello gurus
This dual table is a dummy table with varchar2(1)....my question is how it can select many psedocolumns from dual doesn't it exceed the allowed space of varchar2(1)
Edited by: 964145 on Oct 9, 2012 5:35 PM>
it cannot be a real table
>
Not sure why you say that.
The DDL for it is in the dcore.bsq file (11.2) in the rdbms/admin folder
create table dual /* pl/sql's standard pckg requires dual. */
(dummy varchar2(1)) /* note, the optimizer knows sys.dual is single row */
storage (initial 1)
insert into dual values ('X')
/See the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/queries009.htm#SQLRF20036
>
Selecting from the DUAL Table
DUAL is a table automatically created by Oracle Database along with the data dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X. Selecting from the DUAL table is useful for computing a constant expression with the SELECT statement. Because DUAL has only one row, the constant is returned only once. Alternatively, you can select a constant, pseudocolumn, or expression from any table, but the value will be returned as many times as there are rows in the table. Refer to "About SQL Functions" for many examples of selecting a constant value from DUAL.
>
And the Database Concepts doc
http://docs.oracle.com/cd/B28359_01/server.111/b28318/datadict.htm
>
The DUAL Table
The table named DUAL is a small table in the data dictionary that Oracle Database and user-written programs can reference to guarantee a known result. This table has one column called DUMMY and one row containing the value X.
>
And those pseudo-columns you ask about
>
select sysdate,UID,rowid from dual;
>
You can query those from any table but as the doc quote above says you will get as many values as there are rows in the table. -
Question on dual table..
after i insert another row into dual table,
SQL*PLUS still returns only one row. But PL/SQL Developer returns 2 rows.
What does SQL*PLUS do to return only one row no matter many rows exist in DUAL table?http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1562813956388
-
Lock object for table KNVP and KNVK
Hello Friends,
Can you please tell me the standard lock object for the table KNVP and KNVK.
Thank and regards,
KuldeepHi
see this and do accordingly
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
lock objects
Lock Objects
Lock Objects
Regards
Anji
Maybe you are looking for
-
In emp table i'm having releving_date column as not null and no default value. Without getting releving date from XML message how to populate value into emp table using dbms_XMLStore package. In the below example whater values we are getting from XML
-
Illustrator CS - Selection Tool not working correctly
Hi all... A customer of ours has an odd Illustrator CS problem. When she tries to use the Selection Tool to select any item, it auto-selects everything. Even if she uses the selection box by dragging the cursor over anything, it selects all the diffe
-
in my home directory thera are a lot of file which are called .serverauth.xxx like .serverauth.5549,.serverauth.5317 etc. what are their aims? if i delete them, it occurs any problem?
-
How to use documents like pictures, stored on content management in forms
Hi, We store on content management as an attachment, and in relations with a marketing campaign, an image which represents the campaign. We developed a smartform which restores the data of the campaign and we want to insert the image about which I sp
-
Glassfish error in server log related to APEX application
Oracle EE 11gR1 Red Hat Linux 5.4 ============ This error is not reproducible but has occurred more than once... Error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small Any ideas what might be causing this issue (found in