dbTalk Databases Forums  

How do you rename a named database (P.SQL 8.6)

comp.databases.btrieve comp.databases.btrieve


Discuss How do you rename a named database (P.SQL 8.6) in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Greg D
 
Posts: n/a

Default How do you rename a named database (P.SQL 8.6) - 11-09-2006 , 01:53 PM






Hi,

We have a named database that was created with SQL using primary keys and
foreign keys.

We tried PvModifyDatabase() and although the function returned success, the
resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase() again. It
now fails with error code 7004 - P_E_FAIL, Failed for other reasons (a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg



Reply With Quote
  #2  
Old   
Greg D
 
Posts: n/a

Default Re: How do you rename a named database (P.SQL 8.6) - 11-09-2006 , 04:50 PM






Hi Again,

I did some further research and found that I had asked this question once
before (a couple of years ago) and was told that I needed to unbind the
database before renaming it, so I set up the following procedure:

1.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
2.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
3.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL, 0);
4.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL, P_DBFLAG_RI);
5.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.

I get to step 3 (Rename the database) and it fails with error 7004 as it did
in my previous post.

Can someone help me with this?

Thanks,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote

Quote:
Hi,

We have a named database that was created with SQL using primary keys and
foreign keys.

We tried PvModifyDatabase() and although the function returned success,
the resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase() again.
It now fails with error code 7004 - P_E_FAIL, Failed for other reasons (a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg




Reply With Quote
  #3  
Old   
Wayne
 
Posts: n/a

Default Re: How do you rename a named database (P.SQL 8.6) - 11-10-2006 , 06:57 PM



Hi Greg,

But in this message you said the return status is 7004, which indicates
you don't have adequate permissions to perform the rename. In your
first post, you said it returned a 71, whic refers to a violation of
the RI definitions.

So it looks like you've made a little progress, anyway. I'd look at
your security next.

Wayne Freeman
www.analyticabiz.com

Greg D ha scritto:

Quote:
Hi Again,

I did some further research and found that I had asked this question once
before (a couple of years ago) and was told that I needed to unbind the
database before renaming it, so I set up the following procedure:

1.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
2.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
3.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL, 0);
4.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL, P_DBFLAG_RI);
5.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.

I get to step 3 (Rename the database) and it fails with error 7004 as it did
in my previous post.

Can someone help me with this?

Thanks,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote in message
news:12l71pl8ks14n37 (AT) corp (DOT) supernews.com...
Hi,

We have a named database that was created with SQL using primary keys and
foreign keys.

We tried PvModifyDatabase() and although the function returned success,
the resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase() again.
It now fails with error code 7004 - P_E_FAIL, Failed for other reasons (a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg



Reply With Quote
  #4  
Old   
Greg D
 
Posts: n/a

Default Re: How do you rename a named database (P.SQL 8.6) - 11-14-2006 , 11:52 AM



Hi Wayne,

Thanks for your suggestion, but I know security is not an issue as I am able
to perform steps 1 and 2. The database is on a local workstation and I
don't use any of the new security features.

Thanks,
- Greg

"Wayne" <sales (AT) analyticabiz (DOT) com> wrote

Quote:
Hi Greg,

But in this message you said the return status is 7004, which indicates
you don't have adequate permissions to perform the rename. In your
first post, you said it returned a 71, whic refers to a violation of
the RI definitions.

So it looks like you've made a little progress, anyway. I'd look at
your security next.

Wayne Freeman
www.analyticabiz.com

Greg D ha scritto:

Hi Again,

I did some further research and found that I had asked this question once
before (a couple of years ago) and was told that I needed to unbind the
database before renaming it, so I set up the following procedure:

1.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
2.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
3.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL,
0);
4.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL,
P_DBFLAG_RI);
5.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.

I get to step 3 (Rename the database) and it fails with error 7004 as it
did
in my previous post.

Can someone help me with this?

Thanks,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote in message
news:12l71pl8ks14n37 (AT) corp (DOT) supernews.com...
Hi,

We have a named database that was created with SQL using primary keys
and
foreign keys.

We tried PvModifyDatabase() and although the function returned success,
the resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase()
again.
It now fails with error code 7004 - P_E_FAIL, Failed for other reasons
(a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg





Reply With Quote
  #5  
Old   
Greg D
 
Posts: n/a

Default Re: How do you rename a named database (P.SQL 8.6) - 11-17-2006 , 01:29 PM



For anyone who is interested, the problem turned out to be owner names. You
need to remove the owner names (if you use them) from all the tables before
you rename.

So, the procedure is:

1.) Clear Owner name from each table.
2.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
3.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
4.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL, 0);
5.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL, P_DBFLAG_RI);
6.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.
7.) Set owner name on each table.

- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote

Quote:
Hi Wayne,

Thanks for your suggestion, but I know security is not an issue as I am
able to perform steps 1 and 2. The database is on a local workstation and
I don't use any of the new security features.

Thanks,
- Greg

"Wayne" <sales (AT) analyticabiz (DOT) com> wrote in message
news:1163206626.032849.12260 (AT) b28g2000cwb (DOT) googlegroups.com...
Hi Greg,

But in this message you said the return status is 7004, which indicates
you don't have adequate permissions to perform the rename. In your
first post, you said it returned a 71, whic refers to a violation of
the RI definitions.

So it looks like you've made a little progress, anyway. I'd look at
your security next.

Wayne Freeman
www.analyticabiz.com

Greg D ha scritto:

Hi Again,

I did some further research and found that I had asked this question
once
before (a couple of years ago) and was told that I needed to unbind the
database before renaming it, so I set up the following procedure:

1.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
2.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
3.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL,
0);
4.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL,
P_DBFLAG_RI);
5.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.

I get to step 3 (Rename the database) and it fails with error 7004 as it
did
in my previous post.

Can someone help me with this?

Thanks,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote in message
news:12l71pl8ks14n37 (AT) corp (DOT) supernews.com...
Hi,

We have a named database that was created with SQL using primary keys
and
foreign keys.

We tried PvModifyDatabase() and although the function returned
success,
the resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential
integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase()
again.
It now fails with error code 7004 - P_E_FAIL, Failed for other reasons
(a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg







Reply With Quote
  #6  
Old   
Greg D
 
Posts: n/a

Default Re: How do you rename a named database (P.SQL 8.6) - 11-17-2006 , 04:35 PM



Further research shows that if you use RI but the database is not bound,
then all you need to do is:

1.) Clear Owner name from each table.
2.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL,
P_DBFLAG_RI);
3.) Set owner name on each table.

That's it.

Regards,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote

Quote:
For anyone who is interested, the problem turned out to be owner names.
You need to remove the owner names (if you use them) from all the tables
before you rename.

So, the procedure is:

1.) Clear Owner name from each table.
2.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
3.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
4.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath, NULL,
0);
5.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL,
P_DBFLAG_RI);
6.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.
7.) Set owner name on each table.

- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote in message
news:12lk0kbvll7se7 (AT) corp (DOT) supernews.com...
Hi Wayne,

Thanks for your suggestion, but I know security is not an issue as I am
able to perform steps 1 and 2. The database is on a local workstation
and I don't use any of the new security features.

Thanks,
- Greg

"Wayne" <sales (AT) analyticabiz (DOT) com> wrote in message
news:1163206626.032849.12260 (AT) b28g2000cwb (DOT) googlegroups.com...
Hi Greg,

But in this message you said the return status is 7004, which indicates
you don't have adequate permissions to perform the rename. In your
first post, you said it returned a 71, whic refers to a violation of
the RI definitions.

So it looks like you've made a little progress, anyway. I'd look at
your security next.

Wayne Freeman
www.analyticabiz.com

Greg D ha scritto:

Hi Again,

I did some further research and found that I had asked this question
once
before (a couple of years ago) and was told that I needed to unbind the
database before renaming it, so I set up the following procedure:

1.) Remove foreign key constraints:
ALTER TABLE DROP CONSTRAINT ... for each of the foreign keys.
2.) Turn off RI and unbind:
PvModifyDatabase(hConnection, dbNameExisting, NULL, dictPath, NULL, 0);
3.) Rename the database:
PvModifyDatabase(hConnection, dbNameExisting, dbNameNew, dictPath,
NULL, 0);
4.) Turn RI back on:
PvModifyDatabase(hConnection, dbNameNew, NULL, dictPath, NULL,
P_DBFLAG_RI);
5.) Re-establish the foreign keys:
ALTER TABLE ... for each foreign key.

I get to step 3 (Rename the database) and it fails with error 7004 as
it did
in my previous post.

Can someone help me with this?

Thanks,
- Greg

"Greg D" <nospam (AT) nospam (DOT) com> wrote in message
news:12l71pl8ks14n37 (AT) corp (DOT) supernews.com...
Hi,

We have a named database that was created with SQL using primary keys
and
foreign keys.

We tried PvModifyDatabase() and although the function returned
success,
the resulting database cannot be opened due to RI (error 71) errors.

We read somewhere that you need to remove all the referential
integrity
statements first, so we tried that.
eg. ALTER TABLE DROP CONSTRAINT ...
We removed all the foreign keys and then tried PvModifyDatabase()
again.
It now fails with error code 7004 - P_E_FAIL, Failed for other
reasons (a
truely usless error message).

Does anyone know the correct procedure for renaming a named database?

Thanks,
- Greg









Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.