Hi,
I have a stored procedure that does a lot of INSERT/UDATE to 3
tables. And When I call the stored procedure, I get a Transaction Log
Full error. When I want to do is turning off the transaction log on
those 3 tables that the stored procedure is using.
Now, since I call the stored procedure on the command line (CLI),
where do I run ALTER TABLE ... ACTIVATE NOT LOGGED INITIALLY statement
? Do I have to put them inside the stored procedure ? Or Do I run the
command before I call the SP ? I am on Linux, DB2 8.2
We don't want to configure the logs to make it bigger because this
is just a one time run to populate the tables. And we have to use the
procedure to migrate those data.
Thanks for any inputs/advices
N. 11 5235
from command line is also simple
db2 -c- alter table
db2 -c- call sp
db2 commit
Hi All,
I just want to add some more information on the subject. Basically
my Stored Procedure looks like this :
CREATE PROCEDURE DB.PWC (V_ID CHAR(6), OUT RETURN_VAL INT)
LANGUAGE SQL
BEGIN
DECLARE..
DECLARE..
INSERT INTO TABLE A..
UPDATE TABLE A.. ha*********@gma il.com wrote: Hi, I have a stored procedure that does a lot of INSERT/UDATE to 3 tables. And When I call the stored procedure, I get a Transaction Log Full error. When I want to do is turning off the transaction log on those 3 tables that the stored procedure is using. Now, since I call the stored procedure on the command line (CLI), where do I run ALTER TABLE ... ACTIVATE NOT LOGGED INITIALLY statement ? Do I have to put them inside the stored procedure ? Or Do I run the command before I call the SP ? I am on Linux, DB2 8.2 We don't want to configure the logs to make it bigger because this is just a one time run to populate the tables. And we have to use the procedure to migrate those data.
Can you add commits into your stored procedure?
Otherwise,
db2 +c "alter table ... activate not logged initially"
db2 +c "call ..."
db2 commit
The +c option turns disables auto-commit.
Hi Ian,
Thank you for the reply. I have been trying to figure out
how to do a COMMIT inside the stored procedure, but I
don't think it can be easily done. Anytime I add a COMMIT
in the procedure, I got the error saying something about
the cursot not opened...
Do you think my problem was because I called the stored
procedure without "+c" in front of my CALL statement ?
Thanks,
N
Can you try if this works?
CREATE PROCEDURE DB.PWC (V_ID CHAR(6), OUT RETURN_VAL INT)
LANGUAGE SQL
P1:BEGIN
BEGIN
DECLARE..
DECLARE..
INSERT INTO TABLE A..
UPDATE TABLE A..
END;
.BEGIN
DECLARE..
DECLARE..
INSERT INTO TABLE B..
UPDATE TABLE B..
END;
BEGIN
. DECLARE..
DECLARE..
INSERT INTO TABLE C..
UPDATE TABLE C..
END;
END P1 ha*********@gma il.com wrote: Hi Ian, Thank you for the reply. I have been trying to figure out how to do a COMMIT inside the stored procedure, but I don't think it can be easily done. Anytime I add a COMMIT in the procedure, I got the error saying something about the cursot not opened... Do you think my problem was because I called the stored procedure without "+c" in front of my CALL statement ?
Thanks, N
DECLARE your cursor WITH HOLD.
By default cursors get closed on COMMIT. WITH HOLD suspends this behavior.
Also you can place the ALTER into the procedure.
Try: EXECUTE IMMEDIATE ALTER ....
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Hi Serge,
Thanks for the tips.
I tried to add EXECUTE IMMEDIATE ALTER TABLE DB.A ACTIVATE NOT
LOGGED INITIALLY
in my procedure. But it failed to create. Am I not putting it in the
right place ? Or is my syntax incorrect ?
Can I activate not logged for more than 1 table at a time ?
CREATE PROCEDURE DB.PWC (V_ID CHAR(6), OUT RETURN_VAL INT)
LANGUAGE SQL
BEGIN
EXECUTE IMMEDIATE ALTER TABLE DB.A ACTIVATE NOT LOGGED INITIALLY
DECLARE..
DECLARE..
INSERT INTO TABLE A..
UPDATE TABLE A.. ha*********@gma il.com wrote: Hi Serge, Thanks for the tips. I tried to add EXECUTE IMMEDIATE ALTER TABLE DB.A ACTIVATE NOT LOGGED INITIALLY in my procedure. But it failed to create. Am I not putting it in the right place ? Or is my syntax incorrect ? Can I activate not logged for more than 1 table at a time ?
CREATE PROCEDURE DB.PWC (V_ID CHAR(6), OUT RETURN_VAL INT) LANGUAGE SQL
BEGIN
EXECUTE IMMEDIATE ALTER TABLE DB.A ACTIVATE NOT LOGGED INITIALLY
DECLARE.. DECLARE..
INSERT INTO TABLE A.. UPDATE TABLE A.. . . INSERT INTO TABLE B.. UPDATE TABLE B.. . . INSERT INTO TABLE C.. UPDATE TABLE C..
END
Try
EXECUTE IMMEDIATE 'ALTER TABLE ...';
If that does not work:
SET txt = 'ALTER TABLE ...';
EXECUTE IMMEDIATE txt;
will work for sure.. I do it rarely myself.
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
<ha*********@gm ail.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com... Hi Serge, Thanks for the tips. I tried to add EXECUTE IMMEDIATE ALTER TABLE DB.A ACTIVATE NOT LOGGED INITIALLY in my procedure. But it failed to create. Am I not putting it in the right place ? Or is my syntax incorrect ?
It needs to come after the DECLARE statements but before your insert/update
queries.
--
Matt Emmerton This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Deepak Mehta |
last post by:
i have to update two tables from ASP pages with same data but i want
that both of them should be updated at one time. If either of them is
not updated then my transaction should roll back.I want this thing to
be in a stored procedure. so that i have to write an execute statement
only on the ASP page and pass the parameters.
Looking forward for ur reply
DEEPAK
|
by: steven.cooper |
last post by:
Does anyone know exactly what behaviour is exhibited when running a
stored procedure and the log file fills up while the procedure is still
running?
I am seeing, through a created history table, a stored procedure that
began to run (by the fact that there is a row in the history table) but
not finish correctly. It is being called by VB and no user is
reporting that VB is erroring out.
Checking some of the SQL log files, the times the SQL...
|
by: Mark |
last post by:
If a java applicaiton using the type 4 driver calls a DB2 stored
procedure, does the stored procedure need to do its own commit when
updates are completed? If the stored procedure does a commit or
rollback, does that affect the UOW for any SQL that was directly
issued by the java program before calling the stored procedure?
|
by: Henry |
last post by:
My application uses Oracle stored procedure to modify multiple tables.
but OracleClient does not support table-like arrays in one execution,
therefore, I need call many times of the stored procedure. In this
case how can I use transaction to rollback all the executions if there
is error in the middle of calls? What I found is that the previous
succussful calls already commit the modification in Oracle side, my
application-level transaction...
|
by: Irfan |
last post by:
There are several ways of handling Transactions in DotNet. Some of them are
1. Using COM+ Serviced Component.
2. Using ADO .Net
3. using stored procedure
What is the best way of handling Transaction in DotNet Enterprise
Application interms of performance, maintainance and scalability?
How feasible it would be if we go for stored procedure option, considering
| |
by: Dino L. |
last post by:
How can I run stored procedure (MSSQL) ?
|
by: ucasesoftware |
last post by:
i need to use this :
Private Shared Sub Demo1()
Dim db As SqlConnection = New SqlConnection("connstringhere")
Dim transaction As SqlTransaction
db.Open
transaction = db.BeginTransaction
Try
call (New SqlCommand("INSERT INTO TransactionDemo " + "(Text)
VALUES ('Row1');", db, transaction)).ExecuteNonQuery
|
by: Siv |
last post by:
Hi,
I have a stored procedure that I want to execute and then wait in a loop
showing a timer whilst it completes and then carry on once I get
notification that it has completed. The main reason for this being to stop
the user thinking the application has frozen when in fact it is just waiting
for a long SP to complete. Another reason for doing it like this is that I
also have had a problem in the past where the SP takes longer than the...
|
by: sridhar21 |
last post by:
Hi to all
this is sridhar
i need example to created stored procedure with transaction in sql and how to call that stored procedure in C#
thanxs
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |