ITPub博客

首页 > 数据库 > Oracle > 通过克隆程序目录方式部署迪斯杰

通过克隆程序目录方式部署迪斯杰

原创 Oracle 作者:liiinuuux 时间:2014-03-27 14:47:24 0 删除 编辑
检查环境
dsg用户的组要和oracle一致
[root@db163 ~]# id dsg
uid=600(dsg) gid=501(oinstall) groups=501(oinstall),502(dba)

包含oracle的环境变量
[root@db163 ~]# cat /dsg/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
     . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_SID=test
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
export PATH=.:/u01/app/oracle/product/11.2/db_1/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/root/bin:

export REALSYNC_BASE=/dsg/realsync;
alias 'cdl=cd ${REALSYNC_BASE}/log';
alias 'cds=cd ${REALSYNC_BASE}/scripts';
alias 'cdo=cd ${REALSYNC_BASE}';
alias 'cdv=cd ${REALSYNC_BASE}/vcfs';
alias 'cdb=cd ${REALSYNC_BASE}/bin';
alias 'cdd=cd ${REALSYNC_BASE}/dbps';
alias 'cdc=cd ${REALSYNC_BASE}/config';
alias 'cdva=cd ${REALSYNC_BASE}/vcfsa';
alias 'cdx=cd ${REALSYNC_BASE}/xldr';


export LD_LIBRARY_PATH=/dsg/realsync/bin/elib/11gr2lib32:.
export CLASSPATH=$ORACLE_HOME/jre
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib                               
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib                         
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib      

[dsg@db163 realsync]$ cd $REALSYNC_BASE
[dsg@db163 realsync]$ ll
total 40
drwxr-xr-x. 5 dsg dba 4096 Mar 10 11:37 bin
drwxr-xr-x. 4 dsg dba 4096 Mar 10 11:37 config
-rw-r--r--  1 dsg dba  104 Mar 10 11:36 config.srv
drwxr-xr-x. 5 dsg dba 4096 Mar 10 11:37 dbps
drwxr-xr-x. 4 dsg dba 4096 Mar 10 11:37 log
drwxr-xr-x. 4 dsg dba 4096 Mar  6 10:08 mass
drwxr-xr-x. 2 dsg dba 4096 Mar 10 11:45 scripts
drwxr-xr-x. 4 dsg dba 4096 Mar 10 11:37 vcfs
drwxr-xr-x. 5 dsg dba 4096 Mar 10 11:37 vcfsa
drwxr-xr-x. 6 dsg dba 4096 Mar 10 11:47 xldr


两边删除老的通道
[dsg@db163 ~]$ $REALSYNC_BASE/scripts/del_service s1
Do you really want to delete s1 service ? (Y/N):Y
s1 Oxad was Stopped.
#ServiceName ServerPort AgentPort RoleType MonitorPort VerifyPort
s1 service is delete

检查除了bin下面有一个elib,其它几个文件夹不包含老通道的文件夹
ls $REALSYNC_BASE/bin
elib
ls $REALSYNC_BASE/config
ls $REALSYNC_BASE/dbps
ls $REALSYNC_BASE/log
ls $REALSYNC_BASE/xldr
ls $REALSYNC_BASE/vcfs
ls $REALSYNC_BASE/vcfsa


两边的添加新的通道配置
在config.srv里添加一行新通道配置
主机
[dsg@db163 realsync]$ cat $REALSYNC_BASE/config.srv
#ServiceName ServerPort AgentPort RoleType MonitorPort VerifyPort
s1   6800   6801   SRC   6802   6803

备机
[dsg@db164 ~]$ cat $REALSYNC_BASE/config.srv
#ServiceName ServerPort AgentPort RoleType MonitorPort VerifyPort
s1   6800   6801   TGT   6802   6803

用dsg的脚本初始化通道
[dsg@db163 ~]$ $REALSYNC_BASE/scripts/initservice s1
/dsg/realsync/bin/s1 create
/dsg/realsync/log/s1 create
/dsg/realsync/config/s1 create
/dsg/realsync/vcfs/s1 create
/dsg/realsync/vcfsa/s1 create
/dsg/realsync/xldr/s1 create
/dsg/realsync/dbps/s1 create


注意:下面的配置文件可以在mass文件夹下找到模板
两边配置config.dsg 
config.dsg里可以使用IP地址或者机器名
主机
[dsg@db163 ~]$ cat $REALSYNC_BASE/config/s1/config.dsg
#COMMON INFORMATION
REALSYNC_BASE=/dsg/realsync
REALSYNC_SVR_IP=db163
VMANLOGON=root/dbps

#SOURCE INFORMATION
SOURCE_HOST_IP=db163
SOURCE_ORACLE_SID=test
SOURCE_ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
SOURCE_DB_USER=dsg
SOURCE_DB_PSWD=oracle

#TARGET INFORMATION
TARGET_HOST_IP=db164
TARGET_ORACLE_SID=test
TARGET_ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
TARGET_DB_USER=dsg
TARGET_DB_PSWD=oracle

备机
[dsg@db164 s1]$ cat $REALSYNC_BASE/config/s1/config.dsg
#COMMON INFORMATION
REALSYNC_BASE=/dsg/realsync
REALSYNC_SVR_IP=db163
VMANLOGON=root/dbps

#SOURCE INFORMATION
SOURCE_HOST_IP=db163
SOURCE_ORACLE_SID=test

#TARGET INFORMATION
TARGET_HOST_IP=db164
TARGET_ORACLE_SID=test
TARGET_ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
TARGET_DB_USER=dsg
TARGET_DB_PSWD=oracle
LOADER_PARALLEL=1
LOADER_R_PARALLEL=1


主机创建配置文件
[dsg@db163 ~]$ cat $REALSYNC_BASE/config/s1/config.vm  (M1表示并行度是1,这个并行度要和备库config.dsg的PARALLEL一致
set dm 1.1 -cfg -sync ftcIqM1 -rule r

[dsg@db163 ~]$ cat $REALSYNC_BASE/config/s1/dsdt.vm
set ds 1 -itvl 5 -state start
set dt 1.1 -tgt db 2 -xf1 y -state start

[dsg@db163 ~]$ cat $REALSYNC_BASE/config/s1/mapping.ini
SCOTT SCOTT

real_where=
u.name in ('SCOTT')
full_where=
u.name in ('SCOTT')

查看$REALSYNC_BASE/config/s1/ddl.ini,设置是否同步那些操作。


两边启动服务
主机
[dsg@db163 ~]$ $REALSYNC_BASE/scripts/start_vagentd s1
nohup: appending output to `nohup.out'
nohup: redirecting stderr to stdout
Agent with port 6801 Started.
Dbpsd with port 6800 Started.
Sender with s1 Started.
dsg       4438  4399  0 14:15 pts/1    00:00:00 /dsg/realsync/bin/s1/vagentd -select_mode -f 6801
dsg       4439  4438  0 14:15 pts/1    00:00:00 /dsg/realsync/bin/s1/vagentd -select_mode -f 6801
dsg       4450     1  0 14:15 pts/1    00:00:00 /dsg/realsync/bin/s1/sender -auto_restart -tseq 1
dsg       4451  4450  0 14:15 pts/1    00:00:00 /dsg/realsync/bin/s1/sender -auto_restart -tseq 1
dsg       4444  4399  0 14:15 pts/1    00:00:00 /dsg/realsync/bin/s1/dbpsd -f 6800

备机
[dsg@db164 ~]$ $REALSYNC_BASE/scripts/start_vagentd s1
nohup: appending output to `nohup.out'
nohup: redirecting stderr to stdout
Agent with port 6801 Started.
Dbpsd with port 6800 Started.
Sender with s1 Started.
dsg       6380  6341  0 14:17 pts/0    00:00:00 /dsg/realsync/bin/s1/vagentd -f 6801
dsg       6381  6380  0 14:17 pts/0    00:00:00 /dsg/realsync/bin/s1/vagentd -f 6801
dsg       6390     1  0 14:17 pts/0    00:00:00 /dsg/realsync/bin/s1/sender -auto_restart -tseq 1 -xf1back
dsg       6392  6390  0 14:17 pts/0    00:00:00 /dsg/realsync/bin/s1/sender -auto_restart -tseq 1 -xf1back
dsg       6386  6341  0 14:17 pts/0    00:00:00 /dsg/realsync/bin/s1/dbpsd -f 6800


主机连接vman配置数据库信息
[dsg@db163 ~]$ $REALSYNC_BASE/bin/s1/vman
CHECK_MEMLEAK is turned off
VMAN> connect :6800 (6800是config.srv中的第一个端口)
Connected.
DBPS> user root/dbps(默认密码是dbps)
Authenticated
SYNC:/> menu(进入菜单模式)
   1. System
   2. Scheduler
   s. List current sessions
   q. Return to command mode
===> 1
     1. User
     2. Host
     4. 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
         HID: 1
   Host Name:  db163 (可以使用IP地址或者机器名)
  Agent Port: [2688] 6801 (6801是config.srv中的第二个端口)
     Enabled: [Y]
Host [db163] 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
   Host Name:  db164  (可以使用IP地址或者机器名)
  Agent Port: [2688] 6801 (6801是config.srv中的第二个端口)
     Enabled: [Y]
Host [db164] 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
     ===>  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
        DBID: 1
     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 (for generic files/directries)
Data Source Type: 1
   Host Name:  db163 (和host的名称一致,如果上面使用了IP,这里也填IP)
      DB Name:  test
      DB User:  dsg
  DB Password:  oracle
     OS Owner:  dsg
     OS Group:  dba
          SID:  test
     TNS Name: 
  ORACLE_HOME:  /u01/app/oracle/product/11.2/db_1
    TNS Admin: 
Data source [test] added
         1. List all
         2. List one in detail
         3. Add
         4. Delete
         5. Edit
         q. quit
(设置第二个数据库)
     ===>  3
        DBID: 2
     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 (for generic files/directries)
Data Source Type: 1
   Host Name:  db164 (和host的名称一致,如果上面使用了IP,这里也填IP)
      DB Name:  test
      DB User:  dsg  
  DB Password:  oracle
     OS Owner:  dsg
     OS Group:  dba
          SID:  test
     TNS Name: 
  ORACLE_HOME:  /u01/app/oracle/product/11.2/db_1
    TNS Admin: 
Data source [test] added

一直按q,回到命令行模式
cd到两个库的schemas下,能列出数据库里有那些用户,就可以了
SYNC:/> cd /dbs/test.1/schemas
SYNC:/dbs/test.1/schemas> ls

ANONYMOUS APEX_030200 APEX_PUBLIC_USER APPQOSSYS CTXSYS DBSNMP DIP DSG EXFSYS FLOWS_FILES MDDATA MDSYS MGMT_VIEW OLAPSYS ORACLE_OCM ORDDATA ORDPLUGINS ORDSYS OUTLN OWBSYS OWBSYS_AUDIT SCOTT SI_INFORMTN_SCHEMA SPATIAL_CSW_ADMIN_USR SPATIAL_WFS_ADMIN_USR SYS SYSMAN SYSTEM WMSYS XDB XS$NULL
SYNC:/dbs/test.1/schemas> cd /dbs/test.2/schemas
SYNC:/dbs/test.2/schemas> ls

ANONYMOUS APEX_030200 APEX_PUBLIC_USER APPQOSSYS CTXSYS DBSNMP DIP DSG EXFSYS FLOWS_FILES MDDATA MDSYS MGMT_VIEW OLAPSYS ORACLE_OCM ORDDATA ORDPLUGINS ORDSYS OUTLN OWBSYS OWBSYS_AUDIT SI_INFORMTN_SCHEMA SPATIAL_CSW_ADMIN_USR SPATIAL_WFS_ADMIN_USR SYS SYSMAN SYSTEM WMSYS XDB XS$NULL 


主库启动全同步
[dsg@db163 ~]$ cd $REALSYNC_BASE/scripts
[dsg@db163 scripts]$ nohup ./reload s1 &






                  

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26239116/viewspace-1130723/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-11-12

  • 博文量
    94
  • 访问量
    312222