Development

Extending Oracle Database DevOps with Automated PL/SQL Unit Testing

Shay Shmeltzer - Mon, 2017-06-05 14:57
 
Automated testing helps you locate problems earlier in the development cycle saving you precious time down the road. This is why it should be a key part of any DevOps cycle - and your database code shouldn't be an exception to this rule.This blog entry will teach you how to execute tests automatically following code changes that you do in your Oracle database.
 
In previous blog entires I showed you how to use Oracle Developer Cloud Service (DevCS for short) for database development including how to track and manage tasks, version code changes, conduct code reviews, and automate code deployment to the database. This blog adds one more step to this lifecycle - automated testing.
 
For PL/SQL testing I'm using the open-source utPLSQL unit testing solution. The team behind this project just released a completely re-written version of the framework with features that allow you to add PL/SQL testing to continuous integration processes.

A full explanation of utPLSQL is outside of the scope of this blog (They have decent documentation to get you started). But in short, the concept is that you write PL/SQL procedures that test other procedures. The framework includes functions you invoke from your test functions to evaluate results as well as annotations that deliver meaningful messages and information when reporting test results. The utPLSQL utility is comprised of a set of database objects that you install in a new schema, and then you use their ut.run() procedure to execute test cases.

One nice feature built into the framework is the ability to produce test result reports in a format that is compatible with regular JUnit tests. With this functionality, I was able to get Developer Cloud Service to show me the test results nicely. Further more the built in support of DevCS for the SQLcl commands, made it simple to integrate the PL/SQL based framework as part of a generic build process without the need to install anything else on my continuous integration server.

Here is a quick video showing you the result and the configuration needed.
In the video I show how a check in of a PL/SQL script into the Git repository triggers a chain of events that ends with publishing test results. If the test fails the build is marked as failed - which can trigger an email being sent to you notifying you each time someone broke your code.
 
 
Some tips for configuration of such a chain:

My build pipeline has two jobs. The first one runs the SQL scripts in the database. This job is triggered by any change made to my Git repository. So when I update my git repository with a SQL script that has a new definition of a database object, the build immediately takes it and updates the definition in my development or QA database.
Once this build job finishes, it queues up the next job - the unit testing job.

The unit testing job is using SQLcl to run the following commands:

set serveroutput on;
set feedback off;
spool /workspace_directory/results.xml;
exec ut.run(ut_xunit_reporter());
spool off;

I spool the results of the test run into an xml file that I keep in the workspace directory for my job. (You can find out this directory by adding a shell command build step that does echo $WORKSPACE - an environment variable on the build server). Then I execute the ut.run procedure with the parameter that tells it to output the results as XUnit/JUnit format - doc on this option here. I turn serverouput on to get the results to show, and I turn feedback off to hide the message that the procedure successfully completed.

In the post build step I archive the results.xml file, and then I indicate that I want to publish the content of this file as test results.
 
Post Build Step

When your build finishes you'll see your build status visually and you can then drill down to see specific tests status.
Notice that you can also ask to be notified by email on the results of the build (the CC Me button).
 
 
Click on a specific run of a job to drill down into the test results
 
Test Summary
And click on a specific test suite to get the details of each test

Test Results Report

That's it. You now have a complete chain that will notify you the minute that a database change someone did breaks any tests, helping you deliver better code faster.
Categories: Development

DevOps and the Agile DBA

Gerger Consulting - Wed, 2017-05-31 13:38
The esteemed ACE Director alumna Kellyn Pot'Vin Gorman is hosting our next webinar!

Attend the free webinar by Kellyn on June 13th and learn how agile best practices and virtualization can help you become better at DevOps.


About the Webinar:
This session discusses common database challenges and how they can be solved with newer DevOps practices without impacting the DBAs “safe zone”.

Development, testing, provisioning, patching, upgrading and managing will become easier with agile tools, virtualization and collaboration.

The take-aways from this session are to embrace DevOps basics with a “DBA twist” such as:
  • Develop, Rinse, Repeat
  • Test Until Your Five Year Old Can Do It
  • Human Intervention Creates Human Error- Automate EVERYTHING.
  • How the shorter development cycle build business success.
  • How the DBA can do more with less.
Discover the power of virtualization and agile development practices providing more value to even the most senior database expert.

We’ll demo different scenarios surrounding DevOps, virtualization and how to make the DBA pivotal to DevOps success.

Sign up for the free webinar.

About the Presenter:



Kellyn Pot’Vin-Gorman is a member of the Oak Table Network and an Oracle ACE Director alumna. She is the Technical Intelligence Manager for the Office of CTO at Delphix, a company recognized for it's impressive virtualization and data masking environment capabilities. Kellyn is known for her extensive work with multi-database platforms, cloud migrations, virtualization, the command line interface, environment optimization tuning, automation and architecture design. Her blog, http://dbakevlar.com and social media activity under her handle, DBAKevlar is well respected for her insight and content.

Registration is free but space is limited.
Sign up now.
Categories: Development

Automating Processes With Application Builder and Process Cloud Services

Shay Shmeltzer - Tue, 2017-05-30 18:33

Oracle Application Builder Cloud Service (ABCS) gives you a great way to build apps that track data, but what if your data is also involved in processes? What if you need to automate not just the data collection but also the human workflow interactions? The new integration between Oracle ABCS and Oracle Process Cloud Service (PCS) enables you to achieve this easily.

You can now create processes that are associated with ABCS business objects and interact with them directly from your Oracle ABCS user interfaces. This is a two way interaction patterns, where PCS processes can access information from Oracle ABCS business objects, and ABCS user interfaces can be created on top of these PCS processes to initiate and progress processes.

PCS integration in ABCS

In the video example below I'm developing a basic approval flow for travel requests. The video will show you how the integration works covering:

  • Associating a process with a business object
  • Accessing the business object values from your process
  • Setting security and connection between PCS and ABCS
  • Initiating PCS processes from an ABCS page
  • Creating custom to-do list pages in ABCS to show you your tasks
  • Creating custom task details pages in ABCS to progress tasks

As you'll see, all of these are quite simple and completely declarative to achieve with the visual development approach.

The combination of the products provide great value to the users of each one of those. PCS customers will love the ability to persist the data they use in their processes, and the ability to design even richer interfaces and reports. ABCS users will love the ability to automate and manage long running complex processes. 

 

 

 

Categories: Development

Smart Database Architecture for Software Development

Gerger Consulting - Wed, 2017-05-17 13:00

We are incredibly excited to announce that the amazing Toon Koppelaars from Oracle Real World Performance Team is hosting our next webinar: Smart Database Architecture for Software Development. Register at this link.





About the Webinar

Is the database a processing engine or a persistence layer? In this presentation we'll first go through a bit of history demonstrating how the database has been used in the past 30 years: at times it was a processing engine, and at other times it was just a persistence layer. 

Having witnessed many application development projects, we are convinced that the database ought to be used as a processing engine. The persistence layer approach, where all business logic is implemented outside the database has serious drawbacks in the areas of initial application development, ongoing maintenance, and most notably in the area of performance and scalability. 

We'll discuss these drawbacks, in particular the last one: We'll debunk once and for all that moving business logic out of the database benefits performance and scalability.



About the Presenter

Toon has been part of the Oracle eco-system since 1987. He is currently a member of Oracle's Real World Performance Team. The RWP-team troubleshoots application performance issues in and around the Oracle Database. The way applications currently use (or rather, abuse) the DBMS, is often at the root of these performance issues. Prior to joining the RWP team, Toon has been mainly involved in database application development. His special interests are: architecting applications for performance and scalability, database design, and business rules / constraints modeling. He is a long-time champion of using the database in a smart way, i.e. using the database as a processing engine.

Registration is free but space is limited.


Categories: Development

Leveraging Oracle JET Composite Components in Oracle application Builder Cloud Service

Shay Shmeltzer - Mon, 2017-05-15 16:17

One of the new features of Oracle Application Builder Cloud Service (ABCS) in the May 2017 release is integration with Oracle JET's Composite Components Architecture (JET CCA).

Based on the Web Components standard, JET CCA provides a way to define reusable UI components (with logic) that can easily be incorporated into multiple applications.

The new feature in ABCS allows you to pick such components as extensions to the ABCS design time, providing an easy standard way to extend your UI capabilities. For example in the screenshot below you see a new slider component in the common components section, and how it looks like when added to the visual designer.

ABCS Design Time
 

In this blog entry we'll start by creating a very simple JET CCA component and then see how to add it to Oracle ABCS. (Thanks goes to John Brock who helped get this sample working).

To learn more about JET CCA have a look at their developer guide, and the sample in the Oracle JET Cookbook. We are going to start from that sample and build a very basic component. (For a deep guided tour of Oracle JET CCA check out Duncan's series of JET CCA blogs)

There are 5 files needed to define a component.

5 files in a directory

We'll start with the loader.js file - this file provides info on the other files involved in the component. Note that in the sample we are registering "slider" as the name of the component, in this file we are also indicating which jet components we are going to use and including them in the define section. Specifically we are adding the ojs/ojslider component here.

define(['ojs/ojcore', 'text!./demo-cca.html', './demo-cca', 'text!./component.json', 'css!./demo-cca','ojs/ojcomposite', 'ojs/ojslider'], function(oj, view, viewModel, metadata) { oj.Composite.register('slider', { view: {inline: view}, viewModel: {inline: viewModel}, metadata: {inline: JSON.parse(metadata)} }); } );

The next file we'll create is the component.json file. This file describes the meta data about our component. One of the key things you can define here is a set of properties that users of the components can set when they add it to their application. The nice thing in the ABCS integration is that these will show up at design time as properties in the visual editor.

In our component we are defining four properties that control the title, minimum, maximum, and actual value of a slider. Note that right now ABCS is using Oracle JET 2.3 and we need to specify this in the file.

{ "name": "Slider", "description": "A sample Oracle JET Slider CCA", "version": "1.0.0", "jetVersion": ">=2.3.0", "properties": { "title": { "description": "Name of slider", "type": "string" }, "min": { "description": "Numeric minimum", "type": "number" }, "max": { "description": "Numeric maximum", "type": "number" }, "value": { "description": "Slider value", "type": "number" } } }

Next we'll define the html file (demo-cca.html) that includes our UI. We are using regular HTML code here along with knockout.js binding of properties to values. You can use the $props prefix to refer to values of attributes we defined in the components.json file.

<div data-bind="text: 'Title: '+$props.title"></div>
  <input id="slider-id"
     data-bind="ojComponent: {
            component: 'ojSlider',
            max:$props.max,
            min:$props.min,
            step:10,
            value:$props.value
            }"/>
             

Next there is a css file - controlling the look and feel of the component. Since we are not doing any customization on the look and feel we'll create an empty file called demo-cca.css.

Next is the model file (demo-cca.js) - this file contains data and logic that can be accessed from the component. We'll create a basic file without any logic code in it.

define(['knockout'], function (ko) { function model(context) { var self = this; return model; } } )

Now that you have created the 5 files - simply zip them into a single zip file. This zip file is the file you'll give to your component users. In this case to the ABCS developer.


Go into your Application Settings -> Extensions in Oracle ABCS and choose to create a new UI component from zip file. Upload the zip file you just created. Then make sure to enable the component using the boolean control on the page.

Component extension

Switch over to the UI Designer and you'll see that there is a new component in the component palette.
Drag and drop it into your page - and you'll see the HTML code. Set the properties in the property inspector and you'll see them influencing the content of your page.
You can also bind the properties to the values of fields in your custom business objects.

Here is a quick video showing the integration.

 

Categories: Development

Getting Data from REST Services into Oracle Application Builder Cloud Service

Shay Shmeltzer - Fri, 2017-05-12 11:09

In the latest version of Oracle Application Builder Cloud Service (ABCS) that we rolled out at the beginning of May we introduced a set of new code templates for creating Business Object Providers.

BOP templates screen

Business Object Providers - or BOPs for short - are a mechanism that allow you to extend ABCS and have it access external REST sources of data. In the video below I'm going to show you how to use the most basic template provided for BOPs - which allows you to create a read only BOP.

The template has 2 files that you need to change - one (RESTOperationProvider.js) that has the code for accessing the REST service and reading the results, and the other (RESTEntityProvider.js) has the code that defines the structure of the object you are creating.

In the video I'm using this URL - https://api.github.com/users/Oracle/repos - that gets you a list of projects/repositories that Oracle owns on Github:

Once you created a BOP you can add a new "external service" to your application in the data designer, and then you can use that object like you would any other.

Check it out:

 

Categories: Development

Passing Business Object Values to Custom UI Components in ABCS

Shay Shmeltzer - Mon, 2017-05-08 18:54

This quick one is based on a customer question about Oracle Application Builder Cloud Service. The scenario is that we have a business object that has a field that contains the URL to an image. We want to be able to show that image on a page in Oracle Application Builder Cloud Service.

Image showing up

To do that I add a custom UI component object to the details (or edit) page of a record - then I switched the HTML of that object to be: <img id="logoimg"/>

custom code

 

I then added a button to the page and added a bit of custom JavaScript code in its action as follow:

var img = document.getElementById('logoimg'); img.src=$Company.getValue('Logo'); resolve();

This code simply locates the custom object on the page using the object id and then sets the src property of the img html tag to match the value of the field in the business object.

Code in Button

 

 

Categories: Development

I'm On a New Blog Platform!

Shay Shmeltzer - Fri, 2017-05-05 12:15

This happens every several years, our blogging platform at Oracle is switching to a new environment, and my blog is one of those moving. In the next few days I'll be testing to see if content migration did its magic and everything works.

If you run into any broken entries/links/samples please drop me a line or just comment on the specific blog entry, and I'll try to fix things.

Categories: Development

Getting the Database Backup Report for all Monitored Targets in Enterprise Manager

Arun Bavera - Fri, 2017-05-05 09:05
Use the following query in BIP:

SELECT DATABASE_NAME                                  AS CONFIGURATION_TARGET_NAME    ,
      mgmt$ha_backup.TARGET_TYPE,
 host                                                                                                                                            AS HOST_NAME                              ,
'DB Backup Status'                                                                                                                        AS CONFIGURATION_STANDARD                ,
status                                                                                                                                                AS ACTUAL_VALUE             ,
    CASE    WHEN ( mgmt$ha_backup.status = 'COMPLETED' AND round(sysdate-end_time)<=1 ) THEN 'YES'
            ELSE 'NO'
    END VALIDATION_PASSED,
    input_type,
    output_device_type ,
TO_CHAR(end_time,'YYYY-MM-DD HH24:MI:SS')                                                                            AS COLLECTION_DATE                                ,
    TO_CHAR(start_time,'YYYY-MM-DD HH24:MI:SS') START_TIME,
    TO_CHAR(end_time,'YYYY-MM-DD HH24:MI:SS') END_TIME,
    round(sysdate-end_time) LATEST,
    TIME_TAKEN_DISPLAY TimeTaken,
    INPUT_BYTES_DISPLAY INPUT,
    OUTPUT_BYTES_DISPLAY OUTPUT,
    OUTPUT_BYTES_PER_SEC_DISPLAY OUTPUT_SEC
FROM   mgmt$ha_backup
WHERE  DATABASE_NAME in (  SELECT  unique(MEMBER_TARGET_NAME)
                              from   mgmt$target_flat_members,
                                     mgmt$target_properties
                              where  member_target_type in ( 'rac_database' ,'oracle_database')
                              and    aggregate_target_name = 'Prod-Grp'
                              AND   mgmt$target_flat_members.MEMBER_TARGET_NAME = mgmt$target_properties.target_name
                              AND   mgmt$target_flat_members.member_target_type = mgmt$target_properties.target_type
                              AND   mgmt$target_properties.property_name = 'OpenMode'
                              AND   mgmt$target_properties.property_value= 'READ WRITE'
                       MINUS
                              SELECT   s1.target_name
                              FROM
                                      MGMT$TARGET s5                 ,
                                      GC$ASSOC_INST_WITH_INVERSE s5a1,
                                      MGMT$TARGET s1
                              WHERE  (   s5a1.SOURCE_ME_GUID = s1.TARGET_GUID
                                          AND s5a1.DEST_ME_GUID   = s5.TARGET_GUID
                                          AND s5.TARGET_TYPE      = 'rac_database'
                                          AND s5a1.ASSOC_TYPE     = 'member_of_cluster'
                                      )
                                      AND s1.TARGET_TYPE = 'oracle_database')

ORDER BY VALIDATION_PASSED
Categories: Development

Arup Nanda on Big Data

Gerger Consulting - Thu, 2017-05-04 14:45
Attend our free webinar and learn from the legendary Oracle DBA Arup Nanda about the Big Data ecosystem and how it compares to Oracle solutions.

Register at this link.


About the Webinar

Big Data is the future of database computing and knowing about it not just a luxury you can avoid anymore; it's necessary for survival and growth. But Hadoop, Spark, Hive, Map/Reduce, Flume - if these terms hit you more often than you have the time to pause and think about them, look no further. Learn about these and more in this informative session on this Big Data components explained from the perspective of an Oracle professional, how they are same or different and how they compare with RAC or parallel query.

Register today.
Categories: Development

Passing Business Object Values to Custom UI Components in ABCS

Shay Shmeltzer - Mon, 2017-04-24 17:29

This quick one is based on a customer question about Oracle Application Builder Cloud Service. The scenario is that we have a business object that has a field that contains the URL to an image. We want to be able to show that image on a page in Oracle Application Builder Cloud Service.

animated GIF

To do that I add a custom UI component object to the details (or edit) page of a record - then I switched the HTML of that object to be: <img id="logoimg"/>

custom code

I then added a button to the page and added a bit of custom JavaScript code in its action as follow:

var img = document.getElementById('logoimg');

img.src=$Company.getValue('Logo');

resolve();

This code simply locates the custom object on the page using the object id and then sets the src property of the img html tag to match the value of the field in the business object.

Code in Button

Categories: Development

Custom UI Components in Oracle ABCS for Dynamic Image Display

Shay Shmeltzer - Mon, 2017-04-24 17:29

This quick one is based on a customer question about Oracle Application Builder Cloud Service. The scenario is that we have a business object that has a field that contains the URL to an image. We want to be able to show that image on a page in Oracle Application Builder Cloud Service.

animated GIF

To do that I add a custom UI component object to the details (or edit) page of a record - then I switched the HTML of that object to be: <img id="logoimg"/>

custom code

I then added a button to the page and added a bit of custom JavaScript code in its action as follow:

var img = document.getElementById('logoimg');

img.src=$Company.getValue('Logo');

resolve();

This code simply locates the custom object on the page using the object id and then sets the src property of the img html tag to match the value of the field in the business object.

Code in Button

Categories: Development

We're All In This Thing Together

Greg Pavlik - Fri, 2017-04-14 17:26
This song pretty much summarizes everything I've learned to be true about life after nearly five decades of living...

Well my friend, well I see your face so clear
Little bit tired, a little worn through the years
You sound nervous, you seem alone
I hardly recognize your voice on the telephone

In between I remember
Just before we wound up broken down
We'd drive out to the edge of the highway
Follow that lonesome dead-end roadside sound

We're all in this thing together
Walkin' the line between faith and fear
This life don't last forever
When you cry I taste the salt in your tears

Well my friend let's put this thing together
And walk the path that worn out feet have trod
If you wanted we can go home forever
Give up your jaded ways, spell your name to God

We're all in this thing together
Walkin' the line between faith and fear
This life don't last forever
When you cry I taste the salt in your tears

All we are is a picture in a mirror
Fancy shoes to grace our feet
All that there is is a slow road to freedom
Heaven above and the devil beneath

We're all in this thing together
Walkin' the line between faith and fear
This life don't last forever
When you cry I taste the salt in your tears

Apache Spark for Oracle Developers

Gerger Consulting - Tue, 2017-04-11 01:27
In the last few years, business problems that have been traditionally solved using databases are now being solved using other technologies. Apache Spark is one of the emerging technologies which is used for large scale data processing.

Attend the free webinar by Ivan Lokic and learn how you can use Apache Spark in Big Data applications.  


About the Webinar:
Apache Spark is a general computing engine designed for large-scale data processing. Many well-known companies use it to process petabytes of data on 8000+ nodes with long running jobs measured in weeks.


In this webinar, you will learn about:
  • Apache Spark and how Spark relates to (traditional) Hadoop MapReduce technology
  • What makes Spark so fast
  • How to use the rich set of Spark API’s to design and run your ETL jobs
  • Apache Spark streaming capabilities for near real-time updates and its role in Big Data processing scenarios
  • Structured Streaming, a scalable and fault tolerant stream processing engine which makes near real-time processing scenarios even easier
The webinar is free but space is limited.

Categories: Development

Take a few minutes to patch Oracle APEX 5.1

Dimitri Gielis - Wed, 2017-03-29 08:00
Yesterday a first patch set of Oracle Application Express (APEX) 5.1 has been made available to download.

one-of patches

If you encounter issues, you can ask for support and most likely a bit later a patch is made available through support.oracle.com. The APEX team is doing a great job with this.

For example some people using APEX Office Print had an issue which was caused by a bug in APEX_JSON (which we heavily use behind the scenes). The next day the APEX Dev Team already made a patch available (PSE 25650850).

patch set

Instead of applying those one-off patches, you can wait for a patch set which includes those one-off patches and more. If you didn't move to Oracle APEX 5.1 yet, you can just download the latest version which includes 5.1.1 immediately. 

There're many fixes for the Interactive Grid features, but next to that, many others as well, like for example login issues.

applying the patch set

If you're on Oracle APEX 5.1, search for patch 25341386. Unzip the file, stop the webserver, run @apxpatch, copy the images folder and start the webserver again.
About 2 minutes later you're on the latest version. 


Happy patching...
Categories: Development

Best Way to Write SQL in Java

Gerger Consulting - Wed, 2017-03-15 01:17

Many of us struggle writing SQL in Java. ORM tools such as Hibernate often generate SQL statements that result in poor application performance. Surely, there must be a better way to write SQL in Java.



Attend the free webinar by Java Champion Lukas Eder to learn the best way to write SQL in Java. Find out how you can use SQL as a type safe domain specific language in Java.

Sign up for the free webinar.

Categories: Development

ORA-01031 insufficient privileges Solution

Complete IT Professional - Fri, 2017-03-10 05:00
Are you getting the “ORA-01031 insufficient privileges” error? Learn what causes this error and how to resolve it in this article. ORA-01031 Cause The cause of the ORA-01031 error is that you’re trying to run a program or function and you don’t have the privileges to run it. This could happen in many situations, such […]
Categories: Development

Passing Values Between Pages in Oracle Application Builder Cloud Service

Shay Shmeltzer - Thu, 2017-03-09 12:50

A common use case for applications that have multiple pages is passing values between pages. For example you might want to pick up a specific record or value in one page and then use that as a parameter for a query in another page.

In the February release or Oracle Application Builder Cloud Service as part of the extension hook points that we provide, we added support for shared resources. These are JavaScript libraries you can add to your application - and that can be used across your app.

In the demo below I show you how you can use the built-in sample template for a shared resource to define a variable, and then how that variable is exposed in various places in the product through the expression builder allowing you to set its value in one page and use that value in another one.

Check it out:

Categories: Development

Passing Values Between Pages in Oracle Application Builder Cloud Service

Shay Shmeltzer - Thu, 2017-03-09 12:50

A common use case for applications that have multiple pages is passing values between pages. For example you might want to pick up a specific record or value in one page and then use that as a parameter for a query in another page.

In the February release or Oracle Application Builder Cloud Service as part of the extension hook points that we provide, we added support for shared resources. These are JavaScript libraries you can add to your application - and that can be used across your app.

In the demo below I show you how you can use the built-in sample template for a shared resource to define a variable, and then how that variable is exposed in various places in the product through the expression builder allowing you to set its value in one page and use that value in another one.

Check it out:

Categories: Development

ORA-00937: not a single-group group function Solution

Complete IT Professional - Wed, 2017-03-08 05:00
Have you received an ORA-00937: not a single-group group function error? Learn what it is and how to fix it in this article. ORA-00937 Cause The cause of the ORA-00937 error is that a SELECT statement is trying to be executed, and the SELECT statement has an aggregate function (e.g. COUNT, MIN, MAX, SUM, or […]
Categories: Development

Pages

Subscribe to Oracle FAQ aggregator - Development