Home > Archive > SQL Anywhere database replication > July 2005 > How to replicate a whole database









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to replicate a whole database
Manuel Rodriguez

2005-07-26, 9:23 am

I wanto to know that is the easier way to replicate a whole database usign
asa 9


Reg Domaratzki \(iAnywhere Solutions\)

2005-07-27, 11:24 am

Step 1 : Create a Publication that includes all the tables in the database.
Here's some SQL that adds all tables in the database not owned by SYS,
PUBLIC, dbo, rs_systabgroup and SA_DEBUG into a publication called p1 owned
by DBA. You might want to cut and paste this code if you're going to use
it, since there's mix of single and double quotes that might be hard to
decipher based on what font you're viewing the code with.

begin
declare @sql_stmt long varchar;
select 'create publication "DBA"."p1" ( ' || list ('TABLE "' ||
sup.user_name || '"."' || st.table_name || '"' ) || ')'
into @sql_stmt
from SYSTABLE st key join SYSUSERPERM sup
where creator not in (0,2,3,4,5);
execute immediate @sql_stmt;
end;

Step 2 : Create a Publisher for the consolidated database, and define the
address for the consolidated user

GRANT CONNECT TO cons;
GRANT PUBLISH TO cons;
CREATE REMOTE MESSAGE TYPE FILE ADDRESS 'c:\\msgs\\cons';

Step 3 : Create a Remote user and subscribe the user to the publication.

GRANT CONNECT TO rem1;
GRANT REMOTE TO rem1 TYPE FILE ADDRESS 'c:\\msgs\\rem1';
CREATE SUBSCRIPTION TO p1 for rem1;

Step 4 : Create the remote database

dbxtract -c " eng=cons;uid=dba;pwd
=sql" -an rem1.db rem1

Step 5 : Create the message directories

mkdir c:\msgs\cons
mkdir c:\msgs\cons

Step 6 : Start running dbremote




--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL

"Manuel Rodriguez" < ManuelRodriguez24@ya
hoo.com> wrote in message
news:42e63ecb@forums
-1-dub...
> I wanto to know that is the easier way to replicate a whole database usign
> asa 9
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com