{"action":"created","issue":{"url":"https://api.github.com/repos/pivotalservices/cfops/issues/81","repository_url":"https://api.github.com/repos/pivotalservices/cfops","labels_url":"https://api.github.com/repos/pivotalservices/cfops/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/pivotalservices/cfops/issues/81/comments","events_url":"https://api.github.com/repos/pivotalservices/cfops/issues/81/events","html_url":"https://github.com/pivotalservices/cfops/issues/81","id":151670049,"number":81,"title":"ERT Restore fails using Postgres DB","user":{"login":"jtgammon","id":3753557,"avatar_url":"https://avatars.githubusercontent.com/u/3753557?v=3","gravatar_id":"","url":"https://api.github.com/users/jtgammon","html_url":"https://github.com/jtgammon","followers_url":"https://api.github.com/users/jtgammon/followers","following_url":"https://api.github.com/users/jtgammon/following{/other_user}","gists_url":"https://api.github.com/users/jtgammon/gists{/gist_id}","starred_url":"https://api.github.com/users/jtgammon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtgammon/subscriptions","organizations_url":"https://api.github.com/users/jtgammon/orgs","repos_url":"https://api.github.com/users/jtgammon/repos","events_url":"https://api.github.com/users/jtgammon/events{/privacy}","received_events_url":"https://api.github.com/users/jtgammon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-28T15:19:07Z","updated_at":"2016-05-13T18:39:59Z","closed_at":null,"body":"CFOPS ERT restore is failing when the backend is postgres. We did a **manual** restore using the cfops backup data and it worked. Issue appears to be with the cfops restore. We believe it is the lack of the \"--clean\" option in the pg_restore command. The cfops restore resulted in the cc being unable to start. 1st instance of CC showed starting, 2nd instance of CC showed stopped, and CC worker showed failing.\r\n\r\nWe later tried a manual restore and it worked. Below are the working steps that we used:\r\n\r\n**ERT Restore log:**\r\n[ert.log.gz](https://github.com/pivotalservices/cfops/files/240792/ert.log.gz)\r\n\r\nerror:\r\n2016/04/27 10:50:21 E0427 10:50:21.097533 6309 execute_list.go:15] Process exited with: 1. Reason was:  ()\r\n2016/04/27 10:50:19 D0427 10:50:19.678913 6309 execute_list.go:12] PGPASSWORD=270a0e10f2739c8f /var/vcap/packages/postgres-9.4.2/bin/pg_restore -h localhost -U vcap -x -p 2544 -c -d uaa /tmp/archive.backup\r\n**Note**: No \"--clean\" option\r\n\r\n\r\n\r\n**Working manual steps:**\r\nbosh stop cloud_controller-partition-d46fdf5eca88a5c00fc7 0\r\nbosh stop cloud_controller-partition-d46fdf5eca88a5c00fc7 1\r\n \r\nccdb\r\n   vcap@10.47.104.7    030df4fe78359255\r\n \r\n./pg_restore -U vcap -p 2544 -d ccdb --clean /tmp/ccdb.sql\r\n \r\nbosh stop uaa-partition-d46fdf5eca88a5c00fc7 0\r\nbosh stop uaa-partition-d46fdf5eca88a5c00fc7 1\r\n \r\nuaadb\r\n    vcap@10.47.104.8                         270a0e10f2739c8f\r\n  \r\n./pg_restore -U vcap -p 2544 -d uaa --clean /tmp/uaadb.backup\r\n./pg_restore -U vcap -p 2544 -v -d console --clean /tmp/consoledb.backup\r\n**Note**: Includes \"--clean\" option\r\n \r\nNFS Remote restore:\r\ncat nfs_server.backup | ssh vcap@host \"tar xvzf - -C /var/vcap/store\"\r\nmysql/0  10.47.104.18\r\n \r\nmysql -h localhost -u root -p < /tmp/mysql.backup\r\nmysql -u root -p -h localhost\r\n> flush flush privileges;\r\n \r\nbosh start uaa-partition-d46fdf5eca88a5c00fc7 0\r\nbosh start uaa-partition-d46fdf5eca88a5c00fc7 1\r\n \r\nbosh start cloud_controller-partition-d46fdf5eca88a5c00fc7 0\r\nbosh start cloud_controller-partition-d46fdf5eca88a5c00fc7 1\r\n "},"comment":{"url":"https://api.github.com/repos/pivotalservices/cfops/issues/comments/219126281","html_url":"https://github.com/pivotalservices/cfops/issues/81#issuecomment-219126281","issue_url":"https://api.github.com/repos/pivotalservices/cfops/issues/81","id":219126281,"user":{"login":"calebwashburn","id":16271787,"avatar_url":"https://avatars.githubusercontent.com/u/16271787?v=3","gravatar_id":"","url":"https://api.github.com/users/calebwashburn","html_url":"https://github.com/calebwashburn","followers_url":"https://api.github.com/users/calebwashburn/followers","following_url":"https://api.github.com/users/calebwashburn/following{/other_user}","gists_url":"https://api.github.com/users/calebwashburn/gists{/gist_id}","starred_url":"https://api.github.com/users/calebwashburn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calebwashburn/subscriptions","organizations_url":"https://api.github.com/users/calebwashburn/orgs","repos_url":"https://api.github.com/users/calebwashburn/repos","events_url":"https://api.github.com/users/calebwashburn/events{/privacy}","received_events_url":"https://api.github.com/users/calebwashburn/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T18:39:59Z","updated_at":"2016-05-13T18:39:59Z","body":"Not sure what all is included in typical pg_dump but looks like -x is there to prevent restoring roles.  Which seems like it should be there if restoring from scratch... Let me know if you have a place to test this and can add a draft release without this option."}}