1

Oracle Database on AWS

 3 years ago
source link: https://medium.com/sanrusha-consultancy/oracle-database-on-aws-ec2-instance-73d33249e3f2
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Oracle Database on AWS

Step-by-step instructions on downloading, installing, configuring, and running fully functional Oracle Database on AWS EC2 instance.

Image for post
Image for post
Photo by Renny Chan on Unsplash

Sam was thrilled to get an employment offer as a data engineer in a startup. On his first day in the office and he was up for a surprise: startup founders didn’t know the difference between data engineer and database administrator, and Sam was expected to install a fully functional database on AWS EC2 instance.

If you are in a similar situation or a rookie dba and want a detailed step-by-step process of installing a fully functional server-class database on an AWS EC2 instance, this article is for you. In this article, I am going to take you through the installation of a fully functional server-class Oracle database 12c on AWS EC2 instance. Following are some of the key steps to be performed for installing a fully functional Oracle database on AWS EC2 instance

  1. Display Environment & X11 forwarding
  2. Swap Size
  3. Required Libraries, Package download, and Installation
  4. Operational Considerations

I will start with the assumption that you have an AWS EC2 Linux instance and you can access it through Putty.

Display Environment & X11 Forwarding

Oracle database is installed through Oracle Universal Installer, which is a GUI based application. In order to open a GUI based application on AWS EC2 Linux instance through Putty, you will have to install Xming server, Xming Launch, and enable X11 forwarding on Putty.

Xming can be downloaded from the below link.

After downloading and installing Xming you should see two icons Xming and XLaunch on your computer. Click on Xming and it will start the Xming server.

Click on XLaunch and go through the below screen.

This is the first screen you will see. No action required, click on Next.

Image for post
Image for post
Image by Author

No changes required on this screen. Click on the Next button.

Image for post
Image for post
Image by Author

No changes required on this screen. Click on the Next button.

Image for post
Image for post
Image by Author

No changes required on this screen. Click on the Finish button.

Image for post
Image for post
Image by Author

Xming is good to go. On your computer taskbar, you should see the Xming icon. That indicates the Xming server is running.

Image for post
Image for post
Image by Author

Open putty and ensure X11 forwarding is configured. Enable X11 forwarding option should be selected and X display location should be localhost:0.0

Image for post
Image for post
X11 forwarding setup in Putty (Image by Author)

Login to the AWC EC2 instance. My AWS EC2 instance has the Red Hat Linux operating system.

Open /etc/ssh/ssh_config file and make sure the ForwardX11 option is uncommented and set as yes.

Image for post
Image for post
X11 forwarding setup in ssh_config file (Image by Author)

Open bashrc file

vi ~/.bashrc

add DISPLAY=localhost:10.0 for forwarding the GUI display to your local computer.

Image for post
Image for post
DISPLAY variable in .bashrc file (Image by Author)
source ~/.bashrc

Libraries

For the oracle database, the recommended operating system in Oracle Linux. Oracle Linux repository has RPMs (oracle-rdbms-server-12cR1-preinstal for 12cR1 and oracle-rdbms-server-12cR2-preinstal for 12cR2 version) to address pre-installation requirements. However, these RPMs are not available on any other Linux operating system. As I am using Red Hat, I need to install all the libraries.

Below is the list of mandatory libraries required for Oracle database 12c installation.

sudo yum install -y wget bzip2 unzip xauth libaio ksh sysstat libaio libaio-devel binutils gcc gcc-c++ libstdc++ xterm make binutils gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaio libaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 sysstat unixODBC unixODBC-devel zlib-devel libnsl.so* compat*

Now run xauth command to create .Xauthority file

xauth
Image for post
Image for post
Image by author

To test X11 forwarding and DISPLAY working fine, run xterm

xauth
Image for post
Image for post

You should get xterm window like below.

Image for post
Image for post
Xterm window (Image by Author)

Congratulations! your display forwarding looks good and now any GUI call on your AWS EC2 instance will directly open on your local computer.

Oracle database installation, configuration, and operations will be performed using specific user oracle and specific group oinstall. It’s time to create this user and group and ensure the display forwarding is working through this user as well.

sudo useradd oracle
sudo passwd oracle
sudo groupadd oinstall
sudo usermod -G oinstall oracle
Image for post
Image for post
Image by Author

Add oracle user to sudoer file. Open sudoer file through visudo

sudo vi /etc/visudo

Add oracle user details.

Image for post
Image for post
Image by Author

Now change the user to oracle

sudo su oracle
sudo touch .Xauthority
Image for post
Image for post
Image by Author

Logout, close the putty window and open a new putty window. Login as ec2-user and run xauth list. After that change to oracle user and run “xauth add” command to add the details shown in xauth list of ec2-user

xauth list
sudo su oracle
xauth add <add from the list above>
Image for post
Image for post
Image by Author

Now run xterm command and it would open xterm window with oracle as a user.

Image for post
Image for post
Xterm window (Image by Author)

Congratulations! You have successfully configured oracle user and X11 forwarding display for this user.

Swap Size

In case a lot of applications are running and RAM is completely full, the system might crash. In order to avoid this situation swap size is defined. Swap is the designated size on the hard disk to be used as an extension of RAM when RAM is completely full.

If your RAM size is very large ex. more than 100 GB, chances are that system will never need swap size, nevertheless, Oracle recommends allocating a minimum of 150 MB to swap. To be on the safer side, I am allocating 1Gb to swap size.

cd /var
sudo touch swapfile
chmod 600 swapfile
sudo dd if=/dev/zero of=/var/swapfile bs=1024k count=1000
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
swapon -show
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

Add below line to /etc/fstab file

/var/swapfile none swap sw 0 0
Image for post
Image for post
Image by Author

Congratulations!! Swap size is assigned and now you are all set to download and start Oracle database installation.

Download, Installation & Configuration

The best practice is to create a new directory u01 and give write privilege to oracle user on this directory.

Image for post
Image for post
Image by Author

Oracle database can be downloaded from the Oracle e-delivery site. Select the database version you want to install

Image for post
Image for post
Image by Author

Select the platform

Image for post
Image for post
Image by Author

It provides an option to download through wget.

Image for post
Image for post
Image by Author

Download wget.sh file with details like below and execute it on your AWS EC2 instance.

Image for post
Image for post
Image by Author

It will ask for your Oracle support login details. Enter the support login name. Press the enter button and enter the password and press the enter button.

Image for post
Image for post
Image by Author

Keep the window open. Start a new Putty login session and monitor progress there. You will see new zip files in the u01 folder.

Image for post
Image for post
Image by Author

Unzip all the files.

Image for post
Image for post
Image by Author

Go to the database folder and run the runInstaller.

Image for post
Image for post
Image by Author

Oracle universal installer GUI application will start on your local computer through the Xming. Follow the below screenshot for the next steps

Image for post
Image for post
Oracle Universal Installer (Image by Author)

You will get the below message, click on Yes

Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

In this screen mention the folder where you want to install the database

Image for post
Image for post
Image by Author

You can ignore this message. Click on Yes.

Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

Make a note of this screen. Take a screenshot and keep a copy. This helps you understand what is installed and where.

Image for post
Image for post
Image by Author

Monitor the progress here.

Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

Once this screen comes up

Image for post
Image for post
Image by Author

Open a new window. Login as ec2-user and change to root with sudo su and run the above scripts.

Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

At this stage, a new window will open and oracle database configuration steps will start. Monitor progress on this window.

Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author
Image for post
Image for post
Image by Author

Congratulations!! Oracle database is installed and configured on your AWS EC2 instance.

Image for post
Image for post
Image by Author

You are at the “Finish” step. Click on the close button.

Image for post
Image for post
Image by Author

Operation

Navigate to the u01 folder. You should find folders like below.

Image for post
Image for post
Image by Author

Open bashrc file and setup ORACLE_SID and ORACLE_HOME environment variables.

Image for post
Image for post
Image by Author

Source bashrc file. Start a sqlplus session as sysdba.

source ~/.bashrc
sqlplus / as sysdba
Image for post
Image for post
Image by Author

Here you can run commands to view the database parameters, files, status, etc.

Image for post
Image for post
Image by Author

Conclusion

Congratulations!! You have successfully installed a server-class Oracle database on an AWC EC2 instance. Each step mentioned in this document has gone through a thorough review and has been successfully performed various times by Sanrusha employees and students. However, if you come across any hurdles, please write, and I will be more than happy to help you.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK