PROCEDURE TO CREATE POSTGRES VERSION OF HISTDATA ...

assistantashamedData Management

Nov 29, 2012 (4 years and 4 months ago)

183 views

===============================================================

PROCEDURE TO CREATE POSTGRES VERSION OF HISTDATA DATABASE



===============================================================


Script create_pgdb will create a postgres database from the inform
ix histdata database.
This script needs to run on a machine that can access the informix database "histdata" and
a linux box that can create a postgres database.


The top level directory to run this script is /awips/hydroapps/lx/rfc/idma/pgdb. Its
locati
on is hardwired at the top of script "create_pgdb". Below this directory must exist
the following subdirectories:



/awips/hydroapps/lx/rfc/idma/pgdb/...


scripts


(contains all the needed scripts and files)


database

(initially empty and will contain dat
abase info)


logs


(initially empty and will contain log files)


Log on to any machine with access to the informix database as oper, and execute the
following commands to create the postgres version of the histdata database:



cd /awips/hydroapps/lx/rfc/id
ma/pgdb/scripts


create_pgdb
-
run
-
hostin <inf host>
-
hostpg <pg host> histdata


where <inf host> is the name of the machine that hosts the informix database, and <pg
host> is the machine that will host the postgres database.


This will take about 15 minut
es to complete. There are 15 tables created in the postgres
histdata database:



ncdc_15min_inv


ncdc_hly_inv


ncdc_sao_sta


ncdc_td3200_sta


ncdc_td3200_inv


scs_snt_inv


scs_snt_sta


state_codes


sysmenus


sysmenuitems


usgs_water_sta


usgs_water_inv


u
sgs_pflow_sta


usgs_pflow_sta_loc


usgs_inv


After the postgres conversion is completed, to see the new db that has been created, type
in the command:



psql
-
l



You should see the following:



Name | Owner | Encoding

----------------
+
-------
---
+
-----------


ob6_histdata | oper | SQL_ASCII


To check for correct information on the new ob6_histdata postgres database, type in the
following:



psql ob6_histdata


select count(*) from ncdc_td3200_sta;


There should be an identical number of ro
ws returned by this query on the postgres
database as is returned by the same query on the informix database. Repeat this process
for all tables. All tables should have an identical number of rows between postgres and
informix.


Additionally, check the

file,
/awips/hydroapps/lx/rfc/idma/pgdb/logs/ob6_histdata.psql.out. There should be no errors
reported in this file. If there are errors, then remove the directory
/awips/hydroapps/lx/rfc/idma/pgdb/database/histdata.exp and execute the create_pgdb
comma
nd, given above, again. If errors are again reported, contact the HSD RFC
Support Team.


NOTE: To run the script create_pgdb again, the directory
/awips/hydroapps/lx/rfc/idma/pgdb/database/histdata.exp must be removed!