Book Image

Developing Robust Date and Time Oriented Applications in Oracle Cloud

By : Michal Kvet
Book Image

Developing Robust Date and Time Oriented Applications in Oracle Cloud

By: Michal Kvet

Overview of this book

Proper date and time management is critical for the development and reliability of Oracle Databases and cloud environments, which are among the most rapidly expanding technologies today. This knowledge can be applied to cloud technology, on premises, application development, and integration to emphasize regional settings, UTC coordination, or different time zones. This practical book focuses on code snippets and discusses the existing functionalities and limitations, along with covering data migration to the cloud by emphasizing the importance of proper date and time management. This book helps you understand the historical background and evolution of ANSI standards. You’ll get to grips with data types, constructor principles, and existing functionalities, and focus on the limitations of regional parameters and time zones, which help in expanding business to other parts of the world. You’ll also explore SQL injection threats, temporal database architecture, using Flashback Technology to reconstruct valid database images from the past, time zone management, and UTC synchronization across regions. By the end of this book, you’ll be able to create and manage temporal systems, prevent SQL injection attacks, use existing functionalities and define your own robust solutions for date management, and apply time zone and region rules.
Table of Contents (26 chapters)
1
Part 1: Discovering Oracle Cloud
4
Part 2: Understanding the Roots of Date and Time
7
Part 3: Modeling, Storing, and Managing Date and Time
12
Part 4: Modeling Validity Intervals
17
Part 5: Building Robust and Secure Temporal Solutions
20
Part 6: Expanding a Business Worldwide Using Oracle Cloud

Database provisioning

After connecting to the cloud, you will arrive on the main dashboard screen. There is a hamburger menu in the top-left corner. Clicking on the Oracle Cloud logo navigates you to the home screen. Individual resources and configuration options are here. The top panel consists of the cloud location and profile information, containing your identification details, tenancy, user settings, and more, as shown in the following screenshot:

Figure 1.2 – Oracle Cloud home screen main menu

Figure 1.2 – Oracle Cloud home screen main menu

There are several arrows marked in Figure 1.2. The yellow arrow (1) points to the hamburger menu, while the Oracle Cloud logo (the blue arrow (2)) is used for home screen navigation. The current cloud location is present in the menu as well (indicated by the red arrow (3)). The green arrow (4) points to the user menu, language, notifications, and preference definition.

Database provisioning can be done by locating the menu on the home screen (Launch Resources) or by clicking on the hamburger menu and navigating to Oracle Database | Autonomous Database. The following screenshot shows the sub-elements for provisioning specific database types:

3

Figure 1.3 – Database provisioning

Figure 1.3 – Database provisioning

As can be seen in Figure 1.3, resource types are presented in panels, defined by their categories, along with indications on the estimated time required for the creation and whether the resource is available under the Always Free option or whether specific licensing is necessary. Clicking on Create an ATP database (the yellow arrow (1) in Figure 1.3) will take you to a new database parameter specification window, in which you can enter the Compartment information, Database name, as well as its user-friendly representation, Display name, as shown in the following screenshot. The given Database name must contain only letters and numbers. The first one should be a letter. The maximum length is 30 characters. The red arrow (2) in Figure 1.3 points to the link to Create an ADW database.

Figure 1.4 – Database parameter specification during database provisioning

Figure 1.4 – Database parameter specification during database provisioning

Then, the workload type needs to be selected, depending on the intended usage. ADW is suitable for analytics and complex evaluation, with emphasis on the data retrieval process involving large datasets and pre-calculated values. By contrast, ATP is used for a high-concurrency environment with high transactional workloads. The third option is the JSON option, AJD, mainly associated with the document API and management of storage in JSON format. The APEX database type is optimized for building low-code (or even no-code), data-driven applications.

Then, you select the Deployment type option, choosing from Shared or Dedicated architecture, followed by the database configuration – database system version, OCPU count, and storage capacity (the value is expressed in TB).

Finally, the administrator credentials need to be defined. Oracle applies a strong password strategy. Currently, it must consist of at least 12 characters with at least 1 uppercase letter, 1 lowercase letter, and 1 number. It cannot contain admin, double quotes ("), or your username. The requirements for the credentials might evolve, but will always be summarized in the OCI documentation and outlined when entering the details in a pop-up window.

Optionally, network gateways and accessibility rules can be specified. For the licensing, it is possible to Bring Your Own License (BYOL).

New database resources are provisioned by clicking on the Create Autonomous Database button. The status of the process is visible below the ATP logo. The orange color represents any maintenance or processing currently taking place, while the green color expresses the current availability of the resources. Individual parameters and properties are listed there as well.

Several buttons are present in the upper part of the database home screen, as shown in the following screenshot:

Figure 1.5 – Database actions menu

Figure 1.5 – Database actions menu

Referring to the colored arrows in the preceding screenshot, let’s look at what each of these buttons does:

  • Database actions (the yellow arrow (1)) launches the SQL Developer Web tool. It offers a graphical SQL interface, data modeler, data visualization packages, ML, or REST functionality in the Development section. There is also an Administration subsection for data import operation management, downloading Client Credentials (Wallet), and user administration and APEX management; a Monitoring subsection for performance monitoring and evaluation; a Downloads subsection for downloading Oracle Instant Client or SODA drivers; and Related Services, dealing with RESTful, SODA, and ML services.
  • Database connection (the blue arrow (2)) provides you with the client credentials and connection information to connect to the cloud database. In addition, it offers you a zipped file consisting of the encrypted Client Credentials (Wallet). These are used to connect the SQL Developer Desktop environment launched locally on the client computer.
  • Performance hub (the green arrow (3)) consists of extended statistics and services for monitoring activity, such as average active sessions, workloads, blocking sessions, SQL monitoring, Automatic Database Diagnostic Monitor (ADDM), and more. You can monitor within a specific time zone and for a specified time range (database (server), client (browser), or UTC).
  • Manage scaling (the purple arrow (4)) provides you with the ability to extend the storage capacity or shrink it, as well as optimize the OCPU count for the required workload.
  • Finally, More Actions (the gray arrow (5)) allows you to scale, start, stop, or restart the database. In addition, there are options for license management and changing the administrator password.

Among the management buttons, three tabs consist of Autonomous Database Information, Tools, and Tags, as shown in Figure 1.6. The Tools tab presents Oracle Application Express (APEX) for creating low-code database applications, Oracle ML User Administration, and SODA Drivers for JSON document processing via a set of APIs. SODA drivers are available for REST, Java, Node.js, Python, PL/SQL, and C.

Figure 1.6 – Tools list

Figure 1.6 – Tools list

Graph Studio, however, allows you to create and manipulate graph databases by automating models and in-memory graphs. Graph Studio is a self-service graph database providing a lot of complex data management functionality, visualization tools, and an analytical environment. It is part of the ADB Free Tier and can be applied to ADW and ATP on shared infrastructure. Currently, it is not available for AJD. Property Graph Query Language (PGQL) is commonly used as an SQL variant, focusing on property graph structures formed by the vertices and edges. Figure 1.7 shows an example query visualization.

Figure 1.7 – Graph representation example (source: https://docs.oracle.com/en/database/oracle/property-graph/20.4/spgdg/graph-visualization-application1.html#GUID-6DDB37F7-C78E-49B7-B062-1240B5D38A5C)

Figure 1.7 – Graph representation example (source: https://docs.oracle.com/en/database/oracle/property-graph/20.4/spgdg/graph-visualization-application1.html#GUID-6DDB37F7-C78E-49B7-B062-1240B5D38A5C)

By scrolling down on the Oracle Cloud dashboard, some usage metrics (CPU Utilization, Storage Utilization, Sessions, Execute Count, Running Statements, and Queued Statements) are revealed. Charts can be filtered by time.

You have successfully provisioned the database and are now familiar with the Oracle Cloud console. It’s time to connect to the created database using the SQL Developer tool. We will examine both the desktop and cloud versions.