Hey,
I have a database which contains following tables: user, accessory,company, domain and so on.
I used following code to backup this database, it works fine.
PgSqlConnection conn = new PgSqlConnection( connectionStringBuilder.ConnectionString )
conn.Open();
PgSqlDump pgSqlDump = new PgSqlDump();
pgSqlDump.Connection = conn;
pgSqlDump.Backup( @"c:\backup.dmp" );
conn.Close();
I used following code to restore the database.
PgSqlConnection conn = new PgSqlConnection( connectionStringBuilder.ConnectionString )
conn.Open();
PgSqlDump pgSqlDump = new PgSqlDump();
pgSqlDump.Connection = conn;
pgSqlDump.Restore( @"c:\backup.dmp" );
conn.Close();
The pgSqlDump.Restore throw an exception
"relation "domain" already exists"
Any ideas about this? Thanks.
PgSqlDump restore issue
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Apparently, this problem occurs when creating tables, as the drop statements are not included into the backup script by default. If you need to restore the whole database (including the schema), you can add the drop statements to the script by setting the IncludeDrop property of the PgSqlDump object to true before performing backup. If you need to restore data only and leave the schema unchanged, please set the Mode property to Devart.Common.DumpMode.Data.
For more information about the PgSqlDump component, please refer to our documentation:
http://www.devart.com/dotconnect/postgr ... lDump.html
Feel free to contact us if anything is unclear.
For more information about the PgSqlDump component, please refer to our documentation:
http://www.devart.com/dotconnect/postgr ... lDump.html
Feel free to contact us if anything is unclear.