Oracle Database on AWS
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.
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
- Display Environment & X11 forwarding
- Swap Size
- Required Libraries, Package download, and Installation
- 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.
No changes required on this screen. Click on the Next button.
No changes required on this screen. Click on the Next button.
No changes required on this screen. Click on the Finish button.
Xming is good to go. On your computer taskbar, you should see the Xming icon. That indicates the Xming server is running.
Open putty and ensure X11 forwarding is configured. Enable X11 forwarding option should be selected and X display location should be localhost:0.0
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.
Open bashrc file
vi ~/.bashrc
add DISPLAY=localhost:10.0 for forwarding the GUI display to your local computer.
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
To test X11 forwarding and DISPLAY working fine, run xterm
xauth
You should get xterm window like below.
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
Add oracle user to sudoer file. Open sudoer file through visudo
sudo vi /etc/visudo
Add oracle user details.
Now change the user to oracle
sudo su oracle
sudo touch .Xauthority
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>
Now run xterm command and it would open xterm window with oracle as a user.
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
Add below line to /etc/fstab file
/var/swapfile none swap sw 0 0
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.
Oracle database can be downloaded from the Oracle e-delivery site. Select the database version you want to install
Select the platform
It provides an option to download through wget.
Download wget.sh file with details like below and execute it on your AWS EC2 instance.
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.
Keep the window open. Start a new Putty login session and monitor progress there. You will see new zip files in the u01 folder.
Unzip all the files.
Go to the database folder and run the runInstaller.
Oracle universal installer GUI application will start on your local computer through the Xming. Follow the below screenshot for the next steps
You will get the below message, click on Yes
In this screen mention the folder where you want to install the database
You can ignore this message. Click on Yes.
Make a note of this screen. Take a screenshot and keep a copy. This helps you understand what is installed and where.
Monitor the progress here.
Once this screen comes up
Open a new window. Login as ec2-user and change to root with sudo su and run the above scripts.
At this stage, a new window will open and oracle database configuration steps will start. Monitor progress on this window.
Congratulations!! Oracle database is installed and configured on your AWS EC2 instance.
You are at the “Finish” step. Click on the close button.
Operation
Navigate to the u01 folder. You should find folders like below.
Open bashrc file and setup ORACLE_SID and ORACLE_HOME environment variables.
Source bashrc file. Start a sqlplus session as sysdba.
source ~/.bashrc
sqlplus / as sysdba
Here you can run commands to view the database parameters, files, status, etc.
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK