Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can i import this sql dump?

Posted on 2012-03-27
4
Medium Priority
?
484 Views
Last Modified: 2012-04-26
Hi folks.  I have a firewall device that dumps some SQL info that i would like to import into another postgresql server.  attached is what gets dumped but i get errors importing.  Can anyone tell me what i need to change here to be able to import this into another database?

thanks.

--
-- PostgreSQL database dump
--

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

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: usage_stat_raw_10272011; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE usage_stat_raw_10272011 (
    usage_stat_id bigserial NOT NULL,
    interval_start_time timestamp without time zone DEFAULT now(),
    interval_end_time timestamp without time zone DEFAULT now(),
    report_id bigint,
    username character varying(65),
    content_category_type integer,
    ip_protocol character varying(20),
    total_packet_count bigint DEFAULT 0,
    total_block_count bigint DEFAULT 0,
    total_byte_count bigint DEFAULT 0,
    total_upstream_byte_count bigint DEFAULT 0,
    use_time bigint DEFAULT 0,
    total_downstream_byte_count bigint DEFAULT 0,
    full_report_stat integer,
    reporting_group integer DEFAULT 0,
    total_upstream_packet_count bigint DEFAULT 0,
    total_downstream_packet_count bigint DEFAULT 0,
    content_category_type_name character varying(20),
    filtering_group_number integer,
    firstname character varying(40) DEFAULT ''::character varying,
    lastname character varying(40) DEFAULT ''::character varying,
    filtering_group_name character varying(65) DEFAULT ''::character varying,
    interval_seconds bigint DEFAULT 0,
    aggregate_bandwidth integer DEFAULT 1,
    "location" character varying(60)
);


ALTER TABLE public.usage_stat_raw_10272011 OWNER TO postgres;

--
-- Name: usage_stat_raw_10272011_usage_stat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('usage_stat_raw_10272011', 'usage_stat_id'), 1674380, true);


--
-- Data for Name: usage_stat_raw_10272011; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY usage_stat_raw_10272011 (usage_stat_id, interval_start_time, interval_end_time, report_id, username, content_category_type, ip_protocol, total_packet_count, total_block_count, total_byte_count, total_upstream_byte_count, use_time, total_downstream_byte_count, full_report_stat, reporting_group, total_upstream_packet_count, total_downstream_packet_count, content_category_type_name, filtering_group_number, firstname, lastname, filtering_group_name, interval_seconds, aggregate_bandwidth, "location") FROM stdin;
1	2011-10-27 02:10:36.123041	2011-10-27 02:10:36.123041	0	*10.100.100.100	1		1192	0	229642	149469	0	80173	0	0	668	524	All	1			NoInternet	3602	0	
2	2011-10-27 02:10:36.123041	2011-10-27 02:10:36.123041	0	*10.101.100.101	1		1603	0	398948	168716	0	230232	0	0	805	798	All	1			NoInternet	3602	0
\.

--
-- Name: pk_usage_stat_raw_10272011_usage_stat_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY usage_stat_raw_10272011
    ADD CONSTRAINT pk_usage_stat_raw_10272011_usage_stat_id PRIMARY KEY (usage_stat_id);


--
-- Name: ix_usage_stat_raw_10272011_cct_un; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_cct_un ON usage_stat_raw_10272011 USING btree (content_category_type, username);


--
-- Name: ix_usage_stat_raw_10272011_cct_un_protocol; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_cct_un_protocol ON usage_stat_raw_10272011 USING btree (username, content_category_type, ip_protocol);


--
-- Name: ix_usage_stat_raw_10272011_content_category_type; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_content_category_type ON usage_stat_raw_10272011 USING btree (content_category_type);


--
-- Name: ix_usage_stat_raw_10272011_q1; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_q1 ON usage_stat_raw_10272011 USING btree (interval_start_time, full_report_stat, report_id, username, ip_protocol, content_category_type, total_byte_count);


--
-- Name: ix_usage_stat_raw_10272011_q2; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_q2 ON usage_stat_raw_10272011 USING btree (full_report_stat, report_id, username, ip_protocol, content_category_type, total_byte_count);


--
-- Name: ix_usage_stat_raw_10272011_usage_stat_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX ix_usage_stat_raw_10272011_usage_stat_id ON usage_stat_raw_10272011 USING btree (usage_stat_id);


--
-- PostgreSQL database dump complete
--

Open in new window

0
Comment
Question by:linuxrox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:johanntagle
ID: 37774424
what is the error you are getting?
0
 

Author Comment

by:linuxrox
ID: 37776718
i was using the program "navicat for postgresql" to import this file and apply it to the database and it just sits there and loops forever and nothing happens.  I guess I need to know how to properly import information like this into a postgreSQL database server.

how can i do that via the console?
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 2000 total points
ID: 37780240
The simplest is "psql dbname < dumpfile"

See http://www.postgresql.org/docs/8.1/static/backup.html
0
 

Author Comment

by:linuxrox
ID: 37781630
ahh i see.  i'll try that and get back.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question