oracle---oracle的單向ogg搭建流程(DML+DDL)
# .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_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=wenhe2
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export GGATE=/u01/OGG_linux/ggs
alias sqlplus='rlwrap sqlplus'
NLS_LANG
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
2, GGATE=/u01/OGG_linux/ggs 這個路徑是你將要安裝ogg軟體的路徑。
3,設定LD_LIBRARY_PATH,為了安裝OGG所用的動態連結庫。如果沒有配置這個路徑的話,在安裝OGG的過程
中會報找不到動態連結庫的錯誤,
inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf
inflating: Oracle GoldenGate 11.2.1.0.1 README.txt
inflating: Oracle GoldenGate 11.2.1.0.1 README.doc
[oracle@master2 ggs]$ ll
總計 310956
-rw-rw-r-- 1 oracle oinstall 228556800 2012-04-23 fbo_ggs_Linux_x64_ora11g_64bit.tar
-rw-r--r-- 1 oracle oinstall 89186858 01-15 20:31 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
-rwxrwxrwx 1 oracle oinstall 220546 2012-05-02 OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf
-rwxrwxrwx 1 oracle oinstall 93696 2012-05-02 Oracle GoldenGate 11.2.1.0.1 README.doc
-rwxrwxrwx 1 oracle oinstall 24390 2012-05-02 Oracle GoldenGate 11.2.1.0.1 README.txt
SQL>create tablespace ogg_data datafile '/u01/app/oracle/oradata/ogg_data.dbf' size 1000M autoextend on;
SQL> create user ogg identified by ogg default tablespace ogg_data temporary tablespace TEMP ;
grant connect,resource to ogg;
grant create session,alter session to ogg;
grant select any dictionary,select any table to ogg;
grant alter any table to ogg;
grant flashback any table to ogg;
grant execute on dbms_flashback to ogg;
四:修改源端資料庫配置
源端:解釋:
備註: 在oracle中可以透過rowid來定位某條記錄,但是目標端的資料庫和源端資料庫的資料庫可能完全不一樣,所以無法透過rowid來確定源端資料庫的邏輯變化,這時附加日誌supplemental log便登上了表演的舞臺。資料庫在開啟附加日誌功能後,對於源端的修改操作,oracle會同時追加能夠唯一標示記錄的列到redo log。這樣目標端資料庫就可以知道源端發生了哪些具體的變化。
四:配置ogg
源端:
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
3,新增需要同步的使用者到ogg
開啟scott使用者下所有表的附加日誌
GGSCI (WebServer) 3> add trandata scott.*
2013-03-08 11:02:33 WARNING OGG-00869 No unique key is defined for table 'BONUS'.
All viable columns will be used to represent the key, but may not guarantee
uniqueness. KEYCOLS may be used to
define the key.
Logging of supplemental redo data enabled
for table SCOTT.BONUS.
Logging of supplemental redo data enabled
for table SCOTT.DEPT.
Logging of supplemental redo data enabled
for table SCOTT.EMP.
2013-03-08 11:02:34 WARNING OGG-00869 No unique key is defined for table
'SALGRADE'. All viable columns will be used to represent the key, but may not
guarantee uniqueness. KEYCOLS may be
used to define the key.
Logging of supplemental redo data enabled
for table SCOTT.SALGRADE.
4,GGSCI (WebServer) 4> info trandata scott.*
Logging of supplemental redo log data is
enabled for table SCOTT.BONUS.
Columns supplementally logged for table
SCOTT.BONUS: ENAME, JOB, SAL, COMM.
Logging of supplemental redo log data is
enabled for table SCOTT.DEPT.
Columns supplementally logged for table
SCOTT.DEPT: DEPTNO.
Logging of supplemental redo log data is
enabled for table SCOTT.EMP.
Columns supplementally logged for table
SCOTT.EMP: EMPNO.
Logging of supplemental redo log data is
enabled for table SCOTT.SALGRADE.
Columns supplementally logged for table
SCOTT.SALGRADE: GRADE, LOSAL, HISAL.
5,GGSCI (master2) 3>info mgr
Manager is running (IP port
WebServer.7839).
tranlog:表示資料抓取的來源是資料庫的redo資料。
begin now:表示我們在啟動這個抓取程式的就去抓取資料。
threads 1:表示我們資料庫有多少個redo threads,單例項基本上是1或者不設,rac就自己設定了,
配置過RAC的基本都瞭解。
GGSCI (gg1) 15> add EXTTRAIL ./dirdat/h1, extract ext_liu, megabytes 100
EXTTRAIL added.
分析:
./dirdat:表示trail檔案的目錄
h1:trail檔案的字首
extract ext_demo:值指定給那個程式用的(ext_demo)。
megabytes 100:檔案大小是100m
GGSCI (gg1) 31> add extract dpe_liu, exttrailsource ./dirdat/h1 ##h1是源端設定的trails 檔案的格式
EXTRACT added.
10
輸出:目標主機怎麼寫,也是定義datapumo程式的輸出。
GGSCI (gg1) 33> add rmttrail ./dirdat/h1, EXTRACT dpe_liu,MEGABYTES 100
RMTTRAIL added.
分析:
exttrailsource:抓取程式的來源,因為這個程式不否則到資料庫中取抓取,所以抓取的來源
是透過抓取程式已經生成好的trail檔案中的內容。
建立ogg的使用者和表空間,並授權,注意授權和源端有區別,
SQL>create tablespace ogg_data datafile '/u01/app/oracle/oradata/ogg_data .dbf' size 1000M autoextend on;
SQL> create user ogg identified by ogg default tablespace ogg_data temporary tablespace TEMP ;
1、 啟動manager:start manager
2、 啟動extract:start extract extn
3、 啟動replicat:start replicat repn
4、 停止manager:stop manager
5、 停止 extract:stop extract extn
6、 停止replicat:stop replicat repn
7、 刪除extract:delete extract extn
8、 刪除replicat:delete extract repn
9、 檢視ogg狀態:info all
10、 修改manager引數:edit params mgr
11、 修改extract引數:edit params extn
12、 修改replicat引數:edit params repn
13、 修改全域性引數:edit params ./GLOBAL
以下繼續配置支援DDL操作的流程:
在source端操作:
1:賦予ogg使用者相應的許可權,修改全域性配置檔案新增ggschema引數
SQL> conn /as sysdba
Connected.
SQL> grant execute on utl_file to ogg;Grant succeeded.[oracle@master2 ~]$ cd $GGATE[oracle@master2 ogg]$ ggsciGGSCI (master2 ) 1> edit param ./GLOBALSGGSCI (master2) 2> view param ./GLOBALSggschema ogg
2:執行相關的sql指令碼
[oracle@master2 ~]$ cd $GGATE[oracle@master2 ~]$ sqlplus / as sysdbaConnected.SQL> @marker_setup.sqlMarker setup scriptYou will be prompted for the name of a schema for the Oracle GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: Stop all DDL replication before starting this installation.Enter Oracle GoldenGate schema name:ogg13. Marker setup table script complete, running verification script...14. Please enter the name of a schema for the GoldenGate database objects:15. Setting schema name to OGG16.17. MARKER TABLE18. -------------------------------19. OK20.21. MARKER SEQUENCE22. -------------------------------23. OK24.25. Script complete.26.27. SQL> show parameter recyclebin;28.29. NAME TYPE VALUE30. ------------------------------------ ----------- ------------------------------31. recyclebin string on32.關閉回收站:SQL> alter system set recyclebin=off;System altered.SQL> show parameter recyclebin;NAME TYPE VALUE------------------------------------ ----------- ------------------------------recyclebin string OFF42. SQL> @ddl_setup.sql43. Oracle GoldenGate DDL Replication setup script44. Verifying that current user has privileges to install DDL Replication...45. You will be prompted for the name of a schema for the Oracle GoldenGate database objects.46. NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.47. NOTE: The schema must be created prior to running this script.48. NOTE: Stop all DDL replication before starting this installation.49. Enter Oracle GoldenGate schema name:ogg50.51. Working, please wait ...52. Spooling to file ddl_setup_spool.txt53.54. Checking for sessions that are holding locks on Oracle Golden Gate metadata tables ...55. Check complete.56. Using OGG as a Oracle GoldenGate schema name.57. Working, please wait ...58. RECYCLEBIN must be empty.59. This installation will purge RECYCLEBIN for all users.60. To proceed, enter yes. To stop installation, enter no.61.62. Enter yes or no:yes63. ————————其他輸出省略————————64.65. STATUS OF DDL REPLICATION66. ---------------------------------------------------------------------------------------67. SUCCESSFUL installation of DDL Replication software components68.69. Script complete.70.71. SQL> @role_setup.sql72. GGS Role setup script73. This script will drop and recreate the role GGS_GGSUSER_ROLE74. To use a different role name, quit this script and then edit the params.sql script to change th e gg_role parameter to the preferred name. (Do not run the script.)75.76. You will be prompted for the name of a schema for the GoldenGate database objects.77. NOTE: The schema must be created prior to running this script.78. NOTE: Stop all DDL replication before starting this installation.79.80. Enter GoldenGate schema name:ogg81. Wrote file role_setup_set.txt82. PL/SQL procedure successfully completed.83.84. Role setup script complete85.86. Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:87. GRANT GGS_GGSUSER_ROLE TO <loggedUser>88. where <loggedUser> is the user assigned to the GoldenGate processes.89.90. SQL> grant ggs_ggsuser_role to ogg;91. Grant succeeded.92.93. SQL> @ddl_enable.sql94. Trigger altered.95.96. SQL> @?/rdbms/admin/dbmspool.sql #?就是 $ORACLE_HOME97. Package created.98. Grant succeeded.99. View created.100. Package body created.101.102. SQL> @ddl_pin.sql ogg ###要加上空格 ogg,否則需要自己輸入ogg.
103. PL/SQL procedure successfully completed.104. PL/SQL procedure successfully completed.105. PL/SQL procedure successfully completed.
3:source端修改extract程式的params檔案,新增"ddl include all"引數,重啟extract程式
1. GGSCI (master2) 1> view params ext_liuEXTRACT ext_liusetenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)ddl include alluserid ogg,password oggexttrail ./dirdat/h1,megabytes 100TABLE scott.*;9.GGSCI (master2) 2> stop extract ext_liu10. Sending STOP request to EXTRACT ext_liu ...11. Request processed.12.13. GGSCI (master2) 3> start extract ext_liu14. Sending START request to MANAGER ...15. EXTRACT ext_liu starting16.17. GGSCI (master2) 4> info extract ext_liu18. EXTRACT ext_liu Last Started 2012-06-20 15:42 Status RUNNING19. Checkpoint Lag 00:00:00 (updated 00:00:10 ago)20. Log Read Checkpoint Oracle Redo Logs21. 2012-06-20 15:42:58 Seqno 3, RBA 5004441622. SCN 0.567478 (567478)
在target端操作:
target端修改replicat程式的params檔案,新增ddlerror default ignore retryop maxretries 3 retrydelay 5" 引數,重啟replicat程式 注意: 說明目標端不是必須要配置DDL include all語句,可有可無
1. [root@master1 ~]# su - oracle2. [oracle@master1 ~]$ cd $GGATE3. [oracle@master1 ogg]$ ggsci4. GGSCI (master1) 1> edit params rep_liu5. GGSCI (master1) 2> view params rep_liuREPLICAT rep_liuSETENV (NLS_LANG =AMERICAN_AMERICA.AL32UTF8)ddlerror default ignore retryop maxretries 3 retrydelay 5DDL include all ##可有可無USERID ogg,PASSWORD ogghandlecollisionsREPORTCOUNT EVERY 30 MINUTES, RATEREPERROR DEFAULT, ABENDnumfiles 5000assumetargetdefsDISCARDFILE ./dirrpt/rep_liu.dsc, APPEND, MEGABYTES 1000ALLOWNOOPUPDATESMAP scott.*, TARGET scott.*;GGSCI (master1) 3> stop replicat rep_liuSending STOP request to REPLICAT rep_liu...Request processed.GGSCI (master1) 4> start replicat rep_liuSending START request to MANAGER ...REPLICAT rep_liu startingGGSCI (master1) 5> info replicat rep_liuREPLICAT rep_liu Last Started 2012-06-20 15:50 Status RUNNINGCheckpoint Lag 00:00:00 (updated 00:00:00 ago)Log Read Checkpoint File ./dirdat/pa000000First Record RBA 4780973
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29654823/viewspace-1990267/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- OGG單向DDL複製操作
- OGG安裝及單向配置
- 【OGG】RAC環境下配置OGG單向同步 (四)
- ogg12 mysql to oracle 單向同步MySqlOracle
- OGG搭建(rac到-->單例項)單例
- 在原ogg基礎上重新搭建ogg
- (一)OGG的安裝與配置,並實現單向DML複製操作
- sqlserver2008_ogg單向複製配置文件SQLServer
- linux下單節點oracle資料庫間ogg搭建LinuxOracle資料庫
- OGG雙向DML複製操作
- 在dg庫上搭建ogg
- OGG_windows搭建實驗Windows
- OGG_linux搭建實驗Linux
- OGG 簡單DML同步
- 【OGG】Oracle GoldenGate 11g (二) GoldenGate 11g 單向同步配置 上OracleGo
- 【OGG】Oracle GoldenGate 11g (二) GoldenGate 11g 單向同步配置 下OracleGo
- ogg單機安裝概要
- ogg簡單維護命令
- 關於OGG單表同步
- ogg12 oracle to oracle 雙向DDL複製Oracle
- 手把手教你安裝和配置OGG,並實現單向DML複製技術
- OGG Integrated Mode(downstream方式)環境搭建
- 網路搭建的基本流程包括
- 簡單的Git流程Git
- 搭建一個Oracle到Oracle的GoldenGate單向複製測試環境OracleGo
- Django專案搭建流程Django
- Flarum 搭建流程記錄
- 工作臺快速搭建流程
- ogg單向x86ora10g到x64ora11g支援ddl同步實驗
- Oracle Goldengate(ogg) 12c認證考試流程OracleGo
- 向大家請教開發流程的問題
- SAP公司間STO流程裡外向交貨單PGI後自動觸發內向交貨單的實現
- OGG 的配置:不使用資料泵完成Oracle-Oracle的雙向複製。Oracle
- MySQL 叢集7.4的搭建流程(CentOS 6.5)MySqlCentOS
- ogg不停業務重新初始化目標資料庫流程資料庫
- ogg停止業務重新初始化目標資料庫流程資料庫
- MySQL 5.5 複製搭建流程MySql
- 【OGG】OGG的下載和安裝篇