Thursday, July 11, 2019

Oracle Database 19c Installation on Oracle Linux 7 (OL7)

This article describes the installation of Oracle Database 19c on Oracle Linux 7 (OL7) on VirtualBox.

Introduction:

For installing 19c in your laptop or desktop, computer should have minimum 4 GB or more of RAM required, and minimum 30GB or more of storage required.

This article uses the 64-bit versions of Oracle Linux 7 and Oracle 19c.

Prerequisite: Oracle Linux 7 Install on VirtualBox

Download Software:

Download Oracle 19c database software for Linux x86-64 from OTN or edelivery and copy the files to linux server (on VirtualBox) using winscp or shared folder.

Oracle Installation Prerequisites

Either you can perform Automatic setup  or Manual setup to complete the prerequisites.

Automatic Setup:

Install "oracle-database-preinstall-19c" package to perform all prerequisite setup. use the following command
# yum install -y oracle-database-preinstall-19c           

Manual Setup:

If you have not used the "oracle-database-preinstall-19c" package to perform all prerequisites, you have to manually perform the following setup tasks.

OS Configuration and Preparation:
1) Add the following lines to the "/etc/sysctl.conf" file
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500            
2) Run the following command to change the current kernel parameters.
# /sbin/sysctl -p           
3) Add the following lines to "/etc/security/limits.conf" file
oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728          
4) The following packages are listed as required. Many of the packages should be installed already.
# OL7 
yum install bc
yum install binutils
yum install compat-libcap1
yum install compat-libstdc++
yum install dtrace-modules
yum install dtrace-modules-headers
yum install dtrace-modules-provider-headers
yum install dtrace-utils
yum install elfutils-libelf
yum install elfutils-libelf-devel
yum install fontconfig-devel
yum install glibc
yum install glibc-devel
yum install ksh
yum install libaio
yum install libaio-devel
yum install libdtrace-ctf-devel
yum install libXrender
yum install libXrender-devel
yum install libX11
yum install libXau
yum install libXi
yum install libXtst
yum install libgcc
yum install librdmacm-devel
yum install libstdc++
yum install libstdc++-devel
yum install libxcb
yum install make
yum install net-tools (for Oracle RAC and Oracle Clusterware)
yum install nfs-utils (for Oracle ACFS)
yum install python (for Oracle ACFS Remote)
yum install python-configshell (for Oracle ACFS Remote)
yum install python-rtslib (for Oracle ACFS Remote)
yum install python-six (for Oracle ACFS Remote)
yum install targetcli (for Oracle ACFS Remote)
yum install smartmontools
yum install sysstat      
To determine whether the required packages are installed, enter commands similar to the following:
# rpm -q package_name     
Alternatively, if you require specific system architecture information, then enter the following command:
# rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" | grep package_name       
You can also combine a query for multiple packages, and review the output for the correct versions. For example:
# rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ make sysstat unixodbc     
If a package is not installed, then install it from your Linux distribution media or download the required package version from your Linux distributor's website.

5) Create the new groups and users.
#groups for database management
# groupadd -g 2000 oinstall
# groupadd -g 2001 dba
# groupadd -g 2003 oper        
Add user Oracle for database software
# useradd -u 1000 -g oinstall -G dba,oper oracle    
6) Set the password for the "oracle" user.
# passwd oracle    

7) Create directory structure as user root
$ mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
$ chown -R oracle:oinstall /u01
$ chmod -R 775 /u01          

Installation:

1) Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable.
DISPLAY=<machine-name>:0.0; export DISPLAY           
2) Set environment variables and copy 19c zip file to database ORACLE_HOME location and then unzip.  Start the Oracle Universal Installer (OUI) by issuing the following command.
$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
$ export PATH=$ORACLE_HOME/bin:$PATH

# Unzip software.
cd $ORACLE_HOME
unzip LINUX.X64_193000_db_home.zip

$ pwd
/u01/app/oracle/product/19.0.0/dbhome_1
$ ./runInstaller 
Launching Oracle Database Setup Wizard...
3) Here I have choosen "Set Up Software Only", to install the database software.You can choose "Create and configure a single instance database" option, If you want to install database software and create database in single shot.. In this article, I will create database separately using DBCA.

Click Next to continue the 19c installation.

4) Select Database Installation Option, Accept default "Single instance database installation" and click Next button 

5) Select Database Edition, You can select here type of binaries to install. Once it’s done click Next button.

6) Specify Installation Location, here you should see directories for ORACLE_BASE and ORACLE_HOME for your binaries according to environmental settings. Click Next button.

7) Operating system groups, here you can specify OS group for each oracle group. Change default groups to dba and oinstall and click Next button.

 Click Next


8) Check Prerequisite checks for 19c database installation and click Next

9) Summary, If everything is fine, then click Install button. It’s the last moment to come back to each of previous point and make changes.

Product Installation in-progress

10) Execute configuration script, once binaries are installed the last step is to run root.sh script as user root.  

# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.0.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /u01/app/oracle/product/19.0.0/dbhome_1/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

#          
11) After successful installation click Close button.

Database Creation:

Creating database using the Database Configuration Assistant (DBCA). 

1) Invoke DBCA
# dbca          
2) Select Create a database option and click Next
3) Select Creation Mode as Advanced Configuration and click Next

4) select Database Deployment as General Purpose or Transnational Processing and click Next 

5) Enter Database name and If you want to create pluggable database then choose Create a container database with one or more PDBs option and creare Pluggable Database. Then Click Next

6) Choose database file location and click Next

7) Its a testing machine so not Enabling Archive log mode for the Database. If you want to enable Archive log mode then choose both options and Click Next

8) Click Next. 

 


9) Enter Administrative password and click Next

10) Choose Create Database option and click Next

11) Summary, If everything is fine, then click Finish button to create the database. If you want to make any changes click back button and modify accordingly.


12) Click Close button.

After successful creation of database check the database status.

$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 11 07:10:41 2019
Version 19.3.0.0.0

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


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

SQL> select instance_name, status from v$instance;

INSTANCE_NAME  STATUS
---------------- ------------
orcl19c   OPEN

SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

SQL>          

That's it. Completed the Oracle database 19c Installation and creating a database.

Hope this article will help you and please give your valuable comments !!

Thanks,
Chowdari

Thursday, February 21, 2019

ORA-16698: 12c Dataguard Broker Setup Error

Recently I have configured dataguard on 12c database. While configuring dataguard broker I have encountered an "Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added"
[oracle@primdb dbs]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/dataguard
Connected as SYSDG.
DGMGRL> CREATE CONFIGURATION 'DR_Config' AS PRIMARY DATABASE IS 'primdb' CONNECT IDENTIFIER IS primdb;
Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added

Failed.
DGMGRL>
SQL>

Solution:

Generally you will not receive this error on earlier database versions (Pre 12c). As per Oracle database 12c documentation, "Any LOG_ARCHIVE_DEST_n parameters that have the SERVICE attribute set, and if the NOREGISTER attribute is Not set, then you must remove/clear the 'LOG_ARCHIVE_DEST_n' before creating the broker configuration". Clear archive destination for both primary and standby side and then configure the Dataguard broker.

Once you complete the DataGuard broker setup then revert back the LOG_ARCHIVE_DEST parameter to old values in both primary and standby side.

On Primary Side:

SQL> show parameter LOG_ARCHIVE_DEST_2 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ log_archive_dest_2 string SERVICE=standb ASYNC VALID_FO R=(ONLINE_LOGFILES,PRIMARY_ROL E) DB_UNIQUE_NAME=standb SQL> SQL> alter system set LOG_ARCHIVE_DEST_2='' scope=both; System altered. SQL> DGMGRL> CREATE CONFIGURATION 'DR_Config' AS PRIMARY DATABASE IS 'primdb' CONNECT IDENTIFIER IS primdb; Configuration "DR_Config" created with primary database "primdb" DGMGRL> DGMGRL> show configuration; Configuration - DR_Config Protection Mode: MaxPerformance Members: primdb - Primary database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL>

On Standby Side:

SQL> show parameter LOG_ARCHIVE_DEST_2 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ log_archive_dest_2 string SERVICE=PRIMARY ASYNC VALID_F OR=(ONLINE_LOGFILES,PRIMARY_RO LE) DB_UNIQUE_NAME=primdb SQL> alter system set LOG_ARCHIVE_DEST_2='' scope=both; System altered. SQL> DGMGRL> ADD DATABASE 'standb' AS CONNECT IDENTIFIER IS standb MAINTAINED AS PHYSICAL; Database "standb" added DGMGRL> DGMGRL> enable configuration; Enabled. DGMGRL> show configuration; Configuration - DR_Config Protection Mode: MaxPerformance Members: primdb - Primary database standb - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS (status updated 10 seconds ago) DGMGRL>
That's it.. Hope this article will help you.

Thanks,
Chowdari