Faizur,

There are several ways to backup Postgres -- so, you may want to ask the 
institution what sort of file they gave you.   There are even several 
outputs possible with 'pg_dump' (see the -F <format> option description).

http://www.postgresql.org/docs/8.2/interactive/app-pgdump.html

By default, "pg_dump" gives a textual format (i.e. you should be able to 
read it in a text editor).  But, it's also possible to select a custom 
format which can only be restored using the 'pg_restore' script.

Since you don't know how this backup was created, you're likely going to 
have to ask the person who created it.  It's also possible that they 
only backed up the data, and not the full table definitions themselves 
(by default everything is backed up, but again, it depends on what flags 
they passed to the 'pg_dump' script).

Generally speaking, you need to figure out which scenarios you have:

(1) Which file format do you have?
   (1a) If you have textual backup file, you want to restore it using 
'pgsql' command (like I sent you before)
   (1b) If you have an archive file (non-textual), that can only be 
restored using the 'pg_restore' command (with the proper flags):
http://www.postgresql.org/docs/8.2/interactive/app-pgrestore.html
(2) What info is in that file?
   (2a) If you only have data (no table definitions) -- you'll have to 
first create the tables before you can restore data. So, this would mean 
you'd *have* to first install DSpace from scratch (including running 
'ant fresh_install' to create all the tables)
   (2b) If you have table definitions + data (default for Postgres) then 
you do NOT want to run that 'ant fresh_install' command.

Essentially, your best choice now is to talk to the people who gave you 
the PostgreSQL backup file to find out how they created it.  If you 
cannot talk to them, then you'll probably need to do a 'trial and error' 
process of attempting different types of PostgreSQL restores until you 
can find the one that works properly.

Good luck,

- Tim

On 9/3/2010 9:50 AM, Rahman, Sm F wrote:
> Tim,
>
> Here is the scenario that might reveal any clue what am I missing here:
>
> I am trying to restore the backup that I got from another institution. They 
> used to host our Dspace instance. I got 2 files, one is a Postgres backup and 
> another is Assetstore. Now, digging through all the docs, I found there are 3 
> ways of dumping the data and I am assuming they gave me 'pg_dump' output what 
> I am trying to restore with no luck yet. I followed the exact same steps that 
> you described below before sending any messages in this listserv (except 
> running the init-index script) but after running the script, nothing happened 
> yet. So, do you think, they might gave me a file system level backup or 
> another type instead of 'pg_dump', at least that's what I am thinking at this 
> point of time. What else should I done? Once again, I appreciate your help, 
> thanks,
>
> Faizur Rahman, Ph.D.
> UTD Library Systems
> 972-883-4100
> [email protected]
>
>
> -----Original Message-----
> From: Tim Donohue [mailto:[email protected]]
> Sent: Wednesday, September 01, 2010 4:34 PM
> To: Rahman, Sm F
> Cc: [email protected]
> Subject: Re: [Dspace-tech] Dspace import/Replace error
>
> Faizur,
>
> When you did your Postgres backup, you should have run 'pg_dump' to
> create a full backup of all your DSpace DB tables. So, it should have
> been a command similar to the following:
>
> pg_dump -E UNICODE dspace>  my-dspace-backup.sql
>
> (where 'dspace' is the name of your DSpace Database, and
> 'my-dspace-backup.sql' is the full location of your backup file)
>
> So, assuming you have a backup file created by "pg_dump", you should be
> able to restore it by doing the following:
>
> (1) ReCreate an empty 'dspace' database owned by the 'dspace' user:
>
> createdb -U dspace -E UNICODE dspace
>
> (2) Restore all of its contents from your backup file:
>
> psql dspace<  my-dspace-backup.sql
>
> More information on the various Postgres commands (e.g. 'pg_dump' and
> 'psql'), along with all their options are available on the PostgreSQL
> website:
>
> pg_dump: http://www.postgresql.org/docs/8.2/interactive/app-pgdump.html
> psql: http://www.postgresql.org/docs/8.2/interactive/app-psql.html
> createdb: http://www.postgresql.org/docs/8.2/interactive/app-createdb.html
>
> After you have the database restored, it's recommended to run 'dspace
> index-init' to rebuild the DSpace Browse tables&  also recreate the
> Search indexes.
>
> I hope that helps,
>
> - Tim
>
> On 9/1/2010 4:05 PM, Rahman, Sm F wrote:
>> Tim, you are correct, I don't see any content, what steps exactly should I 
>> take to restore the database from backup, I want to make sure I am taking 
>> the right steps to make it work, thanks again, Faizur
>>
>>
>> -----Original Message-----
>> From: Tim Donohue [mailto:[email protected]]
>> Sent: Wednesday, September 01, 2010 11:32 AM
>> To: Rahman, Sm F
>> Cc: [email protected]
>> Subject: Re: [Dspace-tech] Dspace import/Replace error
>>
>> Faizur,
>>
>> It looks like your Database did not restore properly.  It's saying you
>> have no "community" table (which is one of the main tables in DSpace).
>> Have you verified that your DSpace database actually has contents in it
>> after your attempted restore?  If it has no contents, then obviously
>> your database restore didn't work, and that's why DSpace is not
>> functioning properly.
>>
>> - Tim
>>
>> On 9/1/2010 9:54 AM, Rahman, Sm F wrote:
>>> Tim/Claudia,
>>>
>>> Here is what I am getting after running the index-init script, any 
>>> suggestions? Thanks, Faizur
>>>
>>> dsp...@ubuntu:~/bin$ ./index-init
>>> Creating browse index
>>> Exception in thread "main" org.dspace.browse.BrowseException: 
>>> org.postgresql.util.PSQLException: ERROR: no schema has been selected to 
>>> create in
>>>            at 
>>> org.dspace.browse.BrowseCreateDAOPostgres.createSequence(BrowseCreateDAOPostgres.java:394)
>>>            at 
>>> org.dspace.browse.IndexBrowse.createItemTables(IndexBrowse.java:952)
>>>            at 
>>> org.dspace.browse.IndexBrowse.createItemTables(IndexBrowse.java:921)
>>>            at org.dspace.browse.IndexBrowse.prepTables(IndexBrowse.java:739)
>>>            at 
>>> org.dspace.browse.IndexBrowse.initBrowse(IndexBrowse.java:1045)
>>>            at org.dspace.browse.IndexBrowse.main(IndexBrowse.java:707)
>>> Caused by: org.postgresql.util.PSQLException: ERROR: no schema has been 
>>> selected to create in
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531)
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313)
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308)
>>>            at 
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
>>>            at 
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
>>>            at 
>>> org.dspace.storage.rdbms.DatabaseManager.updateQuery(DatabaseManager.java:390)
>>>            at 
>>> org.dspace.browse.BrowseCreateDAOPostgres.createSequence(BrowseCreateDAOPostgres.java:387)
>>>            ... 5 more
>>> Exception in thread "main" org.dspace.browse.ItemCountException: 
>>> org.postgresql.util.PSQLException: ERROR: relation "community" does not 
>>> exist
>>>            at 
>>> org.dspace.browse.ItemCounter.buildItemCounts(ItemCounter.java:124)
>>>            at org.dspace.browse.ItemCounter.main(ItemCounter.java:85)
>>> Caused by: org.postgresql.util.PSQLException: ERROR: relation "community" 
>>> does not exist
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531)
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1313)
>>>            at 
>>> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
>>>            at 
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258)
>>>            at 
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>            at 
>>> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
>>>            at 
>>> org.dspace.storage.rdbms.DatabaseManager.queryTable(DatabaseManager.java:169)
>>>            at org.dspace.content.Community.findAllTop(Community.java:286)
>>>            at 
>>> org.dspace.browse.ItemCounter.buildItemCounts(ItemCounter.java:115)
>>>            ... 1 more
>>> Creating search index
>>>
>>> Faizur Rahman, Ph.D.
>>> UTD Library Systems
>>> 972-883-4100
>>> [email protected]
>>>
>>> -----Original Message-----
>>> From: Tim Donohue [mailto:[email protected]]
>>> Sent: Wednesday, September 01, 2010 9:05 AM
>>> To: [email protected]
>>> Cc: [email protected]
>>> Subject: Re: [Dspace-tech] Dspace import/Replace error
>>>
>>> Faizur,
>>>
>>> Claudia's correct -- running that 'dspace index-init' command is
>>> necessary.  Its purpose is to rebuild your Browse tables (which all
>>> begin "bi_" -- based on your Postgres logs, those tables may be
>>> missing).  It's usually best practice to re-run that 'index-init'
>>> command after a restore (I overlooked that it wasn't in your restore steps).
>>>
>>> If that still doesn't resolve things, you may want to take a closer look
>>> at your database tables to make sure the database is being restored
>>> properly.
>>>
>>> - Tim
>>>
>>> On 9/1/2010 1:46 AM, Claudia Jürgen wrote:
>>>> Hello Faizur,
>>>>
>>>> the error indicates that you forgot to run:
>>>> [dspace]/bin/dspace index-init
>>>>
>>>> Hope that helps
>>>>
>>>> Claudia Jürgen
>>>>
>>>>
>>>> Am 01.09.2010 00:39, schrieb Rahman, Sm F:
>>>>> Tim,
>>>>>
>>>>> I am sorry that I only hit "reply" instead of "reply all" which caused 
>>>>> not to send the email to "Dspace-tech".
>>>>>
>>>>>>> Here is the Cocoon log with Errors:
>>>>>
>>>>> Caused by: org.postgresql.util.PSQLException: ERROR: current transaction 
>>>>> is aborted, commands ignored until end of transaction block
>>>>>              at 
>>>>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1531)
>>>>>
>>>>>>> Here is the Postgres log with Errors:
>>>>>
>>>>> 2010-08-30 15:59:57 CDT ERROR:  relation "bi_item" does not exist
>>>>> 2010-08-30 15:59:57 CDT STATEMENT:  SELECT  COUNT(*) AS num FROM bi_item
>>>>> 2010-08-30 16:00:00 CDT ERROR:  relation "bi_2_dis" does not exist
>>>>> 2010-08-30 16:00:00 CDT STATEMENT:  SELECT  COUNT(*) AS num FROM bi_2_dis
>>>>> 2010-08-30 16:00:03 CDT ERROR:  relation "bi_item" does not exist
>>>>> 2010-08-30 16:00:03 CDT STATEMENT:  SELECT  COUNT(*) AS num FROM bi_item
>>>>> 2010-08-30 16:00:09 CDT ERROR:  relation "community" does not exist
>>>>> 2010-08-30 16:00:09 CDT STATEMENT:  SELECT * FROM community WHERE NOT 
>>>>> community_id IN (SELECT child_comm_id FROM community2community) ORDER BY 
>>>>> name
>>>>> 2010-08-30 16:00:09 CDT ERROR:  current transaction is aborted, commands 
>>>>> ignored until end of transaction block
>>>>> 2010-08-30 16:00:09 CDT STATEMENT:  SELECT * FROM community WHERE NOT 
>>>>> community_id IN (SELECT child_comm_id FROM community2community) ORDER BY 
>>>>> name
>>>>> 2010-08-30 16:00:11 CDT ERROR:  relation "bi_item" does not exist
>>>>> 2010-08-30 16:00:11 CDT STATEMENT:  SELECT  COUNT(*) AS num FROM bi_item
>>>>> 2010-08-30 16:00:28 CDT ERROR:  relation "bi_4_dis" does not exist
>>>>> 2010-08-30 16:00:28 CDT STATEMENT:  SELECT  COUNT(*) AS num FROM bi_4_dis
>>>>> 2010-08-30 20:02:01 CDT LOG:  incomplete startup packet
>>>>> 2010-08-31 00:02:01 CDT LOG:  incomplete startup packet
>>>>> 2010-08-31 05:02:01 CDT LOG:  incomplete startup packet
>>>>> 2010-08-31 10:02:01 CDT LOG:  incomplete startup packet
>>>>> 2010-08-31 13:53:53 CDT ERROR:  relation "eperson" does not exist
>>>>> 2010-08-31 13:53:53 CDT STATEMENT:  select * from eperson where email = $1
>>>>> 2010-08-31 13:53:56 CDT ERROR:  relation "community" does not exist
>>>>>
>>>>>>> Don't see any error in tomcat log
>>>>>
>>>>> I think the import didn't go through correctly, what do you think and how 
>>>>> to encouter this problem?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Faizur
>>>>>
>>>>> -----Original Message-----
>>>>> From: Tim Donohue [mailto:[email protected]]
>>>>> Sent: Tuesday, August 31, 2010 2:42 PM
>>>>> To: Rahman, Sm F
>>>>> Cc: dspace-tech
>>>>> Subject: Re: [Dspace-tech] Dspace import/Replace error
>>>>>
>>>>> Faizur,
>>>>>
>>>>> I'm copying in 'dspace-tech' again on my response.  We prefer to answer
>>>>> questions on the listserv itself, as it is then a resource for others
>>>>> who may end up experiencing the same issue.
>>>>>
>>>>> Your dspace.log file output looks normal.  Those lines of the log that
>>>>> you sent are just showing that you accessed the main homepage (or
>>>>> possibly the Community listing), which ran queries to determine which
>>>>> communities to display on that homepage.  There are no ERROR lines in
>>>>> that log (where it says "DEBUG" or "INFO", you should see "ERROR" when a
>>>>> problem occurs).
>>>>>
>>>>> You may want to also check the Tomcat logs and PostgreSQL logs.
>>>>> Especially look to see what is logged when you see that "An error has
>>>>> occurred" message -- there should be a log file line somewhere with
>>>>> "ERROR" in it.  Again this webpage will detail the location of your
>>>>> logs: https://wiki.duraspace.org/display/DSPACE/Troubleshoot+an+error
>>>>>
>>>>> - Tim
>>>>>
>>>>> On 8/31/2010 2:23 PM, Rahman, Sm F wrote:
>>>>>> Tim,
>>>>>>
>>>>>> Thanks again for offering the help, I restored the DB from backup and 
>>>>>> replace the Assetstore but giving me the same error. I went through the 
>>>>>> Troubleshoot instructions that you sent me, changed the config file and 
>>>>>> here is what looks like in the Dspace log. Here is the instance at: 
>>>>>> http://10.110.33.25:8180/xmlui/password-login
>>>>>>
>>>>>> Dspace log:
>>>>>>
>>>>>> 2010-08-31 13:55:20,089 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>> 2010-08-31 13:55:20,089 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>> 2010-08-31 14:00:00,154 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>> 2010-08-31 14:00:00,154 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>> 2010-08-31 14:00:00,155 INFO  
>>>>>> org.dspace.app.xmlui.aspect.artifactbrowser.CommunityBrowser @ 
>>>>>> anonymous:session_id=E21866AE973E650DA0637719BE83BE00:ip_addr=10.110.33.126:view_community_list:
>>>>>> 2010-08-31 14:00:00,157 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>> 2010-08-31 14:00:00,157 DEBUG org.dspace.storage.rdbms.DatabaseManager @ 
>>>>>> Running query "SELECT * FROM community WHERE NOT community_id IN (SELECT 
>>>>>> child_comm_id FROM community2community) ORDER BY name"  with parameters:
>>>>>>
>>>>>> Thanks again, Faizur
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Tim Donohue [mailto:[email protected]]
>>>>>> Sent: Tuesday, August 31, 2010 9:36 AM
>>>>>> To: Rahman, Sm F
>>>>>> Cc: [email protected]
>>>>>> Subject: Re: [Dspace-tech] Dspace import/Replace error
>>>>>>
>>>>>> Faizur,
>>>>>>
>>>>>> Your steps sound correct.  All you need to do is restore your complete
>>>>>> database from backup, and replace your Assetstore directory with the one
>>>>>> from backup. Assuming your Database backup and Assetstore backup are
>>>>>> from around the same time (doesn't need to be exact), everything should
>>>>>> work fine.
>>>>>>
>>>>>> Can you check your underlying log files to see if any other errors are
>>>>>> reported there?  Please see the "How to Troubleshoot an Error" page for
>>>>>> information about finding the error in the log files:
>>>>>> https://wiki.duraspace.org/display/DSPACE/Troubleshoot+an+error
>>>>>>
>>>>>> - Tim
>>>>>>
>>>>>> On 8/30/2010 3:52 PM, Rahman, Sm F wrote:
>>>>>>> Respected all,
>>>>>>>
>>>>>>> I am new in Dspace and Postgres and I am having trouble importing and
>>>>>>> replacing the existing dspace AssetStore and Postgress database using
>>>>>>> the backups. The steps I am following are:
>>>>>>>
>>>>>>> 1) Stop tomcat
>>>>>>>
>>>>>>> 2) Drop and recreate the dspace database
>>>>>>>
>>>>>>> 3) Restore the data from the backup
>>>>>>>
>>>>>>> 4) Update dspace sequences: 
>>>>>>> [dspace-source]/dspace/etc/update-sequences.sql
>>>>>>>
>>>>>>> 5) Delete existing AssetStore
>>>>>>>
>>>>>>> 6) Restore the AssetStore from the backup
>>>>>>>
>>>>>>> 7) Start tomcat.
>>>>>>>
>>>>>>> The error I am getting after clicking the communities are:
>>>>>>>
>>>>>>> *An error has occured*
>>>>>>>
>>>>>>> *org.postgresql.util.PSQLException: ERROR: current transaction is
>>>>>>> aborted, commands ignored until end of transaction block*
>>>>>>>
>>>>>>> * *
>>>>>>>
>>>>>>> *Cocoon stacktrace*
>>>>>>>
>>>>>>> *Java stacktrace *
>>>>>>>
>>>>>>> *Java full stacktrace*
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Faizur Rahman, Ph.D.
>>>>>>>
>>>>>>> UTD Library Systems
>>>>>>>
>>>>>>> 972-883-4100
>>>>>>>
>>>>>>> [email protected]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> This SF.net Dev2Dev email is sponsored by:
>>>>>>>
>>>>>>> Show off your parallel programming skills.
>>>>>>> Enter the Intel(R) Threading Challenge 2010.
>>>>>>> http://p.sf.net/sfu/intel-thread-sfd
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> DSpace-tech mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> This SF.net Dev2Dev email is sponsored by:
>>>>>
>>>>> Show off your parallel programming skills.
>>>>> Enter the Intel(R) Threading Challenge 2010.
>>>>> http://p.sf.net/sfu/intel-thread-sfd
>>>>> _______________________________________________
>>>>> DSpace-tech mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net Dev2Dev email is sponsored by:
>>>
>>> Show off your parallel programming skills.
>>> Enter the Intel(R) Threading Challenge 2010.
>>> http://p.sf.net/sfu/intel-thread-sfd
>>> _______________________________________________
>>> DSpace-tech mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/dspace-tech

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to