Thread: A particular database to move to other drive

A particular database to move to other drive

From
nikhil raj
Date:
Hi, Any one can please help me out I want to move a database to 'Y drive' because the size of that database is large about so can I move only that database to because I got an alert of low space is there any way Currently it is on F drive I want to move to Y drive . Thanks

Re: [EXTERNAL] A particular database to move to other drive

From
"Redmon, Bruce"
Date:
How much down time can you afford? Sent from my iPhone On Nov 25, 2017, at 4:59 PM, nikhil raj > wrote: Hi, Any one can please help me out I want to move a database to 'Y drive' because the size of that database is large about so can I move only that database to because I got an alert of low space is there any way Currently it is on F drive I want to move to Y drive . Thanks

Re: A particular database to move to other drive

From
Shreeyansh Dba
Date:
On Sun, Nov 26, 2017 at 1:08 AM, nikhil raj wrote: > Hi, > Any one can please help me out > > I want to move a database to 'Y drive' because the size of that database > is large about so can I move only that database to because I got an alert > of low space is there any way > Currently it is on F drive I want to move to Y drive . > > Thanks > If we want to move a particular database from one drive to another drive for this requires downtime. There are multiple options to move a database like pg_dump & pg_restore or taking a physical copy, we may pick anyone from these options depending on the size of the database. -- [image: http://www.shreeyansh.com]

Re: A particular database to move to other drive

From
Stéphane KANSCHINE
Date:
Le dim. 26 nov., vers 01:08, nikhil raj exprimait :

> Hi,

Hey !

> I want to move a database to 'Y drive' because the size of that database is
> large about so can I move only that database to because I got an alert of
> low space is there any way
> Currently it is on F drive I want to move to Y drive .

Just :
- shutdown your instance
- move data_directory to its new location
- upgrade data_directory to its new location in postgresql.conf
- restart your instance

Done.

Regards,
-- 
Stéphane KANSCHINE - http://www.hexack.fr./ - http://www.nuajik.com./
@ stephane@hexack.fr
  +33 6 64 31 72 52


Re: A particular database to move to other drive

From
Abhishek Gautam
Date:
Hi, May be creating new tablespace on new drives and then changing db tablespace from default to new one. Beware there would be physical movement of data. Haven’t done this for whole db but should work. Sent from iPhone Cheers, Abhishek Gautam > On 27-Nov-2017, at 2:35 PM, Shreeyansh Dba wrote: > > > >> On Sun, Nov 26, 2017 at 1:08 AM, nikhil raj wrote: >> Hi, >> Any one can please help me out >> >> I want to move a database to 'Y drive' because the size of that database is large about so can I move only that database to because I got an alert of low space is there any way >> Currently it is on F drive I want to move to Y drive . >> >> Thanks > > If we want to move a particular database from one drive to another drive for this requires downtime. There are multiple options to move a database like pg_dump & pg_restore or taking a physical copy, we may pick anyone from these options depending on the size of the database. > > -- >

Re: A particular database to move to other drive

From
Thomas Kellerer
Date:
Stéphane KANSCHINE schrieb am 27.11.2017 um 10:35:
>> I want to move a database to 'Y drive' because the size of that database is
>> large about so can I move only that database to because I got an alert of
>> low space is there any way
>> Currently it is on F drive I want to move to Y drive .
> 
> Just :
> - shutdown your instance
> - move data_directory to its new location
> - upgrade data_directory to its new location in postgresql.conf
> - restart your instance
> 
> Done.

Note that this moves all databases to the new drive, not just one. 





Re: A particular database to move to other drive

From
Devrim Gündüz
Date:
Hi,

On Sun, 2017-11-26 at 01:08 +0530, nikhil raj wrote:
> I want to move a database to 'Y drive' because the size of that database is
> large about so can I move only that database to because I got an alert of
> low space is there any way
> Currently it is on F drive I want to move to Y drive .

First, create a new tablespace on Y drive:

https://www.postgresql.org/docs/current/static/sql-createtablespace.html

Then, move the database to that tablespace:

ALTER DATABASE dbname SET TABLESPACE to new_tablespace_name;

Regards,
--
Devrim Gündüz
EnterpriseDB: https://www.enterprisedb.com
PostgreSQL Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Re: A particular database to move to other drive

From
nikhil raj
Date:
Thanks a lot. On Nov 27, 2017 3:49 PM, "Devrim Gündüz" wrote: > > Hi, > > On Sun, 2017-11-26 at 01:08 +0530, nikhil raj wrote: > > I want to move a database to 'Y drive' because the size of that database > is > > large about so can I move only that database to because I got an alert of > > low space is there any way > > Currently it is on F drive I want to move to Y drive . > > First, create a new tablespace on Y drive: > > https://www.postgresql.org/docs/current/static/sql-createtablespace.html > > Then, move the database to that tablespace: > > ALTER DATABASE dbname SET TABLESPACE to new_tablespace_name; > > Regards, > -- > Devrim Gündüz > EnterpriseDB: https://www.enterprisedb.com > PostgreSQL Consultant, Red Hat Certified Engineer > Twitter: @DevrimGunduz , @DevrimGunduzTR

Re: A particular database to move to other drive

From
nikhil raj
Date:
Thanks a lot. On Nov 27, 2017 3:23 PM, "Abhishek Gautam" wrote: Hi, May be creating new tablespace on new drives and then changing db tablespace from default to new one. Beware there would be physical movement of data. Haven’t done this for whole db but should work. Sent from iPhone Cheers, Abhishek Gautam On 27-Nov-2017, at 2:35 PM, Shreeyansh Dba wrote: On Sun, Nov 26, 2017 at 1:08 AM, nikhil raj wrote: > Hi, > Any one can please help me out > > I want to move a database to 'Y drive' because the size of that database > is large about so can I move only that database to because I got an alert > of low space is there any way > Currently it is on F drive I want to move to Y drive . > > Thanks > If we want to move a particular database from one drive to another drive for this requires downtime. There are multiple options to move a database like pg_dump & pg_restore or taking a physical copy, we may pick anyone from these options depending on the size of the database. -- [image: http://www.shreeyansh.com]

RE: A particular database to move to other drive

From
"Runge, Steven"
Date:
I believe you could use pg_repack to move your database to a new tablespace on your Y drive without downtime (minimal locking). Steve Runge Consultant Database Engineering from: Shreeyansh Dba [mailto:shreeyansh2014@gmail.com] Sent: Monday, November 27, 2017 3:05 AM To: nikhil raj Cc: pgsql-admin@postgresql.org Subject: Re: A particular database to move to other drive On Sun, Nov 26, 2017 at 1:08 AM, nikhil raj > wrote: Hi, Any one can please help me out I want to move a database to 'Y drive' because the size of that database is large about so can I move only that database to because I got an alert of low space is there any way Currently it is on F drive I want to move to Y drive . Thanks If we want to move a particular database from one drive to another drive for this requires downtime. There are multiple options to move a database like pg_dump & pg_restore or taking a physical copy, we may pick anyone from these options depending on the size of the database. -- [http://www.shreeyansh.com] CONFIDENTIALITY NOTICE This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.