NCSC-NL / taranis3

Taranis
Other
59 stars 17 forks source link

Migrating postgresql sql.gz to new database not working #12

Closed ScorpionKing34 closed 5 years ago

ScorpionKing34 commented 5 years ago

The issue is, if you have two servers called server01 and server02. server01 has taranis 3.3.4 with db named rss and user rss (Production). server02 has taranis 3.4.3 with db named taranis and user taranis (Semi-Production).

I have tried to import the rss db in to taranis db by renaming the taranis db and owner to rss. But I get SQL syntax error and eventually I get the error 'out of memory'. So I must rerun the installer to login to the new server.

server01 runs on OS Ubuntu 16.04 LTS server server02 runs on OS Ubuntu 18.04 LTS server

example sql error: username character varying(50) NOT NULL, token text NOT NULL, created timestamp with time zone DEFAULT now(), last_access timestamp with time zone DEFAULT now(), expiry_time integer ); 2018-10-03 10:57:50.242 UTC [87571] rss@rss ERROR: must be owner of relation access_token 2018-10-03 10:57:50.242 UTC [87571] rss@rss STATEMENT: ALTER TABLE public.access_token OWNER TO rss; 2018-10-03 10:57:50.242 UTC [87571] rss@rss ERROR: relation "advisory_damage" already exists 2018-10-03 10:57:50.242 UTC [87571] rss@rss STATEMENT: CREATE TABLE public.advisory_damage ( advisory_id integer NOT NULL, damage_id integer NOT NULL ); 2018-10-03 10:57:50.242 UTC [87571] rss@rss ERROR: must be owner of relation advisory_damage 2018-10-03 10:57:50.242 UTC [87571] rss@rss STATEMENT: ALTER TABLE public.advisory_damage OWNER TO rss; 2018-10-03 10:57:50.242 UTC [87571] rss@rss ERROR: relation "advisory_forward_damage" already exists 2018-10-03 10:57:50.242 UTC [87571] rss@rss STATEMENT: CREATE TABLE public.advisory_forward_damage ( damage_id integer NOT NULL, advisory_forward_id integer NOT NULL ); 2018-10-03 10:57:50.243 UTC [87571] rss@rss ERROR: must be owner of relation advisory_forward_damage

This is for all elements in the database.

I hope that the developers have a solution. In the mean time I am still trying to solve this.

with kind regards from Ben B

ScorpionKing34 commented 5 years ago

After couple of tries I have resolved this I having. So, the old db is imported in to new server.

Solution: unzip sql.gz file to .sql and then run the following command: psql -f postgres (without "<>") Then he will import the database.