SlideShare una empresa de Scribd logo
1 de 48
One Application, Many Clients:
Building a Multi-Tenant APEX Application
Jeffrey Kemp jeffkemponoracle.com
Version 1.0
customisations
customisations
customisations
customisations
customisations
customisations
APEX_APPLICATION.g_flow_alias
Version 1.0
Version 1.1
Change Deployment
• WWV_FLOW_UTILITIES.export_application_to_clob
Change Deployment
• Prepend:
set serverout on
begin
apex_pkg.pre_import
(app_id => 323
,app_alias => 'SYG'
,app_name => 'State Youth Games');
end;
/
search and replace
customisations
SYS_CONTEXT('CTX','ORG_YEAR')
if minor_version >= 35 then ... end if
Version 1.1
Version 2.0
https://example.com/
https://example.com/gf/SYG2017
https://example.com/team/G7XHP
https://example.com/ref/104082048993
data-driven customisations
SYS_CONTEXT('CTX','ORG_YEAR')
Version 2.0
Multi-Tenant: Purpose
• Partition the Data
• Partition the Workload
Multi-Tenant: Design Goals
1. Tenant isolation
2. Cloud resource cost
3. Ease of administration
4. Scalability
Tenant Isolation
• Data isolation
• Backup & Restore
• Customisations
• Noisy neighbours
• Data ownership
Hadlow's First Law of Multi-Tenancy
“A multi-tenanted application should
not look like a multi-tenanted
application.”
http://mikehadlow.blogspot.com.au/2008/11/multi-tenancy-part-2-components-and.html
Multi-Tenant: Architecture
• Multiple servers
• Multiple databases
• Multiple workspaces/schemas
• Single schema
Multi-Tenant: Single Schema
Architectures
• Separate tables for each tenant
e.g. TENANT01_EMP, TENANT02_EMP, etc.
“I have been involved in five different projects in which each user, or
survey, or client, or whatever got their own set of tables. In each case
this has been disasterous [sic]. In each case, the project was later re-
engineered to use a generic, static schema.”
[online discussion http://discuss.joelonsoftware.com/default.asp?design.4.319460.16]
• Tenant identifier column
Codebase Structure
• Branch per tenant
OR
• Single codebase
“... per-tenant customisation is pretty much
forbidden, everything that a tenant might
want to change should be configurable ...
You can maintain maybe 5 branches of a
system, but not 15000, and that is what
SaaS is aimed at”
[Daniel B, https://softwareengineering.stackexchange.com/questions/109629/supporting-
multitenancy]
Multi-Tenant: Oracle Features
For multiple databases/schemas:
• Pluggable databases (Oracle Multitenant)
• Application Containers (Oracle 12.2)
• Conditional compilation
Multi-Tenant: Oracle Features
For single schema:
• [Global] Application Context
• Row Level Security (VPD)
• Views (poor-man's VPD)
• Partitioned tables
Multi-Tenant: APEX Features
• Workspace per tenant
• Application per tenant
• Single application/workspace
Convert an APEX Application to Multi-Tenant
APEX changes
• post-authentication: set application context variable
Convert an APEX Application to Multi-Tenant
Data Model changes
• Security groups table
• Add column security_group_id
Convert an APEX Application to Multi-Tenant
Security (Tenant isolation)
• VPD policy for queries
function vpd_policy
(object_schema in varchar2
,object_name in varchar2
) return varchar2 is
begin
return q'[
security_group_id = sys_context('CTX’,
'SECURITY_GROUP_ID’)
]';
end vpd_policy;
begin
dbms_rls.add_policy
(object_name => 'MYTABLE'
,policy name => 'multitenant_policy'
,policy_function => 'pkg.vpd_policy'
,update_check => true
,static_policy => true);
end;
Convert an APEX Application to Multi-Tenant
Constraint changes
• Unique constraints
fix_unique_constraint.sql
• Referential constraints
Details
“Convert an APEX Application to Multi-Tenant”
https://jeffkemponoracle.com/2017/11/convert-an-apex-application-to-multi-tenant
http://bit.ly/2hGXHRE
jeffkemponoracle.com
Thank you

Más contenido relacionado

La actualidad más candente

Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azuretombuildsstuff
 
Alfresco search services: Now and Then
Alfresco search services: Now and ThenAlfresco search services: Now and Then
Alfresco search services: Now and ThenAngel Borroy López
 
Microservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactMicroservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactAraf Karsh Hamid
 
Electronic patients records system based on oracle apex
Electronic patients records system based on oracle apexElectronic patients records system based on oracle apex
Electronic patients records system based on oracle apexJan Karremans
 
API Security in a Microservice Architecture
API Security in a Microservice ArchitectureAPI Security in a Microservice Architecture
API Security in a Microservice ArchitectureMatt McLarty
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewKris Rice
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationDimitri Gielis
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloakGuy Marom
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practicesAnkita Mahajan
 
Azure App configuration
Azure App configurationAzure App configuration
Azure App configurationMuhammad Sajid
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API GatewayYohann Ciurlik
 
Oracle RAD stack REST, APEX, Database
Oracle RAD stack REST, APEX, DatabaseOracle RAD stack REST, APEX, Database
Oracle RAD stack REST, APEX, DatabaseMichael Hichwa
 
Oracle APEX Social Login
Oracle APEX Social LoginOracle APEX Social Login
Oracle APEX Social Loginmsewtz
 
Alfresco DevCon 2019 - Alfresco Identity Services in Action
Alfresco DevCon 2019 - Alfresco Identity Services in ActionAlfresco DevCon 2019 - Alfresco Identity Services in Action
Alfresco DevCon 2019 - Alfresco Identity Services in ActionFrancesco Corti
 
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Claus Ibsen
 
Keycloak Single Sign-On
Keycloak Single Sign-OnKeycloak Single Sign-On
Keycloak Single Sign-OnRavi Yasas
 
Capacitacion Apex 5 Oracle - Daniel Bermudez
Capacitacion Apex 5 Oracle - Daniel BermudezCapacitacion Apex 5 Oracle - Daniel Bermudez
Capacitacion Apex 5 Oracle - Daniel BermudezDaniel Bermudez
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak Abhishek Koserwal
 

La actualidad más candente (20)

Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azure
 
Alfresco search services: Now and Then
Alfresco search services: Now and ThenAlfresco search services: Now and Then
Alfresco search services: Now and Then
 
Microservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactMicroservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito Pact
 
Electronic patients records system based on oracle apex
Electronic patients records system based on oracle apexElectronic patients records system based on oracle apex
Electronic patients records system based on oracle apex
 
API Security in a Microservice Architecture
API Security in a Microservice ArchitectureAPI Security in a Microservice Architecture
API Security in a Microservice Architecture
 
Oracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ OverviewOracle REST Data Services Best Practices/ Overview
Oracle REST Data Services Best Practices/ Overview
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integrationOracle Application Express (APEX) and Microsoft Sharepoint integration
Oracle Application Express (APEX) and Microsoft Sharepoint integration
 
Graphql
GraphqlGraphql
Graphql
 
Secure your app with keycloak
Secure your app with keycloakSecure your app with keycloak
Secure your app with keycloak
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Azure App configuration
Azure App configurationAzure App configuration
Azure App configuration
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API Gateway
 
Oracle RAD stack REST, APEX, Database
Oracle RAD stack REST, APEX, DatabaseOracle RAD stack REST, APEX, Database
Oracle RAD stack REST, APEX, Database
 
Oracle APEX Social Login
Oracle APEX Social LoginOracle APEX Social Login
Oracle APEX Social Login
 
Alfresco DevCon 2019 - Alfresco Identity Services in Action
Alfresco DevCon 2019 - Alfresco Identity Services in ActionAlfresco DevCon 2019 - Alfresco Identity Services in Action
Alfresco DevCon 2019 - Alfresco Identity Services in Action
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
 
Keycloak Single Sign-On
Keycloak Single Sign-OnKeycloak Single Sign-On
Keycloak Single Sign-On
 
Capacitacion Apex 5 Oracle - Daniel Bermudez
Capacitacion Apex 5 Oracle - Daniel BermudezCapacitacion Apex 5 Oracle - Daniel Bermudez
Capacitacion Apex 5 Oracle - Daniel Bermudez
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 

Similar a One App, Many Clients: Converting an APEX Application to Multi-Tenant

.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & DevelopmentGlobalLogic Ukraine
 
SaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloudSaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineClouduEngine Solutions
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic BeanstalkAmazon Web Services
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)QAware GmbH
 
Swarn Singh_CV_SSE
Swarn Singh_CV_SSESwarn Singh_CV_SSE
Swarn Singh_CV_SSESwarn Singh
 
F5 Meetup presentation automation 2017
F5 Meetup presentation automation 2017F5 Meetup presentation automation 2017
F5 Meetup presentation automation 2017Guy Brown
 
Practical lessons from customers performing digital transformation with Azure
Practical lessons from customers performing digital transformation with AzurePractical lessons from customers performing digital transformation with Azure
Practical lessons from customers performing digital transformation with AzureEdward Burns
 
Practical advice on deployment and management of enterprise workloads
Practical advice on deployment and management of enterprise workloadsPractical advice on deployment and management of enterprise workloads
Practical advice on deployment and management of enterprise workloadsJarek Miszczyk
 
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesPatterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesJosef Adersberger
 
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesPatterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesQAware GmbH
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kuberneteskloia
 
Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on BluemixRam Vennam
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsSpiffy
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileWASdev Community
 
Application Model for Cloud Deployment
Application Model for Cloud DeploymentApplication Model for Cloud Deployment
Application Model for Cloud DeploymentJim Kaskade
 
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver VMworld
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle ManagementDoKC
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle ManagementDoKC
 
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...Peter Daalmans
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsChris Munns
 

Similar a One App, Many Clients: Converting an APEX Application to Multi-Tenant (20)

.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
 
SaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloudSaaS transformation with OCE - uEngineCloud
SaaS transformation with OCE - uEngineCloud
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Swarn Singh_CV_SSE
Swarn Singh_CV_SSESwarn Singh_CV_SSE
Swarn Singh_CV_SSE
 
F5 Meetup presentation automation 2017
F5 Meetup presentation automation 2017F5 Meetup presentation automation 2017
F5 Meetup presentation automation 2017
 
Practical lessons from customers performing digital transformation with Azure
Practical lessons from customers performing digital transformation with AzurePractical lessons from customers performing digital transformation with Azure
Practical lessons from customers performing digital transformation with Azure
 
Practical advice on deployment and management of enterprise workloads
Practical advice on deployment and management of enterprise workloadsPractical advice on deployment and management of enterprise workloads
Practical advice on deployment and management of enterprise workloads
 
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesPatterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to Kubernetes
 
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to KubernetesPatterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to Kubernetes
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on Bluemix
 
MS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applicationsMS Cloud Day - Deploying and monitoring windows azure applications
MS Cloud Day - Deploying and monitoring windows azure applications
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
 
Application Model for Cloud Deployment
Application Model for Cloud DeploymentApplication Model for Cloud Deployment
Application Model for Cloud Deployment
 
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver
VMworld 2013: How to Replace Websphere Application Server (WAS) with TCserver
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
 
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...
How to Extend the App Model to Support Your User-Centric XenDesktop in the Da...
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless Applications
 

Más de Jeffrey Kemp

Why You Should Use TAPIs
Why You Should Use TAPIsWhy You Should Use TAPIs
Why You Should Use TAPIsJeffrey Kemp
 
Why You Should Use Oracle SQL Developer
Why You Should Use Oracle SQL DeveloperWhy You Should Use Oracle SQL Developer
Why You Should Use Oracle SQL DeveloperJeffrey Kemp
 
Building Maintainable Applications in Apex
Building Maintainable Applications in ApexBuilding Maintainable Applications in Apex
Building Maintainable Applications in ApexJeffrey Kemp
 
Old Oracle Versions
Old Oracle VersionsOld Oracle Versions
Old Oracle VersionsJeffrey Kemp
 
Apex and Virtual Private Database
Apex and Virtual Private DatabaseApex and Virtual Private Database
Apex and Virtual Private DatabaseJeffrey Kemp
 
Automate Amazon S3 Storage with Alexandria
Automate Amazon S3 Storage with AlexandriaAutomate Amazon S3 Storage with Alexandria
Automate Amazon S3 Storage with AlexandriaJeffrey Kemp
 
11g Function Result Cache
11g Function Result Cache11g Function Result Cache
11g Function Result CacheJeffrey Kemp
 

Más de Jeffrey Kemp (7)

Why You Should Use TAPIs
Why You Should Use TAPIsWhy You Should Use TAPIs
Why You Should Use TAPIs
 
Why You Should Use Oracle SQL Developer
Why You Should Use Oracle SQL DeveloperWhy You Should Use Oracle SQL Developer
Why You Should Use Oracle SQL Developer
 
Building Maintainable Applications in Apex
Building Maintainable Applications in ApexBuilding Maintainable Applications in Apex
Building Maintainable Applications in Apex
 
Old Oracle Versions
Old Oracle VersionsOld Oracle Versions
Old Oracle Versions
 
Apex and Virtual Private Database
Apex and Virtual Private DatabaseApex and Virtual Private Database
Apex and Virtual Private Database
 
Automate Amazon S3 Storage with Alexandria
Automate Amazon S3 Storage with AlexandriaAutomate Amazon S3 Storage with Alexandria
Automate Amazon S3 Storage with Alexandria
 
11g Function Result Cache
11g Function Result Cache11g Function Result Cache
11g Function Result Cache
 

Último

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Último (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

One App, Many Clients: Converting an APEX Application to Multi-Tenant

Notas del editor

  1. How to illustrate the concept of Multi-Tenant? First child…
  2. Then comes two children…
  3. Then three.
  4. An elegant solution.
  5. MULTI-TENANT APEX APPLICATIONS: HOW I STARTED State Youth Games is a multi-sport competition run by Youth Vision.
  6. Churches throughout Western Australia send teams of young people aged 16-28 to compete in a wide variety of sports and games.
  7. I've helped as a volunteer and coordinator, and in 2013 the director asked me to build a registration system for all the teams.
  8. The first version went live that year and worked quite well; later that year the Masters Games, a similar competition run for people over 28, wanted to use the same system so I made a copy of the APEX application and they used that. Over the following years the same system was used by SportsFest and GI Games; it is now being used to manage half a dozen different competitions every year. This is an example of a Multi-Tenant application: one application used by more than one organisation, each with a private view of their own data without seeing or affecting data for other organisations. In my case, all the sites were hosted on a single Oracle database running APEX; the system was designed to support multiple competitions because the first organisation (SYG) ran a new competition every year.
  9. This was Version 1.0. The data model includes a column in most of the tables called "Org/Year Code". This code identifies the data as relating to a particular organisation and competition year, e.g. SYG2013, MASTERS2013, SYG2014, MASTERS2014, SF2014, etc. I made a copy of the APEX application for each organisation and gave each copy an alias like "SYG", "MASTERS", etc. A substitution variable, set in the Application Definition, would tell the application what Year to use. In this way, I was able to make as many copies of the application as required, each pointing to the data for a particular organisation, for a particular competition year.
  10. Since there was a separate application for each organisation, small customisations to the various pages were possible as required by each organisation. One benefit of this approach was being able to respond quickly to a variety of requests and bug reports for each competition - usually someone would call or email me with an issue and I'd have the fix ready within an hour or less. There was a significant problem here as well - every change or fix required redoing the changes again and again in the other copies. If I simply copied an application over the top of another, the customisations done for that other copy would be lost. It soon became impractical and I started planning the next iteration that would solve this particular problem.
  11. In late 2014 I started Version 1.1. I took a copy of the application that was relatively "good", in that it had most of the good enhancements and bugfixes, and designated it "DEV". I reimplemented the remainder of customisations and bugfixes that had been done in the other copies into this new master copy - applying APEX conditions to ensure that customisations were only activated for the organisations that needed them.
  12. The application had global Application Items like these: ORG - the org code such as SYG, MASTERS, SF, etc. YEAR - the competition year VERSION - the minor version number of the application
  13. The application items were initialised for each session by copying corresponding application Substitution Variables.
  14. These substitution variables are used to allow me to programmatically change the tenant for any copy of the application.
  15. On the database side, database packages maintained an Application Context that stored these same variables for each user session. In this way APEX components could switch on or off - sometimes a component was only used by one particular ORG, or it was only applicable to a particular VERSION. In the same way, my PL/SQL code checked the Context variable to determine whether to run certain sections of code.
  16. To deploy enhancements or bugfixes for an organisation, I would first make the change in my DEV application, and then I'd run a SQL*Plus script which took the following steps: 1. Call WWV_FLOW_UTILITIES.export_application_to_clob which returns a CLOB containing a SQL*Plus script that installs the application (Note: this API is not officially supported by Oracle and may change in future releases) - for more info refer to: https://jeffkemponoracle.com/2013/05/deploying-application-express-on-the-command-line/
  17. 2. Prepend some extra initialisation code to the clob, which changes the Application ID, Alias and Name
  18. 3. Do a search-and-replace on the resulting clob to change the substitution variables for ORG and YEAR 4. Save the clob to a file on disk. If it reported no errors I would then (a) check the script into source control, and (b) run the script to install the target application. I later changed the script so that it created a copy of the APEX application export for each application found in the workspace - that way it automatically create scripts for each application making it easy to update some or all of them when needed. I only had to make minor changes to the code when I upgraded to APEX 5.0. I was quite happy with this method so I used it for another registration system, one for youth camps and retreats, as well.
  19. One downside to this approach is that Saved Reports in Interactive Reports are local to each application instance; I had some users who were involved in more than one competition who found it inconvenient that their saved reports did not carry over to the other competitions. On the other hand, this was sometimes convenient because they often had different reporting requirements for the different competitions. The main problem I started having with this approach was at the database schema level - the same PL/SQL code had to work for all different versions of the application that were in play at the time; so there were code fragments like "if minor_version >= 35 then ... end if" peppered throughout. I had to be careful with schema changes to ensure they didn't break things in any of the active versions. Another problem with this approach is that it didn't scale very well; every new organisation needed another copy of the application to be installed; deploying a small change could take several minutes as it installed and re-installed the application many times. After a while of this I realised having lots of separate copies of the application, largely identical, was not providing enough practical benefit. Instead, it would be easier if there was just one application which I could make changes to - and modifying the schema would be a simpler task as a result. In 2016 I decided to rebuild a significant portion of the application as a completely new application.
  20. This was Version 2.0. This application was to use the Universal Theme, and would support all organisations and years in a single application. Instead of setting the org and year codes in Substitution Variables, I made a page that accepted a code via the URL.
  21. I used Apache rewrites on the web server so that my clients didn't need to know what the valid codes were. They were each given a simple URL to publish on their websites and Facebook pages. So, for example, examplecomp.com.au gets directed to “examplecomp.com.au/apex/f?p=GF:FWD:::::P100_ORG_YEAR:SYG2017".
  22. In a Page Load process, the page checks the value of the items, sets up the user session accordingly, and redirects to the home page which would use the session Context (as before) to show the data and customisations applicable to that organisation and year. If an invalid code is supplied, the page does not redirect; the page simply shows a list of links to valid codes as a kind of "graceful fallback".
  23. The same method was implemented later for the camp registration system as well. This simple method has made building and deploying these applications much simpler. In addition, scaling to many clients is now possible; I can have a new client ready to go in under an hour.
  24. MULTI-TENANT APPLICATIONS: THE THEORY The idea of making a system "multi-tenant" has been around for a long time; it forms the basis of "Software As A Service (SaaS)". Provide the same set of services to many tenants who do not share or see each other's data (e.g. in the cloud). A good example would be Gmail and wordpress.com; each user only sees their own data. Facebook and Twitter, conversely, are examples of systems which are most definitely NOT multi-tenant as they exist expressly for the purpose of sharing data between users and groups of users. Multi-tenant is equally applicable for services provided to different clients, or for services provided within a single company to different departments; the same principles might apply.
  25. Purpose The purpose is to partition the data, and (potentially) the workload, so that you can build one system and then re-use (sell) it many times. The hope is that this will reduce costs, increase revenue, and/or more efficiently use available processing power and storage capacity.
  26. Design goals for multi-tenant systems comprise four aspects. 1. Tenant Isolation 2. Optimise cloud resource cost (storage and CPU) 3. Ease of administration - self-service - allow tenants to perform maintenance, backup and recovery, troubleshooting, and customisation 4. Scalability - easily add more tenants, and add more capacity, without modifying the application itself
  27. The goals of tenant isolation are: ensure no-one can see, or be impacted by, any other tenant's data or behaviour; make it possible to backup and restore a single tenant's data; implement tenant-specific customisations; protect from "noisy neighbours"; allow tenants to own their own data;
  28. This goal was nicely expressed by Hadlow’s “First Law of Multi-Tenancy” – and this is partly from the point of view of the tenant, but also from the point of view of the application developer. If the fact of multi-tenancy can be abstracted away to some degree, it makes developing the application much simpler and easier.
  29. Broadly, there are a few different architectures for designing a Multi-Tenant system. They differ on what level or technology they rely to provide tenant isolation: 1. Multiple servers: one server + database per tenant   - pros: excellent isolation for data, workload (dedicated resources) and customisations; if server fails, impact is limited to the customer on that server   - cons: high cost to add more tenants, administer, service, upgrade, and deploy changes; low opportunity to optimise cost of cloud resources - no resource sharing 2. Multiple databases: one (pluggable) database per tenant (Oracle) / one schema per tenant (SQL Server)   - pros: excellent isolation for data and customisations; better use of cloud resources   - cons: complexity of adding tenants, upgrades, changes 3. Multiple workspaces/schemas: one workspace+schema per tenant (Oracle APEX)   - pros: excellent isolation of data and customisations; optimal use of cloud resources   - cons: complexity of adding tenants, upgrades, changes
  30. 4. Single schema: data disambiguated via table name prefix, e.g. tenant01_emp, tenant02_emp, etc.   - pros: query plans are based on stats for each tenant   - cons: too numerous to list! 5. Single schema: data disambiguated via tenant ID column   - pros: optimal use of cloud resources; simple to add tenants, upgrades, changes; new bugfixes/features are immediately available to everyone   - cons: tenant isolation must be carefully engineered into data model and application, higher risk of security issues; regression/new bugs immediately impact everyone
  31. Should you maintain a single codebase for the application, or maintain a separate codebase for each tenant? Basically, if you're maintaining a separate codebase, or separate branches for each tenant, you don't really have a true Multi-Tenant system; instead, you've got a single-tenant system that you're copying, reusing, and customising into copies that lose a lot of the benefits of having a true multi-tenant system. Whether that loss is important depends on each case. If you have only a few clients, each with quite diverse requirements, this approach may well make a lot of sense. You then have freedom to make quite drastic customisations for each client. Of course, you then have a bigger maintenance burden but if you have the clients willing to pay for that flexibility, then why not?
  32. Application Containers (Oracle 12.2)  common objects - share metadata for a multi-tenant application across multiple PDBs  application PDB seed - rapidly create new application PDBs from the seed  views can query all PDBs in the container  perform DML on objects in multiple PDBs  application versioning and application patches Container Maps - routing SQL to the appropriate PDB based on the value of a predicate used in the SQL statement - partitioning data at the PDB level
  33. Workspace per tenant Build Options Application per tenant Build Options Single application/workspace Conditions or Authorizations?
  34. To finish, I’d like to quickly show a very simple set of steps to take an existing APEX application and simply enable it to support multiple tenants. Step 1 – this is the only change necessary on the APEX side – a call to a database procedure in the Post-Authentication procedure.
  35. Some schema changes will be required, including adding a “security group ID” column to each table (some global admin tables excepted, possibly).
  36. To guarantee tenant isolation, I recommend VPD. Make sure to set update_check to “true” (the default is false) to ensure that users or the application cannot inadvertently change the security_group_id on any row.
  37. Some changes to unique constraints and foreign key constraints may be required, if natural keys are used. However, in cases where surrogate keys are used, no modification should be required.
  38. Refer to this article for all the details and sample code.