You are on page 1of 28
University Activity Guide $1105385GC10 Learn more from Oracle University at education.oracle.com ates © 2023 Oracle and/or its affi © Unauthorized reproduction or distribution prohibited. Copyright Copyright © 2025, Oracle and/or its affiliates. Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws. The document may not be modified or altered in any way. Except where your use constitutes "fair use” under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this documentis subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to usin wniting, Restricted Rights Notice IF this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S, GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer decumentation ot ather Oracle data delivered to or accessed by US. Government end users are "commercial computer software" or “commercial computer software cocumentation” pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardare, and modifications of such programs), i) Oracle computer documentation and/or ii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the apalicable contract for such services. No other rights are granted to the U.S. Government. ‘Trademark Notice Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks af their respective owners. Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks oF registered trademarks of SPARC International, Ine. AMD, Epye, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX isa registered trademark of The Open Group. ‘Third-Party Content, Products, and Services Disclaimer This documentation may provide access to or information about content, products, and services from third parties, Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle, Oracle Corporation and its affiliates wll not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle 06072023 Table of Contents ADB Quick Star ADB QUICK StOftesiinnnsnnnnni Practice 1-1: Provision an ADB Instance... Practice 1-2: Create Tables and Load Data... rn Practice 1-3: Use SQL to Analyze Movie Sales Data...... ‘Gapyrgn DRS, Oras arts aes (Oracle Cloud Data Management 2023 Foundations Workshop ~ Table of Contents ites ited. Copyright © 2023 Oracle and/or its affili Unauthorized reproduction or distribution prohi ‘Gapyrg DRIES, race arts as ‘Oracle Cloud Data Management 2028 Foundations Workshop ~ Table of Contents SOJEIIE Sy JO/pue B}92IOC EZOZ © JUBUAdOD “payiqiyosd UONNGU}SIP 10 UOHONposdes pezuouyNeun, Jo uoyonpodas pezuoujneun, SOLE SI 1O/PUL 8,921 EZOT © JUBUAdOD “payqryoud uONNqLy: ADB Quick Start ADB Quick Start Overview In these practices, you will: ‘* Deploy an Autonomous Database instance that is optimized for data warehousing workloads ‘+ Use Autonomous Database tools to load data from object storage + Use advanced SQL to uncover issues and possibilities ‘Capa RES, race aor Ta 6 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates a = Practice 1-1: Provision an ADB Instance Overview In this practice, you deploy a complete data warehousing platform that scales to both your technical and analytic requirements. Tasks Log in to the Oracle Cloud interface Alter you log in, the cloud services dashboard appears, where you can see all the services available to you. Click the navigation menu at the top left to show top-level navigation choices and then click Oracle Database > Autonomous Database. x (cl foley ) 2023 Oracle and/or its aff con ‘Autonomous Database Ca rere ct Coe oer fenton Caer 3. Click Create Autonomous Database to start the instance creation process. Autonomous Databases in Co artment ns tabase delver fost peromance and requires no database edinsration i prfonms all utne database maintenance tase wl Display Neme stow Dedicated ‘ocPus Storage Cpr RIS, Tae aoe ATT ADB Quick Start Z Unauthorized reproduction or distribution prohibited. Copyright 4. This brings up the Create Autonomous Database screen, where you specify the configuration of the instance. Create Autonomous Database Provide basic information for the Autonomous Database moviestream Display ame © 2023 Oracle and/or its affiliates © choose awortiond ye ata Warehouse | Transaction JSON APEX uitfor decision Processing ‘Bui for 1S0N- centre ap- Built tor Ora cartecmaads || Beta || Chasse deoiymanttine ‘Shared Infrastructure Dedicated Infrastructure a 5. Enter basic information for the autonomous database: a, Choose a compartment: You can simply use the default compartment or pick a different one, See the documentation if you want to learn more about compartments. b. Display Name: Enter a memorable name for the database for display purposes. For this practice, use My Quick Start ADB. ©. Database Name: Use letters and numbers only, starting with a letter. Maximum length is 14 characters (underscores are not initially supported). For this practice, use MYQUICKSTART ‘Capa RES, race aor Ta 8 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright Create Autonomous Database Provide basic information for the Autonomous Database ‘Compartment moviestream Display ame My Quick Stan ADW mvauicksraRT 6. Choose the Data Warehouse workload type: “Transaction Processing 7. Choose the Shared Infrastructure deployment type: Choose a deployment type Shared Infrastructure Dedicated Infrastructure Exadata 8. Configure the database: 9. Select Always Free: If your cloud account is an Always Free account, you can select this option to create an always-free autonomous database. An always-frae database comes with 1 CPU and 20 GB of storage. For this practice, we recommend you leave Always Free deselected 10. Choose database version: Select 19c as the database version. , OCPU count: Number of CPUs for your service. For this practice, specify 1 CPUs. If you choose an Always Free database, it comes with 1 CPU. b. Storage (TB): Select your storage capacity in terabytes. For this practice, specify 1 TB of storage. Or, if you choose an always-free database, it comes with 20 GB of storage. Auto Scaling: For this practice, keep auto scaling enabled. This enables the system to automatically use up to three times more CPU and I/O resources to meet workload demand. ‘Capa RES, race aor Ta ADB Quick Start 9 Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates d, New Database Preview: If a check box is available to preview a new database version, do NOT select it. Note: You cannot scale up/down an always-free autonomous database. Configure the database Fee contguancn rons Somer 11. Create administrator credentials: Password and Confirm Password: Specify the password for the ADMIN user of the service instance. The password must meet the following requirements a, The password must be between 12 and 30 characters long and must include at least ‘one uppercase letter, one lowercase letter, and one numeric character. The password cannot contain the username. The password cannot contain the double quote (") character. The password must be different from the last 4 passwords used, The password must not be the same password that you set less than 24 hours ago. Re-enter the password to confirm it. Make a note of this password, cron srintatorcredene (2) Contr passers 12. Choose network access: a. For this practice, accept the default “Secure access from everywhere.” ‘Capa RES, race aor Ta 10 [ADB Quick Start b. Ifyou want to allow traffic only from the IP addresses and VCNs you specify—where access to the database from all public IPs or VCNs is blocked—select "Secure access from allowed IPs and VCNs only" in the Choose Network Access area c. If you want to restrict access to a private endpoint within an OCI VCN, select "Private endpoint access only" in the Choose Network Access area. d. Ifthe "Require mutual TLS (mTLS) authentication” option is selected, mTLS will be required to authenticate connections to your Autonomous Database. TLS connections allow you to connect to your Autonomous Database without a wallet, if you use a JDBC thin driver with JOK8 or above. See the documentation for network options to allow TLS, or to require only mutual TLS (mTLS) authentication. Choose network access ‘Access Type Secure access Secure access Private endpoint from everywhere from allowed IPs access only Alow users wit database and VCNs only Restrict credentials to access the database from the internet. /, cess toa Restrict access to spectied IP addresses and VCNS, Require mutual TLS (mTLS) authentication 13. Choose a license type. For this practice, choose License Included. The two license types are: a, Bring Your Own License (BYOL): Select this type when your organization has existing database licenses. b. License Included: Select this type when you want to subsoribe to new database software licenses and the database cloud service, endpoint within an OCI VCN. ‘Capa RES, race aor Ta ADB Quick Start " Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates 14. For this practice, do not provide a contact email address. The “Contact Email” field allows you to list contacts to receive operational notices and announcements as well as unplanned maintenance notifications. Provide contacts for operational notifications and announcements © Contact Email a mn x ‘Add Contact, 15. Click Create Autonomous Database. 16. Your instance will begin provisioning. In a few minutes, the state will tum from Provisioning to Available. At this point, your autonomous database is ready to use! Have a look at your instance's details here including its name, database version, OCPU count, and storage size. My Quick Start ADB General riomation Iiestractre jeanne ‘Autonomous Data Guard sae Backup eee cmcerees eee aa poems ii ane a Provisioning an Autonomous Database instance, ‘Capa RES, race aor Ta 1 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates = Autonomous Database successfully provisioned. My Quick Start ADB Genera intormation Intestine ‘Autonomous Data Guard © Backup Network ens hta teeen D ADB Quick Start ‘SapyraRRD HES, ace nore wae 13 ites ited. Copyright © 2023 Oracle and/or its affili Unauthorized reproduction or distribution prohil Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates Practice 1-2: Create Tables and Load Data Overview In this practice, you will use Autonomous Database tools to create and load database tables sourced from public files in Oracle Object Storage. Tasks 1. Goto the Details page of the Autonomous Database you provisioned. Click Database Actions to go to the suite of Autonomous Database tools. ‘Search for services, and documentation (Overview » Autonomous Database » Autonomous Database Details Ci Database Actions | OB Connection Performance Hub ‘Autonomous Database Information Tools Tags. General Information Database Name: AVAILABLE Workload Type: Data Warehouse ‘Capa RES, race aor Ta 14 [ADB Quick Start 2. Logging in to Database Actions from the OCI Service Console expects you to be the ADMIN user. Log in as ADMIN if you are not automatically logged in to Database Actions. Enter the administrator password you specified when creating the database. Click Sign in. ORACLE Database Actions 3. Onthe Database Actions Launchpad page, under Data Tools, click DATA LOAD. Data Tools KK CATALOG Pa DATA INSIGHTS. ® susiness movers Discover anomalies, outliers and fe business models for hidden pattems in your data performance and anal ‘Capa RES, race aor Ta ADB Quick Start 18 ites ited. Copyright © 2023 Oracle and/or its affili Unauthorized reproduction or distribution prohi 4, Under What do you want to do with your data? select LOAD DATA. Under Where is your data? select CLOUD STORE, and then click Next ) 2023 Oracle and/or its affiliates Explore and Connect CLOUD LOCATIONS ‘Capa RES, race aor Ta 6 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright 5. The Load Cloud Object page appears. Use this page to drag tables from the public object storage bucket to the data loading job. Copy the following object storage URL to the Select Cloud Store Link or enter public URL field: httos/obiectstorage.us-ashburn-1.oraclecloud.com/re4u04/b/moviestream landing/o Press Enter on your keyboard. You will see a list of folders on the left side, from which you can drag to the data loading job. ST ye Select Cloud Store Link or enter public URI eo | 6. Select multiple folders. First, drag the customer_contact folder over to the right-side pane. Note that a dialog box appears asking if you want to load all the files in this folder to a single target table. In this case, the folder has only a single file, customer-contact .csv. Frequently, data lake folders contain many files of the same type, as you will see with sales data. Click Yes. 7. Perform the same drag-and-drop steps for genre, sales_sample, and pizza_location. ‘Capa RES, race aor Ta ADB Quick Start 7 Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates 8. Click the pencil icon for the customer_contact load task to view the sett Select Cloud Store Link or enter public URL a a spaquet + © 2023 Oracle and/or its affiliates © » £5 cater extension is a > pox ocation a ‘Capa RES, race aor Ta 18 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright 9. Inthe settings viewer, you can see that Database Actions will create a CUSTOMER_CoNTACT table with the list of columns and data types that will be created from the CSV file. They all look correct, so click Close to close the settings viewer. LB toad Data from Cloud Store Location customer contact/ ° 10. Click the pencil icon for the sales_sample task to view its settings. In this case, update the name of the table to CUSTSALES. | D024 bate from Cioud Store Location saies_sample/ + © [euraas we Wepping Click Close. ‘Capa RES, race aor Ta ADB Quick Start 19 ites ited. Copyright © 2023 Oracle and/or its affili Unauthorized reproduction or distribution prohi Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates 11. Now click the Start button to run the data load job. Run Data Load Job ‘The job should take about 2 minutes to run. 12. Check that all of the data load cards have green tick marks in them, indicating that the data load tasks have completed successfully. Click the information button on the genre task: Da Load > Lond! ober Select Cloud Store Link or enter public URL OAD. 77 eb ete Comsleed 68) Tot we 0204 scones Hie ‘SapyraRRD HES, ace nore wae 20 [ADB Quick Start 13. Let's do a quick review of the loaded data. Click the Table tab to view the genre data: Oo Load Data from Cloud Store Location genre/ Settings Table: GENRE File GENRE_ID NAME 1 1 Action 2 2 Adventure sau a 3 Animation Errors | 14 4 Biography Data Definition © 5 Comedy ie 6 Crime i 7 Documentary 2 8 Drama i 9 Family 10 10 Fantasy The data looks good! Click Close to exit the genre task and then click Done to exit the DATA LOAD tool and return to the Database Actions Launchpad. This completes the Data Load practice. We now have a full set of structured tables loaded into the Autonomous Database instance from files in object storage. We will be working with these tables in the next practice. ‘Capa RES, race aor Ta ADB Quick Start at Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates >) 2023 Oracle and/or its affiliates Unauthorized reproduction or distribution prohibited. Copyright Practice 1-3: Use SQL to Analyze Movie Sales Data Overview In this practice, you use Oracle analytic SQL to gain a better understanding of customers. You will learn how to use SQL Worksheet and Bin customers by recency, frequency, and monetary metrics, Tasks 1. From the Data Load tool, navigate to the SQL Worksheet by clicking the top-left hamburger menu and then selecting Development > SQL. Cou ono ca Sn Eee ard Perey Coen) Peg Potten] i Co} oo Pra cn Pret rnny ‘Capa RES, race aor Ta 22 [ADB Quick Start 2. Learn more about the SQL Worksheet features using the help tips or simply click the X at the top left of a tip to dismiss it. You will run queries by entering your commands in the worksheet. You can use the shortcuts [Control + Enter] or [Command + Enter] to run the command and view the Query Result (in tabular format). Clear your worksheet by clicking the trash icon: Run script (text output) Run command (table output) Clear commends {Worksheet]* ¥ 8 1 select user from dual; Query Result Script Output DBMS Output — Explain Plan —_Autotrace W © [© Download y Execution time: 0.007 seconds user al ‘ADMIN You are now ready to start analyzing MovieStream’s performance u ‘Gopyraree BOE, race anor is ae ADB Quick Start 23 tribution prohibited. Copyright © 2023 Oracle and/or its affiliates Unauthorized reproduction or 3. Lot's use a very simple query to look at sales for the top 5 movie genres. select name, round(sum{actual_price),0) as sales from custsales c, genre g where c.genre id ~ g.genre id group by name order by sales desc fetch first 5 rows only Copy this SL statement into the worksheet, and click the Run Command button to start the query. This returns a result similar to the following: [Worksheet]* + Bob % select name, round( sum(actual_price),®) as sales from custsales c, genre g where c.genre_id = g.genre_id group by name order by sales desc fetch first 5 rows only Query Result Script Output DBMS Output Explain Plan Autotrace Si Download ¥ Execution time: 0.532 seconds name sales 1 Drama 789734 2 Action 663613 3 Adventure 397374 4 Comedy 354187 5 Sci-Fi 323543 As you can see, the Drama and Action genres dominate MovieStream sales with Adventure, Gomedy, and Sci-Fi genres rounding out the top 5. 4. In the following steps, the scripts will build a SQL query to identity: Recency: When was the last time the customer accessed the site? ‘+ Frequency: What is the level of activity for that customer on the site? Monetary Value: How much money has the customer spent? ‘Capa RES, race aor Ta 24 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates 2 Customers will be categorized into 5 buckets measured (using the NTILE function) in increasing importance. For example, an RFM combined score of 551 indicates that the customer is in the highest tier of customers in terms of recent visits (R=5) and activity on the site (F=5); however, the customer is in the lowest tier in terms of spend (M=1). Perhaps this is a customer that performs research on the site, but then decides to buy movies elsewhere! 5. Binning customers based on behavior Use the following query to segment customer behavior into § distinct bins based on the recency, frequency, and monetary metrics: SELECT cust_id, NTILB (5) OVER (ORDER BY max(day_ID)) AS rfm_recency, NTILE (5) OVER (ORDER BY count(1)] AS rfm_frequency, NTILE (5) OVER (ORDER BY SUM(actual_price)) aS rén FROM custsales GROUP BY cust_ia ORDER BY cust_id FETCH FIRST 10 ROWS ONLY; The following screenshot shows the result (your result may differ): jonetary ‘Capa RES, race aor Ta ADB Quick Start 25 ites ited. Copyright © 2023 Oracle and/or its affili Unauthorized reproduction or distribution prohi [Worksheet] + BH OB oy TJ Consumer SELECT cust_td, NTILE (5) OVER (ORDER BY max(day_ID)) AS rfm_recency, NTILE (5) OVER (ORDER BY count(1)) AS rfm_frequency, NTILE (5) OVER (ORDER BY SUM(actual_price)) AS rfm_nonetary FROM custsales GROUP BY cust td ORDER BY cust_id FETCH FIRST 10 ROWS ONLY; ES weevomsune Query Result Script Output DBMS Output Explain Plan Autotrace SQL History fi © Download » Execution time: 2.935 seconds cust_id rfm_recency rfm_frequency rfm_monetary 1 1000001, 5 4 4 2 1000004. 3 3 a 3 1000007 5 5 5 4 1000010 2 2 a 5 1000013, 4a 1 2 6 1000015 4 2 4 7 1000017 1 3 2 8 1000021 5 2 ZI 9 1000022 4 3 2 10 1000025 5 5 5 ‘The r£m_* columns in the report show the "bin" values based on the 5 quintiles described. 6. Add customer information to the RFM query. ‘SapyraRRD HES, ace nore wae 25 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates ites 7. Now we use the iT7H clause to oreate an REM query and then join that to attributes coming from the cusToMER table, In addition, the query will focus on important customers (based on spend) that are at risk: WITH rfm AS ( SELECT m.cust_id, NTILE (5) OVER (ORDER BY max(day_id)) AS rfm recency, NTILE (5) OVER (ORDER BY count (1]) AS rfm_frequency, NTILE (5) OVER (ORDER BY SUM(m.actual_price)} AS rfm_monetary FROM custsales m GROUP BY m.cust_id ) SELECT r.cust_id, c.first_name||' '||c.last_name AS cust_name, r.rfm_recency, r.rim frequency, r.rfm monetary, ited. Copyright © 2023 Oracle and/or its affili c.country, c.gender, c.income_level FROM rfm x, customer ¢ WHERE c.cu: soust_id AND r.rfm_monetary >= § AND r.rfm_recency = 1 ORDER BY r.rfm monetary desc, r.rfm_recency desc; The result shows only customers who historically had significant spend (equal to 5) but have not visited the site recently (equal to 1). MovieStream does not want to lose these important customers! ‘Capa RES, race aor Ta ADB Quick Start 2 Unauthorized reproduction or distribution prohi Monet = BOG Le we consumer creas 2 artes ‘ (RE (5) ev een may) 5 ee recocy, 5 ATE (5) vk cock coo) AS rim tremens ‘ TUE (S) ew onoh Sis actunl pce) fs Feta Fes in| east nme AS ast rime, x cs rtm receny xcs Quer Rest Suet OOS Opt ElanPan futrace SOL Mitry —OaaLoaing ® cmtia conan vimswcency ——frcmeueney —immenetry aur once 1 10629 Uiang yan 1 . usesnFoderator Mie a ‘amss® tle Kon Pai 5 T Saas date Male ‘ 1394774 Dlstata Ze 7 ‘ T swsnste Feria . 277072 saanasa oso. 1 ‘ 5 seus wane Mle * 144876 sais Kommane 1 . sss wane Farle ° 10771 abd Ann : ‘ 5 Usekitan Fete 0 1302076 wiomiyey : . 5 ured Nile " e761 Hara Kone 1 . 8 sn le 2 1122616 er Moons 1 4 5 ann Nona This concludes the practices for ADB Quick Start. ‘SapyraRRD HES, ace nore wae 28 [ADB Quick Start Unauthorized reproduction or distribution prohibited. Copyright © 2023 Oracle and/or its affiliates

You might also like