What lock does the Update Statement use?
Hi All,
Does the below statement will put a row level lock or exclusive lock.
update employee set emp_name='Emp1' where emp_id=1;
Regards
W
UKJA@ukja102> drop table t1 purge;
Table dropped.
Elapsed: 00:00:00.93
UKJA@ukja102> create table t1(c1 int);
Table created.
Elapsed: 00:00:00.09
UKJA@ukja102>
UKJA@ukja102> insert into t1 values(1);
1 row created.
Elapsed: 00:00:00.00
UKJA@ukja102> commit;
Commit complete.
Elapsed: 00:00:00.03
UKJA@ukja102>
UKJA@ukja102> update t1 set c1 = 2;
1 row updated.
Elapsed: 00:00:00.00
UKJA@ukja102>
UKJA@ukja102> set serveroutput on
UKJA@ukja102>
UKJA@ukja102> col sid new_value my_sid
UKJA@ukja102>
UKJA@ukja102> select sid
2 from v$mystat where rownum = 1
3 ;
SID
139
Elapsed: 00:00:00.03
UKJA@ukja102>
UKJA@ukja102> exec print_table('select * from v$lock where sid = &my_sid');
ADDR : 695C4224
KADDR : 695C423C
SID : 139
TYPE : TM
ID1 : 74212
ID2 : 0
LMODE : 3
REQUEST : 0
CTIME : 0
BLOCK : 0
ADDR : 69612444
KADDR : 69612560
SID : 139
TYPE : TX
ID1 : 458787
ID2 : 13053
LMODE : 6
REQUEST : 0
CTIME : 0
BLOCK : 0
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.14DML acquires TX lock in exclusive(6) mode(row level lock) and TM lock in row exclusive(3) mode.
=======================================
Oracle Performance Storyteller
Dion Cho
http://ukja.tistory.com
http://wiki.ex-em.com/index.php/performance_in_depth
http://wiki.ex-em.com/index.php/optimizing_oracle_optimizer
=======================================
Similar Messages
-
Trying to update to Os7. Program is asking for four digit pass code and I do not have one set up. Now I an locked in the update. What should I do?
Check to make sure you are not being asked to set up a pass code. Look for a very small Skip button. If the Skip button is there you are being asked to create a passcode. Either enter the four digits you want to use (and remember them) or tap on Skip.
-
Just yesterday I downloaded the newest update for iTunes, a few days before doing this I purchased music, but after doing the update my songs will not play. It shows a message that says this file cannot be located, what can I do to find the location?
The path C:\users\owner\appdata\local\apple\apple software update\bonjour64.msi cannot be found. verify that you have access to this location and try again or try to find the installation package "bonjour64.msi" in a folder from which you can install the product bonjour.
Unfortunately, this sort of trouble has gotten more complicated to deal with ever since Microsoft pulled the Windows Installer CleanUp utility from their Download Center on 25 June 2010. First we have to find a copy of the utility.
Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. (The results from mydigitallife and Major Geeks are worth checking.)
After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any Bonjour entries and click "Remove".
Quit out of CleanUp. Restart the PC, and try another iTunes install. Does it go through properly this time? -
Write an UPdate statement using the logic used in PL/SQL block (oracle 10g)
Hi All,
I have written the following PL/SQL block. I want to write an UPDATE statement using the logic used in the following PL/SQL block. can any one please help me out in this regards.
DECLARE
v_hoov_fag gor_gold_post.hoov_flg%TYPE;
v_b49n gor_gold_post.b49n%TYPE;
CURSOR c
IS
SELECT bs_id, loyalty_date, loyalty_period, contract_date
FROM gor_gold_post
WHERE tariff_code IN (169, 135, 136);
BEGIN
FOR rec IN c
LOOP
IF (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE) < 304
OR ( TRUNC ( ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE
) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
THEN
v_hoov_flg := 1;
ELSE
v_hoover_flag := 99;
END IF;
IF (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE) < 121.6
OR ( TRUNC ( ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE
) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
THEN
v_b49n := 1;
ELSE
v_b49n := 99;
END IF;
UPDATE gor_gold_post
SET hoov_flg = v_hoov_flg,
b49n = v_b49n
WHERE bs_id = rec.bs_id AND tariff_code IN (169, 135, 136);
COMMIT;
END LOOP;
END;Thank you,Using case statement.
UPDATE gor_gold_post
SET hoov_flag = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 304
OR
(TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
THEN 1
ELSE 99
END,
b49n = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 121.6
OR
(TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
THEN 1
ELSE 99
END
WHERE tariff_code IN (169, 135, 136);Note: Code not tested. -
What exactly does the M7 coprocessor do in the iPad air, and what apps can use it?
I've been trying a few 3rd party apps which use the m7 in the iPhone 5s. None of them work. Also there seem to be no apps both built in motion activity under the privacy menu in settings.
My question is, what exactly does the M7 coprocessor in the ipad air?http://en.wikipedia.org/wiki/Apple_M7
http://www.imore.com/apple-m7
http://www.tuaw.com/2013/10/10/seven-apps-that-take-advantage-of-the-m7-motion-c oprocessor-in-t/ -
my itunes need a update and i pluged in my ipod awhile doing the updat now my ipod won't turn on and the screen has a itunes ion on it what should i do? i really need the help
Try:
- iOS: Not responding or does not turn on
- Also try DFU mode after try recovery mode
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
- If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
- Try another cable
- Try on another computer
- If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
Apple Retail Store - Genius Bar -
try doing the update would not download. So like a dummy I did what I went and downloaded the new itunes so it would update itunes did it before and it worked at first it would tell me that I was missing MSVCR80.dll so I downloaded it again and reinstalled it and now it won't work at all
Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$
-
What bluetooth protocol does the iPod Touch use with a keyboard?
Hi...
Say, does anyone know what bluetooth protocol apple is using for their bluetooth keyboards for the iPhone and iPod Touch? It is probably HID, but the people at RIM (i.e. BlackBerry) use SPP. So I would think many 3rd party keyboards use SPP (Serial Port Protocol). But, then, there are many posts about "I wish Apple would support SPP" because people want to build apps that interface with external HW that only supports SPP.
What I want to do? (you ask)
I've one of these nice / expensive Think-out-side portable folding keyboards (good). That only has a serial interface (bad). There are many bluetooth "dongles" out there with serial ports (good). But they only support SPP or Serial Port Protocol (bad? maybe? depends).
See, I know RIM (BlackBerry) people support SPP on their devices. But I haven't heard (found) word one about what the iPod Touch supports. I would hate to spend $80 on one of these dongles and find out it doesn't work.
So, what does the iPod Touch use when talking to the bluetooth keyboard?
-thanksFrom page 37 of iOS 4.1 Touch Users Guide:
Using an Apple Wireless Keyboard
For ease of typing, you can use an Apple Wireless Keyboard (available separately;
iPod touch 3rd generation or later).
Regarding the original questions, the BT profiles supported by the Touch arelisted here:
http://support.apple.com/kb/HT3647 -
What kind of technology does the internal microphone use?
Does the internal mic use USB, Bluetooth, or analog technology. (Rosetta Stone voice recorder/analyzer is crashing app)
I am having the same problem with Rosetta Stone voice recorder/analyzer activity. RS told me to wait before going to the next window in the exercise but this did not help. I had the same experience with an older Mac laptop. I will follow up with Apple under warranty.
-
Hello,
Why is iOS 8.2 not updating on iPhone 5S? It got the user to Agree to the Terms and Conditions but nothing happens. The user is doing the update via a Wifi connection. Current OS version on the device is 8.1.3. User did a hard reboot of the device and still the same result. Not tried using iTunes as a workaround as we want to know why it's not updating via a Wifi connection. Storage space available is 9G.
If you know of someone who is experiencing the same issue, please let me know the fix. Thank you.
Christina1. I do not know if this will help you or not. In researching this issue with my wife's iPhone 5c 8GB, the most common answer you will get is to adjust this or that setting, and disable this or that App. These at best are only a band-aide solution at all. The best reply I got was from a Verizon Rep that stated "By design, iPhones do turn off WiFi when they go dormant. So if a download is in progress, or information is being back-up wirelessly and the phone goes dormant, it will switch to use cellular data if it is left on". Afterwards, I discovered the exact same information here on the Apple Support Forum to support this statement.
2. Later onward, I read that if you keep your iPhone connected to a power source, it will prevent it from going dormant. In which case, this will prevent the iPhone from turning off the WiFi, and keep it connected to the WiFi. So far, this has help the most in controlling the amount of data usage being used, by my wife's iPhone.
3. Here is a web site that may help you at http://www.iphonehacks.com/2014/09/fix-ios-8-wifi-problems.html ..... -
Problem in doing an update statement
Hello all
i should write an update statement,
these tables : country: name,code,population,nextyearr_population ...
nextyear_population is empty,at first i should get population_growth from population table then calculate the next year population according to corrent population and population_growth
population: country(actually is code not name of country) ,population_growth,....
i wrote so and i got this error
Error starting at line 1 in command:
update country c
set c.nextyear_population=(c.population+ ((c.population*(select pop.population_growth from population pop join country co on co.code=pop.code))/100)
where country.code=population.country
Error at Command Line:4 Column:20
Error report:
SQL Error: ORA-00904: "POPULATION"."COUNTRY": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
-- File created - Wednesday-May-15-2013
-- DDL for Table COUNTRY
CREATE TABLE "intern"."COUNTRY" ("NAME" VARCHAR2(40), "CODE" CHAR(2), "CAPITAL" VARCHAR2(40), "PROVINCE" VARCHAR2(40), "POPULATION" NUMBER, "AREA" NUMBER, "NEXTYEAR_POPULATION" NUMBER)
COMMENT ON COLUMN "intern"."COUNTRY"."NAME" IS 'the country name'
COMMENT ON COLUMN "intern"."COUNTRY"."CODE" IS 'the internet country code (two letters)'
COMMENT ON COLUMN "intern"."COUNTRY"."CAPITAL" IS 'the name of the capital'
COMMENT ON COLUMN "intern"."COUNTRY"."PROVINCE" IS 'the province where the capital belongs to'
COMMENT ON COLUMN "intern"."COUNTRY"."POPULATION" IS 'the population number'
COMMENT ON COLUMN "intern"."COUNTRY"."AREA" IS 'the total area'
COMMENT ON TABLE "intern"."COUNTRY" IS 'the countries of the world with some data'
REM INSERTING into intern.COUNTRY
SET DEFINE OFF;
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA,NEXTYEAR_POPULATION) values ('Andorra','ad','Andorra la Vella','Andorra la Vella',69865,468,null);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA,NEXTYEAR_POPULATION) values ('United Arab Emirates','ae','Abu Dhabi','Abu Dhabi',2523915,82880,null);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA,NEXTYEAR_POPULATION) values ('Afghanistan','af','Kabul','Kabul',28513677,647500,null);
-- File created - Wednesday-May-15-2013
-- DDL for Table POPULATION
CREATE TABLE "intern"."POPULATION" ("COUNTRY" CHAR(2), "POPULATION_GROWTH" NUMBER, "INFANT_MORTALITY" NUMBER)
COMMENT ON COLUMN "intern"."POPULATION"."COUNTRY" IS 'the country code'
COMMENT ON COLUMN "intern"."POPULATION"."POPULATION_GROWTH" IS 'population growth rate (percentage, per annum)'
COMMENT ON COLUMN "intern"."POPULATION"."INFANT_MORTALITY" IS 'infant mortality (per thousand)'
COMMENT ON TABLE "intern"."POPULATION" IS 'information about the population of the countries'
REM INSERTING into intern.POPULATION
SET DEFINE OFF;
Insert into intern.POPULATION (COUNTRY,POPULATION_GROWTH,INFANT_MORTALITY) values ('ad',0.95,4.05);
Insert into intern.POPULATION (COUNTRY,POPULATION_GROWTH,INFANT_MORTALITY) values ('ae',1.54,14.51);
Insert into intern.POPULATION (COUNTRY,POPULATION_GROWTH,INFANT_MORTALITY) values ('af',4.77,163.07);thank you in advance
im using oracle11g and ubuntu 12
best,davidHi, David,
Thanks for posting the CREATE TABLE and INSERT statements.
Don't forget to post the results you want from thatsample data (that is, the contents of country after everything is finished).
1003209 wrote:
... i wrote so and i got this error
Error starting at line 1 in command:
update country c
set c.nextyear_population=(c.population+ ((c.population*(select pop.population_growth from population pop join country co on co.code=pop.code))/100)
where country.code=population.country
Error at Command Line:4 Column:20
Error report:
SQL Error: ORA-00904: "POPULATION"."COUNTRY": invalid identifier
00904. 00000 - "%s: invalid identifier"
In the UPDATE statement itself (outside of sub-queries) you can only reference the table being UPDATEd, but in the WHERE clause:
where country.code=population.countryyou're trying to reference another table, population. That's what caused the error.
You either need another sub-query, or MERGE, which will probably be simpler and more efficient than UPDATE. -
'Missing select' error for update statement using WITH clause
Hi,
I am getting the below error for update statement using WITH clause
SQL Error: ORA-00928: missing SELECT keyword
UPDATE A
set A.col1 = 'val1'
where
A.col2 IN (
WITH D AS
SELECT col2 FROM
(SELECT col2, MIN(datecol) col3 FROM DS
WHERE <conditions>
GROUP BY PATIENT) D2
WHERE
<conditions on A.col4 and D2.col3>Hi,
The format of a query using WITH is:
WITH d AS
SELECT ... -- sub_query
SELECT ... -- main query
You don't have a main query. The keyword FROM has to come immediately after the right ')' that ends the last WITH clause sub-query.
That explains the problem based on what you posted. I can't tell if the real problem is in the conditions that you didn't post.
I hope this answers your question.
If not, post a complete test script that people can run to re-create the problem and test their ideas. Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
What exactly does the colaece option do in TOAD software
Hi,
What exactly does the colaece option do in TOAD software.
Regards,
MuruguPandian PCoalesce will take ADJACENT free space and coalesce it into one larger free chunk.
A free extent in a dictionary-managed tablespace is made up of a collection of contiguous free blocks. When allocating new extents to a tablespace segment, the database uses the free extent closest in size to the required extent. In some cases, when segments are dropped, their extents are deallocated and marked as free, but adjacent free extents are not immediately recombined into larger free extents. The result is fragmentation that makes allocation of larger extents more difficult.
You should often use the ALTER TABLESPACE ... COALESCE statement to manually coalesce any adjacent free extents. To Coalesce a tablespace give the following command
SQL> alter tablespace ica coalesce;
Source: http://www.oracle-dba-online.com/tablespaces_and_datafiles.htm
Regards
Asif Kabir -
Is it possible that my update stats used only correct tables?
Whenever there is a schedule maintenance run I receive a error:
Executing the query "UPDATE STATISTICS [Perf].[PerfHourly_F65954CD35A54..." failed with the following error: "Table 'PerfHourly_F65954CD35A549E886A48E53F148F277' does not exist.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly.
Is it possible that my update stats used only correct tables?
ThanksUse below script ...(change if required)
USE [dbname]
go
DECLARE @mytable_id INT
DECLARE @mytable VARCHAR(100)
DECLARE @owner VARCHAR(128)
DECLARE @SQL VARCHAR(256)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE is_ms_shipped = 0
WHILE @mytable_id IS NOT NULL
BEGIN
SELECT @owner = SCHEMA_NAME(schema_id), @mytable = name
FROM sys.tables
WHERE object_id = @mytable_id
SELECT @SQL = 'UPDATE STATISTICS '+ QUOTENAME(@owner) +'.' + QUOTENAME(@mytable) +' WITH ALL, FULLSCAN;'
Print @SQL
EXEC (@SQL)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE object_id > @mytable_id
AND is_ms_shipped = 0
END
Or use below for required table only but it will not execute only generate script, make change as per ur requirements:
SELECT X.*,
ISNULL(CASE
WHEN X.[Total Rows]<=1000
THEN
CASE
WHEN [Percent Modified] >=20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --20% Small Table Rule'
END
WHEN [Percent Modified] = 100.00
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --100% No real Stats Rule'
--WHEN X.[Rows Modified] > 1000
--THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --1000 Rows Modified Rule'
ELSE
CASE
WHEN X.[Total Rows] > 1000000000 --billion rows
THEN CASE
WHEN [Percent Modified] > 0.1
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1B Big Table Rule'
END
WHEN X.[Total Rows] > 100000000 --hundred million rows
THEN CASE
WHEN [Percent Modified] > 1.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100M Big Table Rule'
END
WHEN X.[Total Rows] > 10000000 --ten million rows
THEN CASE
WHEN [Percent Modified] > 2.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10M Big Table Rule'
END
WHEN X.[Total Rows] > 1000000 --million rows
THEN CASE
WHEN [Percent Modified] > 5.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1M Big Table Rule'
END
WHEN X.[Total Rows] > 100000 --hundred thousand rows
THEN CASE
WHEN [Percent Modified] > 10.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100K Big Table Rule'
END
WHEN X.[Total Rows] > 10000 --ten thousand rows
THEN CASE
WHEN [Percent Modified] > 20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10K Big Table Rule'
END
END
END,'') AS [Statistics SQL]
FROM (
SELECT DISTINCT
DB_NAME() AS [Database],
S.name AS [Schema Name],
T.name AS [Table Name],
I.rowmodctr AS [Rows Modified],
P.rows AS [Total Rows],
CASE
WHEN I.rowmodctr > P.rows
THEN 100
ELSE CONVERT(decimal(8,2),((I.rowmodctr * 1.0) / P.rows * 1.) * 100.0)
END AS [Percent Modified]
FROM
sys.partitions P
INNER JOIN sys.tables T ON P.object_Id = T.object_id
INNER JOIN sys.schemas S ON T.schema_id = S.schema_id
INNER JOIN sysindexes I ON P.object_id = I.id
WHERE P.index_id in (0,1)
AND I.rowmodctr > 0
) X
WHERE [Rows Modified] > 1000
ORDER BY [Rows Modified] DESC
Please click "Propose As Answer"
if a post solves your problem, or "Vote As Helpful" if a post has been useful
to you -
Why does the update change my home page and make Google so prevelant?
Several of the last "updates" involved the changing of my bookmarks and home page,. The so called update required me to spend more time in refreshing the browser to its previous condition. This is frustrating to say the least. Second why does the updated version of of firefox seem to favor google?
Normally, an update does not change your home page...
What did you home page change to? That might help identify the source of the problem.
I assume you have tried changing your home page back to your preferred site, either in the Options dialog or using one of the other methods:
* [[Startup, home page and download settings]]
* [[How to set the home page]]
Did that work at all? By "at all" I mean:
* Immediately after making the change, if you click the Home button, or launch a new window using Ctrl+n, does your preferred page load? Or is that ignored?
* Does the setting revert later in your session (you see in Options it has changed)?
* Does the setting revert after you exit and start Firefox up again?
* Is the problem only when you use your Firefox desktop shortcut?
With that information, it will be easier to recommend a solution.
I'm not sure I understand your second question. Google has always been the default search provider in Firefox. Are you seeing even more Google than that?
Maybe you are looking for
-
My iPod doesn't know video from songs
Suddenly, out of nothing, my 60Gb iPod with video forgot what is video and what is song. I used to have video lists and song lists. Now, they're all mixed up together in both sections. And it stopped playing videos. It thinks they're songs. It's very
-
I'm trying to find a way to profile my computer. I know i have an intel core duo, with 2 gigs ram/250 gig hd but i wanted to check gighz and some other stuff, and i have lost my initial box. anyone know where to check for this? I don't have leopard b
-
Methods for Remote Event Log Collection (WMI vs RPC vs WinRM)
Hi, I'm currently evaluating several 3rd party tools (SIEMs) to help me with log management in a large (mostly) Windows domain environment. Each tool uses a different approach to collecting the event log from remote systems, and I'd like help underst
-
I need something to run shell scripts
I am working on an IBM computer with JDK 1.3 I am looking for a function similar to the VB shell function Shell(pathname[,windowstyle]) Can anyone help me with this?
-
I click the Media Manager get the following error:, Runtime Error!, C:\...\MediaManager9.exe, abnormal program termination