cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
quannv
Level 7

Import database from mer log

My English not good but i only want to share a trick for u.

When export mer log i have 2 file mtadb and rptdb in folder bin.


I need create some report for my customer but not affecter to their system.

so i import mtadb and rptdb to orther machine.

and this is checklist i did to import db:

1 - Use livecd upload 2 files: mtadb & rptdb to folder deferred

2 - Drop old database and create new database

   + # psql -U postgres

     # SELECT pg_terminate_backend(pg_stat_activity.pid)

        FROM pg_stat_activity

        WHERE pg_stat_activity.datname='mtadb'

Repeat multi time ulti see (0 rows) if u cant drop, try sometime.

     # DROP DATABASE mtadb;

+ # SELECT pg_terminate_backend(pg_stat_activity.pid)

       FROM pg_stat_activity

       WHERE pg_stat_activity.datname='reports';

     # DROP DATABASE reports;

+ CREATE DATABASE reports;

+ CREATE DATABASE mtadb;

3 - import database

+ # psql -U postgres mtadb < mtadb-20141202T073157.sql

+ # psql -U postgres reports < rptdb-20141202T073105.sql

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

this isn't regularize, it's only a trick i did.

0 Kudos