SlideShare a Scribd company logo
1 of 39
Download to read offline
BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF
HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH
www.christian-gohmann.de@CHGohmannDE
REST in Peace
Administration of an Oracle Cluster/Database using REST
Christian Gohmann
BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF
HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH
Christian Gohmann
• Principal Consultant at Trivadis Germany GmbH, Düsseldorf
• Instructor since 2014
• O-AI (Oracle Architecture and Internals)
• O-AI-DBA (Oracle Architecture and Internals for DBAs)
• Tool Owner of TVD-Backup
• Experiences with Oracle since 2006 (8i – 19c)
• Architecture, Installation & Configuration
• High Availability Solutions (RAC, Data Guardm, GoldenGate)
• Migration Projects
• Backup & Recovery (RMAN, Data Pump)
• Cloud (Amazon, Oracle)
@CHGohmannDE www.christian-gohmann.de
Agenda
1. What is REST?
2. Oracle REST Data Services (ORDS)
3. Database Management REST API
4. OraChk
5. Call REST Endpoint from PL/SQL
What is REST?
What is REST?
• REST is the abbreviation for REpresential State Transfer and is a development paradigm for
distributed systems
• Architectural style for the modern World Wide Web (WWW)
• Provides a uniform and easy-to-use interface using a Uniform Resource Locater (URI)
• Interacts with resources rather than commands
• No method information in the URI
• HTTP calls are used to retrieve or manipulate resources
• Uses the infrastructure (Web- and Application Server, HTML-/XML-Parser, …) of the WWW
• Communication between client and server is stateless (HTTP, HTTPS)
• Implementation can be changed independently
• Only the request and output format must stay the same
HTTP Request Methods
• Supported methods to be performed for a given resource, also referred as HTTP verbs
Verb Description
GET Requests a resource and has no side effects (safe)
POST Adds a new resource or change an existing resource
PUT If the resource does not exist, it will be created, otherwise it will be
updated
PATCH Updates a resource, side effects are okay
DELETE Deletes a resource
Accessing REST API
• The simplest way to call a REST API is to access its URI using a Web Browser
• On Linux/Unix curl can be used to access it from the command line
• The trailing / in the URI is mandatory
• On Windows PowerShell can be used
$> curl --silent --request "GET" --user "mydba:manager" 
"http://oaidba-lin:8080/ords/mydba/_/db-api/stable/database/db_links/"
PS> $credentials = [System.Convert]::ToBase64String(
[System.Text.Encoding]::ASCII.GetBytes("mydba:manager"))
PS> Invoke-WebRequest -Method Get -Uri 'http://oaidba-
lin:8080/ords/mydba/_/db-api/stable/database/db_links/' -Headers @{
"Authorization" = "Basic $credentials" }
Formatting JSON Response
• Normally, curl returns the JSON response in a non-human-readable format
• With an external tool like jq (command-line JSON processor) it is possible to format the
response easily
• Redirect the output of curl to jq
$> yum install jq
$> curl --silent --request "GET" --user "mydba:manager" "http://.../" | jq
{
"links": [
{
"rel": "self",
"href": "http://oaidba-lin.trivadistraining.com:8080/ords/_/db-api/stable/"
},
{
"rel": "describedby",
"href": "http://oaidba-lin.trivadistraining.com:8080/ords/_/db-api/stable/metadata-catalog/"
}
]
}
Oracle REST Data Services
(ORDS)
What is ORDS?
• Middle Tier Java application which provides a REST API to interact with an Oracle Database
• Provides Insert, Update, Delete functionalities for tables by using simple HTTP calls
• Execution of PL/SQL code is also possible
• No extra license is required, it is included in the Oracle Database license
• Restricted-use license for WebLogic Standard edition for hosting ORDS
Source: https://www.thatjeffsmith.com/oracle-rest-data-services-ords/
Installation 1/2
• Download from Oracle Technology Network (OTN) and unzip the file
• https://www.oracle.com/database/technologies/appdev/rest.html
• To create ORDS related database users, SYS or a user with appropriate privileges is required
• SQL script ords_installer_privileges.sql can be used to grant the permissions
• Call ords.war (Java 8 or higher is required) to start installation
• You can add further databases
$> java -jar ords/ords.war install advanced
SQL> @ords/installer/ords_installer_privileges.sql myuser
In the case of a CDB, all PDBs have to be in the OPEN state.
$> java -jar ords/ords.war setup --database tvddb2
$> java -jar ords/ords.war map-url --type base-path /tvddb2 tvddb2
Installation 2/2
$> java -jar ords.war install advanced
This Oracle REST Data Services instance has not yet been configured.
Please complete the following prompts
Enter the location to store configuration data: /u00/app/oracle/config
Enter the name of the database server [localhost]:oaidba-lin.trivadistraining.com
Enter the database listen port [1521]:
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:
Enter the database service name:TVDDB1_SITE1.trivadistraining.com
Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:
Enter the database password for ORDS_PUBLIC_USER:
Confirm password:
Requires to login with administrator privileges to verify Oracle REST Data Services schema.
Enter the administrator username:sys
Enter the database password for SYS AS SYSDBA:
Confirm password:
Retrieving information.
Enter the default tablespace for ORDS_METADATA [SYSAUX]:
Enter the temporary tablespace for ORDS_METADATA [TEMP]:
Enter the default tablespace for ORDS_PUBLIC_USER [USERS]:
Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]:
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:2
Sep 09, 2019 7:32:38 PM
INFO: reloaded pools: []
Installing Oracle REST Data Services version 19.2.0.r1991647
... Log file written to /home/oracle/ords_install_core_2019-09-09_193239_00018.log
... Verified database prerequisites
... Created Oracle REST Data Services proxy user
... Created Oracle REST Data Services schema
... Granted privileges to Oracle REST Data Services
... Created Oracle REST Data Services database objects
... Log file written to /home/oracle/ords_install_datamodel_2019-09-09_193256_00470.log
... Log file written to /home/oracle/ords_install_apex_2019-09-09_193258_00555.log
Completed installation for Oracle REST Data Services version 19.2.0.r1991647. Elapsed time: 00:00:21.662
Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2
Target Database
In standalone mode, ORDS is
started as foreground process
Standalone Mode
• Start ORDS in Standalone Mode
• For a production environment, HTTPS should be used
• Use URL http://<hostname>:8080/ords to access ORDS
• At this point ORDS shows an error 500 page
• Configuration is written to $CONFIG_DIR/ords/standalone
$> java -jar ords/ords.war standalone
Enter 1 if using HTTP or 2 if using HTTPS [1]:1
Enter the HTTP port [8080]:
2019-09-09 19:44:34.247:INFO::main: Logging initialized @5586ms to org.eclipse.jetty.util.log.StdErrLog
Sep 09, 2019 7:44:34 PM
INFO: HTTP and HTTP/2 cleartext listening on port: 8080
…
Use ampersand (&) to start it in the background.
Troubleshooting
• Activate debugging to screen to see errors directly in the web browser
$> java -jar ords.war set-property debug.printDebugToScreen true
Database Management
REST API
Overview
• Overview of REST APIs can be found in the REST APIs for Oracle Database documentation
• Link: https://docs.oracle.com/en/database/oracle/oracle-database/19/dbrst/index.html
• Endpoints are grouped by tasks
• Data Dictionary
Query Data Dictionary objects
• Environment
Create new databases, …
• Fleet Patching and Provisioning
Install new Oracle Homes, install patches, …
• General
Data Pump, Tablespace, Users, …
• Monitoring
Sessions, Alerts, …
• Performance
Execution Plans, Statistics, …
• Pluggable Database Lifecycle Management
Create / Drop / Clone / Unplug PDBs, …
Authentication
• Two ways to authenticate users to access the Database Management API
• Database authentication using username and password
• Mid-tier authentication with System or SQL Administrator role
• Required role depends on the REST endpoint
• Roles, as well username and password are stored in $CONFIG_DIR/ords/credentials
# For ODRS < 19.4
$> java -jar ords.war set-property jdbc.auth.enabled true
# For ORDS >= 19.4
$> java -jar ords.war set-property restEnabledSql.active true
Properties are written to the file $CONFIG_DIR/defaults.xml.
$> java -jar ords.war user REST_API "System Administrator, SQL Administrator"
Configuration 1/3
• Available starting with ORDS 19.1
• Per default it is disabled, a 404 (Page not found) error page is displayed when you try to
access the API
• To activate it, property database.api.enabled must be changed to TRUE
• Configure authentication method (see slide before)
$> java -jar ords.war set-property database.api.enabled true
After changing a property, ORDS has to be restarted.
Configuration 2/3
• A database user with PDB_DBA role (even in a non-CDB database) must be use
• Schema must be activated for ORDS
• If SYS/SYSTEM is used to run ORDS.ENABLE_SCHEMA, ORA-06598 is raised
SQL> GRANT PDB_DBA TO REST_API;
SQL> GRANT INHERIT PRIVILEGES ON USER SYSTEM TO ORDS_METADATA;
SQL> BEGIN
ORDS.ENABLE_SCHEMA(
p_schema => 'REST_API',
p_url_mapping_type => 'BASE_PATH',
p_url_mapping_pattern => 'rest-api',
p_auto_rest_auth => FALSE,
p_enabled => TRUE
);
END;
/
Part of the URL
Workaround for ORA-06598
Configuration 3/3
• For non-database authentication, grant SQL Administrator to the ORDS enabled user
• If role System Administrator is used only, access to REST endpoints will fail
$> java -jar ords.war user REST_API "SQL Administrator"
REST_API is not authorized to access: oracle.dbtools.ords.db-api.developer
REST_API does not have any of the required roles: PrivilegeConstraintImpl
[name=oracle.dbtools.ords.db-api.developer, roles=[SQL Administrator, SQL
Developer], challenges=[]]
Environment Services
• Allows interaction with the environment
• List installed Oracle homes or existing databases
• Create new DBs using DBCA
• Requires ORDS 19.2 or higher
• Create mid-tier user with System Administrator role
• URIs does not include a username part
• Roles are stored in the $CONFIG_DIR/ords/credentials file
$> java -jar ords.war user REST_API "System Administrator"
Username for login is case sensitive - write username in uppercase.
Pluggable Database Lifecycle Management
• Allows create, clone, unplug/plug-in and delete operations for PDB
• A common user with SYSDBA privilege is required
• Enabling a schema for ORDS is not supported in a CDB
• Instead, CDB credentials are defined in the connection pool
• Set SQL Administrator role for the user
$> vi cdbAdmin.properties
db.cdb.adminUser=C##REST_API as SYSDBA
db.cdb.adminUser.password=manager
$> java -jar ords.war set-properties --conf apex_pu cdbAdmin.properties
SQL> CREATE USER C##REST_API IDENTIFIED BY manager;
SQL> GRANT SYSDBA TO C##REST_API CONTAINER = ALL;
$> java -jar ords.war user C##REST_API "SQL Administrator"
Accessing the API
• Use following URL pattern to access the Database REST API
• Hostname
Name of the server hosting ORDS
• Port
Default port for HTTP is 8080 and for HTTPS 8443
• URL Mapping
Used mapping for the REST enabled DBA schema
• Version
Access different versions of the API, e.g. 19.1.0, 19.2.0 or latest / stable
http(s)://<Hostname>:<Port>/ords/<URL Mapping>/_/db-api/<Version>
Use latest to access always the latest version of the API.
Swagger Test Client
• Metadata Catalog and OpenAPI endpoints exist
• JSON output can be used in editor.swagger.io to generate a full test client
http(s)://.../_/db-api/latest/metadata-catalog/openapi.json
List installed Oracle Homes
$> curl --silent --request GET 
–header "Content-Type: application/json" --user "rest_api:manager" 
http://oaidba-lin:8080/ords/rest-api/_/db-api/latest/environment/homes/
Response
{
items: [
{
name: "OraGI19Home1",
version: "19.4.0.0.0",
default: false,
read_only_home: false,
...
},
{
name: "OraDB19Home1",
version: "19.4.0.0.0",
...
}
]
}
Database Status
$> curl --silent --request GET 
–header "Content-Type: application/json" --user "rest_api:manager" 
http://oaidba-lin:8080/ords/rest-api/_/db-api/19.2.0/database/feature_usage/
Response
{
inst_id: 1,
instance_number: 1,
instance_name: "TVDDB1",
host_name: "oaidba-lin.trivadistraining.com",
version: "19.0.0.0.0",
version_legacy: "19.0.0.0.0",
version_full: "19.4.0.0.0",
...
}
In the background gv$instance is queried.
Data Pump - Export
$> curl --silent --request POST --data-binary @expdp.json 
–header "Content-Type: application/json" --user "rest_api:manager" 
http://oaidba-lin:8080/ords/rest-api/_/db-api/latest/database/datapump/export
$> vi expdp.json
{
"datapump_dir": "DATA_PUMP_DIR",
"filter": "SCOTT",
"job_mode": "SCHEMA"
}
Request Body
{
"job_name":"DATAPUMP_REST_EXPORT_20190910215902",
"owner_name":"REST_API",
"operation":"EXPORT",
"job_mode":"SCHEMA",
"state":"EXECUTING",
"degree":1,
"attached_sessions":0,
"datapump_sessions":2,
"job_state":"EXECUTING“
...
}
Response
Master Table is not deleted after the job finished
Create Pluggable Database
$> curl --silent --request POST --data-binary @create_pdb.json 
–-header "Content-Type: application/json" --user "rest_api:manager" 
http://oaidba-lin:8080/ords/_/db-api/latest/database/pdbs/
$> vi create_pdb.json
{
"method": "CREATE",
"pdb_name": ”NEWPDB1",
"adminName": "pdbadmin",
"adminPwd": "HelloPDB!",
"fileNameConversions": "NONE",
"unlimitedStorage": true,
"reuseTempFile": true,
"totalSize": "UNLIMITED",
"tempSize": "UNLIMITED"
}
Request Body
{
"env": {
"defaultTimeZone": "Europe/Berlin"
},
"items": [
{
"statementId": 1,
"response": [
"nPL/SQL procedure successfully
completed.nn"
],
"result": 0
},
…
]
}
Response
ORAchk
Using ORAchk over REST
• Configure ORDS support for ORAchk (run as root user)
• Start ORAchk daemon
• Setup asks for a password for ORDSADMIN user
• Example URL: https://oaidba-lin.trivadistraining.com:7080/ords/tfaml/orachk
• To remove ORDS support use -ordsrmsetup
$> ./orachk –ordssetup
# Integration into an existing ORDS setup
$> ./orachk -ordssetup /u00/app/stage/ords -configdir /u00/app/oracle/config
$> ./orachk -ordsrmsetup
$> ./orachk -d start -ords
Overview of REST Endpoints
• Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/atnms/using-
orachk-or-exachk-over-rest.html#GUID-45CA5280-B10A-42C5-8C90-7782589E4570
Start Health Check
$> curl --silent --request GET 
–header "Content-Type: application/json" --user "ordsadmin:manager" 
https://oaidba-lin.trivadistraining.com:7080/ords/tfaml/orachk/start_client
Response
{
"ID":"UCTW5MLN7O1V1HPG8U",
"Status":"SUBMITTED"
}
To provide special parameters to the Health Check, the POST request must be used.
Call REST Endpoint from
PL/SQL
Example 1/2
• Creates a PDB using PL/SQL
SQL> SET serveroutput ON
SQL> DECLARE
-- Internal variables used to call the REST endpoint
v_request UTL_HTTP.REQ;
v_response UTL_HTTP.RESP;
-- URL to REST endpoint
v_url VARCHAR2(4000 CHAR) := 'http://.../ords/_/db-api/stable/database/pdbs/';
-- Content body required for the REST endpoint
v_body VARCHAR2(4000 CHAR) := q'[{
"method": "CREATE",
"pdb_name": "PLSQLPDB1",
"adminName": "pdbadmin",
"adminPwd": "HelloPDB!",
"fileNameConversions": "NONE",
"unlimitedStorage": true,
"reuseTempFile": true,
"totalSize": "UNLIMITED",
"tempSize": "UNLIMITED"
}]';
...
Set network ACLs to allow communication with the target server.
Example 2/2
...
BEGIN
-- Begin HTTP request
v_request := UTL_HTTP.BEGIN_REQUEST(url => v_url, method => 'POST');
-- Set header information
UTL_HTTP.SET_HEADER(r => v_request, name => 'content-type', value => 'application/json');
UTL_HTTP.SET_HEADER(r => v_request, name => 'content-length', value => LENGTH(v_body));
-- Authenticate with the REST endpoint
UTL_HTTP.SET_AUTHENTICATION(
r => v_request,
username => 'doag',
password => 'manager'
);
-- Write body
UTL_HTTP.WRITE_TEXT(r => v_request, data => v_body);
-- Get response
v_response := UTL_HTTP.GET_RESPONSE(r => v_request);
-- Print status code
DBMS_OUTPUT.PUT_LINE('Status Code: ' || v_response.STATUS_CODE);
END;
/
BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF
HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH
Further Information
Oracle REST Data Services Documentation
https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/
Blog: Jeff Smith (Product Manager SQL Developer & ORDS)
https://www.thatjeffsmith.com/oracle-rest-data-services-ords/
ORAchk / EXAchk over REST
https://docs.oracle.com/en/database/oracle/oracle-database/19/atnms/using-orachk-or-exachk-over-rest.html#GUID-45CA5280-B10A-
42C5-8C90-7782589E4570
My Oracle Support
https://support.oracle.com
BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF
HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH
Questions and answers..
Christian Gohmann
Principal Consultant
Tel. +49-211-58 6664 702
christian.gohmann@trivadis.com
@CGohmannDE
REST in Piece - Administration of an Oracle Cluster/Database using REST

More Related Content

What's hot

MAA Best Practices for Oracle Database 19c
MAA Best Practices for Oracle Database 19cMAA Best Practices for Oracle Database 19c
MAA Best Practices for Oracle Database 19cMarkus Michalewicz
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Sandesh Rao
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1Chien Chung Shen
 
Make Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For ItMake Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For ItMarkus Michalewicz
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesJeff Smith
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationFrederic Descamps
 
Understanding oracle rac internals part 1 - slides
Understanding oracle rac internals   part 1 - slidesUnderstanding oracle rac internals   part 1 - slides
Understanding oracle rac internals part 1 - slidesMohamed Farouk
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle MultitenantJitendra Singh
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACMarkus Michalewicz
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Glen Hawkins
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasKyle Hailey
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linuxKyle Hailey
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningBobby Curtis
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationScott Sutherland
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksKyle Hailey
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginnersPini Dibask
 

What's hot (20)

MAA Best Practices for Oracle Database 19c
MAA Best Practices for Oracle Database 19cMAA Best Practices for Oracle Database 19c
MAA Best Practices for Oracle Database 19c
 
One PDB to go, please!
One PDB to go, please!One PDB to go, please!
One PDB to go, please!
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 
Make Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For ItMake Your Application “Oracle RAC Ready” & Test For It
Make Your Application “Oracle RAC Ready” & Test For It
 
Oracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web ServicesOracle REST Data Services: Options for your Web Services
Oracle REST Data Services: Options for your Web Services
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
 
Understanding oracle rac internals part 1 - slides
Understanding oracle rac internals   part 1 - slidesUnderstanding oracle rac internals   part 1 - slides
Understanding oracle rac internals part 1 - slides
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle Multitenant
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
 
Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive Oracle Active Data Guard: Best Practices and New Features Deep Dive
Oracle Active Data Guard: Best Practices and New Features Deep Dive
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aas
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linux
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance Tuning
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction Locks
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginners
 

Similar to REST in Piece - Administration of an Oracle Cluster/Database using REST

5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...NomanKhalid56
 
ORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesJustin Michael Raj
 
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCI
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCIDatabase Cloud Services Office Hours - 0421 - Migrate AWS to OCI
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCITammy Bednar
 
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...Insight Technology, Inc.
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsSrinivasa Pavan Marti
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsSrinivasa Pavan Marti
 
JoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)Jeff Smith
 
Improving oracle12c security
Improving oracle12c securityImproving oracle12c security
Improving oracle12c securityLaurent Leturgez
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security MultitenantArush Jain
 
Exploring Oracle Database 12c Multitenant best practices for your Cloud
Exploring Oracle Database 12c Multitenant best practices for your CloudExploring Oracle Database 12c Multitenant best practices for your Cloud
Exploring Oracle Database 12c Multitenant best practices for your Clouddyahalom
 
Pres Db2 native rest json and z/OS connect
Pres Db2 native rest json and z/OS connect Pres Db2 native rest json and z/OS connect
Pres Db2 native rest json and z/OS connect Cécile Benhamou
 
Improve oracle 12c security
Improve oracle 12c securityImprove oracle 12c security
Improve oracle 12c securityLaurent Leturgez
 
Oracle 10g introduction
Oracle 10g introductionOracle 10g introduction
Oracle 10g introductionsagaroceanic11
 

Similar to REST in Piece - Administration of an Oracle Cluster/Database using REST (20)

5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
 
ORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesORDS - Oracle REST Data Services
ORDS - Oracle REST Data Services
 
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCI
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCIDatabase Cloud Services Office Hours - 0421 - Migrate AWS to OCI
Database Cloud Services Office Hours - 0421 - Migrate AWS to OCI
 
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...
[db tech showcase Tokyo 2018] #dbts2018 #B31 『1,2,3 and Done! 3 easy ways to ...
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administrators
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administrators
 
Oracle Cloud As Services
Oracle Cloud As ServicesOracle Cloud As Services
Oracle Cloud As Services
 
JoTechies - Azure SQL DB
JoTechies - Azure SQL DBJoTechies - Azure SQL DB
JoTechies - Azure SQL DB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)REST Enabling your Oracle Database (2018 Update)
REST Enabling your Oracle Database (2018 Update)
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 
Improving oracle12c security
Improving oracle12c securityImproving oracle12c security
Improving oracle12c security
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security Multitenant
 
Exploring Oracle Database 12c Multitenant best practices for your Cloud
Exploring Oracle Database 12c Multitenant best practices for your CloudExploring Oracle Database 12c Multitenant best practices for your Cloud
Exploring Oracle Database 12c Multitenant best practices for your Cloud
 
Pres Db2 native rest json and z/OS connect
Pres Db2 native rest json and z/OS connect Pres Db2 native rest json and z/OS connect
Pres Db2 native rest json and z/OS connect
 
Improve oracle 12c security
Improve oracle 12c securityImprove oracle 12c security
Improve oracle 12c security
 
Oracle 10g introduction
Oracle 10g introductionOracle 10g introduction
Oracle 10g introduction
 
Oracle 12c - Multitenant Feature
Oracle 12c - Multitenant FeatureOracle 12c - Multitenant Feature
Oracle 12c - Multitenant Feature
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 

Recently uploaded

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 

Recently uploaded (20)

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 

REST in Piece - Administration of an Oracle Cluster/Database using REST

  • 1. BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH www.christian-gohmann.de@CHGohmannDE REST in Peace Administration of an Oracle Cluster/Database using REST Christian Gohmann
  • 2. BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH Christian Gohmann • Principal Consultant at Trivadis Germany GmbH, Düsseldorf • Instructor since 2014 • O-AI (Oracle Architecture and Internals) • O-AI-DBA (Oracle Architecture and Internals for DBAs) • Tool Owner of TVD-Backup • Experiences with Oracle since 2006 (8i – 19c) • Architecture, Installation & Configuration • High Availability Solutions (RAC, Data Guardm, GoldenGate) • Migration Projects • Backup & Recovery (RMAN, Data Pump) • Cloud (Amazon, Oracle) @CHGohmannDE www.christian-gohmann.de
  • 3.
  • 4. Agenda 1. What is REST? 2. Oracle REST Data Services (ORDS) 3. Database Management REST API 4. OraChk 5. Call REST Endpoint from PL/SQL
  • 6. What is REST? • REST is the abbreviation for REpresential State Transfer and is a development paradigm for distributed systems • Architectural style for the modern World Wide Web (WWW) • Provides a uniform and easy-to-use interface using a Uniform Resource Locater (URI) • Interacts with resources rather than commands • No method information in the URI • HTTP calls are used to retrieve or manipulate resources • Uses the infrastructure (Web- and Application Server, HTML-/XML-Parser, …) of the WWW • Communication between client and server is stateless (HTTP, HTTPS) • Implementation can be changed independently • Only the request and output format must stay the same
  • 7. HTTP Request Methods • Supported methods to be performed for a given resource, also referred as HTTP verbs Verb Description GET Requests a resource and has no side effects (safe) POST Adds a new resource or change an existing resource PUT If the resource does not exist, it will be created, otherwise it will be updated PATCH Updates a resource, side effects are okay DELETE Deletes a resource
  • 8. Accessing REST API • The simplest way to call a REST API is to access its URI using a Web Browser • On Linux/Unix curl can be used to access it from the command line • The trailing / in the URI is mandatory • On Windows PowerShell can be used $> curl --silent --request "GET" --user "mydba:manager" "http://oaidba-lin:8080/ords/mydba/_/db-api/stable/database/db_links/" PS> $credentials = [System.Convert]::ToBase64String( [System.Text.Encoding]::ASCII.GetBytes("mydba:manager")) PS> Invoke-WebRequest -Method Get -Uri 'http://oaidba- lin:8080/ords/mydba/_/db-api/stable/database/db_links/' -Headers @{ "Authorization" = "Basic $credentials" }
  • 9. Formatting JSON Response • Normally, curl returns the JSON response in a non-human-readable format • With an external tool like jq (command-line JSON processor) it is possible to format the response easily • Redirect the output of curl to jq $> yum install jq $> curl --silent --request "GET" --user "mydba:manager" "http://.../" | jq { "links": [ { "rel": "self", "href": "http://oaidba-lin.trivadistraining.com:8080/ords/_/db-api/stable/" }, { "rel": "describedby", "href": "http://oaidba-lin.trivadistraining.com:8080/ords/_/db-api/stable/metadata-catalog/" } ] }
  • 10. Oracle REST Data Services (ORDS)
  • 11. What is ORDS? • Middle Tier Java application which provides a REST API to interact with an Oracle Database • Provides Insert, Update, Delete functionalities for tables by using simple HTTP calls • Execution of PL/SQL code is also possible • No extra license is required, it is included in the Oracle Database license • Restricted-use license for WebLogic Standard edition for hosting ORDS Source: https://www.thatjeffsmith.com/oracle-rest-data-services-ords/
  • 12. Installation 1/2 • Download from Oracle Technology Network (OTN) and unzip the file • https://www.oracle.com/database/technologies/appdev/rest.html • To create ORDS related database users, SYS or a user with appropriate privileges is required • SQL script ords_installer_privileges.sql can be used to grant the permissions • Call ords.war (Java 8 or higher is required) to start installation • You can add further databases $> java -jar ords/ords.war install advanced SQL> @ords/installer/ords_installer_privileges.sql myuser In the case of a CDB, all PDBs have to be in the OPEN state. $> java -jar ords/ords.war setup --database tvddb2 $> java -jar ords/ords.war map-url --type base-path /tvddb2 tvddb2
  • 13. Installation 2/2 $> java -jar ords.war install advanced This Oracle REST Data Services instance has not yet been configured. Please complete the following prompts Enter the location to store configuration data: /u00/app/oracle/config Enter the name of the database server [localhost]:oaidba-lin.trivadistraining.com Enter the database listen port [1521]: Enter 1 to specify the database service name, or 2 to specify the database SID [1]: Enter the database service name:TVDDB1_SITE1.trivadistraining.com Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]: Enter the database password for ORDS_PUBLIC_USER: Confirm password: Requires to login with administrator privileges to verify Oracle REST Data Services schema. Enter the administrator username:sys Enter the database password for SYS AS SYSDBA: Confirm password: Retrieving information. Enter the default tablespace for ORDS_METADATA [SYSAUX]: Enter the temporary tablespace for ORDS_METADATA [TEMP]: Enter the default tablespace for ORDS_PUBLIC_USER [USERS]: Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]: Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step. If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:2 Sep 09, 2019 7:32:38 PM INFO: reloaded pools: [] Installing Oracle REST Data Services version 19.2.0.r1991647 ... Log file written to /home/oracle/ords_install_core_2019-09-09_193239_00018.log ... Verified database prerequisites ... Created Oracle REST Data Services proxy user ... Created Oracle REST Data Services schema ... Granted privileges to Oracle REST Data Services ... Created Oracle REST Data Services database objects ... Log file written to /home/oracle/ords_install_datamodel_2019-09-09_193256_00470.log ... Log file written to /home/oracle/ords_install_apex_2019-09-09_193258_00555.log Completed installation for Oracle REST Data Services version 19.2.0.r1991647. Elapsed time: 00:00:21.662 Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2 Target Database In standalone mode, ORDS is started as foreground process
  • 14. Standalone Mode • Start ORDS in Standalone Mode • For a production environment, HTTPS should be used • Use URL http://<hostname>:8080/ords to access ORDS • At this point ORDS shows an error 500 page • Configuration is written to $CONFIG_DIR/ords/standalone $> java -jar ords/ords.war standalone Enter 1 if using HTTP or 2 if using HTTPS [1]:1 Enter the HTTP port [8080]: 2019-09-09 19:44:34.247:INFO::main: Logging initialized @5586ms to org.eclipse.jetty.util.log.StdErrLog Sep 09, 2019 7:44:34 PM INFO: HTTP and HTTP/2 cleartext listening on port: 8080 … Use ampersand (&) to start it in the background.
  • 15. Troubleshooting • Activate debugging to screen to see errors directly in the web browser $> java -jar ords.war set-property debug.printDebugToScreen true
  • 17. Overview • Overview of REST APIs can be found in the REST APIs for Oracle Database documentation • Link: https://docs.oracle.com/en/database/oracle/oracle-database/19/dbrst/index.html • Endpoints are grouped by tasks • Data Dictionary Query Data Dictionary objects • Environment Create new databases, … • Fleet Patching and Provisioning Install new Oracle Homes, install patches, … • General Data Pump, Tablespace, Users, … • Monitoring Sessions, Alerts, … • Performance Execution Plans, Statistics, … • Pluggable Database Lifecycle Management Create / Drop / Clone / Unplug PDBs, …
  • 18. Authentication • Two ways to authenticate users to access the Database Management API • Database authentication using username and password • Mid-tier authentication with System or SQL Administrator role • Required role depends on the REST endpoint • Roles, as well username and password are stored in $CONFIG_DIR/ords/credentials # For ODRS < 19.4 $> java -jar ords.war set-property jdbc.auth.enabled true # For ORDS >= 19.4 $> java -jar ords.war set-property restEnabledSql.active true Properties are written to the file $CONFIG_DIR/defaults.xml. $> java -jar ords.war user REST_API "System Administrator, SQL Administrator"
  • 19. Configuration 1/3 • Available starting with ORDS 19.1 • Per default it is disabled, a 404 (Page not found) error page is displayed when you try to access the API • To activate it, property database.api.enabled must be changed to TRUE • Configure authentication method (see slide before) $> java -jar ords.war set-property database.api.enabled true After changing a property, ORDS has to be restarted.
  • 20. Configuration 2/3 • A database user with PDB_DBA role (even in a non-CDB database) must be use • Schema must be activated for ORDS • If SYS/SYSTEM is used to run ORDS.ENABLE_SCHEMA, ORA-06598 is raised SQL> GRANT PDB_DBA TO REST_API; SQL> GRANT INHERIT PRIVILEGES ON USER SYSTEM TO ORDS_METADATA; SQL> BEGIN ORDS.ENABLE_SCHEMA( p_schema => 'REST_API', p_url_mapping_type => 'BASE_PATH', p_url_mapping_pattern => 'rest-api', p_auto_rest_auth => FALSE, p_enabled => TRUE ); END; / Part of the URL Workaround for ORA-06598
  • 21. Configuration 3/3 • For non-database authentication, grant SQL Administrator to the ORDS enabled user • If role System Administrator is used only, access to REST endpoints will fail $> java -jar ords.war user REST_API "SQL Administrator" REST_API is not authorized to access: oracle.dbtools.ords.db-api.developer REST_API does not have any of the required roles: PrivilegeConstraintImpl [name=oracle.dbtools.ords.db-api.developer, roles=[SQL Administrator, SQL Developer], challenges=[]]
  • 22. Environment Services • Allows interaction with the environment • List installed Oracle homes or existing databases • Create new DBs using DBCA • Requires ORDS 19.2 or higher • Create mid-tier user with System Administrator role • URIs does not include a username part • Roles are stored in the $CONFIG_DIR/ords/credentials file $> java -jar ords.war user REST_API "System Administrator" Username for login is case sensitive - write username in uppercase.
  • 23. Pluggable Database Lifecycle Management • Allows create, clone, unplug/plug-in and delete operations for PDB • A common user with SYSDBA privilege is required • Enabling a schema for ORDS is not supported in a CDB • Instead, CDB credentials are defined in the connection pool • Set SQL Administrator role for the user $> vi cdbAdmin.properties db.cdb.adminUser=C##REST_API as SYSDBA db.cdb.adminUser.password=manager $> java -jar ords.war set-properties --conf apex_pu cdbAdmin.properties SQL> CREATE USER C##REST_API IDENTIFIED BY manager; SQL> GRANT SYSDBA TO C##REST_API CONTAINER = ALL; $> java -jar ords.war user C##REST_API "SQL Administrator"
  • 24. Accessing the API • Use following URL pattern to access the Database REST API • Hostname Name of the server hosting ORDS • Port Default port for HTTP is 8080 and for HTTPS 8443 • URL Mapping Used mapping for the REST enabled DBA schema • Version Access different versions of the API, e.g. 19.1.0, 19.2.0 or latest / stable http(s)://<Hostname>:<Port>/ords/<URL Mapping>/_/db-api/<Version> Use latest to access always the latest version of the API.
  • 25. Swagger Test Client • Metadata Catalog and OpenAPI endpoints exist • JSON output can be used in editor.swagger.io to generate a full test client http(s)://.../_/db-api/latest/metadata-catalog/openapi.json
  • 26. List installed Oracle Homes $> curl --silent --request GET –header "Content-Type: application/json" --user "rest_api:manager" http://oaidba-lin:8080/ords/rest-api/_/db-api/latest/environment/homes/ Response { items: [ { name: "OraGI19Home1", version: "19.4.0.0.0", default: false, read_only_home: false, ... }, { name: "OraDB19Home1", version: "19.4.0.0.0", ... } ] }
  • 27. Database Status $> curl --silent --request GET –header "Content-Type: application/json" --user "rest_api:manager" http://oaidba-lin:8080/ords/rest-api/_/db-api/19.2.0/database/feature_usage/ Response { inst_id: 1, instance_number: 1, instance_name: "TVDDB1", host_name: "oaidba-lin.trivadistraining.com", version: "19.0.0.0.0", version_legacy: "19.0.0.0.0", version_full: "19.4.0.0.0", ... } In the background gv$instance is queried.
  • 28. Data Pump - Export $> curl --silent --request POST --data-binary @expdp.json –header "Content-Type: application/json" --user "rest_api:manager" http://oaidba-lin:8080/ords/rest-api/_/db-api/latest/database/datapump/export $> vi expdp.json { "datapump_dir": "DATA_PUMP_DIR", "filter": "SCOTT", "job_mode": "SCHEMA" } Request Body { "job_name":"DATAPUMP_REST_EXPORT_20190910215902", "owner_name":"REST_API", "operation":"EXPORT", "job_mode":"SCHEMA", "state":"EXECUTING", "degree":1, "attached_sessions":0, "datapump_sessions":2, "job_state":"EXECUTING“ ... } Response Master Table is not deleted after the job finished
  • 29. Create Pluggable Database $> curl --silent --request POST --data-binary @create_pdb.json –-header "Content-Type: application/json" --user "rest_api:manager" http://oaidba-lin:8080/ords/_/db-api/latest/database/pdbs/ $> vi create_pdb.json { "method": "CREATE", "pdb_name": ”NEWPDB1", "adminName": "pdbadmin", "adminPwd": "HelloPDB!", "fileNameConversions": "NONE", "unlimitedStorage": true, "reuseTempFile": true, "totalSize": "UNLIMITED", "tempSize": "UNLIMITED" } Request Body { "env": { "defaultTimeZone": "Europe/Berlin" }, "items": [ { "statementId": 1, "response": [ "nPL/SQL procedure successfully completed.nn" ], "result": 0 }, … ] } Response
  • 31. Using ORAchk over REST • Configure ORDS support for ORAchk (run as root user) • Start ORAchk daemon • Setup asks for a password for ORDSADMIN user • Example URL: https://oaidba-lin.trivadistraining.com:7080/ords/tfaml/orachk • To remove ORDS support use -ordsrmsetup $> ./orachk –ordssetup # Integration into an existing ORDS setup $> ./orachk -ordssetup /u00/app/stage/ords -configdir /u00/app/oracle/config $> ./orachk -ordsrmsetup $> ./orachk -d start -ords
  • 32. Overview of REST Endpoints • Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/atnms/using- orachk-or-exachk-over-rest.html#GUID-45CA5280-B10A-42C5-8C90-7782589E4570
  • 33. Start Health Check $> curl --silent --request GET –header "Content-Type: application/json" --user "ordsadmin:manager" https://oaidba-lin.trivadistraining.com:7080/ords/tfaml/orachk/start_client Response { "ID":"UCTW5MLN7O1V1HPG8U", "Status":"SUBMITTED" } To provide special parameters to the Health Check, the POST request must be used.
  • 34. Call REST Endpoint from PL/SQL
  • 35. Example 1/2 • Creates a PDB using PL/SQL SQL> SET serveroutput ON SQL> DECLARE -- Internal variables used to call the REST endpoint v_request UTL_HTTP.REQ; v_response UTL_HTTP.RESP; -- URL to REST endpoint v_url VARCHAR2(4000 CHAR) := 'http://.../ords/_/db-api/stable/database/pdbs/'; -- Content body required for the REST endpoint v_body VARCHAR2(4000 CHAR) := q'[{ "method": "CREATE", "pdb_name": "PLSQLPDB1", "adminName": "pdbadmin", "adminPwd": "HelloPDB!", "fileNameConversions": "NONE", "unlimitedStorage": true, "reuseTempFile": true, "totalSize": "UNLIMITED", "tempSize": "UNLIMITED" }]'; ... Set network ACLs to allow communication with the target server.
  • 36. Example 2/2 ... BEGIN -- Begin HTTP request v_request := UTL_HTTP.BEGIN_REQUEST(url => v_url, method => 'POST'); -- Set header information UTL_HTTP.SET_HEADER(r => v_request, name => 'content-type', value => 'application/json'); UTL_HTTP.SET_HEADER(r => v_request, name => 'content-length', value => LENGTH(v_body)); -- Authenticate with the REST endpoint UTL_HTTP.SET_AUTHENTICATION( r => v_request, username => 'doag', password => 'manager' ); -- Write body UTL_HTTP.WRITE_TEXT(r => v_request, data => v_body); -- Get response v_response := UTL_HTTP.GET_RESPONSE(r => v_request); -- Print status code DBMS_OUTPUT.PUT_LINE('Status Code: ' || v_response.STATUS_CODE); END; /
  • 37. BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH Further Information Oracle REST Data Services Documentation https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/ Blog: Jeff Smith (Product Manager SQL Developer & ORDS) https://www.thatjeffsmith.com/oracle-rest-data-services-ords/ ORAchk / EXAchk over REST https://docs.oracle.com/en/database/oracle/oracle-database/19/atnms/using-orachk-or-exachk-over-rest.html#GUID-45CA5280-B10A- 42C5-8C90-7782589E4570 My Oracle Support https://support.oracle.com
  • 38. BASEL | BERN | BRUGG | BUKAREST | DÜSSELDORF | FRANKFURT A.M. | FREIBURG I.BR. | GENF HAMBURG | KOPENHAGEN | LAUSANNE | MANNHEIM | MÜNCHEN | STUTTGART | WIEN | ZÜRICH Questions and answers.. Christian Gohmann Principal Consultant Tel. +49-211-58 6664 702 christian.gohmann@trivadis.com @CGohmannDE