Hello,

you could drop the schema after logging in as it's owner (postgres user I 
assume). The following command drops the schema and all tables:
DROP SCHEMA public CASCADE;
And then import again.

Alternatively you could try to grant your foreman database user permissions 
for public schema:
GRANT ALL ON schema public TO <foreman_db_username>;
If this is not enough you might even have to change the owner.


On Tuesday, March 7, 2017 at 11:19:55 AM UTC+1, James Denton wrote:
>
> Hi
>
> I backed up the Postgresql DB on our active server and restored on the new 
> RHEL 7 server using the instructions in the Foreman manual (
> https://theforeman.org/manuals/1.14/index.html#5.5Backup,RecoveryandMigration),
>  
> however i receive the following errors:
>
> [root@test ~]# foreman-rake db:import_dump file=/tmp/foreman.1488881123.sql
> Your backup is going to be imported from: /tmp/foreman.1488881123.sql
> You can backup the old database 'foreman' by running:
>  - foreman-rake db:dump destination=/mydir/dumps/foreman.sql 
> RAILS_ENV=production
> This task will destroy your old database tables! Are you sure you want to 
> continue? [y/N]
> y
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 3; 2615 2200 SCHEMA 
> public postgres
> pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner 
> of schema public
>     Command was: DROP SCHEMA public;
>
> pg_restore: [archiver (db)] could not execute query: ERROR:  schema 
> "public" already exists
>     Command was: CREATE SCHEMA public;
>
>
>
> pg_restore: [archiver (db)] Error from TOC entry 2803; 0 0 COMMENT SCHEMA 
> public postgres
> pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner 
> of schema public
>     Command was: COMMENT ON SCHEMA public IS 'standard public schema';
>
>
>
> pg_restore: WARNING:  no privileges could be revoked for "public"
> pg_restore: WARNING:  no privileges could be revoked for "public"
> pg_restore: WARNING:  no privileges were granted for "public"
> pg_restore: WARNING:  no privileges were granted for "public"
> WARNING: errors ignored on restore: 3
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 3; 2615 2200 SCHEMA 
> public postgres
> pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner 
> of schema public
>     Command was: DROP SCHEMA public;
>
> pg_restore: [archiver (db)] could not execute query: ERROR:  schema 
> "public" already exists
>     Command was: CREATE SCHEMA public;
>
>
>
> pg_restore: [archiver (db)] Error from TOC entry 2803; 0 0 COMMENT SCHEMA 
> public postgres
> pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner 
> of schema public
>     Command was: COMMENT ON SCHEMA public IS 'standard public schema';
>
>
>
> pg_restore: WARNING:  no privileges could be revoked for "public"
> pg_restore: WARNING:  no privileges could be revoked for "public"
> pg_restore: WARNING:  no privileges were granted for "public"
> pg_restore: WARNING:  no privileges were granted for "public"
> WARNING: errors ignored on restore: 3
> Completed.
>
> After the restore has finished and foreman services restarted i receive 
> the following from the front end page:
>
> *Service unavailable *ERF64-6496 [Foreman::MaintenanceException]: There 
> are migrations pending in the system.
>
> Any ideas?
>
> On Tuesday, March 7, 2017 at 8:12:45 AM UTC, James Denton wrote:
>>
>> Thanks Josh, what is the best way to migrate all the puppet modules?
>>
>> On Monday, March 6, 2017 at 12:56:14 PM UTC, Josh wrote:
>>>
>>> The easiest way to do this is to simply take a backup of your Foreman 
>>> database and re-import it into your new Foreman instance.
>>>
>>> On Mon, Mar 6, 2017 at 5:35 AM, James Denton <[email protected]> wrote:
>>>
>>>> Hi
>>>>
>>>> As later versions of Foreman are no longer supported on RHEL6 we have 
>>>> decided to build a new Foreman/Puppet master server on RHEL7 with the 
>>>> latest versions. Is there any documentation, previous questions on how to 
>>>> migrate current Foreman specific files/data including for example - nodes, 
>>>> host groups, config groups, puppet modules etc... from the existing 
>>>> Foreman 
>>>> installation to the new server?
>>>>
>>>> Any help would be appreciated. 
>>>>
>>>> Thanks!
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Foreman users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/foreman-users.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to