Weitere ähnliche Inhalte
Ähnlich wie Oracle GoldenGate 18c - REST API Examples (20)
Mehr von Bobby Curtis (20)
Kürzlich hochgeladen (20)
Oracle GoldenGate 18c - REST API Examples
- 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Oracle GoldenGate 18c
RESTful API & Scripts Examples
Bobby Curtis, MBA
Director of Product Management
Oracle GoldenGate
October, 2018
- 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
Confidential – Oracle Internal/Restricted/Highly Restricted
- 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Oracle GoldenGate
Real time Performance
Extensible & Flexible
Proven & Reliable
Oracle GoldenGate provides low-impact capture, routing,
transformation, and delivery of database transactions
across homogeneous and heterogeneous environments in
real-time with no distance limitations.
Most
Databases
Data
Events
Transaction Streams
Cloud
DBs
Big
Data
Supports Databases, Big Data and NoSQL:
* The most popular enterprise integration tool in history
Confidential – Oracle Internal/Restricted/Highly Restricted
- 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Oracle GoldenGate 18c Microservices Architecture
Network
Capture Trail
Files
DS
AS
SM
PM AS
RS
PM
Delivery
SM
>HTML>>SQL >>CLI >>API
Customizable Interactive Experience
Proxy/Reverse Proxy Proxy/Reverse Proxy
Trail
Files
- 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Confidential – Oracle Internal/Restricted/Highly Restricted 5
- 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
General Information
• Oracle GoldenGate 18c for Microservices uses RESTful APIs
• All administration functions can be performed with RESTful APIs
• Core Documentation
– https://docs.oracle.com/en/middleware/goldengate/core/18.1/index.html
• RESTful API Documentation (12.3.0.1.x)
– https://docs.oracle.com/goldengate/c1230/gg-winux/OGGRA/toc.htm
Confidential – Oracle Internal/Restricted/Highly Restricted 6
- 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Database
7
- 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add Trandata
curl -X POST
http://{hostname}:{port}/services/v2/connections/{Domain}.{Alias}/trandata/table
--user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"operation":"add",
"tableName":"pdb1.inittest.optype_test"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 8
Single Table
- 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add SchemaTrandata
curl -X POST
http://{hostname}:{port}/services/v2/connections/{Domain}.{Alias}/trandata/schema
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"operation":"add",
"schemaName":"oggtst1.soe"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 9
Whole Schema
- 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Connections
curl -X GET
http://{hostname}:{port}/services/v2/connections
- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 10
See who is connected
- 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Administration Service
11
- 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Credential
curl -X POST
http://{hostname}:{port}/services/v2/credentials/{Domain}/{Alias}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"userid":"c##ggate@cdb",
"password":"ggate"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 12
Add a Credential to Administrative Service
- 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Credential
curl -X POST
http://{hostname}:{port}/services/v2/credentials /{Domain}/{Alias}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"userid":"c##ggate@cdb",
"password":"ggate"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 13
Add a Credential to Administrative Service
• Same command structure works for Source or Target Administrative Service
- 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Credential – Protocol User
curl -X POST
http://{hostname}:{port}/services/v2/credentials /{Domain}/{Alias}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"userid":"oggadmin",
"password":"Welcome1"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 14
Add a Protocol User to Administrative Service – Non-Secure
• This user is the ServiceManager user for Target system.
• Created on the source Administrative Service
- 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Extract
curl -X POST
http://{hostname}:{port}/services/
v2/extracts/{ExtractName}
-- user
‘{ServiceManagerUser}:{password}
'
-H 'cache-control: no-cache'
-d '{
"description":"Integrated
Extract",
"config":[
"Extract IEPKTST",
"ExtTrail bc",
"UseridAlias SGGATE",
"sourcecatalog pdb1;",
"Table inittest.pktst_table,
getbeforecols(on update all, on
delete all);"
],
"source":{
"tranlogs":"integrated"
},
"credentials":{
"alias":"SGGATE"
},
"registration":{
"containers": [ "pdb1" ],
"optimized":false
},
"begin":"now",
"targets":[
{
"name":"bc",
"sizeMB":250
}
],
"status":"stopped"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 15
Add an Extract to Administrative Service
- 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Delete Extract
curl -X DELETE
http://{hostname}:{port}/services/v2/extracts/{ExtractName}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 16
Remove an Extract to Administrative Service
- 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Extract
curl -X GET
http://{hostname}:{port}/services/v2/extracts
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 17
List all Extracts
- 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Replicat
curl -X POST
http://{hostname}:{port}/service
s/v2/replicats/{ReplicatName}
-- user
‘{ServiceManagerUser}:{passwor
d}'
-H 'cache-control: no-cache'
-d '{
"config":[
"Replicat IRPKTST",
"UseridAlias TGGATE",
"Map
pdb1.inittest.pktst_table, Target
inittest.pktst_table,
colmap(usedefaults,
optype=@getenv('''ggheader''','
''optype'''),
beforerid=@before(rid));"
],
"source":{
"name":"bd"
},
"credentials":{
"alias":"TGGATE"
},
"checkpoint":{
"table":"ggate.checkpoint"
},
"mode":{
"type":"integrated",
"parallel": false
},
"registration": "standard",
"begin":"now",
"status":"running"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 18
Add an Replicat to Administrative Service
- 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Delete Delete
curl -X DELETE
http://{hostname}:{port}/services/v2/replicats/{ReplicatName}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 19
Remove an Replicat to Administrative Service
- 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Replicat
curl -X GET
http://{hostname}:{port}/services/v2/replicats
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 20
List all Replicats
- 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Distribution Service
21
- 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Create Distribution Path
curl -X POST
http://{hostname}:{port}/services/v2/sources/{PathName}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"name": "PKTSTPATH",
"status": "stopped",
"source": {
"uri": "trail://localhost:16002/services/v2/sources?trail=bc"
},
"target": {
"uri": "ws://OracleGoldenGate+WSTARGET@localhost:17003/services/v2/targets?trail=bd"
}
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 22
Create a Distribution Path in Distribution Service
- 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Delete Distribution Path
curl -X DELETE
http://{hostname}:{port}/services/v2/sources/{PathName}
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
-d '{
"distpath":"TSTPATH"
}'
Confidential – Oracle Internal/Restricted/Highly Restricted 23
Delete a Distribution Path in Distribution Service
- 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Distribution Path(s)
curl -X GET
http://{hostname}:{port}/services/v2/sources
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 24
List all Distribution Paths in Distribution Service
- 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Extract + Trail File
curl -X GET
http://{hostname}:{port}/services/v2/exttrails
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 25
List Extract and Trail File in Distribution Service
- 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Receiver Service
26
- 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
List Distribution Paths
curl -X GET
http://{hostname}:{port}/services/v2/targets
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 27
List Distribution Paths from Receiver Service
- 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Retrieve Distribution Paths Statistics
curl -X GET
http://{hostname}:{port}/services/v2/targets/{SystemGenPathName}/stats
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 28
Retrieve Distribution Paths from Receiver Service
- 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
RESTful API Examples
Performance Metric Service
29
- 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Retrieve Extract Statistics
curl -X GET
http://{hostname}:{port}/services/v2/mpoints/{ExtractName}/statisticsExtract
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 30
Retrieve Extract from Performance Metric Service
- 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Retrieve Table Statistics
curl -X GET
http://{hostname}:{port}/services/v2/mpoints/{ExtractName}/statisticsTableExtract
-- user ‘{ServiceManagerUser}:{password}'
-H 'cache-control: no-cache'
Confidential – Oracle Internal/Restricted/Highly Restricted 31
Retrieve Table Statistics per Extract from Performance Metric Service
- 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted
Shell Script Examples
RESTful API within Shell Scripts
- 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add Credential
#!/bin/bash
#variables
vPass=$1
vASHost=localhost
vASPort=$2
vGGUser=$3
vGGPass=$4
vGGAlias=SGGATE
function _createAlias {
curl -X POST
http://$vASHost:$vASPort/servic
es/v2/credentials/{Domain}/$vG
GAlias
--user "oggadmin:"$vPass
-H 'Cache-Control: no-cache'
-d '{
"userid":"'$vGGUser'",
"password":"'$vGGPass'"
}' | python -mjson.tool
}
function _main {
_createAlias
}
_main
Confidential – Oracle Internal/Restricted/Highly Restricted 33
Add Credential via RESTful API using Shell Scripts
- 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add Credential
#!/bin/bash
#variables
vPass=$1
vASHost=localhost
vASPort=$2
vProtoUser=$3
vProtoPass=$4
vProtoAlias=WSTARGET
function _createAlias {
curl -X POST
http://$vASHost:$vASPort/servic
es/v2/credentials/{Domain}/$vPr
otoAlias
--user "oggadmin:"$vPass
-H 'Cache-Control: no-cache'
-d '{
"userid":"'$vProtoUser'",
"password":"'$vProtoPass'"
}'| python -mjson.tool
}
function _main {
_createAlias
}
_main
Confidential – Oracle Internal/Restricted/Highly Restricted 34
Add Protocol Credential via RESTful API using Shell Scripts – Non-Secure
- 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add Extract
#!/bin/bash
….
function _addExtract {
curl -X POST
http://$vASHost:$vASPort/services/v2/extracts/$vExt
Name
--user "oggadmin:"$vPass
-H 'Cache-Control: no-cache'
-d '{
"description":"Integrated Extract",
"config":[
"Extract '$vExtName'",
"ExtTrail aa",
"UseridAlias '$vGGAlias'",
"sourcecatalog oggoow181;",
"table soe.addresses;",
"table soe.customers;",
"table soe.orders;",
"table soe.order_items;",
"table soe.card_details;",
"table soe.logon;",
"table soe.product_information;",
"table soe.inventories;",
"table soe.product_descriptions;",
"table soe.warehouses;",
"table soe.orderentry_metadata;"
],
"source":{
"tranlogs":"integrated"
},
"credentials":{
"alias":"'$vGGAlias'"
},
"registration":{
"containers": [ "oggoow181" ],
"optimized":false
},
"begin":"now",
"targets":[
{
"name":"aa",
"sizeMB":250
}
],
"status":"stopped"
}' | python -mjson.tool
}
Confidential – Oracle Internal/Restricted/Highly Restricted 35
Add Extract via RESTful API using Shell Scripts
- 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Add Replicat
#!/bin/bash
….
function _addReplicat {
curl -X POST
http://$vASHost:$vASPort/services/v2/replicats/$vRe
pName
--user "oggadmin:"$vPass
-H 'Cache-Control: no-cache'
-d '{
"description":"Integrated Replicat",
"config":[
"Replicat '$vRepName'",
"UseridAlias '$vGGAlias'",
"map oggoow181.soe.addresses,target
soe.addresses, keycols(address_id);",
"map oggoow181.soe.customers, target
soe.customers, keycols(customer_id);",
"map oggoow181.soe.orders, target soe.orders,
keycols(order_id);",
"map oggoow181.soe.order_items, target
soe.order_items, keycols(order_id, line_item_id);",
"map oggoow181.soe.card_details, target
soe.card_details, keycols(card_id);",
"map oggoow181.soe.logon, target soe.logon;",
"map oggoow181.soe.product_information,
target soe.product_information;",
"map oggoow181.soe.inventories, target
soe.inventories, keycols(product_id, warehouse_id);",
"map oggoow181.soe.product_descriptions,
target soe.product_descriptions;",
"map oggoow181.soe.warehouses, target
soe.warehouses;",
"map oggoow181.soe.orderentry_metadata,
target soe.orderentry_metadata;"
],
"source":{
"name":"ab"
},
"mode":{
"type":"integrated"
},
"credentials":{
"alias":"'$vGGAlias'"
},
"checkpoint":{
"table":"ggate.checkpoints"
},
"status":"stopped"
}' | python -mjson.tool
}
Confidential – Oracle Internal/Restricted/Highly Restricted 36
Add Replicat via RESTful API using Shell Scripts
- 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 37
- 38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Speaker Reference
Confidential – Oracle Internal/Restricted/Highly Restricted 38
@dbasolved
http://dbasolved.com
bobby.Curtis@oracle.com