Creating an Oracle 11g instance in AWS

This document assumes, that you already have an AWS account and you are able to login using any standard net browser. After logging into AWS (Amazon Web Services) EC2 site, click on Launch Instance button.
NOTE: Starting this instance using this documentation will incur some monthly financial cost.

We’ll user the instance ami-117b9778. We can narrow down the earch by typing in some key words. I used Oracle.

We’ll use a specific instance: ami-117b9778 instance store.
We’ll create a “small instance”.
No specific preference for zone.

In the next screen we’ll take default for all values.
Specifically note if you use monitoring, additional charges may apply.
Click on Continue…

At this point, we have chosen our AMI.

We’ll add one “tag information” for our instance…

We are ready to create KEY Pair for our instance. The Key-Pair is used for loggin into our instance with root access. With this set up, we’ll disable userid/password login to root and root access login will only be allowed using PKI key pair.
Note: we’ll be using Putty-SSH telnet to log into this instance as root. We’ll later create additional user-id which will have password enabled.
NOTE: This step is important, as we’ll create key for server and client. Save the client file safely in a directory and note the location/filename.

Give the key-pair a unique name, click on Create & Download your Key Pair button.
Note: You could proceed without key creation and create one later time.
You may be asked to save the file.

I clicked on Save As and chose a specific local location to save the file.
Note that the file type downloaded is PEM.

We have to choose a Security Group. We’ll go with default. We can change the values like port and accessibility later (or you can create a new security group).
We’ll go with default and click on continue…

Review the summary…
You have an opportunity to change your settings however you can also change many of these setting later.
We’ll click on Launch button

This step will take few minutes to launch the instance.

Click on Close to create an Oracle 11g instance. You’ll be returned to EC2 home.
Note: In the My Resources section, both Key Pair and Security Group has been updated.

Click on Instances on left panel to go to your instance page.
Note the instance is in pending state and status is initializing.
This may take some time. Just have some patience… It’ll come through 🙂

Once your instance is instantiated, you find the following in your EC2 home.
Note the instance is in running state and status is green check.

Note: The name of the instance is empty. You can edit the name to something that you can recognize, by clicking on the field.

Now our next step is to connect to our instance.
To connect to our newly created AWS instance, we are going to use PUTTY-SSH telnet session.
You can download putty-ssh telnet client from here. I downloaded putty and puttygen from source forge.

PUTTYGEN will be used to generate private key from the PEM file that was downloaded from the KEY-PAIR of aws instance.
Generate Private Key using PUTTYGEN
Run PUTTYGEN by double clicking on the application

Click on LOAD… Note file type of PPK!!!!

Navigate to the directory where the PEM file was saved and select the PEM files (using all file types).

Open the PEM file.

DONOT Click on Generate: this allows you to move cursor over the BLANK space to generate randomized key, this will not work with your instance.
JUST click on SAVE PRIVATE KEY and Save Private Key, ENSURE to change the file type to ppk.

Close the PUTTYGEN application.

Connect to our AWS instance

Now we’ll use the PUTTY (telnet) application to connect to AWS instance.
When you open PUTTY application, you get the following dialog.

From the AWs instance definition (property) use Public DNS address

In our case the value is

Browse to the PPK file that was saved from PUTTYGEN.

Save PUTTY configuration and Open

Type in root and press ENTER

The Oracle 11g instance on AWS is READY to be configured.

Configure Oracle 11g instance

Ready for Oracle configuration…
The password and verification was entered and installation complete.

Check, if Oracle processes are running…

Check ID / GRP ???

1 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ id
2 uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
3 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ id oracle
4 uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper),503(asmadmin)
5 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ groups
6 root bin daemon sys adm disk wheel
7 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$

Logged in as ROOT to the linux instance, we’ll attempt to log into database instance.
Just to make sure the database is there, configured and started. We’ll use sqlplus.

1 $ ./sqlplus
2 Error 6 initializing SQL*Plus
3 SP2-0667: Message file sp1.msb not found
4 SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

SP2-0750 indicates we have not set ORACLE_HOME value. We’ll do that and try again.

01 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/
03 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ ./sqlplus
05 SQL*Plus: Release Production on Mon Apr 23 22:43:39 2012
07 Copyright (c) 1982, 2009, Oracle. All rights reserved.
09 Enter user-name: oracle
10 Enter password:
13 ORA-12162: TNS:net service name is incorrectly specified

ORA-12162 indicates we have not set ORACLE_SID value. We’ll do that and try again.

01 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ export ORACLE_SID=orcl
02 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]$ ./sqlplus
04 SQL*Plus: Release Production on Mon Apr 23 22:44:37 2012
06 Copyright (c) 1982, 2009, Oracle. All rights reserved.
08 Enter user-name: oracle
09 Enter password:
12 ORA-01034: ORACLE not available
13 ORA-27101: shared memory realm does not exist
14 Linux Error: 2: No such file or directory
15 Process ID: 0
16 Session ID: 0 Serial number: 0

Login was successful (in a way) however ORA-01034 indicates that ORACLE database instance is not up and running. At this point we can connect to ORCL instance in NOLOG mode.

1 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin]
2 $ ./sqlplus /nolog
4 SQL*Plus: Release Production on Mon Apr 23 22:46:15 2012
6 Copyright (c) 1982, 2009, Oracle. All rights reserved.
8 SQL>

Nice… We are now connected to ORCL instance of the database. However, the DB instance is not up and providing any service. We’ll try to start the database instance.

1 SQL> startup
3 ORA-01031: insufficient privileges
5 SQL> exit;
7 root@domU-12-31-39-03-BD-92:[/u01/app/oracle/product/11.2.0/db_1/bin

The database exists, but we are unable to start the database as root is NOT a member of dba or oper groups. Only members of these groups are authorized (ORA-01031) to start or stop a DB instance.
In the next blog entry, I’ll continue with configuring the database instance and starting the database.
However, before we do that we should also create a non-root user at the OS level and open up the LINUX instance for password login.

We’ll continue and connect and work with this DB instance in the following BLOG entry.

2 thoughts on “Creating an Oracle 11g instance in AWS

  1. Great post on this, everything was going as expected from this post. However, did you ever post the continuation for this? I've been having problems with privileges/memory/etc. and would appreciate further instructions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s