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

how to clone a dataset?



I want to create a clone of a dataset except with a different dataset name and different users. Both versions need to be "live" simultaneously.

The idea is to be able to play around with the data set without risk of damaging live data. Of course it would also be a useful trick for migrating to a new server.

Below are my own notes of what I used to do for SQL-ledger. Does it still work for LSMB 1.2 ?


thanks...

David.




CREATING A COPY OF A DATASET ON SQL-Ledger:
these notes relate to either:
 * moving an old SL install to a new host, or
 * creating a clone of data on the same host
1) login to SL to access the dataset to be copied
2) use System/Backup/SaveToFile, which creates a SQL script of the
data. This has to be done on the localhost, as the browser will retrieve the
backup file to whichever machine it's on. It must be on localhost for the
next steps.
3) if appropriate, move back up file to the new host. In any case, gunzip it.
4) use SL's administration screen to create a new default dataset called
<NewDataBaseName>. The contents will be over-written, so default is fine.
5) at a console window...
6) Login to postgresql   e.g.:
   ..hidden..:~# su - postgres
   ..hidden..:~$ psql -h localhost -U  sql-ledger -d <NewDataBaseName>
   password (see createuser above)
7) at the psql  prompt... type..     \i  </path/to/oldbackupunzipped>
this uses the backup file created at 3) as input commands to recreate the dbase.
8) you should now be able to log in to your old data on the new copy.