Faheem

Remove Oracle Enterprise Manager in 19c Upgrade

Remove Oracle Enterprise manager

For upgrading Oracle database from 11g to 19c, we need to remove the Enterprise manager repository manually. Below are the steps,

  1. Stop the em dbconsole If database control is configured.
[oracle@ol7-dev u01]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://ol7-dev:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
 ...  Stopped.

2. Copy emremove.sql from target 19c ORACLE_HOME/rdbms/admin to source 11g ORACLE_HOME/rdbms/admin

[oracle@ol7-dev admin]$ cp /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/emremove.sql /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/

3. Connect to source database using sys user and run emremove.sql

[oracle@ol7-dev admin]$ sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Sat Nov 7 22:53:58 2020

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @$ORACLE_BASE/product/11.2.0/db_1/rdbms/admin/emremove.sql
old  70:     IF (upper('&LOGGING') = 'VERBOSE')
new  70:     IF (upper('VERBOSE') = 'VERBOSE')

PL/SQL procedure successfully completed.

SQL>

EM repository has been removed successfully…

Upgrade Database timezone file in oracle 19c upgrade

Upgrade Timezone file

We may need to upgrade database timezone file during database upgrade from 11g to 19c. Below recommend action is from preupgrade.jar information tool.

Upgrade the database time zone file using the DBMS_DST package.

The database is using time zone file version 14 and the target 19 release ships with time zone file version 32.

Oracle recommends upgrading to the desired (latest) version of the time zone file.  For more information, refer to "Upgrading the Time Zone File and Timestamp with Time Zone Data" in the 19 Oracle Database Globalization Support Guide.

Below are the steps to Upgrade the database timezone file

Connect to sqlplus and start the database in upgrade mode

sqlplus / as sysdba
shutdown immediate;
startup upgrade;

Check the current timezone file version

SELECT * FROM v$timezone_file;

--output:
SQL> SELECT * FROM v$timezone_file;

FILENAME		VERSION     CON_ID
-------------------- ---------- ----------
timezlrg_14.dat 	     14 	 0

Start the upgrade window

SET SERVEROUTPUT ON
DECLARE
l_tz_version PLS_INTEGER;
BEGIN
l_tz_version := DBMS_DST.get_latest_timezone_version;
DBMS_OUTPUT.put_line('l_tz_version=' || l_tz_version);
DBMS_DST.begin_upgrade(l_tz_version);
END;

--output
SQL> SET SERVEROUTPUT ON
DECLARE
l_tz_version PLS_INTEGER;
BEGIN
l_tz_version := DBMS_DST.get_latest_timezone_version;
DBMS_OUTPUT.put_line('l_tz_version=' || l_tz_version);
DBMS_DST.begin_upgrade(l_tz_version);
END;
/SQL>   2    3    4    5    6    7    8
l_tz_version=32
An upgrade window has been successfully started.

PL/SQL procedure successfully completed.

Start the database in normal mode

shutdown immediate;
startup;

Do the upgrade

SET SERVEROUTPUT ON
DECLARE
  l_failures   PLS_INTEGER;
BEGIN
  DBMS_DST.upgrade_database(l_failures);
  DBMS_OUTPUT.put_line('DBMS_DST.upgrade_database : l_failures=' || l_failures);
  DBMS_DST.end_upgrade(l_failures);
  DBMS_OUTPUT.put_line('DBMS_DST.end_upgrade : l_failures=' || l_failures);
END;


--output
SQL> SET SERVEROUTPUT ON
DECLARE
  l_failures   PLS_INTEGER;
BEGIN
  DBMS_DST.upgrade_database(l_failures);
  DBMS_OUTPUT.put_line('DBMS_DST.upgrade_database : l_failures=' || l_failures);
  DBMS_DST.end_upgrade(l_failures);
  DBMS_OUTPUT.put_line('DBMS_DST.end_upgrade : l_failures=' || l_failures);
END;
/SQL>   2    3    4    5    6    7    8    9  
Table list: "MDSYS"."SDO_DIAG_MESSAGES_TABLE"
Number of failures: 0
.
.
<output truncated>
.
.
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_S"
Number of failures: 0
DBMS_DST.upgrade_database : l_failures=0
An upgrade window has been successfully ended.
DBMS_DST.end_upgrade : l_failures=0

PL/SQL procedure successfully completed.

SQL> 

Check the new timezone settings

SELECT * FROM v$timezone_file;

--output
SQL> SELECT * FROM v$timezone_file;

FILENAME		VERSION     CON_ID
-------------------- ---------- ----------
timezlrg_32.dat 	     32 	 0

Timezone file has been upgraded to version 32.

Install and configure VNC Server on Linux

Installating and configuring VNC on linux

Description

In this article I will describe the step by step Installation and Configuration of VNC Server on Linux 7 environments.

We will be covering the following steps:

  1. VNC Server Prerequisites and rpm installation
  2. Configure VNC Server
  3. Start the VNC Service
  4. Enable VNC Server
  5. Accessing the GUI using VNC Server
1. VNC Server Prerequisites and rpm installation

Note: Before installing the VNC server, Make sure the OS is installed with GNOME Desktop.

For configuring VNC Server, the following packages has to be installed.

# yum install tigervnc-server
# yum install xorg-x11-fonts-Type1
2. Configure VNC Server

Copy the VNC configuration file /lib/systemd/system/vncserver@.service to /etc/systemd/system directory and mention the port which has to connect. By default VNC will listen to port 5900.

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service

Here I have mentioned port 2, so that the VNC Desktop will be accessible on port 5902.

Manually edit the copied file /etc/systemd/system/vncserver@:2.service and replace <USER> to your username
In the below example I have replaced <USER> with oracle

# vi /etc/systemd/system/vncserver@:2.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver_wrapper oracle %i
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

Or you may use sed command to replace the string,

# sed -i 's/<USER>/oracle/g' /etc/systemd/system/vncserver@:2.service
3. Start the VNC Service

Switch to Oracle user and start the VNC Service

# vncserver

Output:

[oracle@ol7-dev ~]$ vncserver
Warning: ol7-dev:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server ol7-dev:1
xauth: file /home/oracle/.Xauthority does not exist
New 'ol7-dev:2 (oracle)' desktop is ol7-dev:2
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/ol7-dev:2.log
[oracle@ol7-dev ~]$
4. Enable the VNC Service

Switch to root user and enable the vncserver service for oracle user on port 5902. This will also enable autostart on system boot.

Switch to root user:

# su -

Reload systemd’s configuration

# systemctl daemon-reload

Configure the VNC password for user oracle

# vncpasswd oracle

Start and enable the VNC Server service. This will enable the auto start on system boot

# systemctl start vncserver@:2.service
# systemctl enable vncserver@:2.service
5. Accessing the GUI using VNC Server

Download and install any VNC viewer on your client PC to access the VNC Server. Here I am using VNC Viewer (Here is the download link)

Enter the VNC Server IP and

Enter the VNC password

You are now connected to the VNC Server.

Hope this helps…

Oracle 19c database installation on Linux

19c database installation

Description:

In this post I will describe the step by step installation of Oracle database 19c 64-bit on Oracle Linux 7 64-bit and creation of a single instance 19c database.

We will be covering the following steps:

  1. Oracle Database Installation Prerequisites
  2. Installation of Oracle 19.3.0.0 binaries
  3. Creation of single instance database

Download the software binaries from the below link:
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html

1. Oracle Database Installation Prerequisites

Start a terminal session and enter the following command as root:

# yum install oracle-database-preinstall-19c

Create the directories where Oracle binaries has to be installed:

# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01

Set the environment variables:
Edit /home/oracle/.bash_profile and add the below lines,

# Oracle ENV Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_UNQNAME=db19c
export ORACLE_SID=db19c
export PDB_NAME=pdb1
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Unzip the database binary software:
Switch to ORACLE_HOME directory and unzip the database binary software,


# cd $ORACLE_HOME
# unzip /u01/software/db-soft/LINUX.X64_193000_db_home.zip

2. Installation of Oracle 19.3.0.0 binaries

Log into the oracle user and set the environment variables.

Here I am using VNC viewer to do the installation in graphical mode. Refer the link to Install and configure VNC Server on Linux 7

# cd /home/oracle
# . .bash_profile
# cd $ORACLE_HOME
# ./runInstaller

Click on Set Up Software only

Select the Single instance database installation

Choose Enterprise Edition

Verify the ORACLE_BASE and ORACLE_HOME locations

Select the OS Groups for the installation

Uncheck the Automatically run configuration scripts, Here we will do this manually

Verify the prerequisite output

Install the missing packages and click on Check again

# yum install kmod-20-21*
# yum install kmod-libs-20-21*

Check Summary and click on Install

Run root.sh script as root user

Database binary installation completed.

3. Creation of single instance database using DBCA

Login to oracle user run dbca. The dbca utility is typically located in ORACLE_HOME/bin directory.

Choose Create a database

Select Advance configuration, In Advanced configuration, you can customize storage locations, management database options, and different passwords for Admin user accounts.

Choose Database type: Oracle single instance database and General Purpose or Transaction Processing template

Provide the Global database name & SID
Enable Create as Container database and provide the PDB name

Choose File System and Provide the Database files location details

Enable Specify Fast Recovery Area and provide the location and size

If no listener is available, create a new one

Data Vault Option,

Choose Automatic Memory Management (if your physical memory is less than 4 GB) and Provide the Memory Target.

Note: If the total physical memory of your database instance is greater than 4 GB, then you cannot select the Use Automatic Memory Management option. Instead, use automatic shared memory management.

Specify the Processes count, This will be the maximum number of processes that can simultaneously connect to the database.

Use Unicode (AL32UTF8) Select this option to support multiple languages for your database users and database applications

Management Option

specify the passwords for the administrative accounts such as SYSSYSTEM, and PDBADMIN.

Choose Create database and and click on Next

Review the summary information and click on Finish

Database created successfully..

[oracle@ol7-dev software]$ export ORACLE_SID=db19c
[oracle@ol7-dev software]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 10 23:45:18 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
DB19C     READ WRITE

Detaching a block volume from an instance in Oracle cloud

Oracle cloud detach block volume

In this article I will describe how to detach a block volume from an Oracle cloud Linux instance We will be covering the following steps:

  • Unmount the mount-point from the Linux Instance
  • Disconnect the Block volume from the instance
  • Detach the Block volume from the Instance
  • Delete the volume from Cloud console

1. Unmount the disk from the Linux Instance

Connect to the linux instance and run the umount command to unmount the filesystem with has to be deleted
umount /oracle

2. Disconnect the Block volume from the instance

Once the disk is unmounted, access the cloud console and copy the commands to disconnect the block volume from the instance:
Goto Attached block volumes > Click on ellipsis(…) and select iSCSI Commands & Information

Copy the COMMANDS FOR DISCONNECTING

Connect the VM as root user and run the commands

3. Detach the Block volume from the Instance

Once the Block volume is detached. Access the cloud console, navigate to Instances page and click on Instance name (oc-ol7 here)

Under Resources select Attached Block Volumes and click on the ellipsis(…) then select Detach

Click on Continue Detachment

Click ok

Now we can see the Volume State is Detaching.

4. Delete the volume from Cloud console

Once the volume is Detached, Open the navigation menu. Under Core Infrastructure, goto Block Storage and Click on Block Volumes

In the block volume section click on the ellipsis(…) on which the volume you want to delete, then click Terminate and confirm the selection when prompted.

Now the block volume is terminated successfully.

Attaching a block volume to an instance in Oracle cloud

Oracle cloud Attach block volume

In this article I will describe how to create a block volume and attaching it to an instance in Oracle cloud. We will be covering the following sections:

  1. Creating Block Volume
  2. Attaching the Block Volume to the Linux VM Instance
  3. Format and Mount the volume on the instance

1. Creating Block Volume

Open the navigation menu. Under Core Infrastructure, go to Block Storage and click Block Volumes

Select the root compartment and click on Create Block Volume

Provide the Name and Volume size and Performance, then click on Create Block Volume

The Block volume is successfully created

2. Attaching the Block Volume to the Linux VM Instance

Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances

Click on the instance name

Under Resources select Attached Block Volumes and click on Attach Block Volume

Choose Volume attachment type: ISCSI
Select the volume which created in the previous section
Select the Device Path, then click on Attach

Block Volume is successfully attached

Click on the ellipsis(…) and select iSCSI Commands & Information

Click on copy to copy the COMMANDS FOR CONNECTING

Connect the Linux VM instance as root user and run the iSCSI commands to connect the block volumes

3. Format and Mount the volume on the instance

Verify the newly added disk using fdisk command

Format the newly added Disk /dev/sdb

Verify the new partitioned disk /dev/sdb1

Format and Mount the disk

Create directory “oracle” and mount the newly created disk

 

Step by step creation of Oracle cloud free tier account and creating a VM

Oracle Cloud free tier account creation

Hello Friends!

This is my first blog post and I hope you will ignore mistakes. Thank you in advance.

Description:

In this blog post I will describe the step by step creation of Oracle cloud always free account and creating a Linux Virtual Machine.

Oracle Cloud Free Tier will allows you to sign up for an Oracle Cloud account which provides a number of Always Free services and a free credit of 300$ which can be use on all eligible Oracle cloud Infrastructure services for up to 30 days. The Always Free services are available for an unlimited period of time. Kindly click here to know more in detail.

We will be covering the following steps:

  1. Create a free Oracle account
  2. Sign into your account
  3. Network Configuration
    • Create Virtual Cloud Network (VCN)
    • Configure Internet Gateway
    • Adding Route table
    • Adding Security list
  4. Creation of Oracle Linux Virtual Machine Instance
  5. Accessing the Linux Virtual Machine Instance

1. Create a free Oracle trial account

Open the web browser to access the Oracle Cloud account registration form

Choose your country and enter your name and email address
Once provided the details, check your email. You will see an account validation email from Oracle.

Enter the account information.
Note: Home Region cannot be changed once you sign-up.

Enter the address information, mobile details & Payment details and verify the same
Note: You need to provide the credit card details and 1$ will be charged for the verification and the same will be reserved. You will not be charged unless you elect to upgrade the account.

2. Sign into your account

Go to cloud.oracle.com and click on Sign into cloud

Enter you cloud account name and click next. This is the name we choose during the account creation

Enter the cloud account credentials and click next. Username is your email address.

You are now login to your cloud account

3. Network Configuration

Create Virtual Cloud Network (VCN)

Open the navigation menu. Under Core Infrastructure, go to Networking and click Virtual Cloud Networks

Select the compartment you want to create the network. Then click on Create VCN

Enter a name for the VCN
For CIDR Block, I choose IP 192.168.10.0/24, so that I can use the private IP range b/w 192.168.10.1 to 192.168.10.254.

Now the VCN status is available

Click on VCN Name (ocvcn) and you will be redirected to VCN Details page. Under Resource select Subnets and then click Create Subnet

Enter the information as per the below screenshot and click on Create Subnet.
Note: Public subnet has selected to access the instance in public n/w.

The subnet is now created

Configure Internet Gateway

From VCN Details page under Resources, click on Internet Gateways

Give it a name and choose the compartment, then click on Create Internet Gateway

Your internet gateway is created. but you still need to add a route rule that allows traffic to flow to the gateway.

Adding Route table

From VNC Details page, Under Resources –> Route Tables, click on the route table associated with your public subnet.

Click on Add Route Rules

This is for the public subnet.
select Target Type as Internet gateway
Destination CIDR Block: 0.0.0.0/0 (This means all the internet)
Once ready, click on Add Route Rules

Now you can see the Internet gateway route has been successfully added

Adding Security lists

Check your public IP using the URL and whitelist it to access the cloud VM which you will be creating in the next steps

From Subnet Details page, Under Resources, select Security Lists and click on the Default Security List as shown below

Click on Add Ingress Rules

Source Type: CIDR
Source CIDR: <Your Public IP>/32
IP Protocol: TCP; Source Port Range: All; Destination Port Range: All
Once ready, Click on Add Ingress Rules

Now you can see your my Public IP is whitelisted

Creation of Oracle Linux Virtual Machine Instance

Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances.

Click on create instance

Name: Enter the name for the instance
Create in Compartment: Select the compartment to create the instance in
Availablilty Zone: Select the Availability domain that you want to create the instance
Image: Select the image, by default Oracle Linux 7.x is used to boot the instance
Shape: Select VM.Standard.E2.1.Micro, which is eligible for always free
Add SSH keys: select Generate SSH Key pair; Click Save Private Key and Save Public key on your computer.

In Management section leave the setting as default

In Networking section enter the private IP and Hostname of the VM. Then click on Create

Wait for the instance creation to complete

After a couple of minutes you can see your Instance is in running state

Accessing the Linux Virtual Machine Instance

Connect the newly created VM from the windows system using ssh.
Before connecting you must set the file permissions for the Private key so that only you can read the file. Do the following.
Reference: https://docs.cloud.oracle.com/en-us/iaas/Content/GSG/Tasks/testingconnection.htm

a. Navigate to <private key file path> which we saved during the VM creation, right-click the file, and then click Properties.

b. On the Security tab, click Advanced.

c. Ensure the owner is yours

d. Click Disable Inheritance, and then select Convert inherited permissions into explicit permissions on this object.

e. Select each permission entry that is not your user account and click Remove.

f. Ensure that the access permission for your user account is Full control and save the changes.

Now we are good to connect to the instance. Open windows command prompt and run the following command.

ssh -i “<private key path>” opc@<public-ip-address>

Thanks for reading my post…

Hope this helps..