oracle database 12c it wars - nloug.nl · pdf filecommitment to deliver any material, code ......
TRANSCRIPT
![Page 1: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/1.jpg)
Copyright©2014,Oracleand/oritsaffiliates.Allrightsreserved.|
OracleDatabase12candDevOpsMariaColganOracleDatabaseSystemsJune,2017@SQLMaria
IT
WARS
![Page 2: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/2.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
ThefollowingisintendedtooutlineourgeneralproductdirecNon.ItisintendedforinformaNonpurposesonly,andmaynotbeincorporatedintoanycontract.Itisnotacommitmenttodeliveranymaterial,code,orfuncNonality,andshouldnotberelieduponinmakingpurchasingdecisions.Thedevelopment,release,andNmingofanyfeaturesorfuncNonalitydescribedforOracle’sproductsremainsatthesolediscreNonofOracle.
SafeHarborStatement
![Page 3: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/3.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
• ReputaNon:Fast&Agile
• Primaryfocus:Delivery
• Favoriteline:“Let’sgetitdone”
Public 3
MeettheDeveloper
Developer
![Page 4: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/4.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
• ReputaNon:Cau=ous&RiskAverse
• Primaryfocus:Longevity&Security
• Favoriteline:“Let’snotgethacked”
Public 4
MeettheDBA
DBA
![Page 5: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/5.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| OracleConfidenNal–Internal/Restricted/HighlyRestricted 5
Together they must build a new web application for the recently
acquired coffee shops chain
![Page 6: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/6.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 6Public
Weneedtobuildanewwebapplica=onforthecoffee
shopswerecentlyacquiredinahurry,sowewanttouseaflexibleschemausingJSONdocuments.CanyousetupaMongoDBdatabaseforus?
ShecannotdifferenNateablasterfroma
sNck…
Developer DBA
Ohno!Whatdoeshewant
now?
Whydon’tyoujustuseOracle?
![Page 7: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/7.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 7
OracleDatabase12casaDocumentStore12.2JSON
SQL> CREATE TABLE orders (order_details BLOB CONSTRAINT is_json CHECK (order_details IS JSON) );
TablecontainingJSONdocuments
Public
• OraclestoresJSONintablecolumns• Nospecialdatatype• CanbeVARCHAR2,BLOBorCLOB
• JSONsupportedbyallOraclefeatures• AnalyNcs,EncrypNon,In-Memory,RAC,
ReplicaNon,ParallelSQL,…
• PluscanindexanyJSONelement
![Page 8: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/8.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 8
OracleDatabase12casaDocumentStore12.2JSON
SQL> CREATE TABLE orders (order_details BLOB CONSTRAINT is_json CHECK (order_details IS JSON) );
TablecontainingJSONdocuments
Public
• OraclestoresJSONintablecolumns• Nospecialdatatype• CanbeVARCHAR2,BLOBorCLOB
• JSONsupportedbyallOraclefeatures• AnalyNcs,EncrypNon,In-Memory,RAC,
ReplicaNon,ParallelSQL,…
• PluscanindexanyJSONelementIS_JSONconstraintensuresonlylegalJSONdocumentscanbeinserted
![Page 9: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/9.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 9Public
ButtheJSONdocumentisBLOB.That’snotwhatweneed.Weneedtobe
abletoquerytheelementsintheJSON
documents?
Developer DBA
Don’tpanic!OracleoffersnaNveSQL
supportforJSON.Letmeshowyou
![Page 10: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/10.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 10
NaNveSQLSupportforJSON12.2JSON
Public
• JSONcanbequeriedusingsimpleSQLdotnotaNon
SELECT
o.order_details.location.city FROM orders o;
Location--------------------BostonLos AngelesNew YorkSan FranciscoWashington
SQL> desc ORDERSNAME TYPE------------------ -----------ORDER_DETAILS BLOB
TablecontainingJSONdocuments
{"date": "2017-05-03 10:40:36","loyaltyCardNo": 1230, "location": { "city": "Dallas", "state": "TX”}, "salesAmount": 7.55, "order": [ { "item": "Espresso”, …. }}
![Page 11: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/11.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
Afewhourslater….........
Public 11
![Page 12: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/12.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
Developer
12Public
Hey,wehavedecidedtodoeverythingviaRESTandweknowthatMongoDBcanspeakRESTSoitlookslikeweneedadocumentstore
aVerall
DBA
Dude,RESTisoutoftheboxwithOracle!Letme
showyou
![Page 13: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/13.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| OracleConfidenNal–Internal/Restricted/HighlyRestricted 13
Conn establishment
Ackn
Request
Response
Conn close
Ackn
13
Request
Response
Conventional communication
RESTful communication
RESTinanutshell
![Page 14: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/14.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
OracleRESTDataServicesHTTP(s)APIApp-DevwithRelaNonalTablesinOracleDatabase
{“loyaltyCardNo”:1001,“name”:“ScooKing”,“LocaNon”:“500Mainstreet,InnovaNonCA”“date”:“Feb27,2017”"salesAmount":4.15“orders”:[{"item":"Mocha","size":"medium","salesAmount":4.15,"coffee_used_gram":15}]}
OracleRESTDataServices
ORDSmapsstandardURIrequeststocorrespondingrelaNonalSQL(notschemaless):e.g.SQLSELECTfromcustomersandorderstable.ORDSalsotransformstheSQLresultsintothehighlypopularJavaScriptObjectNotaNon(JSON),otherformatsincludeHTML,binaryandCSV.
FullycommioedtosupporNnganyandallstandardsrequiredbyFusion/SaaS/FMW;weareacNvelyengagedintheongoingdialog.
SQL
URIRequestorHTTP(s)postmappedtoSQLrequest
JDBCConnecNon
Pool
JSONSQLresultto
JSONtransformaNon
hops://myhost/myapp/hr/customerorders/1001
URI
![Page 15: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/15.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
ConfiguringRESTwithOracleExadataExpressCloudService
15
![Page 16: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/16.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
ConfiguringRESTwithOracleExadataExpressCloudService
16
Givetheserviceanameandspecify
theprefix
![Page 17: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/17.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
ConfiguringRESTwithOracleExadataExpressCloudService
17
SpecifytherestoftheURL
orders
![Page 18: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/18.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
ConfiguringRESTwithOracleExadataExpressCloudService
18
Specifythetypeofservice
Specifytheactualcommandtobe
usedbytheservice
![Page 19: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/19.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
RESTEndpointForDeveloper
hops://demo-a425370.db.us2.oraclecloudapps.com/apex/coffeeshop/orders
OracleConfidenNal–Internal/Restricted/HighlyRestricted 19
![Page 20: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/20.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 20Public
Developer DBA
Goahead,sendyourRESTcalls
![Page 21: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/21.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
CheckingresultofRESTSELECT Count(*) FROM orders;
COUNT(*)
--------
1
21
![Page 22: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/22.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DBA
22Public
Thisisawesome!YoujustreducedourNmetomarketbytwoweeks!Thanksa
million!
Theforceisstrongwithme
You’rewelcome
Developer
![Page 23: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/23.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
Afewhourslater….........
Public 23
![Page 24: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/24.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DBA
24Public
I’mheadinghomeforthedayandIwanttokeep
workingonmycommutebutIwon’thavegoodinternetconnecNvity.Canwebuildthesameenvironmentin
Docker?
Absolutely!YouwillneedtodownloadtheDocker
imageforOracleDatabase12c&Oracle
SQLDeveloper
Developer
Letmeshowyouonmymachine
![Page 25: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/25.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
1. Clickonthetoolsmenu2. ClickontheRESTDataServices3. ClickonInstall
OracleConfidenNal–Internal/Restricted/HighlyRestricted 25
EnablingSQLDeveloperasORDS
![Page 26: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/26.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
1. UseOracleRESTDataServicethat’sincludedwithSQLDev
2. SpecifythelocaNonforyourRESTconfigfile
3. Clicknext
OracleConfidenNal–Internal/Restricted/HighlyRestricted 26
EnablingSQLDeveloperasORDS
![Page 27: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/27.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
1. FillinyoutheServiceNameforyourdatabaseindocker
2. SpecifythepasswordforyourORDS_PUBLIC_USER
3. Clicknext
OracleConfidenNal–Internal/Restricted/HighlyRestricted 27
EnablingSQLDeveloperasORDS
![Page 28: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/28.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
1. ClickRunStandalonemode2. SpecifyHTTPPORT(8080)3. Clicknext4. Clickfinish
OracleConfidenNal–Internal/Restricted/HighlyRestricted 28
EnablingSQLDeveloperasORDS
![Page 29: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/29.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
RESTEndpointForDocker
hop://localhost:8080/ords/coffeeshop/orders/order
OracleConfidenNal–Internal/Restricted/HighlyRestricted 29
![Page 30: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/30.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
Afewdayslater….........
Public 30
![Page 31: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/31.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DBA
31Public
How’sitgoing?
Isn’ttheCRMdataalreadyinthedatabasewiththeJSONdata?
Yeah,exactly.Nowwejustneedtobuildsomeclassesto
getthatcorrespondingrelaNonaldatafortheJSON
orders
Hey,weareworkingonintegraNngtheCRMdatawiththatJSONdatawe
stored
Developer
![Page 32: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/32.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DBA
32Public
Thereisnoneedtointegrateattheapplevel.YoucanuseSQLtorunaqueryagainsttheJSON&theCRMdata.LetmeshowyoubutfirstI’llneedtocheckwhatthe
structureofyourJSONlookslike.
Developer
![Page 33: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/33.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DataGuide:UnderstandingYourJSONDocuments
• Metadatadiscovery:discoversthestructureofcollecNonofJSONdocuments– OpNonal:deepanalysisofJSONforListofValues,ranges,sizingetc.
• AutomaNcallyGenerates– Virtualcolumns– RelaNonalviews
• De-normalizedrelaNonalviewsforarrays
– Reports/SynopsisofJSONstructure
33
![Page 34: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/34.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 34
SQL> SELECT JSON_DATAGUIDE(o.order_details) FROM orders o; JSON_DATAGUIDE(O.ORDER_DETAILS) ---------------------------------------------------------------------- [ {"o:path": "$.date", "type": "string", "o:length": 32 }, {"o:path": "$.order", "type": "array", "o:length": 256 }, {"o:path": "$.location", "type": "object", "o:length": 32}, {"o:path": "$.location.city", "type": "string", "o:length": 8}, .... { "o:path": "$.salesAmount", "type": "number", "o:length": 4 }, { "o:path": "$.loyaltyCardNo","type": "number", "o:length": 8}]
DataGuide:UnderstandingYourJSONDocuments
![Page 35: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/35.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
QueryJSONwithRelaNonalDataSQL> SELECT c.c_name,
o.order_details.location.city,
SUM(To_number(o.order_details.salesAmount)) total
FROM customers c,
orders o
WHERE c.c_custid = o.order_details.loyaltyCardNo
GROUP BY c.c_name,
o.order_details.location.city
ORDER BY total Desc
FETCH FIRST 10 ROWS ONLY;
35
FETCHFIRST10ROWSONLY
• Newsyntaxtolimitnumberofrowsreturned
• ReplacesSELECT*FROMWHEREROWNUM<11
![Page 36: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/36.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 36Public
Developer DBA
Tomakeiteasierforyou,Icancreateaviewsothedevelopersdon’tneedtoknowallofthe
joincondi=ons
Yeahright,andanybodyis
rememberingthatstuff!
![Page 37: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/37.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
CreaNngaViewonTopofJSON&RelaNonalDataSQL> CREATE OR replace VIEW crm_data AS
SELECT c.c_name,
o.order_details.location.city,
SUM(To_number(o.order_details.salesAmount)) total
FROM customers c,
orders o
WHERE c.c_custid = o.order_details.loyaltyCardNo
GROUP BY c.c_name,
o.order_details.location.city
ORDER BY total Desc
FETCH FIRST 10 ROWS ONLY
37
![Page 38: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/38.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
CreaNngaViewonTopofJSON&RelaNonalDataSQL> SELECT *
FROM crm_data;
38
![Page 39: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/39.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 39Public
Developer DBA
Noway,thatjustleadstoalotofroundtripsbetweenappanddatabase,whichwillmakethingseven
slower.Andbesides,thisproblemhasalreadybeen
solved.EverheardofMaterializedViews?
That'sgreatbuthowwillthatworkwhenwehaveGBsofdatainthere.Surelyjust
selecNngtheJSONfirstandthenretrievingthe
correspondingcustomerdataisfasterandsaferperformance
wise
![Page 40: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/40.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 40Public
Ohboy,thisonereallydoesn’tfeeltheforce!
Amaterializedwhat?
Developer DBA
![Page 41: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/41.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
WhatisaMaterializedView?• Amaterializedviewisadatabaseobjectthatcontainstheresultsofaquery• Thequerycanbebaseontables,vieworothermaterializedviews• TypicallyusedtoavoidrepeaNngcostlyaggregaNons• OpNmizertransformsqueriesagainstoriginaltablesintoasemanNcallyequivalentqueryagainstthematerializedview
• AtradeoffbetweendiskspaceandCPU
OracleConfidenNal–Internal/Restricted/HighlyRestricted 41
![Page 42: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/42.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
CreaNngReal-TimeMVonTopofJSON&RelaNonalDataSQL> CREATE MATERIALIZED VIEW top_customers_mv
ENABLE query rewrite
ENABLE on query computation
AS SELECT c.c_name,
o.order_details.location.city,
SUM(To_number(o.order_details.salesAmount)) total
FROM customers c,
orders o
WHERE c.c_custid = o.order_details.loyaltyCardNo
GROUP BY c.c_name,
o.order_details.location.city;
42
ENABLEonquerycomputa=on
• Real-TimeMaterializedView
• EnsureyoualwaysgetaccurateanswerevenifmaterializedviewisstalebyjoiningtoMVlog
![Page 43: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/43.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
QueriesAutomaNcallyRedirectedtoUseMaterializedView
43
SQL> SELECT *
FROM crm_data;; --------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | --------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 10 | 20550 | |* 1 | VIEW | | 10 | 20550 | |* 2 | WINDOW SORT PUSHED RANK | | 1 | 2029 | | 3 | MAT_VIEW REWRITE ACCESS FULL| TOP_CUSTOMERS_MV | 1 | 2029 | ---------------------------------------------------------------------------
![Page 44: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/44.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 44Public
I’msNllnotsurethisapproachwillscaleasweneedthequeriestobe
returnedinsub-seconds.Canwetryitwithabiggerdata
set?
Developer DBA
Sure.Whereisthebiggerdataset?
![Page 45: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/45.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
TestMVQueryAgainstLargerDataset3.2millionJSONdocuments
OracleConfidenNal–Internal/Restricted/HighlyRestricted 45
SQL> CREATE MATERIALIZED VIEW top_customers_history_mv
ENABLE query rewrite
ENABLE on query computation
AS SELECT c.c_name,
o.order_details.location.city,
SUM(To_number(o.order_details.salesAmount)) total
FROM customers c,
orders_history o
WHERE c.c_custid = o.order_details.loyaltyCardNo
GROUP BY c.c_name,
o.order_details.location.city;
![Page 46: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/46.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 46Public
Developer DBA
Thewhat?Ohthat’sgreatfortheknownreportsbutthe
markeNngfolkswanttorunad-hocreportstoo.Whatcanwedotomakesuretheystay
within30seconds?Don’tpanic,wecanput
thetablesintotheIn-Memorycolumn
store
![Page 47: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/47.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
OracleDatabaseIn-Memory:DualFormatArchitecture
• BOTHrowandcolumnformatsforsametable
• SimultaneouslyacNveandtransacNonallyconsistent
• OLTPusesprovenrowformat
• AnalyNcs&reporNngusenewin-memoryColumnformat• SeamlesslybuiltintoDatabase• Allenterprisefeatureswork
-RAC,Dataguard,Flashback,etc47
BufferCache
NewIn-MemoryColumnStore
SALES SALESRow
FormatColumnFormat
SALES
![Page 48: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/48.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
• FullJSONdocumentspopulatedusinganopNmizedbinaryformat
• AddiNonalexpressionscanbecreatedonJSONcolumns(e.g.JSON_VALUE)&storedincolumnstore
• QueriesonJSONcontentorexpressionsautomaNcallydirectedtoIn-Memoryformat
Superfast/MulN-ModelAnalyNcs:In-MemoryJSON
RelaNonal
In-MemoryColumStore
In-MemoryVirtualColumns
In-MemoryJSONFormat
RelaNonal Virtual JSON
48
{"date": "2016-05-03 10:40:36","loyaltyCardNo": 1230, "location": { "city": "Dallas", "state": "TX”}, "salesAmount": 7.55, "order": [ { "item": "Espresso”, …. }}
![Page 49: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/49.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
SQL> ALTER TABLE orders_history ADD city AS (JSON_VALUE(order_details, '$.location.city'));
SQL> ALTER TABLE orders_history ADD state AS (JSON_VALUE(order_details, '$.location.state'));
SQL> ALTER TABLE orders_history ADD salesamount AS (JSON_VALUE(order_details, '$.salesAmount'));
CreateVirtualColumnsontheOrders_Historytable
49
![Page 50: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/50.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
SQL> ALTER TABLE customers INMEMORY;
SQL> ALTER TABLE orders_history INMEMORY;
SQL> SELECT count(*) FROM customers;
SQL> SELECT count(*) FROM orders_history;
SQL> SELECT segment_name,
populate_status, bytes_not_populated
FROM v$im_segments;
PlaceTablesintoIMColumnStore
50
![Page 51: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/51.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DBA
51Public
Wow,that’sfantasNc.WillitautomaNcallystay
In-Memory?Yup,alldoneforyoubythedatabase!
Thisisawesome!That'sexactlywhatyouwantfrom
adatabase.Schemaflexibility,analyNcsand
performance.
Developer
![Page 52: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/52.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| Public 52
JustWhenyouthinkeverythingisdone…........
Developer Securityguy
HaveyousecuredthecustomersensiNve
data?
![Page 53: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/53.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 53Public
Heyonemorething,Chewiehasgivenussomeridiculoussecurityrequirements.Nobodyisallowedtoseetheloyaltycardnumberandstufflikethat.Canwedo
somethingtheretoo?"
Developer DBA
SurewecanLet'simplementdata
redacNon.
![Page 54: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/54.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
DefineaRedacNonPolicytoRedactEmployeeLastNameSQL> BEGIN
dbms_redact.add_policy( object_schema => ’coffeeshop',
object_name => ’customers',
column_name => ’c_custid',
policy_name => 'redact_Loyal_crd',
function_type => DBMS_REDACT.FULL,
expression => '1=1');
END;
/
OracleConfidenNal–Internal/Restricted/HighlyRestricted 54
![Page 55: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/55.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 55Public
Thisisjustawesome,canyoualsogivemeaREST
endpointtothat?
Developer DBA
Ofcourse!
![Page 56: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/56.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.| 56Public
Man,Iwishwewouldhavetalkedtoyousooner.Youpreoymuchgotourgo-livedownfrom6to1week!Hey,canwejustincludeyougoingforwardinourdiscussionsand
projectplanning?
Developer DBA
I'dbedelightedto!Ialwaysthoughtweshouldworkmuchclosertogether.It'salsogreatformetohavebeoerunderstandwhatappsyouarebuildinginorderto
supportthem.
![Page 57: Oracle Database 12c IT WARS - nloug.nl · PDF filecommitment to deliver any material, code ... • AnalyNcs, EncrypNon, In-Memory, RAC, Replicaon, Parallel ... API App-Dev with Relaonal](https://reader031.vdocuments.net/reader031/viewer/2022022501/5aa658957f8b9ab4788e5c43/html5/thumbnails/57.jpg)
Copyright©2015,Oracleand/oritsaffiliates.Allrightsreserved.|
Summary:OracleDatabase12cUniversalPeaceMaker
OracleConfidenNal–Internal/Restricted/HighlyRestricted 57
Summary:
FlexibilityNaNveJSONsupportRESTServices
ScalabilityScale-outandScale-up
Real-TimeAnalyNcsJSONintheIn-MemoryColumnStore
SecurityDataencryptedatrestDataRedacNon