Oracle 12c Developer Days VM

April 24, 2015 at 10:36 am | Posted in Oracle Developement | Leave a comment

Get OS authentication to work with the Dev. Days VM

Reblogged from Stojan’s Oracle Blog.

Quick & Dirty: Instal htop on Redhead Enterprise Linux 7 (RHEL7)

April 23, 2015 at 1:42 pm | Posted in Oracle Developement | Leave a comment
Tags: , , , , , , , ,

I typically prefer htop to the regular top command. Here are the steps I took to install htop on the Oracle Developer Day VM:

  1. Change to tmp direcoty
    cd /tmp
  2. Download epel repository:
    wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  3. Install epel repository:
    sudo yum install epel-release-7-5.noarch.rpm
  4. Install htop:
    sudo yum install htop

Enjoy the enhanced process viewer

htop

htop

Quick & Dirty: Create a pluggable database in Oracle 12c

April 22, 2015 at 8:30 am | Posted in Oracle Developement | Leave a comment
Tags: , , , , ,
  1. Log in as sys
  2. Change to CDB$ROOT and verify container:
    SQL> alter session set container = cdb$root;
    Session altered.
    SQL> show con_name
    CON_NAME
    ------------------------------
    CDB$ROOT
  3. Create plugable database from seed (this command also adds the new pdb2 directory):
    create pluggable database pdb2 admin user pdb2_admin 
    identified by secret_password
    file_name_convert =(
    '/home/oracle/app/oracle/oradata/cdb1/pdbseed/',
    '/home/oracle/app/oracle/oradata/cdb1/pdb2/'
    );
  4. At this point the database is created and mounted. Open new database:
    SQL> alter pluggable database pdb2 open read write;
  5. List pluggable databases:
    alter session set container=CDB$ROOT;
    col pdb_name for a30
    col status for a10
    col status for a10
    
    select a.pdb_name,a.status,b.open_mode
      from dba_pdbs a, v$pdbs b
     where a.pdb_name = b.name(+)
     order by 1
    /
    PDB_NAME		       STATUS	  OPEN_MODE
    ------------------------------ ---------- ----------
    ORCL			       NORMAL	  READ WRITE
    PDB$SEED		       NORMAL	  READ ONLY
    PDB2			       NORMAL	  READ WRITE
    
  6. Create a new tnsnames.ora entry for the database:
    PDB2 =
        (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
            (CONNECT_DATA =
                (SERVER = DEDICATED)
                (SERVICE_NAME = pdb2)
            )
        )
  7. Log in as pdb2_admin:
    sqlplus pdb2_admin/secret_password@pdb2
  8. Log in as sys to pdb2:
    1. sqlplus sys@pdb2 as sysdba;

      or

    2. sqlplus sys as sysdba;
      alter session set container = pdb2;

The new database will have three tablespaces;

SQL> select tablespace_name,contents from dba_tablespaces;

 TABLESPACE_NAME                CONTENTS
 ------------------------------ ---------
 SYSTEM                         PERMANENT
 SYSAUX                         PERMANENT
 TEMP                           TEMPORARY

For more information see the Oracle-Base article.

Chase that cat! Enable scp on the Oracle Developer Day VM

April 16, 2015 at 10:23 am | Posted in Oracle Developement | Leave a comment
Tags: , , , , , , , ,

I just installed the Oracle Developer Day – Database VirtualBox Appliance and noticed I wasn’t able to scp from my host to the VM. Thanks to Mauro Pagano, who suggested removing the banner from the login script, I was able to fix it.

To remove the banner, edit the /home/oracle/.bashrc file and comment out the following line

cat /home/oracle/Desktop/readme.txt

This prevents the banner to show up, and allows scp to work.

APEX 5: JavaScript execution order in Universal Theme

April 1, 2015 at 2:31 pm | Posted in Oracle Developement | Leave a comment

Playing around with APEX 5, I noticed that the execution order of JavaScript has changed in the Universal Theme. In previous versions of APEX and even in the older themes in APEX 5, JavaScript that was specified in the JavaScript attribute of the page properties was always executed before any JavaScript specified inside static regions with <script> tags.

This has changed with the Universal Theme. If you now create static regions with JavaScript, they will get executed before the JavaScript specified in the page properties. The same is true when including JavaScript libraries in the page properties: They will get included after the JavaScript in the static regions was executed, possibly resulting in errors.

Patrick Wolf of Oracle, was kind enough to provide me with an explanation for this:

Our new Universal Theme is following browser performance best practices to load JavaScript files at the end of the page to not block page rendering. This has the side effect that any JS code directly included with a <script> tag somewhere on the page will not be able to access APIs provided by those libraries because they have not been loaded at the time when the <script> tag is parsed and executed.

We strongly recommend that developers are using the declarative JavaScript attributes provided by APEX and not include JS code with <script> tags. By declarative I mean the page level attributes ‘JavaScript – Function and Global Variable Declaration’ and ‘JavaScript – Execute when Page Loads’ and the ‘Execute JavaScript Code’ dynamic action. This has a few advantages:

  • The APEX engine is able to optimize the execution of JavaScript code.
  • APEX Builder can provide JS code editor support when entering JavaScript code.
  • And las but not least: JavaScript code used and executed on the page is transparent for every developer. It’s not hiding in some region source / footer attribute.

So if you plan to migrate an application from a previous APEX version to version 5, and you have JavaScript inside regions, you may want to consider sticking with an older theme, like theme 26, in which the JavaScript execution order has not changed.

Thanks to Patrick for the detailed explanation.

Quick & Dirty: How to parse a delimited string and get the nth element

March 2, 2015 at 9:55 pm | Posted in Oracle Developement | Leave a comment

I have a comma delimited string:

Now I want to extract the 3rd element (is) from it inside a select statement:

select regexp_substr('Hello,this,is,my,string', '[^,]+', 1, 3) from dual;

To count the elements in my string I can use:

select regexp_count('Hello,this,is,my,string', ',', 1, 'i')+1 regexp_count from dual;

SQLd360 v3 now available, new features and (hopefully) less bugs!

February 27, 2015 at 8:51 am | Posted in Oracle Application Express (Apex), Oracle Developement, Oracle Performance, Oracle Tools, PL/SQL | Leave a comment

SQLd360 v3 now available, new features and (hopefully) less bugs!.

10 places where anyone can learn to code

February 24, 2015 at 2:39 pm | Posted in Oracle Developement | Leave a comment

Originally posted on TED Blog:

blog_learn_to_code_art_revTeens, tweens and kids are often referred to as “digital natives.” Having grown up with the Internet, smartphones and tablets, they’re often extraordinarily adept at interacting with digital technology. But Mitch Resnick, who spoke at TEDxBeaconStreet, is skeptical of this descriptor. Sure, young people can text and chat and play games, he says, “but that doesn’t really make you fluent.”

[ted_talkteaser id=1657]Fluency, Resnick proposes in this TED Talk, comes not through interacting with new technologies, but through creating them. The former is like reading, while the latter is like writing. He means this figuratively — that creating new technologies, like writing a book, requires creative expression — but also literally: to make new computer programs, you actually must write the code.

The point isn’t to create a generation of programmers, Resnick argues. Rather, it’s that coding is a gateway to broader learning.“When you learn to read, you…

View original 567 more words

Set Session State with JavaScript and dynamic action

January 16, 2015 at 9:38 am | Posted in Oracle Developement | 2 Comments
Tags: , , , , ,

I have two page items, P1_FIRST_NAME and P1_LAST_NAME whose values I wish to remain in session state. Here are two ways you can achieve this.

To have item values persist in session state with JavaScript in APEX, you can use the following code:

apex.server.process(‘DUMMY’,{pageItems: ‘#P1_FIRST_NAME,#P2_LAST_NAME’},{dataType: “text”});

An alternative method would be using a dynamic action that fires a dummy PL/SQL process. The action allows you to specify page items to submit in session state.;

PL/SQL Process to Set Session State

PL/SQL Process to Set Session State

Next Page »

Create a free website or blog at WordPress.com. | The Pool Theme.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.