Tuesday, June 17, 2008

Re: [pgsql-es-ayuda] Copia y restauracion de base de datos de GForge

En el archivo de respaldo de SQL:

--
-- PostgreSQL database dump
--

-- Started on 2008-06-13 09:47:49 CEST

SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

ALTER TABLE ONLY public.wiki_version DROP CONSTRAINT wikipageid_fk;
ALTER TABLE ONLY public.user_project_role DROP CONSTRAINT userprojectid_fk;
ALTER TABLE ONLY public.tracker_my_queue DROP CONSTRAINT userid_fk;
[...]
DROP TRIGGER users_ts_update ON public."user";
DROP TRIGGER tracker_item_update_trigg ON public.tracker_item;
DROP TRIGGER tracker_item_ts_update ON public.tracker_item;
[...]
DROP RULE wikipagefilesystemdelete_rule ON public.wiki_version;
DROP RULE wikipage_association_delete_rule ON public.wiki_page;
DROP RULE trackeritem_insert_rule ON public.tracker_item;
[...]
DROP INDEX public.wikiversion_wikipageidpageversion;
DROP INDEX public.wikipage_secionrefidpagename;
DROP INDEX public.users_idxfti;
[...]
ALTER TABLE ONLY public.wiki_version DROP CONSTRAINT wiki_version_pkey;
ALTER TABLE ONLY public.wiki_page DROP CONSTRAINT wiki_page_pkey;
ALTER TABLE ONLY public.wiki_page_link DROP CONSTRAINT wiki_page_link_pkey;
[...]
DROP TABLE public.wiki_version;
DROP TABLE public.wiki_page_link;
DROP TABLE public.wiki_page;
[...]
DROP SEQUENCE public.user_project_user_project_id_seq;
[...]
DROP OPERATOR public.= (tsvector, tsvector);
DROP OPERATOR public.<> (tsvector, tsvector);
DROP OPERATOR public.<= (tsvector, tsvector);
DROP OPERATOR public.< (tsvector, tsvector);
DROP FUNCTION public.update_vectors();
DROP FUNCTION public.update_last_modified_date();
DROP FUNCTION public.tsvector_ne(tsvector, tsvector);
DROP FUNCTION public.tsvector_lt(tsvector, tsvector);
DROP FUNCTION public.tsvector_le(tsvector, tsvector);
DROP FUNCTION public.tsvector_gt(tsvector, tsvector);
[...]
DROP TYPE public.tokentype;
DROP TYPE public.tokenout;
DROP TYPE public.statinfo;
[...]
DROP PROCEDURAL LANGUAGE plpgsql;
DROP SCHEMA public;
--
-- TOC entry 4 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA public;
[...]
--
-- TOC entry 584 (class 2612 OID 16387)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner:
--

CREATE PROCEDURAL LANGUAGE plpgsql;


--
-- TOC entry 79 (class 1255 OID 16557)
-- Dependencies: 4
-- Name: gtsvector_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION gtsvector_in(cstring) RETURNS gtsvector
AS '$libdir/tsearch2', 'gtsvector_in'
LANGUAGE c STRICT;


ALTER FUNCTION public.gtsvector_in(cstring) OWNER TO postgres;
[...]
CREATE TABLE wiki_version (
wiki_version_id serial NOT NULL,
wiki_page_id integer NOT NULL,
page_version integer NOT NULL,
posted_by integer NOT NULL,
refs text,
last_modified_date timestamp with time zone DEFAULT now(),
score integer,
hits integer,
create_date timestamp with time zone
);


ALTER TABLE public.wiki_version OWNER TO gforge;

--
-- TOC entry 2827 (class 0 OID 0)
-- Dependencies: 1640
-- Name: wiki_version_wiki_version_id_seq; Type: SEQUENCE SET; Schema:
public; Owner: gforge
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('wiki_version',
'wiki_version_id'), 7, true);


--
-- TOC entry 2704 (class 0 OID 16956)
-- Dependencies: 1613
-- Data for Name: activity_log; Type: TABLE DATA; Schema: public; Owner: gforge
--

COPY activity_log (activity_date, project_id, page, activity_type) FROM stdin;
\.


--
-- TOC entry 2749 (class 0 OID 18141)
COPY association (section, ref_id, to_section, to_ref_id, "comment") FROM stdin;
trackeritem 10 trackeritem 12 Es necesario
trackeritem 10 trackeritem 11 Es necesario
trackeritem 18 trackeritem 5 TambiÃ(c)n en el upgrade
trackeritem 74 trackeritem 18 Relacionado
trackeritem 112 trackeritem 95 Asociado a esta tarea
trackeritem 18 trackeritem 134
trackeritem 78 trackeritem 143 Tarea Fran
trackeritem 167 trackeritem 106 Puede necesitar
tambiÃ(c)n la tarjetería Avaya que comenta Dani.
\.


--
-- TOC entry 2667 (class 0 OID 16658)
-- Dependencies: 1554
-- Data for Name: audit_trail; Type: TABLE DATA; Schema: public; Owner: gforge
--

COPY audit_trail (audit_trail_id, change_date, user_id, section,
ref_id, field_name, new_value, old_value) FROM stdin;
1 2008-05-21 09:58:38.326763+02 103 user_project 4
\N 103 \N
[...]

Como ves, primero borra toda la BBDD, ya que el pg_dump le paso la
opcion -c, y después crea la BBDD, y por último hace el copy.

Da errores desde el principio, aunque existen todos los datos, y la
base de datos...

No lo entiendo... :S

El 17/06/08, Clemente López Giner <clemenlg@gmail.com> escribió:
> Restaurando la copia de la BBDD de
> /backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql
> SET
> SET
> SET
> SET
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:13:
> ERROR: no existe la restricción «wikipageid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:14:
> ERROR: no existe la restricción «userprojectid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:15:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:16:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:17:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:18:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:19:
> ERROR: no existe la relación «public.users_idx»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:20:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:21:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:22:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:23:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:24:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:25:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:26:
> ERROR: no existe la restricción «userid_fk»
> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:27:
> ERROR: no existe la restricción «userid_fk»
>
> Eso es lo primero que saca, como ves, no parece que de ninguno acerca de
> copy...
>
> 2008/6/13, Alvaro Herrera <alvherre@alvh.no-ip.org>:
>> Clemente López Giner escribió:
>>> Para crear la copia de la bbdd lo he hecho con pg_dump:
>>> pg_dump -c -v -f $ARCHIVEROOT/$INCREMENTDIR/$BACKUP_BBDD -U $USERNAME
>>> $DBNAME
>>> Y para restaurarla, con:
>>> psql -f $ARCHIVEROOT/$INCREMENTDIR/$BACKUP_BBDD -d $DBNAME -U $USERNAME
>>>
>>> Pero nada, me sigue dando errores
>>>
>>> Algunos errores al restaurarlo (me da muchos):
>>> psql:/backup/diarias/GForge/backup_13-06-2008/bbdd_GForge_13-06-2008.sql:32134:
>>> ERROR: error de sintaxis en o cerca de «1» en el carácter 1
>>
>> [...]
>>
>> Debe haber errores antes que esos. Por favor muestra los primeros
>> errores que da. Tiene que haber uno sobre falla de la orden COPY, antes
>> que este error de sintaxis.
>>
>> PD: por favor no te olvides de copiar la lista.
>>
>> --
>> Alvaro Herrera
>> http://www.PlanetPostgreSQL.org/
>> "En el principio del tiempo era el desencanto. Y era la desolación. Y
>> era
>> grande el escándalo, y el destello de monitores y el crujir de teclas."
>> ("Sean los Pájaros Pulentios", Daniel Correa)
>>
>
--
TIP 9: visita nuestro canal de IRC #postgresql-es en irc.freenode.net

No comments: