SQL & PL/SQL :: Lock Table Manually?
Jul 15, 2010How can one lock a table manually?
View 7 RepliesHow can one lock a table manually?
View 7 Replieswe know we can see lock mode held in session can be analysed using LM column in v$lock.But i confused in seeing LM column it all shows in numbers from 0 to 6.
eg
0,'None(0)',
1,'Null(1)',
2,'Row Share(2)',
3,'Row Exclu(3)',
4,'Share(4)',
5,'Share Row Ex(5)',
6,'Exclusive(6)')
how one can lock a particular row in a table.for example i have a employee table in which 50 records. now i want to lock only 10 records of the employee table.
View 8 Replies View RelatedHow to Release Lock on table ? ( without killing session )
create table x ( a number);
insert into x(a) values (1);
Lets lock table.
declare
cursor c is select * from x for update;
begin
open c ;
end;
[code]....
I want to read 1 table. If the date is less than today, I want to update 4 other tables. I only want to do this update once a day.
While the 4 other tables are being updated, I want the other web users to pause for the update while this procedure runs.
Is there a better way to do this?
Here is what I have:
CREATE OR REPLACE PROCEDURE TEST_TODAY2 AS
-- to create the table
-- create table test_today(updated_date date);
-- insert into test_today(updated_date) values (sysdate-1);
-- select * from test_today;
cursor daily_update_cur is
select updated_date from test_today
for update of updated_date;
[Code]...
Please use {noformat}{noformat} tags before and after your code as described in the FAQ: {message:id=9360002}.
I've corrected it this time for you.
Can we lock data in global temporary table?
View 4 Replies View RelatedI want to know that what oracle server do to minimize the lock on parent table, when we use Index on foreign key column ?
View 2 Replies View RelatedI am using the Oracle 10g and I have question related to "for Update" clause.We have the data warehouse db, so no foreign key constraint between parent and child.We process the data files every hour, the condition is If we find the row in parent table then we go and look into child tables and perform insertion (if no corresponding record is present) or updation (if one corresponding record is present) in the child table.
The problem is If I run the two process simultaneously for the same kind of data, and if no record is present in the child table then it create the duplicate in child table.My question is if I use FOR Update clause while selecting the data in parent table will it lock the child table for any insertion or updation?
Ex- We have employee table for employee 1
In my data files I have the row for employee 1, so when I run the select query on employee table I found 1 row.The I look the child table "Salary" as there is no record for emp_id =1 in this table I insert the record for this
Emp_id Salary
1 500
The problem is if both the process run at same time then I get duplicate rows in child table
Emp_id Salary
1 500
1 500
we do not want the duplicate row insertion. Can I lock the child table during first process run
alter index test_idx1 shrink space;
I've heard that this statement causes a table lock but cant find any information on this.if it is so, is it a write lock or also a read lock of the table?
I have a question. If we have two scott sessions. I am updating a table EMP in session
1. It means it is exclusively locked.It cannot be used by session 2. Then can we use select command on table EMP in session
2.? This command should not work according to me. But it is working.
I ran into an issue in a project where a function is recreating an index-organized table by doing:Table Structure:
CREATE TABLE table_iot(
...)
ORGANIZATION INDEX
OVERFLOW ...;
Recreate Steps:
1) Populate global temporary staging table (gtt) with data
-- where gtt is staging for target index-organized table (iot)
2) Lock the target index-organized table (iot)
3) Copy old iot data to gtt
-- gtt now contains old and new data
4) Create new index-organized table (iot2) from gtt
-- iot2 now contains old and new data
[code]...
Because index-organized tables are primarily stored in a B-tree index, you can encounter fragmentation as a consequence of incremental updates. However, you can use the ALTER TABLE...MOVE statement to rebuild the index and reduce this fragmentation.The following statement rebuilds the index-organized table admin_docindex:
ALTER TABLE admin_docindex MOVE;
Just started to learn oracle DBA. I am creating database manually.. I am facing following errors
I executed catproc.sql script it was running suddenlt oracle throwd following error.
CODEPL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Package body created.
No errors.
Package body created.
BEGIN
*
ERROR at line 1:
ORA-01552: cannot use system rollback segment for non-system tablespace 'TEMP'
ORA-06512: at "SYS.DBMS_STATS", line 13210
ORA-06512: at "SYS.DBMS_STATS", line 13517
[code]...
Script detail's
CODECREATE DATABASE drprod
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/drprod/redo01.log') SIZE 100M , GROUP 2 ('/u01/app/oracle/oradata/drprod/redo02.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
[code]...
I disable the triggers when I program. what the program is doing behind the scenes. So if I insert into a table, the trigger would fire and insert into another table. Disabling the triggers shows me that I need to insert into both tables. This also allows me to have the primary key in my conversion tables match the database.
With that being said, can I tell the trigger to fire after the fact?
I am trying to make database manually and i am successfully created it,but when i am trying to run catalog.sql and catproc.sql my database get dismount automatically. i also tried to upgrade it via search results on problem but i found this below error when i am typing startup.
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
I have a form with a datablock displaying 3 text item fields.But the actual oracle table have 8 columns.When ever I insert new data and save it, only the three records are being stored in backend whereas remaining column stores with null value.That is the basic function of the form.
I placed an another list item field in a control block which is non-database item.Now I want to store the list item value into a column along with the 3 columns.In a simple way, how to insert record manually along with the other records?
when i connected with oracle user i got error message like "
ERROR:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_APPLICATION_INFO.SET_MODULE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
"
I want to check an item manually. Here is the
//when-validate-item
declare
i number;
begin
if :a.b is null then
i:=show_alert('null');
else if :a.b between 1900 and 2013 then
message('date valid');
else
i:=show_alert('date_invalid');
:a.b:=null;
raise form_trigger_failure;
end if;
end if;
exception when others then
i:=show_alert('exception');
end;
the problem for example when I entered a value "3000" I received two messages (the first on the alert "date_invalid" and the 2nd on the exception message) but normally I must received one message, the relative "date_invalid"
I have lots of materialized views and I want to refresh it manually every weekend (Sunday).
I tried :
SQL> refresh materialize view model_type_mv;
SP2-0734: unknown command beginning "refresh ma..." - rest of line ignored.
I am missing something?
I know how to design master_detail form using wizard but i want to create it without using wizard.I have created two blocks emp and dept without using wizard ,and connected them to emp and dept table by changing their properties.Now i want to create relationship between these two blocks, My requirement is when i press execute_query button if deptno is 10 in dept block then emp block should show data for deptno 10 only.
I know it can be done using add relationhip option in dept block (which is master block)but how to do that.
I am getting error ORA-16816: incorrect database role. The reason is my switch over to standby become failed and now both primary and standby databases showing 'database_role' as 'Physical Standby'.My question is how to manually set 'database_role' to 'PRIMARY' on primary database.
--------------------------------------------
DGMGRL> show configuration
Configuration - dgproj
Protection Mode: MaxPerformance
Databases:
repl - Primary database
Error: ORA-16816: incorrect database role
dgrepl - Physical standby database
--------------------------------------------
I have install Oracle 10g Database software in Red Hat 5.9 64bit. When I want to create a database manually (not using DBCA) I am getting errors like follow:
[oracle@t24app2 ~]$ export ORACLE_SID=dbend08
[oracle@t24app2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 19 16:19:37 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name: I am trying to connect as host not using Tns file info.
How to retrieve data manually to the text fields from the EMP database.what are the main properties ?
View 5 Replies View Relatedi forget my system password and i can't login to my database,and its not letting me in as sys/manager as sysdba...how to generate new user and password....
View 13 Replies View Relatedi want to create a blood donor report, which consists of his profile, donations_n_tests details, donor_to_patient tracking. each is a different table which i have imported to the layout.
now the problem is that for the 1st ever layout that i make via the report builder wizard, it offers me to choose aggregate functions (like sum, cout, avg, etc). but for the rest of the tables that i import into this layout via ADDITIONAL LAYOUT OPTION (report block. it does not offer me these summary functions.
actually i can only configure aggrigate functions via the report layout wizard, perhaps report builder is not that friendly like form developer where we can put a display item set calculation mode to summary and specify the column for the aggregate function.
Grid Version:11.2.0.3OS : RHEL 5.8 I have succesfully installed cluster (GI) and installed RDBMS software on my 2-Node RAC . But, I don't want to use dbca to create the database due to some custom requirements. Instead , I want to run CREATE DATABASE command manually to create the RAC DB. Once the DB is created in one node, what are the steps I need to do to make this DB a RAC DB?
View 5 Replies View Relatedi want to run this procedure manually for testing purpose
procedure Reject_Doc(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2 )
what are the possible values for the variables itemtype,itemkey, actid,funcmode?
I am using oracle 9.2.0.8 on RHEL 4.8 (64-bit). I am facing a strange problem. I have this one job in database that takes almost 12-15 minutes to execute but when I execute procedure in that job manually, it executes in one minute. Even when no other job is running in database, it takes more than 10 minutes to execute.
View 1 Replies View Related1) First Problem:
Difference in hours is supposed to be 35 but it comes as 34.When i manually find the difference in days and multiply by 24 it comes as 34.999999999 and floor converts it as 34.. But when i execute the difference between dates alone and convert to 24 it shows as 35. So when i apply floor to this, it should be 35 instead of 34 right?
SQL> select (to_date('2011-05-03 09:00:00', 'yyyy-mm-dd hh24:mi:ss') -
2 to_date('2011-05-01 22:00:00', 'yyyy-mm-dd hh24:mi:ss'))
3 from dual
4 ;
[code].....
1) Second Problem:
For the following query, difference of the dates in minutes is 2100.. so mod(2100,60) should give 0 but it's giving 60.. Separately if if put mod(2100,60) it is giving as 0 only.
SQL> SELECT MOD(((to_date('2011-05-03 09:00:00', 'yyyy-mm-dd hh24:mi:ss') -
2 to_date('2011-05-01 22:00:00', 'yyyy-mm-dd hh24:mi:ss')) * 1440),
3 60) AS duration,
4 (to_date('2011-05-03 09:00:00', 'yyyy-mm-dd hh24:mi:ss') -
5 to_date('2011-05-01 22:00:00', 'yyyy-mm-dd hh24:mi:ss')) * 1440 as diffinmin
[code]....
how to create database manually(without dbca).
View 2 Replies View RelatedI've been working to create (via script) this database for the last 2 days.. everytime I startup in nomount mode (as sysdba), it displays this error:
$ echo $ORACLE_SID
elams
$
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Mar 7 09:41:26 2011
[code]....