配置GoldenGate啟動DDL支援同步DDL操作
4、配置DDL支援
4.1 配置使用者及表空間
一般第一步都是建立使用者。前面我們已經做過操作,使用者已建好,這裡仍然沿用前面建立的ggate使用者,當然此刻也可以建立一個新的使用者,注意使用者的預設表空間不要指定為SYSTEM,否則在初始化DDL支援時可能會遇到段無法擴充套件,或包無法編譯等錯誤。
正式應用的話,需要注意ggate使用者所在表空間是否有充足的空間。
為ggate使用者授予utl_file的execute許可權,執行命令如下:
SQL> grant execute on utl_file to ggate;
Grant succeeded.
4.2 配置全域性引數檔案
- GGSCI (ora9node1) 14> edit param ./GLOBALS
增加下列內容:
- GGSCHEMA ggate
接下來有一個可選操作,就是說是否要自定義DDL相關物件的名稱,一般情況下不需要修改,ORACLE也建議保持資料庫物件預設值,如果由於某些特殊的需求要改的話,那麼就需要現在改,而不能等到部署完成。
修改主要是透過重定義params.sql中的相關變數值,該檔案位於GoldenGate軟體安裝目錄下,編譯並儲存即可。
另外,改完params.sql後,還需要修改GLOBALS配置檔案,新增物件名稱的對應關係,例如:
MARKERTABLE
前者表示Marker表,後一個表示DDL歷史表。
4.3 執行配置指令碼
接下來要執行一堆的SQL指令碼,這些指令碼均在GoldenGate安裝目錄,因此建議移動到GoldenGate目錄下,以方便呼叫指令碼(當然,直接完整路徑方式呼叫也是可以的):
- [oracle@ora9node1 ~]$ cd /data/oracle/ora9i/ggate/
以SYSDBA身份登入到SQL*Plus,此時應該斷開所有連線到ORACLE資料庫的會話,並且不再允許建立新會話,僅保留剛剛建立的SYSDBA身份登入的SQL*Plus。
本步要執行的指令碼比如多,先列個列表備忘:
- marker_setup.sql
- ddl_setup.sql
- role_setup.sql
- Grant the role to all GoldenGate Extract users
- ddl_enable.sql
- install and use the optional performance tool
詳細執行步驟如下:
4.3.1 執行marker_setup指令碼
該指令碼安裝marker系統,這部分為啟用DLL支援所必備,執行該指令碼時會提示輸入GoldenGate管理帳戶schema名,例如:
[oracle@ora9node1 ggate]$ sqlplus "/ as sysdba"
SQL> set line 150 pages 1000
SQL> @marker_setup
Marker setup 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:ggate
Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGATE
MARKER TABLE
-------------------------------
OK
MARKER SEQUENCE
-------------------------------
OK
Script complete.
4.3.2 執行ddl_setup指令碼
執行該指令碼要確認關閉掉所有ORACLE會話,未被關閉的會話會以列表形式顯示,執行過程中會要求希望物件屬主,並選擇安裝模式。
如果是初次安裝就選擇“INITIALSETUP”,該模式假設當前沒有任何GoldenGate DDL物件存在,如果存在則會刪除並重建。如果是重新安裝,則應該選擇“NORMAL”。具體執行示例如下:
SQL> @ddl_setup
GoldenGate DDL Replication setup script.
Verifying that current user has privileges to install DDL Replication...
Checking user sessions...
Check complete.
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:ggate
You will be prompted for the mode of installation.
To install or reinstall DDL replication, enter INITIALSETUP
To upgrade DDL replication, enter NORMAL
Enter mode of installation:INITIALSETUP
Working, please wait ...
Spooling to file ddl_setup_spool.txt
Using GGATE as a GoldenGate schema name, INITIALSETUP as a mode of installation.
Working, please wait ...
DDL replication setup script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGATE
DDLORA_GETTABLESPACESIZE STATUS:
.....................
.....................
Analyzing installation status...
STATUS OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------------------------------------
SUCCESSFUL installation of DDL Replication software components
Script complete.
4.3.3 執行role_setup指令碼
該操作會重建DDL同步所需的許可權,授予GoldenGate中的DDL物件以DML許可權,執行示例如下:
SQL> @role_setup
GGS Role setup script.
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql 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:ggate
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO
where
按照上面返回的提示,執行授權操作,注意是將許可權授予執行Extract/GGSCI或其它管理操作的使用者,我們這裡的情況看顯然是ggate,執行命令如下:
SQL> GRANT GGS_GGSUSER_ROLE TO GGATE;
Grant succeeded.
4.3.4 執行ddl_enable指令碼
啟用DDL觸發器,以捕獲DDL操作:
SQL> @ddl_enable
Trigger altered.
4.3.5 安裝效能最佳化工具(可選項)
要提高DDL觸發器的效能,可以透過ddl_pin指令碼,該指令碼會將觸發器使用的包載入到記憶體,以此提高效率。該指令碼執行時需要引用dbms_shared_pool系統包,因此在使用ddl_pin指令碼前需要確保dbms_shared_pool可用。
SQL> @?/rdbms/admin/dbmspool.sql
Package created.
Grant succeeded.
View created.
Package body created.
執行ddl_pin指令碼需要指定GoldenGate管理員schema名稱,例如:
SQL> @ddl_pin ggate
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
然後,用於同步DDL操作的物件就建立完成了。
4.4 測試DDL同步
首先在源端修改extract程式的配置檔案,例如:
- GGSCI (ora9node1) 18> edit param ext2
在適當位置增加下列內容:
- DDL INCLUDE ALL OPTYPE CREATE OBJTYPE 'table'
該語句用以支援create table操作,如果需要其它如alter/drop等,則增加相應配置即可。
啟動extract程式:
GGSCI (ora9node1) 20> start extract ext2
Sending START request to MANAGER ...
EXTRACT EXT2 starting
隨後sqlplus中建立新表:
SQL> conn jss/jss
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
J1 TABLE
J2 TABLE
2 rows selected.
SQL> create table j3(id number);
Table created.
登入到目標端ggsci命令列模式下,同樣需要對replicat的引數進行配置:
- GGSCI (rhel5u3) 4> edit param rep2
在適當位置增加一模一樣的內容(當然此處也可以與源端不同,具體根本實際情況設定):
- DDL INCLUDE ALL OPTYPE CREATE OBJTYPE 'table'
啟動replicat程式:
GGSCI (rhel5u3) 5> start replicat rep2
Sending START request to MANAGER ...
REPLICAT REP2 starting
檢視新建立的物件是否同步過來的:
GGSCI (rhel5u3) 9> dblogin userid ggate,password ggate
Successfully logged into database.
GGSCI (rhel5u3) 10> list tables jss.j3
JSS.J3
Found 1 tables matching list criteria.
成功同步。
=========================================
相關文章:
Oracle GoldenGate安裝應用及初始化資料示例
配置GoldenGate增量資料同步機制
配置GoldenGate捕獲Replicat端資料應用異常
配置GoldenGate捕獲Replicat端資料應用異常
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21754115/viewspace-1752348/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL DDL操作表MySql
- 04 MySQL 表的基本操作-DDLMySql
- DDL、DML、DCL、DQL相關操作
- 資料庫操作語言DDL資料庫
- Oracle 19C OGG基礎運維-05DDL操作同步Oracle運維
- MySQL5.7 InnoDB線上DDL操作MySql
- MySQL的DDL和DML操作語法MySql
- 記錄一次 Online DDL 操作
- MySQL DDL執行方式-Online DDL介紹MySql
- ddl練習
- MyCAT中的DDL
- MySQL 執行 Online DDL 操作報錯空間不足?MySql
- Mysql系列第四講 DDL常見操作彙總MySql
- MySQL Online DDL詳解MySql
- [20181026]12c增強索引線上DDL操作.txt索引
- 資料傳輸 | 如何配合 pt-osc 使用 DTLE 同步 DDL
- 12C grid CDB異機恢復+歸檔(DDL操作)
- MsSql 資料庫使用sqlplus建立DDL和DML操作方法SQL資料庫
- mysql的DDL操作對業務產生影響測試MySql
- DDL操作導致欄位長度變更修復方案
- 獲取表空間DDL
- 對比上次MySQL的DDLMySql
- DDL:運算元據庫
- 資料定義語言(DDL)
- Begin end程式碼段裡面有DDL和DML,如果DDL成功了而DML失敗了,則DDL的程式碼也會回滾
- MsSql資料庫使用SQL plus建立DDL和DML操作方法SQL資料庫
- mysql之 openark-kit online ddlMySql
- oracle檢視物件DDL語句Oracle物件
- 2.6.7 設定DDL鎖超時
- MySQL 線上DDL "gh-ost"MySql
- MySQL & MariaDB Online DDL 參考指南MySql
- PostgreSQL 函式獲取表DDLSQL函式
- MySQL - DDL詳解(Data Definition Language)MySql
- mysql DDL時鎖表的排查MySql
- 詳談 MySQL 8.0 原子 DDL 原理MySql
- mysql 原生 線上DDL 的bug .MySql
- MySQL全面瓦解4:資料定義-DDLMySql
- 【學習】SQL基礎-013-DDLSQL
- MySQL之資料定義語言(DDL)MySql