SQL*Plus Error OID generation failed

November 21, 2016 at 9:40 am | Posted in Oracle Developement | Leave a comment

I received this error on a MacBook, when trying to connect with SQL*Plus to my database:

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 21 08:27:22 2016

Copyright (c) 1982, 2016, Oracle. All rights reserved.

ERROR:
ORA-21561: OID generation failed

The issue comes from not having the MacBook’s hostname associated with the home IP address. To fix this, simply find your hostname:

~$ hostname
MY_MACBOOK

Then edit your /etc/hosts file and add the home name to the home IP address:

127.0.0.1       localhost MY_MACBOOK

Also make sure that when you edit the hosts file, that you are not connected to a VPN. Some VPN clients may overwrite the hosts file.

 

Create your own Font Awesome Icon

October 17, 2016 at 2:02 pm | Posted in Oracle Developement | Leave a comment

There may be a special character you wish to use in the same way you would use a Font Awesome icon. To do this you need to find the hex code for the character and a little bit of CSS.

  1. Find the hex code for your character
    There are many sites that show you the ASCII values for various letters, numbers, or characters. I needed to have the greek letter Sigma, (Σ) so I looked it up here, and copied the hex value 03A3.
  2. Add CSS to your page or global CSS file:
    .sigma:before {
       content: "\03a3";
    }
  3. Use the new CSS class like any other Font Awesome icon:
    <i class="fa sigma"></a>

You can also use any of the Font Awesome modifiers such as size with this method.

Please leave a comment if this helped you.

Cheers!

APEX 5 DA when cancelling modal dialog

October 11, 2016 at 11:15 am | Posted in Oracle Developement | 1 Comment

I needed to have a dynamic action that fires when a modal dialog is cancelled or the escape key is pressed. To do this in APEX 5, on the parent page, you can create a dynamic action based on a custom event called dialogclose.

Parent page:
Custom Dynamic Action

When:
Event: Custom
Custom Event: dialogclose
Selection Type: JavaScript Expression
JavaScript Expression: document

The True/False actions can be set as usual, such as refreshing a report or setting some value.

 

 

#YourBlogHelpedMe

October 11, 2016 at 10:51 am | Posted in Oracle Developement | Leave a comment

In light of the OTN Appreciation day I want to start a little initiative of appreciation myself. I know my job would be quite a bit more difficult if it weren’t for the help I receive from other people’s blogs.

Writing helpful blog posts takes time and effort. In order to show a little bit of appreciation to the bloggers who take the time and make the effort to post helpful articles, I’m going to let them know via twitter, using their handle and the hashtag #YourBlogHelpedMe.

I encourage others to do so as well. I’m sure it will not only allow us to show gratitude, but it will encourage more bloggers to write, and built up the community.

Cheers

OTN Appreciation Day: Oracle JET Cookbook

October 11, 2016 at 9:35 am | Posted in Oracle Developement | Leave a comment

I’m taking part in the Massive Open Online Course (MOOC) for learning about the Oracle Javascript Extension Toolkit (JET). I’m impressed with the quality of the learning materials and the methodology by which the course is taught. I’m especially impressed with the Oracle JET Cookbook, the site that allows you to browse, explore, and learn about the many available components available in the JET.

It is amazing how well the cookbook is laid out, and how easy it is to find component examples and code samples. There are also previews available for various mobile devices, and the JavaScript documentation intelligently linked for each example.

All in all: Well done, and thank you for providing such an awesome resource!

jet

 

Handy Regexp trick for Listaggs

September 27, 2016 at 7:46 pm | Posted in Oracle Developement | Leave a comment

I use the listagg function to generate a comma separated list of employees who work in department 10 from the EMP table.

To make the list more readable, I want to substitute the last comma with the word and.

 with q as (
 select listagg(ename,', ') within group (order by 1) ret
from emp
 where deptno = 10
 )
 select regexp_replace(ret,',',' and',instr(ret,',',-1)) ret
 from q;
SQL> 

RET
--------------------------------------------------------------------------------
CLARK, KING and MILLER

 

 

APEX 5 Theme/Static files issue (503 error)

September 7, 2016 at 10:32 am | Posted in Oracle Application Express (Apex), Oracle Developement | Leave a comment
Tags: , , , , ,

I’ve recently come across the issue of static images not working and my custom theme roller theme not being applied to my APEX 5 app.

When looking at the browser’s console, I noticed a bunch of errors:
Failed to load resource: the server responded with a status of 503 (Service Unavailable)

After digging around some and scratching my head for a while, the issue turned out to be expired APEX_REST_PUBLIC_USER and APEX_LISTENER database accounts.

When the passwords were reset for these accounts, the images came back and the custom theme was applied.

Display Checkmarks for Yes values in APEX report.

July 25, 2016 at 1:13 pm | Posted in Oracle Developement | Leave a comment

I have a table with an “active” flag column that stores either Y or N. In an APEX report, rather than displaying the literal letter in an APEX report, I want to display a green checkmark for Y, and a red X for N. To do this, I wrote a couple of custom classes utilizing the Font Awesome icon library.

I placed these two CSS classes into my global CSS file:

.check-Y:before {
 content: "\f00c";
 color: green;
}
.check-N:before {
 content: "\f00d";
 color: red;
}

The values for the content attributes can be gotten from the Font Awesome cheatsheet (ignore the &#X characters).

facheck

In my APEX report ACTIVE column, I added the following HTML Expression:

htmlexpression

When the report runs, the HTML expression will return either check-Y or check-N, thus referencing the classes with the green check mark, or the red X.

report

 

 

 

 

 

Convert .ppk to .pem

June 23, 2016 at 4:08 pm | Posted in Oracle Developement | Leave a comment

If you’re working on a Mac, you may have encountered the problem of trying to use ssh with a .ppk (PuTTY key file). You can easily convert this file to a Mac friendly .pem file.

  1. Install Homebrew
  2. Install putty, which also installs puttygen:
    brew install putty
  3. Generate .pem file:
    puttygen keyfile.ppk -O private-openssh -o keyfile.pem
  4. Change permissions:
    chmod go-rw keyfile.pem
  5. Connect:
    ssh -i keyfile.pem username@server

Enjoy

Configure AWS Cloud Instance for SSH access

June 14, 2016 at 2:49 pm | Posted in Oracle Developement | Leave a comment

In a previous post I explained how to set up a SQL Developer connection with SSH using a .pem key file. In this post I’ll show you how to generate the .pem file and what you have to do on your remote AWS instance in order to get this to work.

In my case, I use an EC2 instance on which my Oracle database is installed. Via the EC2 online dashboard, I created a Key Pair:

aws_keypair

After clicking Create the private key file sqldev-key.pem downloaded. Note that you can only get the key file during the creation process. You’ll never be able to re-create the key file again.
I then placed the downloaded file in a directory on my laptop. Using terminal, I then generated the public key using ssh-keygen -y. When asked for a file, I gave it the sqldev-key.pem file name. The command then output the pubic key string, which I copied to my clipboard.

In order to limit access to the instance, I created a user account with no privileges on my database host, through the command line:

$ useradd sqldev
$ passwd secret

I then logged in as sqldev and created the file ~/.ssh/authorized_keys, into which I pasted the key from my clipboard. I then changed the permissions of the authorized_keys file:

$ chmod 400 authorized_keys

Now I tested the connection from my laptop:

$ ssh -i sqldev-key.pem sqldev@[aws host ip]

Now that the connection is verified, I setup SQL Developer to use the new key file for my database connection. See SQL Developer SSH Connection.

 

Next Page »

Blog at WordPress.com.
Entries and comments feeds.