A. Install Oracle 19c on RHEL 7
Step 1
Download Software
Download Oracle 19c from https://www.oracle.com/database/technologies/oracle-database-software-downloads.html and Unpack Files. You should get on directory named "database"
Step 2
Hosts File
- The "/etc/hosts" file must contain a fully qualified name for the server.
127.0.0.1 localhost.localdomain localhost 10.10.0.100 oracle.example.com oracle
- Use "ifconfig" command to check your IP Address. if no IP address is assigned, specify a static IP address by using following command.
# system-config-network # service network restart # service NetworkManager restart # ifconfig
This should give you the static IP address to be used in /etc/hosts file
Step 3 Add or amend the following lines in the "/etc/sysctl.conf" file.
fs.suid_dumpable = 1 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.shmmni = 4096 # semaphores: semmsl, semmns, semopm, semmni kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 kernel.panic_on_oops = 1 net.core.rmem_default=4194304 net.core.rmem_max=4194304 net.core.wmem_default=262144 net.core.wmem_max=1048586
Run the following command to change the current kernel parameters.
# sysctl -p
Step 4 Add the following lines to the "/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
Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
SELINUX=disabled
Once the change is complete, restart the server.
Step 5 Install the following packages if they are not already present.
yum install -y sysstat numactl python glibc gcc ksh glibc-devel targetcli smartmontools \ make bc libgcc libaio libXrender libX11 libXi libXau libXtst libxcb libstdc++ gcc-c++ \ libaio-devel libdtrace-ctf-devel libXrender-devel librdmacm-devel OpenSSL unixODBC \ nfs-utils python-configshell python-rtslib python-six compat-libcap1 fontconfig-devel \ binutils glibc-common libstdc++-devel compat-libstdc++-33 net-tools dtrace-utils \ elfutils-libelf elfutils-libelf-devel compat-libstdc*i686 glibc*i686 libgcc*i686 \ dejavu-serif-fonts numactl-devel motif motif-devel libstdc++*i686
Note. This will install all the necessary packages for 12.2. From 11.2.0.2 onwards many of these are unnecessary, but having them present does not cause a problem.
Step 6 Create the new groups and users.
groupadd -g 501 oinstall groupadd -g 502 dba groupadd -g 503 oper groupadd -g 504 asmadmin groupadd -g 505 asmdba groupadd -g 506 asmoper
useradd -u 502 -g oinstall -G dba,asmdba,oper oracle passwd oracle
Step 7 Create the directories in which the Oracle software will be installed.
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1 chown -R oracle:oinstall /u01 chmod -R 775 /u01
Step 8 Login as root and issue the following command.
xhost +oracle.example.com
Step 9 Login as the oracle user and Create a "scripts" directory.
mkdir /home/oracle/scripts
Create an environment file called "setEnv.sh"
# vi /home/oracle/scripts/setEnv.sh export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=oracle.example.com export ORACLE_UNQNAME=cdb1 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1 export ORA_INVENTORY=/u01/app/oraInventory export ORACLE_SID=cdb1 export PDB_NAME=pdb1 export DATA_DIR=/u01/oradata export PATH=/usr/sbin:$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
Add a reference to the "setEnv.sh" file at the end of the "/home/oracle/.bash_profile" file.
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
Create a "start_all.sh" and "stop_all.sh" script that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.
vi /home/oracle/scripts/start_all.sh #!/bin/bash . /home/oracle/scripts/setEnv.sh export ORAENV_ASK=NO . oraenv export ORAENV_ASK=YES dbstart $ORACLE_HOME
vi /home/oracle/scripts/stop_all.sh #!/bin/bash . /home/oracle/scripts/setEnv.sh export ORAENV_ASK=NO . oraenv export ORAENV_ASK=YES dbshut $ORACLE_HOME chown -R oracle:oinstall /home/oracle/scripts chmod u+x /home/oracle/scripts/*.sh
Step 10 Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable.
DISPLAY=oracle.example.com:0.0; export DISPLAY
Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.
./runInstaller
Step 11 Post Installation : Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
CDB1:/u01/app/oracle/product/19.3.0/dbhome_1:Y
Next, create a file called "/etc/init.d/oracledb" as the root user, containing the following.
#!/bin/sh # chkconfig: 345 99 10 # description: Oracle auto start-stop script. # # Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME. ORA_HOME=/u01/app/oracle/product/19.3.0/dbhome_1 ORA_OWNER=oracle if [ ! -f $ORA_HOME/bin/dbstart ] then echo "Oracle startup: cannot start" exit fi case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" touch /var/lock/subsys/oracledb ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" rm -f /var/lock/subsys/oracledb ;; esac
Use the chmod command to set the privileges to 750.
chmod 750 /etc/init.d/oracledb
Associate the
oracledb
service with the appropriate run levels and set it to auto-start using the following command.
chkconfig --add oracledb chkconfig oracledb on
B. Install and Configure Oracle EM Cloud Control 12c R5 on CentOS 7
https://www.youtube.com/watch?v=Qu2SZ6hfyos
Pre Requisites.
- RAM on Machine: 10GB
- Disk Space Free: 45GB
- Oracle 19c Installed and Running
- Swap Space: 8GB
Sequence 1. Prepare the System for OEM Cloud Control
- Install following packages with yum if not already installed:
# yum install -y binutils* compat-libcap1* compat-libstdc* compat-libstdc*i686 gcc-4.8.2 gcc-c++* glibc glibc*i686 glibc-devel libaio libaio-devel libgcc libgcc*i686 libstdc++ libstdc++*i686 libstdc++-devel # yum install -y dejavu-serif-fonts ksh make sysstat numactl numactl-devel motif motif-devel OpenSSL make binutils gcc libaio glibc-common libstdc++ sysstat
- Add or change the following lines in the "/etc/sysctl.conf" file if not added already
fs.suid_dumpable = 1 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default=4194304 net.core.rmem_max=4194304 net.core.wmem_default=262144 net.core.wmem_max=1048586
- Run the following command to change the current kernel parameters.
/sbin/sysctl -p
- Add the following lines to the "/etc/security/limits.conf" file if not added already
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 4096 oracle hard nofile 65536 oracle soft stack 10240
- Generate a Password File and Update Password of sys user (mandatory for authentication by EM Cloud Control).
$ cd $ORACLE_HOME/dbs $ orapwd file=orapworclpdb force=y password=oracle ignorecase=y format=12 $ sqlplus / as sysdba alter user sys identified by oracle; SQL > exit $ sqlplus sys/oracle as sysdba alter user sys identified by oracle; SQL> exit
- System wide parameters settings: These parameters needs to be changed for the installation. If you don’t change them, Installer will complain.
$ sqlplus sys/oracle as sysdba alter system set "_optimizer_nlj_hj_adaptive_join"= FALSE scope=both sid='*'; alter system set "_optimizer_strans_adaptive_pruning" = FALSE scope=both sid='*'; alter system set "_px_adaptive_dist_method" = OFF scope=both sid='*'; alter system set "_sql_plan_directive_mgmt_control" = 0 scope=both sid='*'; alter system set "_optimizer_dsdir_usage_control" = 0 scope=both sid='*'; alter system set "_optimizer_use_feedback" = FALSE scope=both sid='*'; alter system set "_optimizer_gather_feedback" = FALSE scope=both sid='*'; alter system set "_optimizer_performance_feedback" = OFF scope=both sid='*'; alter system set "_allow_insert_with_update_check"=true scope=both; alter system set job_queue_processes=0 scope=both; ALTER SYSTEM SET DB_SECUREFILE = 'PERMITTED';
- Repeat same for PDB
sqlplus sys/oracle@oracle:1521/orclpdb as sysdba alter system set "_optimizer_nlj_hj_adaptive_join"= FALSE scope=both sid='*'; alter system set "_optimizer_strans_adaptive_pruning" = FALSE scope=both sid='*'; alter system set "_px_adaptive_dist_method" = OFF scope=both sid='*'; alter system set "_sql_plan_directive_mgmt_control" = 0 scope=both sid='*'; alter system set "_optimizer_dsdir_usage_control" = 0 scope=both sid='*'; alter system set "_optimizer_use_feedback" = FALSE scope=both sid='*'; alter system set "_optimizer_gather_feedback" = FALSE scope=both sid='*'; alter system set "_optimizer_performance_feedback" = OFF scope=both sid='*'; alter system set "_allow_insert_with_update_check" =true scope=both; alter system set job_queue_processes=0 scope=both;
- Restart the Instance
shutdown startup
- Login as “oracle” user and download and unzip Oracle Enterprise Manager Cloud Control 13c Release 2 from
https://www.oracle.com/enterprise-manager/downloads/linux-x86-64-13c-rel2-downloads.html
- There are Seven files
- em13200_linux64.bin
- em13200_linux64-2.zip
- em13200_linux64-3.zip
- em13200_linux64-4.zip
- em13200_linux64-5.zip
- em13200_linux64-6.zip
- Create a Directory, move the downloaded files in that directory and unzip the files
$ mkdir ~/emc $ mv ~/Downloads/em* ~/emc
Sequence 2. Prepare Oracle Database 19c for Installation
- Make Changes in SQLNET.ORA for Compatibility. For this add following lines:
$ cd $ORACLE_HOME/network/admin $ vi sqlnet.ora SQLNET.ALLOWED_LOGON_VERSION_SERVER=11 SQLNET.ALLOWED_LOGON_VERSION_CLIENT=11
- Set important Parameters for Oracle Instance and CDB
$ sqlplus / as sysdba <
- Set Memory Parameters for PDB
$ sqlplus sys/[email protected]:1521/orclpdb as sysdba alter system set session_cached_cursors=600 scope=spfile sid='*'; alter system set sga_target=2G scope=spfile sid='*'; alter system set shared_pool_size=1G scope=spfile sid='*'; exit;
- Verify that parameters are changed
$ sqlplus sys/oracle as sysdba show parameter session_cached_cursors; show parameter sga_target;
Sequence 3. Install Oracle Enterprise Manager Cloud Control 13c R2
- Create the Installation directory for OEM Cloud Control “middleware” and “agent”. You will be needing these during installation.
$ mkdir –p /u01/app/oracle/middleware $ mkdir –p /u01/app/oracle/agent
- Change to directory where you have extracted the downloaded the files and run the installer.
$ cd ~/emc/ $ ./runInstaller
- Start the Oracle Management Service:
$ OMS_HOME/bin/emctl start oms
- Login at https://oracle.example.com:7803/em/ using
- User ID : sysman
- Password : you provided during installation
- Privilege Delegation. The host that will perform the scan need to be setup for privilege delegation as the scanning account needs to be configured with sudo to root. Go to Setup/Security/Privilege Delegation and select the host(s) to be used for the scan. Click on the edit icon and select the Sudoradio button and then enter:
sudo -E -u %RUNAS% %COMMAND% sqlplus sys/oracle as sysdba select username, account_status from dba_users where username='DBSNMP'; USERNAME -------------------------------------------------------------------------------- ACCOUNT_STATUS -------------------------------- DBSNMP LOCKED SQL> alter user dbsnmp identified by oracle account unlock; User altered. SQL> select username, account_status from dba_users where username='DBSNMP'; USERNAME -------------------------------------------------------------------------------- ACCOUNT_STATUS -------------------------------- DBSNMP OPEN
- Stop the Oracle Management Service:
$ $OMS_HOME/bin/emctl stop oms --all
- Change directory to the home directory for the Oracle Management Agent and stop the Management Agent:
$ $AGENT_HOME/bin/emctl stop agent
Sequence 4. Clean up for Reinstallation
- Drop the repository users:
$ sqlplus sys/oracle@oracle:1521/orclpdb as sysdba drop user SYSMAN cascade; drop user SYSMAN_MDS cascade; drop user MGMT_VIEW cascade; drop user SYSMAN_RO cascade; drop user SYSMAN_OPSS cascade; drop user SYSMAN_APM cascade; drop user SYSMAN_BIP; drop user CLOUD_SWLIB_USER cascade; drop user CLOUD_ENGINE_USER cascade; drop role MGMT_USER; drop user SYSMAN_BIPLATFORM cascade;
- Drop the synonyms:
SQL> spool synonyms.lst SQL> select 'drop '|| decode(owner,'PUBLIC',owner||' synonym '||synonym_name, ' synonym '||owner||'.'||synonym_name) ||';' from dba_synonyms where table_owner in ('SYSMAN', 'SYSMAN_MDS', 'MGMT_VIEW', 'SYSMAN_BIPLATFORM', 'SYSMAN_APM', 'SYSMAN_OPSS', 'SYSMAN_RO') ; SQL> spool off SQL> @synonyms.lst
- Drop the tablespace objects:
SQL> spool tablespaces.lst SQL> select 'drop tablespace '||tablespace_name||' including contents and datafiles;' from dba_tablespaces where tablespace_name like 'MGMT%'; SQL> spool off SQL> @tablespaces.lst
- Drop the registry objects:
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Metadata Services'; delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Authorization Policy Manager'; delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Oracle Platform Security Services';
- Delete the Directories
$ rm -rf /u01/app/oracle/middleware $ rm -rf /u01/app/oracle/agent