通過克隆程式目錄方式部署迪斯傑

liiinuuux發表於2014-03-27
檢查環境
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章