Friday, June 17, 2005

 

Copying a database

Warning: this is a VERY simplistic overview.

Today I had to grab a database on one system and put it up on another: structure, data and all. Here are the basic steps (refer to Sybooks for more detailed information):

1. On the base machine, dump the database

1> use master
2> go

1> dump database fk6_5_latest_release to "/tmp/db_name.dmp"
2> go

This will create some messages.

2. Move the dump file to the target machine

In this case, the target machine had an FTP server, so I FTP'd the dump file over. Due to its size, it took awhile. After confirming it was there, I deleted it from the base machine.

3. On the target machine, make sure the backupserver is running

You can not do dump or load without the backupserver running.

4. Create or check the devices on which you will be created this database

disk init name="data1",physname="/usr/local2/data1",size="2500M"
go

disk init name="log1",physname="/usr/local2/log1",size="1250M"
go

sp_helpdevice
go

5. Create the database on the target machine

create database db_name on data1=2500 log on log1=1250
go

6. Load the dump file into this new database

load database db_name from "/usr/local2/db_name.dmp"
go

7. Bring the new database online

online database db_name
go

use db_name
go

Comments:
Well, what about master database? :-)
Rebuild with buildmaster looks little bit tricky...
 
Also we can use Embarcadero to migrate database from one machine to another!
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?