36
Oracle Modern Cloud Day Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Oracle Modern Cloud Day 1 오라클 자율운영 DB로 데이터 중심 어플리케이션 개발하기 이상윤 상무 Autonomous DB & Analytics 2019.11.19

Oracle Modern Cloud Day€¦ · 오라클자율운영DB의REST 지원 URI Oracle Autonomous DB SQL, PL/SQL JSON Result Set Map & Bind Transform to JSON Oracle REST Data Service (ORDS):

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • Oracle Modern Cloud Day

    Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |

    Oracle Modern Cloud Day

    1

    1

    오라클자율운영 DB로데이터중심어플리케이션개발하기

    이상윤 상무

    Autonomous DB & Analytics

    2019.11.19

  • Safe harbor statement

    The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.

    The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation.

    2 Copyright © 2019 Oracle and/or its affiliates

  • 들어가며

    차례

    1

    2

    3

    4

    5

    어플리케이션개발을위한몇가지 Choice들

    최신표준의구현

    가장빠른웹어플리케이션개발도구 - APEX

    In-DB 애널리틱스의활용

    3 Copyright © 2019 Oracle and/or its affiliates

    6 마치며

  • 들어가며

    차례

    1

    2

    3

    4

    5

    4 Copyright © 2019 Oracle and/or its affiliates

    6

  • 자율운영 DB: 오라클자동화기술의정점

    Copyright © 2019 Oracle and/or its affiliates5

    Oracle Cloud

    자동화된데이터센터오퍼레이션, 그리고

    머신러닝

    완전한인프라스트럭처

    자동화

    완전한데이터베이스

    자동화

    ORACLEAUTONOMOUS

    DATABASE

  • 개발을위한자율운영!

    Copyright © 2019 Oracle and/or its affiliates6

    자율운영은오퍼레이션업무뿐만아니라개발업무에대해서도실익을제공

    IT 인력들의다음역할:

    운영이아닌혁신에주력

    • 데이터베이스디자인

    • 엔터프라이즈데이터아키텍처링

    • 데이터애널리틱스

    • 어플리케이션개발협업/지원

  • 오라클자율운영 DB 아키텍처

    Copyright © 2019 Oracle and/or its affiliates7

    Developer Tools

    SQL Developer

    Data Integration Services

    Oracle DI Platform Cloud

    3rd Party DI on Oracle Cloud Infrastructure

    3rd Party DI On-premises

    Business Intelligence Services

    Oracle Analytics Cloud

    Oracle Analytics Desktop

    3rd Party BI on Oracle Cloud Infrastructure

    3rd Party BI On-premises

    Autonomous Database

    Service Management

    Built-in Query and Application Development Tools

    Service Console

    ML Notebook

    SQL Developer Web

    REST Data Service

    Application Express

    Oracle Database

    Oracle Object Storage Cloud

    Data Files for Loading and External Access

  • 차례

    1

    2

    3

    4

    5

    어플리케이션개발을위한몇가지 Choice들

    8 Copyright © 2019 Oracle and/or its affiliates

    6

  • #1 워크로드선택

    데이터분석

    Columnar (Hybrid), 압축

    Full Scan, 집계

    소수의분석가

    조인, 집계

    병렬프로세싱

    업무목적

    데이터

    데이터처리방식

    동시사용자

    메모리사용

    리소스사용

    트랜잭션처리

    Row, 비압축

    인덱스 Lookup

    다수의사용자

    IO 최소화를위한캐싱

    Serial 프로세싱

    AutonomousData Warehouse

    AutonomousTransaction Processing

    두종류의자율운영 DB 서비스 동일한 아키텍처동일한 HW 인프라 & DBMS S/W

    동일한 클라우드 환경동일한 자율운영동일한 SLA

    9 Copyright © 2019 Oracle and/or its affiliates

  • 복합워크로드의처리

    서비스 DB 자원 Share 값 병렬도 동시사용성

    TPURGENT 12 MANUAL 100 X OCPU

    TP 8 1 100 X OCPU

    HIGH 4 CPU_COUNT 3

    MEDIUM 2 4 1.25 X OCPU

    LOW 1 1 100 X OCPU

    예: Autonomous Transaction Processing 서비스의자원관리

    서로다른유형의워크로드를하나의데이터베이스에서지원:

    오라클의전략적특장점!

    트랜잭션처리에활용

    리포팅, 배치, 애널리틱스작업에활용

    10 Copyright © 2019 Oracle and/or its affiliates

  • #2 Deployment 선택

    각 어플리케이션 전용의 Pluggable DB (PDB)• PDB 사용을 위한 어플리케이션의 변경 없음• 복제를 통한 빠른 프로비저닝• Unplug/plug를 통한 portability

    공통의 오퍼레이션은 Container DB 레벨에서 수행• 다수의 DB를 하나처럼 관리

    (패치, 업그레이드, HA, 백업)

    공유 메모리와 백그라운드 프로세스 공유• 물리적인 서버 당 보다 많은 DB 지원

    CapEx/OpEx 최소화, 민첩성, 사용용이성, … →최상의클라우드 DB 아키텍처→Microservice 아키텍처지원

    자율운영 DB의기반구조: 멀티테넌트아키텍처

    11 Copyright © 2019 Oracle and/or its affiliates

  • #2 Deployment 선택

    Serverless: 다수의테넌트들이하나의 Exadata Container DB를공유

    • Simple

    • 오라클이모든것을자동화하고관리함

    • Deployment, 라이프사이클, 소프트웨어업데이트등

    • 고객은데이터베이스컴퓨트파워 (OCPU) , 스토리지용량, 클라우드센터 region만을선택하면됨

    • Elastic

    • 최소사이즈 - 1 OCPU

    • 최소커밋타임 - 1 시간

    • 자동스케일링과함께진정한 pay-per-use 구현

    12 Copyright © 2019 Oracle and/or its affiliates

  • #2 Deployment 선택

    Dedicated: 테넌트전용의 Exadata Container DB

    • 고도의 Isolation

    • 다른테넌트로부터완벽히차단된 Secure Isolation Zone

    • Virtual Cloud Network 내의자율운영 DB

    • 복수의 container DB를활용하여 intra-company isolation 구현

    • 운영정책의 Customization

    • 프로비저닝, 업데이트/업그레이드, 고가용성등

    Public 클라우드인프라내에서 Private Database Cloud 구축!

    Roadmap: Autonomous Database Cloud at Customers13 Copyright © 2019 Oracle and/or its affiliates

  • #3 클라이언트선택

    Copyright © 2019 Oracle and/or its affiliates14

    ToolsLanguages

    Client

    Oracle Autonomous

    DB

    SQL*Net

    SQLDeveloper

    AnalyticsCloud

    Analytics Desktop

    Golden Rule: 기존보유기술을그대로활용!

  • 차례

    1

    2

    3

    4

    5

    최신표준의구현

    15 Copyright © 2019 Oracle and/or its affiliates

    6

  • JSON과 REST

    Copyright © 2019 Oracle and/or its affiliates16

    Request

    Response

    {"id":1,

    "name":"Century 16",

    "location":{"street":"Main St",

    "city":"Redwood",

    "zipCode":"94607",

    "state":"CA",

    "phoneNumber":null

    },

    “ticketPrice”: …

    }

    JSON

    • 유연한데이터모델

    • 데이터 Exchange 또는 Messaging의최신트렌드이자표준

    REST

    • 간단한웹요청/응답모델

    • 웹서비스프로토콜의최신트렌드이자표준

  • 오라클자율운영 DB의 JSON 지원

    SQL> desc THEATER

    NAME TYPE

    ------------------ -----------

    JSON_DOCUMENT VARCHAR2

    {"id":1,

    "name":"Century 16",

    "location":{"street":"Main St",

    "city":"Redwood",

    "zipCode":"94607",

    "state":"CA",

    "phoneNumber":null

    }

    }

    테이블컬럼에저장되어모든 DB feature 지원 Native SQL 지원

    Conventional insert 또는bulk load

    SELECT t.theater_id,

    t.json_document.location.city,

    m.movie_name,

    SUM(TO_NUMBER(

    t.json_document.ticketPrice.adultPrice)

    ) AS total

    FROM theater t, movies m

    WHERE m.theater_name =

    t.json_document.theater_name

    GROUP BY t.theater_id,

    t.json_document.location.city

    ORDER BY total DESC

    FETCH FIRST 10 ROWS ONLY;

    제약조건: IS JSON

    + 다양한함수, DBMS_JSON 패키지, 인덱싱, JSON 생성, …

    17 Copyright © 2019 Oracle and/or its affiliates

  • 오라클자율운영 DB의 REST 지원

    URI

    Oracle Autonomous DB

    SQL, PL/SQL

    JSON Result Set

    Map & Bind

    Transform to JSON

    Oracle REST Data Service (ORDS):

    오라클자율운영 DB에 내장

    • “REST-Enable”: 테이블, 뷰에 대한기본적인 REST API 자동 생성

    • GET (query), PUT (insert),

    POST( update), DETETE(delete)

    • Custom SQL 또는 PL/SQL

    18 Copyright © 2019 Oracle and/or its affiliates

  • 종합: Polyglot 어플리케이션

    어플리케이션 개발자:JSON 문서를 REST API로 다루기

    PUT /my_database/my_schema/customers HTTP/1.0

    Content-Type: application/json

    Body:

    {"firstName": "John",

    “lastName”: "Smith",

    "age": 25,

    "address": {

    "streetAddress": "21 2nd Street",

    "city": "New York",

    "state": "NY",

    "postalCode": "10021“,

    "isBusiness" : false },

    "phoneNumbers": [

    select

    c.json_document.firstName,

    c.json_document.lastName,

    c.json_document.address.city

    from customers c;

    firstName lastName address.city

    ----------- ----------- --------------

    “John” “Smith” “New York”

    SQL 개발자 및 분석가: SQL을 이용하여 JSON 데이터 조회

    Oracle Autonomous

    DB

    서로다른유형의데이터, API를하나의데이터베이스에서지원:

    오라클의전략적특장점!19 Copyright © 2019 Oracle and/or its affiliates

  • 차례

    1

    2

    3

    4

    5

    가장빠른웹어플리케이션개발도구 - APEX

    20 Copyright © 2019 Oracle and/or its affiliates

    6

  • APEX (Application Express)란?

    웹어플리케이션개발(Desktop & Mobile)

    오라클데이터베이스를중심으로한어플리케이션

    SQL 스킬및데이터베이스기능들을

    활용

    21 Copyright © 2019 Oracle and/or its affiliates

  • APEX의주요특징

    웹브라우저가바로어플리케이션개발을위한 IDE별도의클라이언트소프트웨어

    불필요

    어플리케이션그자체가데이터베이스내에메타

    데이터로저장선언적 –코드관리최소화

    웹페이지는한쌍의요청-응답에의해효율적으로생성됨

    데이터베이스단에서최대한의프로세싱수행

    22 Copyright © 2019 Oracle and/or its affiliates

  • APEX 아키텍처

    SQL & PL/SQL

    Schemas

    APEX EngineJDBCHTTPS

    Mid TierBrowserDatabase

    Tier

    어플리케이션 별도의어플리케이션로직없이클라이언트와데이터베이스를매개

    어플리케이션로직은해당스키마데이터에대한 SQL & PL/SQL로 구현되며렌더링을APEX 엔진이담당

    오라클 자율운영 DB에 내장!23 Copyright © 2019 Oracle and/or its affiliates

  • APEX를이용한개발엿보기

    Copyright © 2019 Oracle and/or its affiliates24

  • APEX를이용한개발엿보기

    Copyright © 2019 Oracle and/or its affiliates25

  • 다른개발방법과의비교

    APEX on Autonomous

    - 선언적

    - 최소한의코딩량

    - APEX 자체의체계적인어플리케이션관리기능 + 자율운영 DB가안전하면서도유연한 Repository를제공

    - Default로보안에충실

    JavaScript on AWS

    - 절차적

    - 많은코딩량

    - 코드유지보수및진단이복잡함

    - 보안기능은각각의개발자에의해코딩이되어야함

    20X faster to develop

    100X fewer lines of code

    26 Copyright © 2019 Oracle and/or its affiliates

  • APEX 예: 라이브어플리케이션

    https:// apex.oracle.com

    27 Copyright © 2019 Oracle and/or its affiliates

  • 차례

    1

    2

    3

    4

    5 In-DB 애널리틱스의활용

    28 Copyright © 2019 Oracle and/or its affiliates

    6

  • 오라클자율운영 DB의 In-DB 애널리틱스개요

    • DBMS_STATS_FUNCS

    기본통계 (Descriptive)

    • Statistical aggregates

    • Linear regression

    • Descriptive stats

    • Correlations

    • Cross Tabs

    • Hypothesis testing

    • Distribution fitting

    • Pareto analysis

    고급통계 (Inferential)

    • Window functions

    • Ranking

    • Lag/lead

    • Top-N

    • WITH clause

    • Pivot/Unpivot

    • Aggregation functions

    • Approximate Queries

    • Ratio to Report

    기본애널리틱스

    • Model clause

    • Pattern matching

    • Machine Learning

    고급 애널리틱스

    In-DB 애널리틱스의전략적인특장점

    • 데이터 이동이없음

    • 비용 절감: 별도의 분석용 서버불필요

    • 복잡도 감소: No Extra ETL

    • 보안 강화

    • SQL, PL/SQL 인터페이스

    • 데이터 처리에 가장 적합한 API

    • 엔터프라이즈가 보유한 기존 스킬활용

    29 Copyright © 2019 Oracle and/or its affiliates

  • 예 1: Spreadsheet 스타일분석

    Copyright © 2019 Oracle and/or its affiliates30

    SELECT transaction_date, cust_id, sales_amount, mov_median

    FROM sales

    MODEL

    PARTITION BY (cust_id)

    DIMENSION BY (

    ROW_NUMBER() OVER (PARTITION BY cust_id ORDER BY transaction_date) rn)

    MEASURES (

    transaction_date, sales_amount, 0 mov_median)

    RULES (

    mov_median[ANY] = MEDIAN(sales_amount)[rn BETWEEN CV()-2 AND CV()])

    ORDER BY cust_id, transaction_date, mov_median;

    →테이블을 spreadsheet처럼다루자

    →엑셀의 worksheet에해당

    →엑셀의행/열에해당

    →각셀의값정의

    →새로채워넣을셀값의계산식정의

    대용량데이터에대한 Spreadsheet 스타일작업을 DB에서바로수행!

  • * @author nbayliss

    */

    public class W_FINDER extends EvalFunc {

    private class V0Line {

    String state = null;

    String[] attributes;

    String prev = "";

    String next = "";

    public V0Line(String[] atts) {

    attributes = atts;

    }

    public String[] getAttributes() {

    return attributes;

    }

    public void setState(String state) {

    this.state = state;

    }

    public String getQuantity() {

    return this.attributes[4];

    }

    public String setState(V0Line linePrev, V0Line lineNext) {

    String q = this.getQuantity();

    if (linePrev == null) {

    prev = "";

    } else {

    prev = linePrev.getQuantity();

    }

    if (lineNext == null) {

    next = "";

    } else {

    next = lineNext.getQuantity();

    }

    if (!q.isEmpty() && (prev.isEmpty() || (eq(q, prev) && gt(q, next)))) {

    state = "S";

    return state;

    }

    if (gt(q, prev) && gt(q, next)) {

    state = "T";

    return state;

    }

    if (lt(q, prev) && lt(q, next)) {

    state = "B";

    return state;

    }

    if (!q.isEmpty() && (next.isEmpty() || (gt(q, prev) && eq(q, next)))) {

    state = "E";

    예 2: 패턴매칭10:00 10:05 10:10 10:15 10:20 10:25

    SELECT first_x, last_z

    FROM ticker

    MATCH_RECOGNIZE (

    PARTITION BY name ORDER BY time

    MEASURES FIRST(x.time) AS first_x,

    LAST(z.time) AS last_z

    ONE ROW PER MATCH

    PATTERN (X+ Y+ W+ Z+)

    DEFINE X AS (price < PREV(price)),

    Y AS (price > PREV(price)),

    W AS (price < PREV(price)),

    Z AS (price > PREV(price) AND

    z.time - FIRST(x.time)

  • 예 3: 머신러닝을위한데이터준비

    Copyright © 2019 Oracle and/or its affiliates32

    “Vectorizing”

    • Numbering

    • Binning

    • Normalization

    • Null Value Treatment

    • Outlier Treatment

    필요한데이터준비작업

    Automatic Data Preparation → ON!

    데이터를보다쉽게다룰수있는다양한방안을제공

    O

    N-Dimensional Space

    x =x 1x2

    xN…

    Cases

    Attributes

  • 차례

    1

    2

    3

    4

    5

    33 Copyright © 2019 Oracle and/or its affiliates

    6 마치며

  • 요약

    Copyright © 2019 Oracle and/or its affiliates34

    IDC Whitepaper 2019.09

    Meanwhile, the fully managed quality of Oracle Autonomous Database

    empowers developers to focus on developing applications without worrying about operational considerations such as patches, updates, security, backups, disaster recovery, performance tuning, or high availability.

    Powered by machine learning, Oracle Autonomous Database is illustrative of the future of databases that are self-managing and demonstrative of intelligence and the capability to automatically adjust to changing input parameters and workloads. Developers will appreciate the ability of Oracle Autonomous Database to dynamically self-manage its operational behavior because they will subsequently be able to focus more of their attention on writing code.

  • 감사합니다

    Sangyun Lee

    Master Principal Solution EngineerAutonomous DB & Analytics

    35 Copyright © 2019 Oracle and/or its affiliates