Re: [SQL] Migrating a Database to a new tablespace

2006-04-27 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Bruce Momjian wrote: >> I have work someone did in the past. I just need to be updated to deal >> with tablespaces. >> >> ftp://candle.pha.pa.us/pub/postgresql/mypatches/checkfile.* > It looks nice, but I would not like automatic deletion (or only opt

Re: [SQL] Migrating a Database to a new tablespace

2006-04-27 Thread Markus Schaber
Hi, Bruce, Bruce Momjian wrote: > I have work someone did in the past. I just need to be updated to deal > with tablespaces. > > ftp://candle.pha.pa.us/pub/postgresql/mypatches/checkfile.* > > Let me know if you want details. It looks nice, but I would not like automatic deletion (or on

Re: [SQL] Migrating a Database to a new tablespace

2006-04-27 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: >>As I said the leftovers are likely to be caused by hard kills and >>backend crashes, so I would not go into deeper analysis, but maybe the >>finding and possibly removing of such leftovers should be half-automated >>to assist server admins. > > It's been discussed. Pe

Re: [SQL] Migrating a Database to a new tablespace

2006-04-26 Thread Jim C. Nasby
On Wed, Apr 26, 2006 at 12:35:39PM -0400, Bruce Momjian wrote: > Tom Lane wrote: > > Markus Schaber <[EMAIL PROTECTED]> writes: > > > As I said the leftovers are likely to be caused by hard kills and > > > backend crashes, so I would not go into deeper analysis, but maybe the > > > finding and poss

Re: [SQL] Migrating a Database to a new tablespace

2006-04-26 Thread Bruce Momjian
Tom Lane wrote: > Markus Schaber <[EMAIL PROTECTED]> writes: > > As I said the leftovers are likely to be caused by hard kills and > > backend crashes, so I would not go into deeper analysis, but maybe the > > finding and possibly removing of such leftovers should be half-automated > > to assist se

Re: [SQL] Migrating a Database to a new tablespace

2006-04-26 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > As I said the leftovers are likely to be caused by hard kills and > backend crashes, so I would not go into deeper analysis, but maybe the > finding and possibly removing of such leftovers should be half-automated > to assist server admins. It's been di

Re: [SQL] Migrating a Database to a new tablespace

2006-04-26 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: > Match the subdirectory names against pg_database.oid --- any subdir that > doesn't correspond to any live entry in pg_database is junk and can be > flushed. Within a valid database's subdirectory, match the file names > to that database's pg_class.relfilenode (not oid!

Re: [SQL] Migrating a Database to a new tablespace

2006-04-25 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Instead of assuming anything, why don't you look in the tablespace >> directory and see what's there? A quick "ls -aR" would give more >> information than guessing. > There's plenty of stuff there, 8.8 Gigabytes in total. The questio

Re: [SQL] Migrating a Database to a new tablespace

2006-04-25 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: >>So when pgadmin3 displays no dependencies, can I assume it is safe to >>empty the tablespace directory manually, and then drop the tablespace? > > Instead of assuming anything, why don't you look in the tablespace > directory and see what's there? A quick "ls -aR" wou

Re: [SQL] Migrating a Database to a new tablespace

2006-04-25 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > So when pgadmin3 displays no dependencies, can I assume it is safe to > empty the tablespace directory manually, and then drop the tablespace? Instead of assuming anything, why don't you look in the tablespace directory and see what's there? A quick "l

Re: [SQL] Migrating a Database to a new tablespace

2006-04-25 Thread Markus Schaber
Hi, Jim, Jim C. Nasby wrote: > That means that the tablespace directory isn't empty. This might be some artifacts from backend kills / crashes, partially during COPY and CREATE DATABASE operations. (It's a developer machine after all). So when pgadmin3 displays no dependencies, can I assume it i

Re: [SQL] Migrating a Database to a new tablespace

2006-04-24 Thread Jim C. Nasby
That means that the tablespace directory isn't empty. On Mon, Apr 24, 2006 at 01:34:33PM +0200, Markus Schaber wrote: > Hello, > > I now pulled the plug, migrated all databases via "create database ... > tempate olddatabase tablespace newts" to new tablespaces, one for each > database, and droppe

Re: [SQL] Migrating a Database to a new tablespace

2006-04-24 Thread Markus Schaber
Hello, I now pulled the plug, migrated all databases via "create database ... tempate olddatabase tablespace newts" to new tablespaces, one for each database, and dropped all old databases that contained references to the tablespace. Pgadmin3 also shows that the tablespace is not referenced by any

Re: [SQL] Migrating a Database to a new tablespace

2006-04-24 Thread Markus Schaber
Hello, Markus Schaber wrote: > What is the easiest way to migrate a complete database from one > tablespace to another? > > ALTER DATABASE only allows to set the default tablespace, but not > migrating the existing database. Is there really no way to do this? Thanks, Markus -- Markus Schaber

Re: [SQL] Migrating a Database to a new tablespace

2006-04-24 Thread Markus Schaber
Hello, Markus Schaber wrote: >>What is the easiest way to migrate a complete database from one >>tablespace to another? >> >>ALTER DATABASE only allows to set the default tablespace, but not >>migrating the existing database. > > Is there really no way to do this? Via some scripting, I now migr

[SQL] Migrating a Database to a new tablespace

2006-04-18 Thread Markus Schaber
Hello, What is the easiest way to migrate a complete database from one tablespace to another? ALTER DATABASE only allows to set the default tablespace, but not migrating the existing database. Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software