Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003
    Posts
    4

    Unanswered: How to synchronize 2 Databases?

    Hi everyone,

    I have 2 Oracle 8 databases that need to be synched on a regular basis.
    I do it using imp/exp utilities but now I need to create a script/batch file that the users of these databases could run without my help. The DBs reside on different machines (server and laptop).
    I wrote a script to upload server database to the laptop but it doesn't work for some reason. Here is what have so far:

    Server to Laptop script:
    (where LAPTOPDB = database name on laptop, SERVERDB = database name on server, D:\ = network drive to Server DB machine, C:\ = laptop drive where Laptop database resides)


    ------------------------SERVER_TO_LAPTOP.cmd--------------------------

    set local=SERVERDB
    call svrmgrl @c:\stop_SERVERDB.sql

    set local=LAPTOPDB.world
    svrmgrl.exe @c:\stop_LAPTOPDB.sql

    delete c:\LAPTOPDB_DATA_BACKUP\*.*

    move C:\Oracle\oradata\LAPTOPDB\*.dbf c:\LAPTOPDB_DATA_BACKUP

    move C:\oracle\ora81\database\control01.ctl c:\LAPTOPDB_DATA_BACKUP

    move C:\oracle\oradata\LAPTOPDB
    \control02.ctl c:\LAPTOPDB_DATA_BACKUP

    copy D:\oa\SERVERDB\*.dbf C:\Oracle\oradata\LAPTOPDB

    set local=LAPTOPDB
    svrmgrl.exe @c:\create_LAPTOPDB.sql

    set local=LAPTOPDB
    svrmgrl.exe @c:\start_LAPTOPDB.sql

    set local=SERVERDB
    svrmgrl.exe @c:\start_SERVERDB.sql


    -------------------------stop_SERVERDB.sql-----------------------------

    connect internal/manager@SERVERDB;
    shutdown;
    disconnect;
    exit;

    -------------------------stop_LAPTOPDB.sql-----------------------------

    connect internal/manager@LAPTOPDB;
    shutdown;
    disconnect;
    exit;


    --------------------------create_LAPTOPDB.sql---------------------------
    CREATE CONTROLFILE SET DATABASE "LAPTOPDB" RESETLOGS NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 254
    MAXINSTANCES 1
    MAXLOGHISTORY 226
    LOGFILE
    GROUP 1 'C:\Oracle\oradata\LAPTOPDB\REDO01.LOG' SIZE 2M,
    GROUP 2 'C:\Oracle\oradata\LAPTOPDB\REDO02.LOG' SIZE 2M,
    GROUP 3 'C:\Oracle\oradata\LAPTOPDB\REDO03.LOG' SIZE 2M
    DATAFILE
    'C:\Oracle\oradata\LAPTOPDB\SYSTEM01.DBF',
    'C:\Oracle\oradata\LAPTOPDB\RBS01.DBF',
    'C:\Oracle\oradata\LAPTOPDB\USERS01.DBF',
    'C:\Oracle\oradata\LAPTOPDB\TEMP01.DBF',
    'C:\Oracle\oradata\LAPTOPDB\TOOLS01.DBF',
    'C:\Oracle\oradata\LAPTOPDB\INDX01.DBF';
    ALTER DATABASE OPEN RESETLOGS;


    -------------------------------start_LAPTOPDB.sql---------------------
    connect internal/manager@LAPTOPDB;
    startup pfile=C:\oracle\ora81\database\initLAPTOPDB.ora
    disconnect;
    exit;

    -------------------------------start_SERVERDB.sql---------------------

    connect internal/manager@SERVERDB;
    startup pfile=D:\oracle\ora81\database\initSERVERDB.ora
    disconnect;
    exit;



    Maybe there is a simpler way to synch 2 databases?

    Thanks.

  2. #2
    Join Date
    Sep 2003
    Posts
    4
    Hi,

    You can also try using Archived logs. This can be one method to incrementally sync your server and laptop by applying the archived logs. This method may be faster especially if the size of your DB files are large

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •