8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Amazon Web Services (AWS) : Installation of Oracle on EC2
This article gives an overview of creating an Oracle database in an Amazon Web Services (AWS) Elastic Compute Cloud (EC2) virtual machine (VM). This example uses Oracle Linux 7 (OL7) and Oracle Database 12c Release 1 (12.1.0.2), although the process is similar for any other Linux and database version.
- Create a Virtual Machine
- Prepare the OS
- Oracle Software Installation
- Database Creation (DBCA)
- Remote Connections
- Other Considerations
Related articles.
- Oracle Linux Virtual Machine (VM) on Amazon Web Services (AWS)
- Oracle Databases in the Cloud
- A Cure for Virtual Insanity: A Vendor-Neutral Introduction to Virtualization Without the Hype
- Oracle Database Consolidation Comparison
Create a Virtual Machine
Select the EC2 option from the service catalog.
Click the "Launch Instance" button.
Select the Amazon Machine Image (AMI) of your choice. There are some images available with Oracle already installed, but this article assumes you want to install the database yourself. Click the "Select" button for the required image. In this case we clicked on the "Community AMIs" tab and searched for "OL7.2", then used the "Oracle Linux 7.2 (HVM)" AMI.
Select the required instance type, then click the "Next: Configure Instance Details" button.
Make any required changes to the instance configuration, then click the "Next: Add Storage" button.
Edit the size and volume type to the required settings (30GiB and General Purpose (SSD)). If you require any other volumes add them now. Click the "Next: Tag Instance" button.
Tags allow you to associate name-value pairs with an instance. Add any required tags. In this case, I've just defined a name tag. When you are ready, click the "Next: Configure Security Group" button.
Add a rule for TCP with the port 1521 and click the "Review and Launch" button. It's better to lock this down to specific IP addresses, but in this case I'm making it accessible from anywhere.
On the "Review Instance Launch" page, click the "Launch" button.
You can either download a new key pair, or use an existing one. Once you've selected the option you want, click the "Launch Instances" button.
Click the "View Instances" button.
Wait while the instance initializes.
Once initialized, you can connect to virtual machine. It may take some time for the Public DNS to be propagated, but you can use the Public IP immediately.
Prepare the OS
Connect to the virtual machine using the following type of commands. Remember to adjust to the name of your VM and the user you created.
$ cd Dropbox/cloud/aws-keys/ $ chmod 600 obtestkey1.pem $ ssh -i obtestkey1.pem ec2-user@54.229.16.169 [ec2-user@ip-172-30-2-197 ~]$
Either use "sudo" before all your admin commands, or switch to the "root" user.
[ec2-user@ip-172-30-2-197 ~]$ sudo su - [root@ip-172-30-2-197 ~]#
Follow the setup instructions for the Oracle installation you are attempting. In this case, I used the automatic setup from the following.
You will probably also need the following.
yum install wget zip unzip -y yum update -y
Unzip the installation software.
mkdir -p /u01/software cd /u01/software # Copy the Oracle software to the directory. unzip linuxamd64_12102_database_1of2.zip unzip linuxamd64_12102_database_2of2.zip cd database chown -R oracle.oinstall /u01
Oracle Software Installation
Silent installations are the simplest solution for most cloud-based VMs. The following command shows a silent software-only installation using a response file (oui12102.rsp).
# su - oracle $ cd /u01/software/database $ ./runInstaller -silent -ignoreSysPrereqs -responseFile /tmp/oui12102.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 24071 MB Passed Checking swap space: 0 MB available, 150 MB required. Failed <<<< >>> Ignoring required pre-requisite failures. Continuing... Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-04-06_11-35-07AM. Please wait ...[oracle@ip-172-30-2-197 database]$ [WARNING] [INS-13014] Target environment does not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-04-06_11-35-07AM/installActions2015-04-06_11-35-07AM.log ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-04-06_11-35-07AM/installActions2015-04-06_11-35-07AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2015-04-06_11-35-07AM.log The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2015-04-06_11-35-07AM.log' for more details. As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/12.1.0.2/db_1/root.sh Successfully Setup Software. $
Remember to run the "orainstRoot.sh" and "root.sh" scripts as directed.
Database Creation (DBCA)
Before you start the database creation, start the listener using the following command.
[oracle@ip-172-30-0-173 database]$ lsnrctl start LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-APR-2015 11:45:11 Copyright (c) 1991, 2014, Oracle. All rights reserved. Starting /u01/app/oracle/product/12.1.0.2/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 12.1.0.2.0 - Production Log messages written to /u01/app/oracle/diag/tnslsnr/ip-172-30-2-197/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ip-172-30-2-197.eu-west-1.compute.internal)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production Start Date 06-APR-2015 11:45:11 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Log File /u01/app/oracle/diag/tnslsnr/ip-172-30-2-197/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ip-172-30-2-197.eu-west-1.compute.internal)(PORT=1521))) The listener supports no services The command completed successfully [oracle@ip-172-30-2-197 database]$
As with the software installation, the database creation should be run in silent mode. The following command creates a container database with a single PDB.
[oracle@ip-172-30-2-197 database]$ dbca -silent -createDatabase \ -templateName General_Purpose.dbc \ -gdbname cdb1 -sid cdb1 -responseFile NO_VALUE \ -characterSet AL32UTF8 \ -sysPassword OraPasswd1 \ -systemPassword OraPasswd1 \ -createAsContainerDatabase true \ -numberOfPDBs 1 \ -pdbName pdb1 \ -pdbAdminPassword OraPasswd1 \ -databaseType MULTIPURPOSE \ -automaticMemoryManagement false \ -storageType FS \ -ignorePreReqs Copying database files 1% complete 2% complete 8% complete 13% complete 19% complete 27% complete Creating and starting Oracle instance 29% complete 32% complete 33% complete 34% complete 38% complete 42% complete 43% complete 45% complete Completing Database Creation 48% complete 51% complete 53% complete 62% complete 70% complete 72% complete Creating Pluggable Databases 78% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/cdb10.log" for further details. [oracle@ip-172-30-2-197 database]$
You can now connect to the database from the local server.
[oracle@ip-172-30-2-197 database]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Mon Apr 6 05:17:57 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> SELECT name, open_mode FROM v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB1 READ WRITE SQL>
Remote Connections
With the public endpoint in place, remote connections are now possible. Create the following "tnsnames.ora" entry on a remote PC.
aws_pdb1= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=54.229.16.169) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=pdb1) ) )
Connect to the cloud database.
C:\>sqlplus sys@aws_pdb1 as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 6 10:46:33 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options sys@cdb1>
Other Considerations
It would make sense to protect the public endpoint using the local firewall on the VM.
- Linux Firewall (iptables, system-config-firewall)
- Linux Firewall (firewalld, firewall-cmd, firewall-config)
For more information see:
- Oracle Linux Virtual Machine (VM) on Amazon Web Services (AWS)
- Amazon Wes Services (AWS)
- Oracle Database 12c Release 1 (12.1) Installation On Oracle Linux 7 (OL7)
- Linux Firewall (iptables, system-config-firewall)
- Linux Firewall (firewalld, firewall-cmd, firewall-config)
- Database Configuration Assistant Command Reference for Silent Mode
- Oracle Databases in the Cloud
- A Cure for Virtual Insanity: A Vendor-Neutral Introduction to Virtualization Without the Hype
- Oracle Database Consolidation Comparison
Hope this helps. Regards Tim...