Thursday, November 19, 2015

Oracle Database on Amazon - monitoring and alerting

See my last post about creating an Oracle database on Amazon – you can have a free one up and running in about 30 minutes.

Once set up, it's also very easy to implement monitoring and alerting.

So, assuming you've signed into the AWS console and are looking at your Instance(s):


Click on the 'Show Monitoring' button and you will see something like this:

Pretty impressive.

Note there are several pages, click on the number at the top right or select 'Show All'.

Below the charts is a section called 'CloudWatch Alarms'. 

To create an alarm, just click on the 'Create Alarm' button.

If you haven't set up an alarm before, click on 'Create Topic':


Enter a topic name – I made a mistake and called this the name I wanted to call the alarm -  better name would be the instance name and Amazon. 

Enter your email address and specify the metric and threshold – it might be worth setting one what will alarm so you can test that it works (it does).



So here I've asked it to monitor the disk space and alert me if the free space is more than 7000MB  -which it is, so I should get an alert.

Click on 'Create Alarm'.

Check your email, you will have a confirmation link to check. Click on the link and the alarm will be enabled and a confirmation will pop up:



Within a short time, you should receive an email alert:



How cool is that?
If you go back to the AWS console web page and refresh it, all sorts of things are happening:


You can click on the links to drill-down for more information.

Now that you know it's working, click on the alarm name to edit it and change the >= to <= . 
This will alert you if your 10GB of free space drops below 7GB – or set it to what you want. Save the changes.



On page 2 there are 2 charts called 'CPU Credit Usage' and 'CPU Credit Balance'. 
To make sure you don't get your credit card charged, you can set up billing alerts. 

Although it's after the event, if you set the threshold low it should give you time to log on and shut it down or delete it before it goes mad (it would be nice if you could set a limit, if there is I haven't found it yet).

Click on the 'View All CloudWatch Alarms' link, it will open a new page.

To the left of the page, click on 'Billing'


If your instance is not set to US East as the region, you will see this:


Click on the 'US East' link.

The page will refresh, click on the 'Create a billing alarm' link under 'Alarm Summary':


A window will open. Set the threshold (I set 0), create a new list and enter a name and email address, then click on 'Create Alarm'


You will be sent a confirmation to the email address, click on the link to confirm.

If you have accrued any charges you will be sent a mail immediately. I somehow ran up 40c worth of charges.

You can now close the window.

There is also an App for the phone (of course there is).

Go to Google Play or Apple App store depending on your phone and search for 'AWS console'.

Download and install it, select 'root account' and enter your username / password and sign in



Make sure the region is the one you created the database in (top right) and scroll down to 'RDS Instances' and you should see yours there.

 Select it and  select 'CloudWatch Metrics' to see the charts.




It also shows alarm status.




Next time I'll look at how to upload data to the database, which is what you will need to do if someone wants to migrate an existing database to the cloud.


Wednesday, November 18, 2015

Creating a test Oracle Database on Amazon web Services

So, the latest buzzword is 'Cloud', and Oracle are pushing this at OpenWorld. With this in mind, I thought I'd see if I could create an Oracle database on Amazon Web Services.

Is is surprisingly easy...

Create an AWS account

If you don't already have one, create an account:


Click on the 'Get Started for Free' button.

Enter an email address or mobile number and select 'I am a new user' and click on 'Sign in using our secure server'.

Fill in the fields in the Login credentials page and click 'Create Account'

Check the 'Personal' box and fill in the fields.

Note – you need to enter your real phone number because it calls you and asks to enter a verification code.

Click on 'Create Account and Continue'.

It will show you the plan details which should be plenty for a test database. You also need to credit card details so they can bill you if you exceed the terms, so try not to.

Click on 'Continue'.

It will then call your phone and ask you to enter a verification code.


Once done, you will also be sent confirmation emails and can then sign into the console.

Sign into the console

If not redirected, go here : http://aws.amazon.com/

Click on 'Sign In to the Console', enter the username and password and click on 'Sign in using our secure server'.

You will be presented with a page full of stuff:


The one you are interested in is the 'RDS' under 'Database', middle left of the page:


So click on that.

Then click on the 'Get Started Now' button.

At the next page, click on Oracle


At the next screen, select 'Oracle SE One' – I don't know if it will prompt for licence details for the others, and since this is a test, SE One is fine.




At the next page, check the 'No' box – otherwise it might charge your credit card - it might not, but I'm not game to try...

Click 'Next Step'

Fill in the fields – I've made it the smallest so that my credit card doesn't get charged.


Click 'Next Step'

I don't know what most of these are, so I let them default except for the name. I also selected 'default (VPC)'.




Click 'Launch DB Instance'

Click on the 'View Your DB Instances' link.

You should see this:


It will take around 20-30 minutes to create, so you can't do anything for a while.

Viewing your instances later

I had a bit of trouble finding the main status page later – this is where it is.


Click on 'Sign into the Console'

Enter your username and password and click on 'Sign in to our secure server'.

At the main AWS page, click on the 'RDS' icon (middle-left of page).

Click on 'Instances'

You should see this:



You can then click on the 'Show Monitoring' button to see charts of the activity, create alerts etc (which I'll do next time).

Connecting to the database with SQL Developer

The database won't be available for a while as it's being created, maybe 30 minutes or so.

After that time, click on the small arrow next to the database and you will see a field 'Endpoint'. 

If this says 'Not Yet Available' then you need to wait.

If it's ready, it will show something like this (I've obscured mine for obvious reasons):


Go to SQL Developer (or SQL Plus) and enter this as the connection info, using the username / password when you set it up:



Click on 'Test', if all is OK it will work.

Mine stopped working because it created another security group for some reason.

So if you get a 'file I/O' error when trying to connect, the same thing may have happened to you.


Go to the RDS Console, show the instance details and hover the mouse over the 'I' icon next to 'Endpoint':


Note the Security Group – click on the link.


It will open a new page with the security group shown. Click on 'Actions' and select 'Edit inbound rules':



Use the drop-down to select 'Anywhere' under the source, then Save:



Click on 'Save' and then 'Connect'..

Congratulations, you now have an Oracle database in the cloud. 

Next time I'll look at monitoring and alerting.