Blue Flower

This article covers a project I did in the previous IT infrastructure I was supporting. We had an old Oracle database running on an obsolete SuSe Linux virtual machine, together with a front web end, and we wanted to move the whole thing to a more up to date Operating System, moving away at the same time of Oracle because the support for it was too expensive. Furthermore, there was only one critical section of the Oracle database that we wanted to move and which data we did not want to lose at all

Oh dear, where do we start? First of all, document what we have and make a diagram with the plan of where we want to be

 

  1. Documenting existing problem
  2. Creating the test environment
  3. Fixing the SuSe Oracle cloned VM
  4. Fixing the SuSe Apache Tomcat cloned VM
  5. Create snapshots for both VMS, and needed tools
  6. Create a SQL database on Ubuntu Server
  7. Connect to the Oracle database

 

1.- Documenting existing problem

We were running VMware vSphere 6.5 on the infrastructure where those SuSe Linux Enterprise 10 were running, which extended support finished in July 2016 (https://www.suse.com/lifecycle/), and they were never gonna take on board the new versions of VMware tools. Besides, the 32-bit version of SuSe Enterprise 10 what we were running was subject of the SMB Wannacry vulnerability (https://www.suse.com/support/kb/doc/?id=7019508) and that was a major worry for us. Another condition that intensified the urgency of this project what that the Oracle version was also obsolete and no longer supported (https://n4stack.io/oracle-11g-end-of-life/), so we just could no longer have these systems in production anymore

What versions were we running on these old systems? These commands were handy:

cat /etc/issue
cat /etc/SuSe-release
cat /opt/tomcat/RELEASE-NOTES 

 

2.- Creating the test environment

Before embarking in the process of upgrading the whole system, I cloned both VMS (the Oracle and the Apache web-front GUI) using vCenter into one of our test ESXi servers, and created a unique VLAN for these machines to communicate among them in isolation, totally separated from the production network. I also created a Management VM with CentOS which I called "XYZ-MANAGEMENT", from where I'll SSH those machines without affecting their replicas who were still in production

Here you can see the 3 VMs to start with, in an "Isolated" network with no physical nic attached

 

 

3. Fixing the SuSe Oracle cloned VM

After the restore, when you first turn on the SuSe Enterprise 10 running Oracle, I notice that the network card wasn't working. The VMware clone doesn't work well with such ancient Linux OS. To fix it I opened "yast" and deleted the dummy card that was listed as 'not connected', if you can't deleted it, first set a "No IP Address (for Bonding Devices)" to both cards, and then reboot

Once the system boots, and before proceeding, ensure that IP address of the server is responding. If you managed to fix the network, then use SSH from the management computer and logon with the username of "oracle", and start executing the following to initialise the Oracle database:

#lsnrctl status listener  //**check status of the listener, then restart it
#lsnrctl stop listener  
#lsnrctl start listener  

#cat /etc/oratab          //**identify the SID of the database
#export ORACLE_SID=PROD   //**export the SID, on this example is "PROD"
#sqlplus / as sysdba      //**logon to Oracle, it will use WHICHEVER acccount you have on the shell to logon

SQL> select status from v$instance;  //**check status of the database

SQL> Shutdown
SQL> Startup

If you get the error The ORA-01031: "insufficient privileges" make sure you're logon to the shell with an account that has full access to Oracle, and not the root

For documentation purposes, this is a video of the SuSe Oracle server booting up:

 

4. Fixing the SuSe Apache Tomcat cloned VM

When booting up this other SuSe Enterprise cloned VM, running Apache Tomcat, I find out that I could not logon to it, the machine was giving "Error on service module" and refused to logon. Not a good way to start a Friday! This error is documented in this link by SuSe: https://www.suse.com/support/kb/doc/?id=7008866

To fix this problem you actually need to start the VM in running level 1, by inserting "1" in the boot options, then once you boot on single-user mode, open "yast" and remove the duplicated network card, then issue these commands:

cd etc/var
mkdir log
touch lastlog

For documentation purposes, this is another video of the SuSe Enterprise machine booting with Apache tomcat on it:

I needed to restart the Apache Tomcat service after the restore, enabling that way a right communication between the Oracle and Apache

cd usr/local/tomcat/bin
./restart.sh

This is a screenshot of the front end website that the application runs. I need to transfer all these systems to a Linux platform more up to data than SuSe 10 SP3, let's see how we'll do that

To change the setting of this IP address, edit the file: /share/www/webapps/helloacc/issues/DisplayFeature.jsp

The tomcat-users.xml configuration file for SuSe is located in /usr/local/apache-tomcat-5.5.23/conf folder

 

 

 

5. Create snapshots for both VMS, and needed tools

Before moving any further, create snapshots of the now working cloned VMs, so we can restore to them if things go awry, which most likely will be now that we are stepping into unknown territory

 For the Windows 10 Management machine, you need to download and install these tools:

 

6. Create a VM with the free version of Oracle

Install CentOS7 on a virtual machine, we'll use it as the repository for the new Oracle to migrated the data to from the old SuSe machine. Download the Oracle Express Edition for Linux (64-bit) from here, together with the pre-install package requirements : https://www.oracle.com/database/technologies/xe-downloads.html

Then, execute these commands:

cd /home/user/Downloads
chmod 755 *

yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install glibc-devel
yum -y install ksk
yum -y install libaio-devel
yum -y install libstdc++-devel

rpm -ivh oracle-database-preinstall-10c-1.0-1.el7.x86_64.rpm
rpm -ivh oracle-database-xe-18c-1.0.-1.x68_64.rpm

 

7. Configure the new Oracle database

Once the installation has successfully completed on the CentOS7 server, do a snapshot of that machine! Then it will be time to configure the new Oracle database as follows

vi /etc/hostname
#set the correct name that you want for the computer first!

After setting the name of your CentOS, edit the file /etc/hosts and add an entry for your machine

/etc/init.d/oracle-xe-18c configure
#Password for PDBADMIN = Arnw3n40

 The installation of Oracle will have created a new account called "oracle", enable the password for it using the control panel in your CentOS machine

Proceed as below to configure Oracle:

vi /opt/oracle/product/18c/dbhomeXE/network/admin/tnsnames.ora
#set the IP address on your VM on your HOST ENTRY

cd ~
vi ./bash_profile
#and add the folowing entries below:

export ORACLE_BASE=/opt/oracle/ 
export LD_LIBRARY_PATH=/opt/oracle/product/18c/dbhomeXE/lib 
export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE 
export PATH=$ORACLE_BASE/product/18c/dbhomeXE/bin:$PATH 
export PATH=/usr/bin:$PATH 
export ORACLE_SID=XE 

#Edit the PAHT and add :/opt/oracle/product/18c/dbhomeXE/bin
#Finally, to logon to the DB use:

source ~/.bash_profile

sqlplus sys as sysdba
#the above, do it under the oracle account

To configure the Oracle dabatase to start automatically upon reboot of the system, do as follows:

systemctl daemon-reload
systemctl enable oracle-xe-18c 

#Now, use the oracle account to start the database
sqlplus sys as sysdba
SQl> Startup

lsnrctl start

If you get the error ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

 

 

 

the arclig pwkdddf

 

oracle@centos# export ORACLE_SID=XE

oracle@centos#./sqlplus "/as sysdba"

 

After a reboot, do the following to start the ORACLE2 database:

 

 

---------------

 

8. Install Tomcat on the new CentOS virtual machine

Use WinSCP from the Windows 10 management, to move the website content from the SuSe Apache to the new CentOS Apache, then we should install Java and Tomcat on the new CentOS so we can run .jsp pages on it. Tomcat is a Java Serverlet container that will allow us to run java pages on the Apache server

yum install tomcat
yum install tomcat-webapps
yum install tomcat-admin-webapps
yum install tomcat-docs-webapp
yum install tomcat-javadoc

firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload

We need to create an user to manager Apache Tomcat. Edit the file /etc/tomcat/server.xml and ensure the GlobalNamingResources section is pointing to the right location of tomcat-users.xml

#extract of the file /etc/tomcat/server.xml

  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="etc/tomcat/conf/tomcat-users.xml" />
  </GlobalNamingResources>

 

 

 

 

 

 

 

 

 

6. Create a SQL database on Ubuntu Server

I figure out that the best thing to approach this project will be in stages, like all good projects do, so I decided the 1st objective to be to transfer the DB from Oracle to a SQL server, and for that I needed to know the size of the database in Oracle, which on my case was 4GB. Run this command on the Oracle SuSe to find out:

SQL> select sum(bytes)/1024/1024 size_in_mb from dba_data_files;

Jumping now the new Linux virtual machine that will host SQL, the machine called XYZ-LINUXSQL, I installed Ubuntu Server 16.04.6, supported by Microsoft to run SQL server. Do install it with minimal configuration:

 

After the installation of Ubuntu (and obviously the run of 'sudo apt-get udpate'), execute the following commands to install dependencies, register a Microsoft depo and install and downloadl Microsoft SQL server. Note that you have to install the "Microsoft SQL Evaluation Edition", otherwise you won't be able to transfer the data from Oracle, the free version of SQL Express doesn't support migration to/from Oracle

#Be careful when copying/pasting these 2 commands, pipe (|) don't paste well!

sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"

sudo apt-get update
sudo apt-get install -y --allow-unauthenticated mssql-server 
sudo systemctl restart mssql-server.service

Once you've done all the above bits, start the configuration of the SQL Server database, on my case I choose the Microsoft SQL Standard Edition... okay, we don't want to pay for it but at the minute that's the one we need to use to be able to migrate data from Oracle

sudo /opt/mssql/bin/mssql-conf setup

 After the configuration is done, run this command to check the SQL server is moment:

systemctl status mssql-server --no-pager

Finally, start the SQL Server Agent as below:

sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true 
sudo systemctl restart mssql-server

 Do a snapshot on that virtual machine now, then it is time to create a database to receive the data from Oracle as follows (warning! if you do copy/paste to a VM, ensure the symbol | 'pipe' and double quotes " are properly pasted)

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

sudo apt-get update 
sudo apt-get install mssql-tools unixodbc-dev

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
#The above will export that path to your profile

 If the exported path does not work and you cannot run the sqlcmd command, then visit /opt/mssql-tools/bin and run this command to create a new database:

./sqlcmd -S localhost -U SA -P 'MyPassword123'

1> CREATE DATABASE ORACLE2
1> SELECT Name from sys.Databases
1> GO

After the GO, the 2 above commands will be executed, and a new DB called ORACLE2 created

Let's see now if we can connect to that newly created database from the Windows Management machine

 

7. Connect to the Oracle database

Following the instructions on this Microsoft KB (https://docs.microsoft.com/en-us/sql/ssma/oracle/installing-ssma-for-oracle-oracletosql?view=sql-server-ver15), download and install SSMA for Oracle on the XYZ-WIN10 virtual machine, we'll use this machine to convert the data from Oracle/SuSe to SQL Express/Ubuntu. On that same Windows machine, install the following:

Once you have Microsoft Assistant for Oracle installed, launch it and create a new project to migrate to SQL 2017, as highlighted on the above screenshot. Click on the "Connect to Oracle" button and enter the details of the database to logon as below, notice that the username has to be SYSTEM

 

If you get the error message Connection to Oracle failed ORA-01017: invalid username/password; logon denied, first of all verify that the Oracle database is up and running (restart the listener and export the SID). If it is running okay, then issue this command on the Oracle Linux to fix the error:

SQL> ALTER USER SYSTEM IDENTIFIED BY PasswdOfYourChoice;

This will reset the SYSTEM account to a password of your choice, and that logon details should let you in

After you successfully connect to Oracle, click on the button to "Connect to SQL Server", and ensure that the option to Trust the Certificated is selected

 

--------

 

orapwd file=orapwdsid password=MyPassword123 force-y

 

 

https://www.theurbanpenguin.com/1013-change-runlevels-and-shutdown-or-reboot-system/

 

 

 

 

 

We used to have a massive VM of 2TB running SuSe Linux Enterprise 10 SP3, that was hosted on an Hyper-V cluster

We decommissioned that Hyper-V cluster and moved the SuSe VM to a vSphere environment running 6.0. In this article I'm just going to list the main points that we follow to achieve the completion of this project

 

Reduce the size of the SuSe VM

Personally, I believe that there is something wrong if you have a VM that is bigger than 1TB, this one was hosting 2TB of data which is totally out of order. We acquired an NFS storage server (you can use Nimble, NetApp, EMC, etc) to host those files running on the SuSe, and one that huge drives on the SuSe were empty we needed to detach them from the system without upsetting the kernel. This is what I did:

vi /etc/fstab   //**edit this file and comment out (with a #) the drives that you don't need

 

References:

https://www.theurbanpenguin.com/1013-change-runlevels-and-shutdown-or-reboot-system/

http://www.orafaq.com/wiki/ORA-01034 

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-sql-agent?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/ssma/oracle/installing-ssma-for-oracle-client-oracletosql?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-red-hat?view=sql-server-ver15

https://docs.oracle.com/en/database/oracle/oracle-database/18/xeinl/installation-guide.html#GUID-31891F22-B1FA-4489-A1C5-195E6B3D89C8 

 

 

Handy command for the SuSe:



ps -ef  //**list of the processes running on the system

ps -ef | grep tomcat

ENABLE ROOT TO LOGIN THROUGH SSH

vi etc/ssh/sshd_config //**edit this file and uncommet the following entry:

#PermitRootLogin yes


AFTER SUSE LINUX ENTERPRISE RESTART:

/usr/local/tomcat/bin# ./startup.sh

/var/log# chwon -R squid:nogroup squid

/var/log# chmod -R 755 squid

rcsquid start

rcsquid status

READ ROOT MAIL

/var/logs# cat root

  

 

The oracle - from Hyper-V to VMware

First of all, shutdown the Oracle 11g do as follows:

//**to check status of the listener:

lsnrctl status listener


cat /etc/oratab //**identify the SID of the database

export ORACLE_SID=PROD  //**export the SID, on this example is "PROD"

sqlplus / as sysdba

shutdown immediate


//**to check status of the database do:

select status from v$instance;

 

At the time of running VMware converter for a SuSe 10 machine, follow this guides:

  1. Use VMware Coverter 5.5
  2. Copy the VM to a standalone ESXi host (not vCenter) with SSH enabled
  3. Define a static IP address in the VMware converter section of "Helper VM network configuration"; ensure that this new IP address is different from the static IP assigned to the source VM
  4. Edit the file /etc/udev/rules.d/70-persistent-net.rules and delete the conflicting eth0, renaming then the VMware nic to "eth0" instead of "eth1"
  5. Edit the file /etc/fstab and set " 1 1" at the end of the entry for every /dev/mapper/mpath mounted file, instead of the current "1 2"

 

 https://docs.oracle.com/cd/B28359_01/server.111/b32009/strt_stp.htm#UNXAR153

 

Change IP address in CentOS

http://ask.xmodulo.com/configure-static-ip-address-centos7.html 

 

Make Linux a FTP server

If you need to add a new hard drive to your Linux VM to cope with the FTP transfer, follow these instructions:

https://www.codero.com/knowledge-base/content/30/111/en/how-do-i-add-a-new-hard-drive-in-linux.html 

Install the webmin as described on this link:

http://www.nazaudy.com/index.php/16-linux/36-install-squid-webmin-and-sent-data-to-splunk-with-centos-7

 

rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
yum update
yum install proftpd

ProFTPD Server is installed in: /usr/libeexec.webmin/proftpd

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.orig 

 

 

 

Disable user list at login window:

https://www.centos.org/forums/viewtopic.php?t=54014 

References:

https://forums.opensuse.org/showthread.php/399471-Network-named-eth1-instead-of-eth0

https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-2017

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-editions-and-components-2017?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/ssma/oracle/installing-ssma-for-oracle-client-oracletosql?view=sql-server-ver15

https://www.theurbanpenguin.com/1013-change-runlevels-and-shutdown-or-reboot-system/

https://www.youtube.com/watch?v=0xKMOnjZlyw

http://www.davidghedini.com/pg/entry/install_oracle_11g_xe_on

https://gamblisfx.com/how-to-install-oracle-database-18c-xe-on-centos-7-6/

http://www.differencebetween.info/difference-between-apache-and-tomcat

 

 

Print Friendly, PDF & Email

Comments powered by CComment