【正文】
CATION OF DDL TRACE FILEC:\ORACLE\PRODUCT\\ADMIN\TEST\UDUMP/Analyzing installation status...STATUS OF DDL REPLICATIONSUCCESSFUL installation of DDL Replication software ponentsScript plete.SQL @GGS Role setup scriptThis script will drop and recreate the role GGS_GGSUSER_ROLETo use a different role name, quit this script and then edit the script to change the gg_role parameter to the preferred name. (Do not run the script.)You will be prompted for the name of a schema for the GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: Stop all DDL replication before starting this installation.Enter GoldenGate schema name:goldengate已寫入 file PL/SQL 過程已成功完成。Role setup script pleteGrant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL mand:GRANT GGS_GGSUSER_ROLE TO loggedUserwhere loggedUser is the user assigned to the GoldenGate processes.SQL GRANT GGS_GGSUSER_ROLE TO goldengate。授權成功。SQL @觸發(fā)器已更改SQL exit安裝完成Note:Supported Oracle objects and operations for DDL replicationclustersfunctionsindexespackagesproceduretablestablespacesrolessequencessynonymstriggerstypesviewsmaterialized viewsusersNonsupported Oracle objects and operations for DDL replicationOraclereserved schemasOracle recycle binLimitation of GG DDL Support1) GoldenGate supports DDL replication for unidirectional configurations. Bidirectionalreplication of DDL is not supported.(只支持單向復制)2)GoldenGate supports DDL synchronization only in a liketolike DDL support requires the following:lSource and target object definitions must be identical.lThe ASSUMETARGETDEFS parameter must be used in the Replicat parameter file. Replicat will abend if objects are configured for DDL support and the SOURCEDEFS parameter is being used.(必須在Replicat參數(shù)文件中指定ASSUMETARGETDEFS參數(shù))5.玩玩GoldenGate前一段跟著Quest的朋友學習了一些SharePlex的東西,最近Oracle則在大力推廣另一個類似的產(chǎn)品GoldenGate,手頭的資料不多,只有一份官方文檔和一份所謂的培訓教材PPT,不過可操作性不強,上手有點難,后來看了這篇文章,才終于把基本的同步實現(xiàn)了。不過這位作者顯然已經(jīng)研究不少時間的GG,所以很多命令并沒有寫明,這里我把它補充一下吧。1,數(shù)據(jù)庫準備 檢查SUPPLEMENTAL_LOG和SharePlex一樣,GG要求打開SUPPLEMENTAL_LOG,通過如下SQL可以查看:SQLselect SUPPLEMENTAL_LOG_DATA_MIN from v$database。如果沒有開啟,則執(zhí)行如下語句打開SUPPLEMENTAL_LOG:SQLalter database add supplemental log data。 建立測試用戶ggs和ggt分別為源數(shù)據(jù)用戶和目標用戶。create user ggs identified by ggs default tablespace users。grant connect,resource to ggs。create user ggt identified by ggt default tablespace users。grant connect,resource to ggt。建立GG使用的用戶gg。create user gg identified by gg default tablespace users。grant dba to gg。2. 下載安裝GoldenGate需要到,我不太明白的是為什么這個GG的Product Pack是Oracle Fusion Middleware,另外,所以Platform我選擇了Linux x86,下載文件大約27M。為了簡單,我直接使用操作系統(tǒng)的oracle用戶安裝GG。建立目錄/home/oracle/ggs,把下載的文件unzip,然后存放到這個目錄后執(zhí)行:tar xvof 這樣,/home/oracle/ggs就是我們的GG的目錄了。這時候我們進入ggs目錄,執(zhí)行ggsci可能會報找不到庫的錯誤,那是我們還沒有配置LIB,對于我這個系統(tǒng),:LD_LIBRARY_PATH=/home/oracle/ggs:/u01/app/oracle/product/:$LD_LIBRARY_PATH。 export LD_LIBRARY_PATHPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:/home/oracle/ggs。 export PATH運行’. .bash_profile’,或者重新登入oracle,再執(zhí)行ggsci,就可以進入ggsci的管理界面,可以運行GG的命令了。這時,首先要做的就是建立GG的工作目錄,我們運行:CREATE SUBDIRS(這一步最好在cd到/home/oracle/ggs,然后運行ggsci后執(zhí)行,別的地方建立的環(huán)境有問題,我還是初學,應該有配置的方法,暫時不懂)運行完畢,就生成了許多目錄,這是GG配置文件,日志等文件的存放目錄。3. 配置最簡單的實驗本次測試模擬的情況是:為了把ggs模式下的表中的數(shù)據(jù)變化同步到ggt模式的相關表中。本次配置不在源端緩存數(shù)據(jù),直接把extract進程抓取的數(shù)據(jù)存儲在目標端數(shù)據(jù)庫服務器上,然后目標端數(shù)據(jù)庫服務器的Replicat進程把隊列中的數(shù)據(jù)投遞到目標數(shù)據(jù)庫中。相關配置命令和參數(shù)如下:添加相關進程:ADD EXTRACT ext1 TRANLOG, BEGIN NOWADD rmttrail /home/oracle/ggs/dirdat/r1 extract ext1ADD replicat rep1 EXTTRAIL /home/oracle/ggs/dirdat/r1, nodbcheckpoint運行edit param mgr,然后保存文件內容如下:port 7809運行edit param ext1 ,然后保存文件內容如下:extract ext1userid gg,password ggrmthost , mgrport 7809rmttrail /home/oracle/ggs/dirdat/r1dynamicresolutiontable ggs.*。運行edit param rep1,然后保存文件內容如下:replicat rep1userid gg,password ggassumetargetdefsmap ggs.*, target ggt.*。然后啟動必要的進程:start mgrstart ext1start rep1這時可以運行info all來查看是否所有的進程都是正常運行:GGSCI info allProgram Status Group Lag Time Since ChkptMANAGER RUNNINGEXTRACT RUNNING EXT1 00:00:00 00:00:07REPLICAT RUNNING REP1 00:00:00 00:00:084. 測試同步使用sqlplus執(zhí)行SQL語句:create table (a number, CONSTRAINT pk1 PRIMARY KEY (a)) 。create table (a number, CONSTRAINT pk1 PRIMARY KEY (a)) 。然后運行:insert into values (1)。mit。?26