Enabling Database 12c in write mode

SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE
—————————— ———-
PDB$SEED READ ONLY
PDBORCL MOUNTED

SQL> alter pluggable database PDBORCL open;

Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE
—————————— ———-
PDB$SEED READ ONLY
PDBORCL READ WRITE

#.

> alter system set session_cached_cursors=100 scope=spfile;
> alter system set processes=500 scope=spfile;
> shutdown immediate;
> startup;
> alter system set aq_tm_processes=1 scope=both;
> alter system set open_cursors=800 scope=both;

Oracle Database – Installing on OL7

# A couple of points to note :

# Make sure following package is installed :

$ yum install compat-libstdc*

# Check for relevant packages by the following command :


$ rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libXext \
libXtst \
libX11 \
libXau \
libXi \
make \
sysstat \
unixODBC \
unixODBC-devel \
zlib-devel

# During the installation perform the following when you get em related error :

1. Edit this file: /u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk

2. Change the following:
OLD: $(MK_EMAGENT_NMECTL)
NEW: $(MK_EMAGENT_NMECTL) -lnnz11

3. Retry.

# unset proxy variables

$ export unset http_proxy
$ export no_proxy

# First install the software and then set the configuration variable to configure netca and dbca

Database – Create Env


#!/bin/bash
#############################################################
# Created on: 2/17/09
# Last Updated: 07/09/09
# Version 2.1.6
#############################################################
#clear the screen
clear
#check for root user (this script must be run as root)
if [[ $EUID -ne 0 ]]; then
echo “This script must be run as root” 1>&2
exit 1
fi
# Confirm Start of Installation
echo -n “Are you sure that you want to continue? [y/n] “
read resp
if [ $resp != "Y" ] || [ $resp != "y" ]
then
echo “Exiting Installation”
exit
fi
# Create the Oracle User
echo “Creating ‘oracle’ user and groups”
echo “check if group oinstall exist:”
egrep “oinstall” /etc/group >/dev/null
if [ $? -eq 0 ]; then
echo “group: oinstall already exists”
else
groupadd oinstall
echo “group: oinstall added.”
fi
echo “check if dba group exists:”
egrep “dba” /etc/group >/dev/null
if [ $? -eq 0 ]; then
echo “group: dba already exists”
else
groupadd dba
echo “group: dba added.”
fi
echo “check to see if ‘oracle’ exists”
egrep “oracle” /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo “oracle already exists.”
else
useradd -g oinstall -G dba -d /home/oracle -m -s /bin/bash oracle
echo “user: oracle added.n”
passwd oracle
fi
# Creating Oracle Base Directory
echo “Create Oracle_Base directory”echo “Create Oracle_Base directory”
echo -e “Please enter the full of the Oracle Home”
read oh
mkdir -p $oh
chown -R oracle:oinstall $oh
# Kernel Parameter Modifications.
echo “Making kernel changes permanant by modifying /etc/sysctl.conf”
echo “# Kernel parameters required by Oracle” >> /etc/sysctl.conf
echo “kernel.msgmni = 2878″ >> /etc/sysctl.conf
echo “kernel.msgmax = 8192″ >> /etc/sysctl.conf
echo “kernel.msgmnb = 65535″ >> /etc/sysctl.conf
echo “kernel.sem = 256 32000 100 142″ >> /etc/sysctl.conf
echo “kernel.shmall = 2097152″ >> /etc/sysctl.conf
echo “kernel.shmmax = 4294967295″ >> /etc/sysctl.conf
echo “kernel.shmmni = 4096″ >> /etc/sysctl.conf
echo “fs.file-max = 131072″ >> /etc/sysctl.conf
echo “net.ipv4.ip_local_port_range = 20000 65000″ >> /etc/sysctl.conf
echo “Finished modifying /etc/sysctl.conf”
# Flush the sysctl.conf file after making the above changes.
/sbin/sysctl -p
# change to the oracle home directory
cd /home/oracle
echo “Create Environment source file:”
touch /home/oracle/infra.env
echo “ORACLE_BASE=/opt/oracle; export ORACLE_BASE” >> /home/oracle/infra.env
echo “ORACLE_HOME=$ORACLE_BASE/ias1; export ORACLE_HOME” >> /home/oracle/infra.env
echo “LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/lib:/user/local/bin; export LD_LIBRARY_PATH” >> /home/oracle/infra.env
echo “ORACLE_SID=orcl; export ORACLE_SID” >> /home/oracle/infra.env
echo “PATH=/usr/bin:$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH; export PATH” >> /home/oracle/infra.env
# Change ownership of infra.env to oracle:oinstall
chown oracle:oinstall /home/oracle/infra.env
clear
echo -e “Oracle Environment Setup is Complete.”
exit 1

OID – ODS Password Resets

# Issue : OID cannot restart, logs show the following messages :


[2016-05-04T04:02:02-07:00] [OID] [NOTIFICATION:16] [] [OIDMON] [host: oidhost] [pid: 4984] [tid: 0] Guardian: Connecting to database, connect string is oiddb

[2016-05-04T04:02:02-07:00] [OID] [NOTIFICATION:16] [] [OIDMON] [host: oidhost] [pid: 4984] [tid: 0] Guardian: [gsdsiConnect] ORA-28002, ORA-28002: the password will expire within 7 days
[2016-05-04T04:02:02-07:00] [OID] [NOTIFICATION:16] [] [OIDMON] [host: oidhost] [pid: 4984] [tid: 0] Guardian: [oidmon]: Unable to connect to database,
will retry again after 10 sec

[2016-05-04T04:02:12-07:00] [OID] [NOTIFICATION:16] [] [OIDMON] [host: oidhost] [pid: 4984] [tid: 0] Guardian: Connecting to database, connect string is oiddb

[2016-05-04T04:02:12-07:00] [OID] [NOTIFICATION:16] [] [OIDMON] [host: oidhost] [pid: 4984] [tid: 0] Guardian: [gsdsiConnect] ORA-28002, ORA-28002: the password will expire within 7 days

Solution :

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 4 04:08:34 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.
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> connect ODS/Welcome1
ERROR:
ORA-28002: the password will expire within 7 days
Connected.
SQL> PASSWORD
Changing password for ODS
Old password:
New password:
Retype new password:
Password changed

setenforce : libjvm.so: cannot restore segment prot after reloc: Permission denied

# Error :

libjvm.so: cannot restore segment prot after reloc: Permission denied


1) To temporarily disable SELinux security policy enforcement on a running system, (as root) run command:
/usr/sbin/setenforce 0

2) To permanently disable SELinux security policy enforcement during a system startup, 
(as root) change "enforcing" to "disabled" in ''/etc/selinux/config'', then reboot SELinux.

Start Database

# Set Oracle Variables

$ export ORACLE_HOME=/appl/oracle/dbsoft/product/11.2.0/dbhome_1
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=orcl

# Start the Database Instance:

$ sqlplus / as sysdba
sql> startup;

# Start the Listerner :

$ /appl/oracle/dbsoft/product/11.2.0/dbhome_1/bin/lsnrctl start
$ /appl/oracle/dbsoft/product/11.2.0/dbhome_1/bin/lsnrctl stop

# Check if Database is running ( wait for a min or two after starting the db and listener

$ sqlplus sys/Welcome1@//localhost:1521/orcl as sysdba