DSG数据复制配置

 

 

 

1、准备工作

 

创建用户

 

DSG软件安装在Oracle用户下

创建数据库用户

 

$sqlplus ‘/as sysdba’

SQL > create user dsg identified by dsg;

SQL > grantconnect,resource,exp_full_database,all privileges,dba to dsg;

 

软件安装

 

$ su – oracle

$cd /home/dsg/dtsb

$mkdir bin

$cd bin

$gunzip *.gz

$tar xvf *.tar

$chmod +x *

源端软件安装

 

$su – dsg

$cd /dsg

$chmod +x setup.sh

$./setup.sh

1、输入软件安装目录,回车即为当前目录

Please choice setup Directory, default isCurrentDirectory [/dsgdata/dssb]:

 2、输入安装类型 1为源端,2为目标端(这里输入1)

Please choice the Agent Type [ 1-Source ,2-Target]:1

 3、输入源端Dbpsd的端口号(这里输入50000)

Please input Source Dbpsd port,default portis[50000]:50000

 4、输入源端Vagentd的端口号:(这里输入50001)

Please input Source Vagentd port,defaultport is[50001]:50001

 5、输入日志归档的间隔时间(默认为12小时)

Please input Archive log interval,defaultis12:

 

目标端软件安装

 

$./setup.sh

1、输入软件安装目录,回车即为当前目录(这里输入回车)

Please choice setup Directory, default isCurrentDirectory [/dsg]:/home/dsg/dtsb

 2、输入安装AgentType类型 1为源端,2为目标端(这里输入2)

Please choice the Agent Type [ 1-Source ,2-Target]:2

 3、输入目标端Vagentd的端口号(这里输入50001)

Please input Target Vagentd port,defaultport is[50001]:50001

 4、输入目标端VerifyVagentd的端口号(这里输入50011)

Pease input Target Verify port,default portis [50011]:50011

 5、输入日志归档的间隔时间(默认时间为12小时)

Please Please input Archive loginterval,defaultis 12:

 6、数据全同步的线程数(这里输入4)

Please input the number of parallelloaderprocess:<1-10>4

对复目标端制进行启动、查看、停止脚本

 

分别执行/home/dsg/dtsb/scripts/start_vagentd、check、stop_vagentd脚本

源端软件配置

 

源端基础信息配置

 

登录到源端(192.168.*.*)的/dsgdata/dssb/bin目录下

 

$ cd /dsgdata/dssb/bin

$ cd bin

$./vman

vman> connect :50000

dbps>user root/dbps

SYNC:/> menu

1.System

2.Scheduler

s. List current sessions

q.Return to command mode 

  ===> 1

       1.User

       2.Host

       3.Database

       q.quit       

     ===>  2

           1. List all

           2. List one in detail

           3. Add

           4. Delete

           5. Edit

           6. Detect and update hardware/os_type/vagentd

           q. quit

===> 3                                                              ―――选择增加一个HOST

HID:1                                                                ―――输入一个HOSTID,不能重复

HostName: localhost                                      ―――服务器地址(localhost代表dbpsd进程所在的服务器地址)

          Agent Port: [2688] 11001                  ―――源端主机vagentd启动所用端口号

           Enabled: [Y]

Host[localhost] added

           1. List all

           2. List one in detail

          3. Add

          4. Delete

          5. Edit

          6. Detect and update hardware/os_type/vagentd

          q. quit

           ===>  3

          HID: 2                                                 ----- 目标端主机IP

          Host Name: 192.168.*.*                ----- 目标端主机地址

          Agent Port: [2688]50001                    ----- 目标端主机agentd端口号

          Enabled: [Y]                         

          Host [127.0.0.1  ] added              ----- 主机注册成功

===> q

       1. User

       2. Host

       4. Database

       q. quit

    ===> 4

           1. List all

           2. List one in detail

           3. Add

           4. Delete

           5. Edit

           q. quit

  ===> 3                                                                       ―――选择增加一个database

       DBID: 1                                                               ―――输入数据库ID,不能重复

       Please select data source type:

                1. Oracle

                2. DB2

                3. Sybase

                4. Sql Server

               5. Informix

                6. Lotus Notes

                7. Exchange Server

                8. Access Server

                9. File Server (forgenericfiles/directries)

DataSource Type: 1                                         ―――数据库类型:目前只支持oracle

HostName: locahost                                      ――― DS的IP

DBName: SID                                           ―――数据库名称 

DBUser: dsg                                                      ―――数据库中的用户

  DBPassword: dsg                                            ―――  DS数据库中用户的密码

  OSOwner:                                                      ―――一般取空

  OSGroup:                                                       ―――一般取空

SID: SID1                                                      ――― DS数据库SID

  TNSName:

ORACLE_HOME: /oracle/product/10.2.0/db   ――― DS的$Oracle_Home目录,

  TNSAdmin:

Datasource [source] added

           1. List all

           2. List one in detail

           3. Add

           4. Delete

           5. Edit

           q. quit

        ===>  3                        ―――选择增加一个database

       DBID: 2                          ―――输入数据库ID,不能重复     

 Please select data source type:

                1. Oracle

                2. DB2

                3. Sybase

                4. Sql Server

                5. Informix

                6. Lotus Notes

                7. Exchange Server

                8. Access Server

                9. File Server (forgenericfiles/directries)

DataSource Type: 1                                      ――― DT端数据库类型

HostName: 192.168.100.181                 ―――对应的DT端服务器的IP

DBName:  dsghis                                 ――― DT端数据库名称

DBUser: dsg                         ―――  DT端数据库中的用户

DBPassword: dsg                  ―――  DT端数据库中的用户

OSOwner:                            ―――一般取空

OSGroup:                            ―――一般取空

SID: dsghis                          ――― DT端数据库SID

TNSName:

ORACLE_HOME:/oracle/product     ―――DT端数据库Home目录TNSAdmin:

Datasource [target] added

           1. List all

           2. List one in detail

           3. Add

           4. Delete

           5. Edit

           q. quit

 

源端配置映射关系

$/config目录下配置mapping.ini 文件

源用户名.源表 目用户名.目表

real_where=

u.namein ('用户名') ando.name in ('实时同步表', 实时同步表')

full_where=

u.namein (用户名') ando.name in ('初始化用户名.初始化表名')

 

11g与10g表空间区别配置

more session_prev.sql

declare

   sql_st varchar2(500);

begin

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);

end;

启动脚本start_vagentd环境配置

$/scripts/start_vagentd

#export REPORT_PERFORMANCE=ON

#export XLOGGER=Y

#export IN_MEM_XF1_SIZE=67108864

#export INITIAL_COMMIT_GROUPS=100000

#export IN_MEM_XF1_INITIAL=32768

#export TWO_TASK=

#export RAC_IDLE_TIMES=10

#export CHECK_MEMLEAK=ON

export ORACLE_SID=SID

export ORACLE_HOME=/home/u01/app/oracle/

export ORACLE_BASE=/home/u01/

export LD_LIBRARY_PATH=/home/dsg/elib:/home/u01/app/oracle/lib

 

目标端软件配置

启动脚本start_vagentd环境配置

#export REPORT_PERFORMANCE=ON

#export XLOGGER=Y

#export IN_MEM_XF1_SIZE=67108864

#export INITIAL_COMMIT_GROUPS=100000

#export IN_MEM_XF1_INITIAL=32768

#export TWO_TASK=

#export RAC_IDLE_TIMES=10

#export CHECK_MEMLEAK=ON

export ORACLE_SID=SID

export ORACLE_HOME=/home/u01/app/oracle/

export ORACLE_BASE=/home/u01/

exportLD_LIBRARY_PATH=/home/dsg/elib:/home/u01/app/oracle/lib

 

过滤文件配置

$/config/data_load.ini

# table

create_table=y

drop_table=y

alter_table=y

analyze_table=y

truncate_table=y

# index

create_index=y

drop_index=y

alter_index=y

analyze_index=y

# sequence

create_sequence=y

alter_sequence=y

drop_sequence=y

# synonym

create_synonym=y

drop_synonym=y

alter_synonym=y

# view

create_view=y

drop_view=y

alter_view=y

# procedure

create_procedure=y

alter_procedure=y

drop_procedure=y

# trigger

create_trigger=y

alter_trigger=y

drop_trigger=y

# function

create_function=y

alter_function=y

drop_function=y

# package

create_package=y

alter_package=y

drop_package=y

# package body

create_package_body=y

alter_package_body=y

drop_package_body=y

# table level filter (...)

table=bill.ACCT_BALANCE

drop_table=n

truncate_table=n

table=bill.ACCT_ITEM

drop_table=n

truncate_table=n

 

 

启动软件

目标端和源端都执行以下文件

$/scripts/start_vagentd

初始化同步

$cd /dsgdata/dssb/bin

$ ./vman

vman>@vm

 

 

监控同步复制脚本

monit

DBPS_HOME_LIST="安装目录"

while true

do

clear

echo ======================DSGREALSYNC======================

for DBPS_HOME in $DBPS_HOME_LIST

do

    a1=`cat $DBPS_HOME/rmp/real0/cfg.loaderno|awk '{print $1}'`

    a2=`cat $DBPS_HOME/rmp/real0/cfg.loaderno|awk '{print $2}'`

    a_c=`expr $a2 - $a1 `

echo "            =====$DBPS_HOME=====         "

tail -n 8 $DBPS_HOME/log/log.r0

echo { $a2 - $a1 = $a_c }

done

echo ======================DSGREALSYNC======================

sleep 3

done

监控rowID脚本

grep "rowid(U)" log.r* |awk'{print $NF}'| uniq |awk -F. '{print $1,$2}'|sort -k2 |uniq

关键文件监控

$/dsg/scripts/check                                     检测进程脚本

$/dsg/scripts/clean_vagentd                    清空脚本(慎重使用)

$/dsg/scripts/start_vagentd                     启动进程脚本

$/dsg/scripts/stop_vagentd                      停止进程脚本

$/dsg/log/sync.report                                 初始化同步日志文件

$/dsg/log/log.r0                                            Receive日志文件

$/dsg/log/log.dbpsd                                     dbpsd日志文件

$/dsg/log/log.sender                                   sender日志文件

$/dsg/log/log.vagentd                                 vagentd日志文件

 

你可能感兴趣的:(oracle)