gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Corrupt database


From: Jerzy Luszawski
Subject: Re: [Gnumed-devel] Corrupt database
Date: Thu, 30 May 2013 21:04:42 +0200

On 30-05-2013 16:57 "Vaibhav Banait" <address@hidden> wrote:

> I have renamed gnumed _v18 to gnumed-_v18 old and bootstrapped. I can access 
> data old system by renaming and then connecting. Plan is to write soaps as 
> pdf for all 300 patients and attach the pdf as documents to present system at 
> leasure time. 
> This work can be eased if I can import demographic table. 
I have recently successfully copied necessary reference data and
populated database with patients' demographic data.
You may have a look at my messages from Sun, 28 Apr 2013 20:01:10
+0200, Subject: [Gnumed-devel] import patient data - basic procedure
and another one: Subject: [Gnumed-devel] "reference"/"enum" tables
outside "ref" schema Date: Sun, 28 Apr 2013 21:01:10 +0200 and follow
these threads.

I tried to describe the procedure with details. Maybe it will be help
you. If it needs clarification - just ask.

> I had taken backup from schema dem, but I am not sure
> 1. Restoring the particular table will cause any problem with fresh database 
You can restore selected tables as long as they fulfil the reference
constraints. This should be handled properly by GUI software you use
(are you using pgadmin or something else?)

> 2. How to drop a readonly table 
You must have enough privileges to change the session from read-only to
read-write. Use: 
set session characteristics as transaction READ WRITE ;
The next statements within the same session can write data and delete
objects. Or temporary change the default transaction type to RW. It's
up to you.

> 3. Is there any other way of copying one table to other.
Sure. The one I use utilizes extension 'dblink'. You can then execute
statement like this (when connected to your TARGET database):
---- example ----
insert into clin.soap_cat_ranks (rank, soap_cat)
select *
from dblink('dbname=<your db> host=<host or socket> port =
<port> ',
            'SELECT rank, soap_cat
  FROM clin.soap_cat_ranks;')
       as t1(
  rank integer,
  soap_cat character(1))

For more info see
http://www.postgresql.org/docs/9.1/static/contrib-dblink-function.html

> 4. How can I check a database integrity regularly. Can it be automated.
What you would like to check? 
The purpose of creating constraints and triggers is to ensure
integrity, and when you restore them together with data - everything
should be right. 

-- 
Jerzy Luszawski



reply via email to

[Prev in Thread] Current Thread [Next in Thread]