Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 31st, 2004, 05:15 PM
nasben nasben is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 4 nasben User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem with restoring

hi,
I have before insert triggers on some of my tables, which they generate new key ID for the table.
The problem I am facing is that when I restore my data from a backed up file, I get new IDs for the tables. Is there any way to deactivate the triggers.

I am using FB1.5, also I use TIBRestoreService for the restore.

thanks

Reply With Quote
  #2  
Old January 4th, 2005, 10:31 AM
nasben nasben is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 4 nasben User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still waiting for an answer, any help would be appreciated.
Nasben

Reply With Quote
  #3  
Old January 5th, 2005, 03:56 AM
fikret fikret is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Sarajevo, Bosnia
Posts: 111 fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 h 17 m 43 sec
Reputation Power: 8
Quote:
Originally Posted by nasben
hi,
I have before insert triggers on some of my tables, which they generate new key ID for the table.
The problem I am facing is that when I restore my data from a backed up file, I get new IDs for the tables. Is there any way to deactivate the triggers.

I am using FB1.5, also I use TIBRestoreService for the restore.

thanks

Can you explain what do you mean by "when I restore my data from a backed up file, I get new IDs for the tables"?
Maybe you need to reset generator values (if I understand your question)?
And YES, there IS a way to deactivate trigger.
Use this syntax:
ALTER TRIGGER TRIGGER_NAME_BI INACTIVE;

For setting (manually) genarator value, try
SET GENERATOR GEN_NAME TO SOME_VALUE;

--
Best regards,
Fikret Hasovic http://fikret.fbtalk.net

FirebirdSQL Foundation member.
- Join today at http://www.firebirdsql.org/ff/foundation
JEDI VCS contributor
http://jedivcs.sourceforge.net/

Reply With Quote
  #4  
Old January 5th, 2005, 04:29 AM
SilverDB's Avatar
SilverDB SilverDB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Romania
Posts: 173 SilverDB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 45 m 53 sec
Reputation Power: 4
Send a message via Yahoo to SilverDB
There is no way that you can get new IDs while restoring if restored corectly !
Are you restoring and overwriting the initial database ?
Try restoring to another location and see what happens ...

Reply With Quote
  #5  
Old January 6th, 2005, 06:21 AM
nasben nasben is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 4 nasben User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by fikret
Can you explain what do you mean by "when I restore my data from a backed up file, I get new IDs for the tables"?
Maybe you need to reset generator values (if I understand your question)?
And YES, there IS a way to deactivate trigger.
Use this syntax:
ALTER TRIGGER TRIGGER_NAME_BI INACTIVE;

For setting (manually) genarator value, try
SET GENERATOR GEN_NAME TO SOME_VALUE;


I meant restoring the data which was backed up using the TIBBackupService component.

It looks to me like when the TIBRestoreService doing the restore it's using INSERTS, which in my case making the on before insert trigger to be executed, therefore it's generating a new ID for the table.

My before insert trigger looks like this:


CREATE TRIGGER A_ADDRESS_BI0 FOR A_ADDRESS
ACTIVE BEFORE INSERT POSITION 0
AS
begin
new.address_id = gen_id(ADDRESS_COUNT,1,1)
end

where ADDRESS_COUNT is a generator

I hope this is clearer now.

Thanks

Reply With Quote
  #6  
Old January 6th, 2005, 06:26 AM
nasben nasben is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 4 nasben User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by SilverDB
There is no way that you can get new IDs while restoring if restored corectly !
Are you restoring and overwriting the initial database ?
Try restoring to another location and see what happens ...


Yes i am overwriting an existing db, I shall try to restore to another location and see what will happen.

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Problem with restoring


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway