Last active
August 13, 2016 22:55
-
-
Save thiagokronig/97c3f3ff5895eb4cb09d to your computer and use it in GitHub Desktop.
Oracle 11.2.0 em Centos 6.4 x86_64 com VirtualBox 4.2.12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Oracle 11.2.0 em Centos 6.4 x86_64 com VirtualBox 4.2.12 | |
# | |
# VM Configuration | |
# oracle11g.ova | |
# | |
# 4 CPUS | |
# 4128 MB RAM | |
# | |
# IDE: PIIX4: use host i/o cache | |
# SATA: AHCI: 4 ports: use host i/o cache | |
# | |
# oracle11g-disk1.vmdk 24GB SATA 0 sda | |
# oracle11g-disk2.vmdk 80GB SATA 1 sdb | |
# cd/dvd with oraclelinux SATA 3 scd0 | |
# | |
# VM Network | |
# eth0 | |
# nat | |
# 080027DD12A3 | |
# dhcp | |
# | |
# eth1 | |
# host-only adapter | |
# promiscuos mode deny | |
# 0800274B5B95 | |
# 192.168.56.100/24 | |
# | |
# VirtualBox Host-Only Adapter | |
# 192.168.56.1/24 | |
# Work network (define some gateway) | |
# | |
# Shared folder | |
# share, com auto-mount e full access | |
# | |
# Oracle | |
# instância: ora11g em 192.168.56.100:1521 | |
# web-manager: https://192.168.56.100:1158/em | |
# | |
# Referências: | |
# - http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:database:oracle10g_centos55 | |
# Instalação | |
# PART I | |
echo Configuring default environment | |
cat >/etc/hosts <<EOF | |
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 oracle11g | |
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 oracle11g | |
192.168.56.100 localhost localhost.localdomain localhost6 localhost6.localdomain6 oracle11g | |
EOF | |
echo "group_package_types=mandatory" >>/etc/yum.conf | |
yum install -y vim lynx wget | |
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm | |
yum install -y rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm | |
yum install -y vim lynx wget man man-pages bash-completion p7zip | |
yum groupinstall -y Development Tools | |
# https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-analyzeperf-tuned.html | |
yum install tuned -y | |
chkconfig tuned on | |
service tuned start | |
tuned-adm profile virtual-guest | |
tuned-adm active | |
yum update -y | |
# Probably best: shutdown -r now | |
# PART II Oracle: kernel config and libs | |
yum install -y binutils.x86_64 compat-libcap1.x86_64 compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.x86_64 glibc-devel.i686 ksh libgcc.i686 libgcc.x86_64 libstdc++.x86_64 libstdc++.i686 libstdc++-devel.x86_64 libstdc++-devel.i686 libaio.x86_64 libaio.i686 libaio-devel.x86_64 libaio-devel.i686 make sysstat.x86_64 | |
sed 's/\(^tmpfs.*\)defaults/\1 size=3g/' </etc/fstab >/etc/fstab.new | |
mv -f /etc/fstab.new /etc/fstab | |
mount -t tmpfs shmfs -o size=3g /dev/shm | |
cat >>/etc/sysctl.conf <<EOF | |
fs.aio-max-nr = 1048576 | |
fs.file-max = 6815744 | |
kernel.sem = 250 32000 100 128 | |
net.ipv4.ip_local_port_range = 9000 65500 | |
net.core.rmem_default = 262144 | |
net.core.rmem_max = 4194304 | |
net.core.wmem_default = 262144 | |
net.core.wmem_max = 1048576 | |
EOF | |
cat >>/etc/security/limits.conf <<EOF | |
oracle soft nproc 2047 | |
oracle hard nproc 16384 | |
oracle soft nofile 1024 | |
oracle hard nofile 65536 | |
oracle soft stack 10240 | |
EOF | |
# http://eduardo-lago.blogspot.com.br/2012/01/how-to-install-oracle-11g-database.html | |
cat >>/etc/pam.d/login <<EOF | |
session required /lib64/security/pam_limits.so | |
session required pam_limits.so | |
EOF | |
cat >>/etc/profile.d/custom.sh <<EOF | |
#!/bin/bash | |
if [ $USER = "oracle" ]; then | |
if [ $SHELL = "/bin/ksh" ]; then | |
ulimit -p 16384 | |
ulimit -n 65536 | |
else | |
ulimit -u 16384 -n 65536 | |
fi | |
fi | |
EOF | |
chmod +x /etc/profile.d/custom.sh | |
sysctl -p | |
# PART III - Installation: Insert linux.iso em /dev/scd0 | |
groupadd -g 501 oinstall | |
groupadd -g 502 dba | |
useradd -u 501 -g oinstall -G dba oracle | |
passwd oracle <<EOF | |
oracle | |
oracle | |
EOF | |
mkdir -p /oracle/app/oraInventory | |
chown -R oracle:oinstall /oracle/app/oraInventory | |
chmod -R 775 /oracle/app/oraInventory | |
mkdir -p /oracle/app/oracle | |
chown -R oracle:oinstall /oracle/app/oracle | |
chmod -R 775 /oracle/app/oracle | |
umount /dev/vgoracle/lvoradata | |
mkfs.ext4 -T largefile /dev/vgoracle/lvoradata | |
mount -a | |
mkdir -p /oradata/app/oracle | |
chown -R oracle:oinstall /oradata/app/oracle | |
chmod -R 775 /oradata/app/oracle | |
cat >/etc/oraInst.loc <<EOF | |
inventory_loc=/oracle/app/oraInventory | |
inst_group=oinstall | |
EOF | |
chown oracle:oinstall /etc/oraInst.loc | |
chmod 664 /etc/oraInst.loc | |
su - oracle | |
cat >>/home/oracle/.bash_profile <<\EOF | |
umask 022 | |
TMP=/tmp | |
TMPDIR=$TMP | |
export TMP | |
export TMPDIR | |
ORACLE_BASE=/oracle/app/oracle | |
ORACLE_SID=ora11g | |
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome | |
ORACLE_HOME_NAME=dbhome | |
ORACLE_HOSTNAME=192.168.56.100 | |
ORACLE_UNQNAME=ora11g | |
KRONIG_ORADATA=/oradata/app/oracle | |
ORACLE_HOME_LISTNER=LISTENER | |
ORACLE_DATAFILE=/oradata/app/oracle/oradata | |
ORACLE_RECOVERY=/oradata/app/oracle/fast_recovery_area | |
export ORACLE_BASE | |
export ORACLE_SID | |
export ORACLE_HOME | |
export ORACLE_HOME_NAME | |
export ORACLE_HOSTNAME | |
export ORACLE_UNQNAME | |
export KRONIG_ORADATA | |
export ORACLE_HOME_LISTNER | |
export ORACLE_DATAFILE | |
export ORACLE_RECOVERY | |
LD_LIBRARY_PATH=$ORACLE_HOME/lib | |
PATH=$ORACLE_HOME/bin:$PATH | |
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib | |
export LD_LIBRARY_PATH | |
export PATH | |
export CLASSPATH | |
EOF | |
source /home/oracle/.bash_profile | |
cat >/home/oracle/netca.rsp <<EOF | |
[GENERAL] | |
RESPONSEFILE_VERSION="11.2" | |
CREATE_TYPE="CUSTOM" | |
SHOW_GUI=false | |
[oracle.net.ca] | |
INSTALLED_COMPONENTS={"server","net8","javavm"} | |
INSTALL_TYPE=""typical"" | |
LISTENER_NUMBER=1 | |
LISTENER_NAMES={"$ORACLE_HOME_LISTNER"} | |
LISTENER_PROTOCOLS={"TCP;1521"} | |
LISTENER_START=""$ORACLE_HOME_LISTNER"" | |
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} | |
NSN_NUMBER=1 | |
NSN_NAMES={"EXTPROC_CONNECTION_DATA"} | |
NSN_SERVICE={"PLSExtProc"} | |
NSN_PROTOCOLS={"TCP;$ORACLE_HOSTNAME;1521"} | |
EOF | |
exit | |
# PART IV - Input linux.x64_11R2_database.iso into scd0 | |
mkdir -p /media/cdrom | |
mkdir -p /tmp/orainstaller | |
mount /dev/scd0 /media/cdrom | |
cp -rv /media/cdrom/* /tmp/orainstaller/ | |
umount /dev/scd0 | |
chown -R oracle:oinstall /tmp/orainstaller | |
chmod -R 775 /tmp/orainstaller | |
# PART V - Real Installation | |
su - oracle -c 'echo y | /tmp/orainstaller/database/runInstaller \ | |
-silent \ | |
oracle.install.option=INSTALL_DB_SWONLY \ | |
oracle.install.db.InstallEdition=EE \ | |
oracle.install.db.DBA_GROUP=dba \ | |
oracle.install.db.OPER_GROUP=dba \ | |
DECLINE_SECURITY_UPDATES=true \ | |
\ | |
3>&1 | cat' | |
/oracle/app/oracle/product/11.2.0/dbhome/root.sh \ | |
3>&1 | cat | |
su - oracle -c 'netca \ | |
/silent \ | |
/responsefile /home/oracle/netca.rsp \ | |
\ | |
3>&1 | cat' | |
su - oracle -c 'dbca \ | |
-silent \ | |
-responseFile NO_VALUE \ | |
-createDatabase \ | |
-templateName General_Purpose.dbc \ | |
-gdbname $ORACLE_SID \ | |
-sid $ORACLE_SID \ | |
-sysPassword oracle \ | |
-systemPassword oracle \ | |
-emConfiguration LOCAL \ | |
-dbsnmpPassword oracle \ | |
-sysmanPassword oracle \ | |
-datafileDestination $ORACLE_DATAFILE \ | |
-redoLogFileSize 2048 \ | |
-recoveryAreaDestination $ORACLE_RECOVERY \ | |
-storageType FS \ | |
-characterSet AL32UTF8 \ | |
-listeners $ORACLE_HOME_LISTNER \ | |
-automaticMemoryManagement TRUE\ | |
\ | |
3>&1 | cat' | |
# PART VI - Auto INIT | |
sed 's/:N$/:Y/' </etc/oratab >/etc/oratab.new | |
mv -f /etc/oratab.new /etc/oratab | |
chown oracle:oinstall /etc/oratab | |
chmod 664 /etc/oratab | |
cat >/etc/init.d/dbora <<\EOF | |
#!/bin/sh | |
# chkconfig: 345 99 10 | |
# description: Oracle auto start-stop script. | |
# | |
# Set ORA_OWNER to the user id of the owner of the | |
# Oracle database software. | |
# | |
# http://www.oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux.php | |
ORA_OWNER=oracle | |
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 "/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" | |
touch /var/lock/subsys/dbora | |
;; | |
'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 "/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" | |
rm -f /var/lock/subsys/dbora | |
;; | |
esac | |
EOF | |
mkdir -p /home/oracle/scripts | |
cat >/home/oracle/scripts/startup.sh <<\END_STARTUP | |
#!/bin/bash | |
source /home/oracle/.bash_profile | |
# Start DB Console | |
emctl start dbconsole | |
# Start Listener | |
lsnrctl start | |
# Start Database | |
sqlplus / as sysdba << EOF | |
STARTUP; | |
EXIT; | |
EOF | |
END_STARTUP | |
cat >/home/oracle/scripts/shutdown.sh <<\END_SHUTDOWN | |
#!/bin/bash | |
source /home/oracle/.bash_profile | |
# Stop Database | |
sqlplus / as sysdba << EOF | |
SHUTDOWN IMMEDIATE; | |
EXIT; | |
EOF | |
# Stop Listener | |
lsnrctl stop | |
# Stop DB Console | |
emctl stop dbconsole | |
END_SHUTDOWN | |
chown -R oracle.oinstall /home/oracle/scripts | |
chmod -R u+x /home/oracle/scripts/* | |
chmod 750 /etc/init.d/dbora | |
chkconfig --add dbora | |
chkconfig dbora on | |
# VII - GUEST ADDITIONS | |
yum --enablerepo rpmforge install dkms -y | |
yum install kernel-devel -y | |
mount /dev/scd0 /media/cdrom | |
/media/cdrom/VBoxLinuxAdditions.run | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment