Commit d8d15d05 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

database: Revision 7

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parent 15500e94
......@@ -19,6 +19,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This script executes all the processes needed to load the new data into the
# database in a parallel way whenever possible
if test $# -ne 3; then
printf "Usage: ./load.sh <database> <sa_dump_file> <dump_file>\n"
exit 1
......@@ -36,11 +39,25 @@ pg_dump ${DUMPPARAM} -T dm_* -f "${dump_file}" ${database}
date +"Backup completed at %F %T"
date +"Data warehouse load started at %F %T"
psql -d ${database} -f "${PREFIX}/load_data_warehouse.sql"
psql -d ${database} -c "select load_data_warehouse();"
psql -d ${database} -f "${PREFIX}/load_dim_dw.sql"
psql -d ${database} -f "${PREFIX}/load_invent_dw.sql"
psql -d ${database} -f "${PREFIX}/load_nu_dw.sql"
psql -d ${database} -c "select load_dim_dw();"
psql -d ${database} -c "select load_invent_dw();" &
psql -d ${database} -c "select load_nu_dw();" &
wait
date +"Data warehouse load finished at %F %T"
date +"Data marts load started at %F %T"
psql -d ${database} -f "${PREFIX}/load_data_marts.sql"
psql -d ${database} -c "select load_data_marts();"
psql -d ${database} -f "${PREFIX}/load_avail_dm.sql"
psql -d ${database} -f "${PREFIX}/load_invent_dm.sql"
psql -d ${database} -f "${PREFIX}/load_audit_dm.sql"
psql -d ${database} -f "${PREFIX}/load_alert_dm.sql"
psql -d ${database} -f "${PREFIX}/load_nu_dm.sql"
psql -d ${database} -c "select load_avail_dm();" &
psql -d ${database} -c "select load_invent_dm();" &
psql -d ${database} -c "select load_audit_dm();" &
psql -d ${database} -c "select load_alert_dm();" &
psql -d ${database} -c "select load_nu_dm();" &
wait
date +"Data marts load finished at %F %T"
This diff is collapsed.
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of database
#
# database is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This script executes all the processes needed to load the new data into the
# database in a sequential way
if test $# -ne 3; then
printf "Usage: ./seq_load.sh <database> <sa_dump_file> <dump_file>\n"
exit 1
fi
PREFIX="$(dirname $(readlink -f $0))"
DUMPPARAM="-Fc -b"
database=$1
sa_dump_file=$2
dump_file=$3
date +"Backup started at %F %T"
pg_dump ${DUMPPARAM} -t sa_* -f "${sa_dump_file}" ${database}
pg_dump ${DUMPPARAM} -T dm_* -f "${dump_file}" ${database}
date +"Backup completed at %F %T"
date +"Data warehouse load started at %F %T"
psql -d ${database} -f "${PREFIX}/load_data_warehouse.sql"
psql -d ${database} -c "select load_data_warehouse();"
date +"Data warehouse load finished at %F %T"
date +"Data marts load started at %F %T"
psql -d ${database} -f "${PREFIX}/load_data_marts.sql"
psql -d ${database} -c "select load_data_marts();"
date +"Data marts load finished at %F %T"
......@@ -29,14 +29,21 @@ fi
database=$1
limit=$2
count=0
count=1
command="insert into sa_inventory (contact_date, project, inep, machine,
os_type, os_distro, kernel, processor, memory_size, hd_model, hd_size,
hd_used, hd2_model, hd2_size, hd2_used, extra_hds) select contact_date -
${count}, project, inep, machine, os_type, os_distro, kernel, processor,
memory_size, hd_model, hd_size, hd_used, hd2_model, hd2_size, hd2_used,
extra_hds from sa_inventory"
while test ${count} -lt ${limit}; do
psql -d ${database} -c "insert into sa_inventory (contact_date, project,
command="${command} union all select contact_date - ${count}, project,
inep, machine, os_type, os_distro, kernel, processor, memory_size,
hd_model, hd_size, hd_used, hd2_model, hd2_size, hd2_used, extra_hds)
select contact_date - ${count}, project, inep, machine, os_type,
os_distro, kernel, processor, memory_size, hd_model, hd_size, hd_used,
hd2_model, hd2_size, hd2_used, extra_hds from sa_inventory;"
hd_model, hd_size, hd_used, hd2_model, hd2_size, hd2_used, extra_hds
from sa_inventory"
((count++))
done
command="${command};"
test ${limit} -gt 0 && psql -d ${database} -c "${command}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment