Thread: [GENERAL] - Regarding Schema ROLLBACK

[GENERAL] - Regarding Schema ROLLBACK

From
VENKTESH GUTTEDAR
Date:
Hello All, I have run CREATE SCHEMA xyz accidentally, and it replaced my existing schema (xyz) with tables, and i have lost all my data. Is there any way to rollback or get the schema back with old tables and data. Any help would be appreciated. -- Regards : Venktesh Guttedar.

Re: [GENERAL] - Regarding Schema ROLLBACK

From
Melvin Davidson
Date:
On Tue, Nov 28, 2017 at 7:23 AM, VENKTESH GUTTEDAR < venkteshguttedar@gmail.com> wrote: > Hello All, > > > I have run CREATE SCHEMA xyz accidentally, and it replaced my existing > schema (xyz) with tables, and i have lost all my data. > > Is there any way to rollback or get the schema back with old tables > and data. > > Any help would be appreciated. > > -- > Regards : > Venktesh Guttedar. > > *>Is there any way to rollback or get the schema back with old tables and data.* *Hopefully you have a pg_dump of the database or schema.* *If it in in plain format, you can edit the dump and recover the tables that way.* *If it is in custom format, you can use the -l option to list and edit, then restore with -L option.* *https://www.postgresql.org/docs/9.6/static/app-pgrestore.html * *Otherwise, your next option would be trying to use PITR recovery, providing you have available WAL files.* *https://www.postgresql.org/docs/9.6/static/continuous-archiving.html * -- *Melvin Davidson* I reserve the right to fantasize. Whether or not you wish to share my fantasy is entirely up to you.

Re: [GENERAL] - Regarding Schema ROLLBACK

From
"David G. Johnston"
Date:
On Tue, Nov 28, 2017 at 5:23 AM, VENKTESH GUTTEDAR < venkteshguttedar@gmail.com> wrote: > I have run CREATE SCHEMA xyz accidentally, and it replaced my existing > schema (xyz) with tables, and i have lost all my data. > ​As far as I know "CREATE SCHEMA" by itself cannot "drop" data nor would it successfully execute if a schema of the same name already exist... As Melvin says if you've truly dropped the data you will need to resort to backups of some form.​ David J.

Re: [GENERAL] - Regarding Schema ROLLBACK

From
Alban Hertroys
Date:
> On 28 Nov 2017, at 16:43, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
> On Tue, Nov 28, 2017 at 5:23 AM, VENKTESH GUTTEDAR <venkteshguttedar@gmail.com> wrote:
>     I have run CREATE SCHEMA xyz accidentally, and it replaced my existing schema (xyz) with tables, and i have lost
allmy data. 
>
> ​As far as I know "CREATE SCHEMA" by itself cannot "drop" data nor would it successfully execute if a schema of the
samename already exist... 
>
> As Melvin says if you've truly dropped the data you will need to resort to backups of some form.​
>
> David J.

Just what I was thinking. Are you looking in the correct database?

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



Re: [GENERAL] - Regarding Schema ROLLBACK

From
"Rakesh Kumar"
Date:
> Just what I was thinking. Are you looking in the correct database?

All:  He has already replied to me earlier that he had indeed dropped the schema before creating it.