Page 1 of 1

PgSqlDump Restore - out of memory exception

Posted: Tue 20 Mar 2018 09:22
by zephyr
Devart.Data version: 5.0.1335.0
Devart.Data.PostgreSql version: 7.4.543.0
dotConnect for PostgreSQL Professional version: 7.4.543.0
PostgreSQL version: 10.3

Backup code:

Code: Select all

using (var conn = new PgSqlConnection(connectionstring))
{
	conn.Open();

        var pgSqlDump = new PgSqlDump
        {
           Connection = conn
        };
        pgSqlDump.ObjectTypes |= PgSqlDumpObjects.Views;
        pgSqlDump.Backup(stream);

        conn.Close();
}
Backup file size: 2.47 GB

Restore code:

Code: Select all

using (var conn = new PgSqlConnection(connectionString))
{
	 conn.Open();

	var pgSqlDump = new PgSqlDump
	{
	   Connection = conn
	};
	pgSqlDump.Restore(fileName);

	conn.Close();
}
Available memory: about 1 GB (x86 platform)

Stack trace:

Code: Select all

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at Devart.Data.PostgreSql.PgSqlDataReader.f(Int32 A_0)
   at Devart.Data.PostgreSql.PgSqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)
   at Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   at Devart.Common.DbCommandBase.ExecuteNonQuery()
   at Devart.Common.DbScript.ExecuteSqlStatement(SqlStatement sqlStatement, Boolean forceExecute)
   at Devart.Common.DbScript.a(SqlStatement A_0, Boolean A_1)
   at Devart.Common.DbScript.a(Boolean A_0, IDataReader& A_1)
   at Devart.Common.DbScript.Execute()
   at Devart.Data.PostgreSql.PgSqlDump.InternalRestore(TextReader reader)
   at Devart.Common.DbDump.b(String A_0)
   at Devart.Common.DbDump.Restore(String fileName)
   at PostgreSQLExpImp.MakeImport(String fileName, String database, String connectionString) in ...
Diagnostic session from Visual Studio:
Image

An exception occurs during recovery database. Any suggestions how to fix this? Thanks.

Re: PgSqlDump Restore - out of memory exception

Posted: Tue 27 Mar 2018 15:09
by Pinturiccio
We could not reproduce the issue. We have created a backup file of our database, and it has a size of 6.14 GB. Restore runs almost 9 minutes before fail. In the end, we get an error, but it is not OutOfMemoryException. Diagnostic tool shows, that no more than 40 MB of memory is used.

Do you have a large value in some table of your backup in a column with a text data type?

If possible, send us your backup file. You can archive your project and upload it to our ftp server (ftp://ftp.devart.com, credentials: anonymous/anonymous ) or to any file exchange server so that we could download it from there. And send us the password to the archive.
Please also tell us the names of all the schemas that you have backed up.