1

Topic: How to disconnect all keys (FK, PK)?

Good afternoon.
How to disconnect all keys on tables (FK, PK), and after export-import to include them?

It is necessary here for what:
The user works with the program which uses basis Firebird. I have this program with basis (only the data in it old). The structure of my basis exchanges (I it I will finish, I will add labels, indexes...). And now the user should overload from the basis the data in my basis (an overload the program should do). The structure of tables on 99 % remains old, i.e. will be added two-three new labels, or any label  on two (the part of fields remains in one, a part in another).
Tables in basis will be nearby 100-150, in labels - it is not a lot of data, approximately to 10000-20000 records.
I wanted to make so:
1. To be connected to the basis, to disconnect all keys (FK, PK)
2. To delete "almost" all (it and there are those labels identical on 99 % for both bases) the data (to delete a line from tables).
3. In a cycle to be transversed on "almost all labels and to copy a line from basis of the user in the basis.
4. Remained given (tables at which the structure exchanged) the program transfers on the algorithm put in it.
5. To make on generators in the basis - those values which at the user that primary keys were generated correctly further.
6. To include all keys (FK, PK)
While at shut-down FK of an index (the key is a link from a label dataful, on a label - the reference manual) faced an error:
This operation is not defined for system tables.
unsuccessful metadata update.
ALTER INDEX @1 failed.
action cancelled by trigger (@1) to preserve data integrity.
Cannot deactivate index used by an integrity constraint.

2

Re: How to disconnect all keys (FK, PK)?

Vlad_567> How to disconnect all keys on tables (FK, PK);
Vlad_567> and after export-import to include them?
In any way. PK/FK, their indexes cannot be disconnected.
> It is necessary here for what:
> And now the user should overload from the basis
> The data in my basis (an overload the program should do)
And why the program and for what is all?
Why it is impossible to copy simply its DB
(A file or ) and it is simple all necessary
Changes to make over a copy?

3

Re: How to disconnect all keys (FK, PK)?

Vlad_567;
Not to disconnect/include, and to delete/create. Other way, seemingly, is not present.

4

Re: How to disconnect all keys (FK, PK)?

Other way very much even can exist, if the task properly to consider.

5

Re: How to disconnect all keys (FK, PK)?

Similar the replicator is necessary to the author.

6

Re: How to disconnect all keys (FK, PK)?

The replicator with DB structure does not help.

7

Re: How to disconnect all keys (FK, PK)?

And operation at it, I feel, single, instead of regular.

8

Re: How to disconnect all keys (FK, PK)?

Rustam wrote:

In any way. PK/FK, their indexes cannot be disconnected.

It is possible to disconnect, but in 3 this method will not work most likely though did not check.
Actually, the idea to disconnect the PC and , probably, appeared that the author does not want to build sequence of data migration. It will be faster clear that without indexes filling, but hardly for the author now it is an important point.

Vlad_567 wrote:

2. To delete "almost" all (it and there are those labels identical on 99 % for both bases) the data (to delete a line from tables).

it is necessary to do it, if you can make to the basis gbak-b-g-m, and receive empty , and then it . There will be an empty basis, much faster than to delete records.
Other variant - to create empty basis from a script of yours (isql-x).
In general, explicitly there is no knowledge of toolkit.

9

Re: How to disconnect all keys (FK, PK)?

kdv> it is possible to disconnect
It . And the difference with removal will not be.

10

Re: How to disconnect all keys (FK, PK)?

Rustam wrote:

Other way very much even can exist, if the task properly to consider.

Here it should be cut in a stone.

11

Re: How to disconnect all keys (FK, PK)?

kdv wrote:

Other variant - to create empty basis from a script of yours (isql-x).

Even moreover - at first only that part of a script, in which create table, without  and indexes. Then filling of the data, then the script rest. My liver However, feels, we will explain then why do not form FK smile

12

Re: How to disconnect all keys (FK, PK)?

> Here it should be cut in a stone.
To mold in a granite! ()

13

Re: How to disconnect all keys (FK, PK)?

The question solved.
Made so:
In the program the user specifies DB files old and new. In new basis I delete all keys (FK, UN). From old basis all records are copied in new basis, and then all keys recovered (form anew).
It was necessary here for what: the User works with the basis, through any time I throw off to it new basis, empty in which there were new tables, indexes. The program transfers all data to new basis and the user works already with new basis and transient data (it will be after program finishing). If the structure changes - the program at data migration already considers it. Make export/import I cannot, since to the user I can not be connected, all dialogue through the third parties, and finishings will become still.

14

Re: How to disconnect all keys (FK, PK)?

Vlad_567 wrote:

the User works with the basis, through any time I throw off to it new basis;
Empty in which there were new tables, indexes.

Instead of is easier to it to throw off a script of creation of new tables and indexes in old basis? It will be
To work faster, than  the data.

15

Re: How to disconnect all keys (FK, PK)?

+ For  updates. Itself so I do.

16

Re: How to disconnect all keys (FK, PK)?

Similarly on hundreds installations sew systems.
Reference meta data together with new programs, generation and performance on fighting basis of the difference script and changeover of programs.