Last active
June 9, 2016 14:13
-
-
Save mrmichalis/08dd1c9c5d2efd5a5231 to your computer and use it in GitHub Desktop.
Deploy Oracle XE 11r2
This file contains hidden or 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
# http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html | |
dd if=/dev/zero of=/tmp/swapfile bs=1024M count=2 | |
mkswap /tmp/swapfile | |
free -m | grep Swap | |
swapon /tmp/swapfile | |
rpm -Uvh oracle-xe-11.2.0-1.0.x86_64.rpm | |
/etc/init.d/oracle-xe configure | |
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh | |
sqlplus "sys as sysdba" | |
create user scm identified by cloudera; | |
grant all privileges to scm; | |
drop user scm cascade; | |
ln -s /u01/app/oracle/product/11.2.0/xe/jdbc/lib/ojdbc6.jar /usr/share/cmf/lib/ojdbc6.jar | |
/usr/share/cmf/schema/scm_prepare_database.sh -P 1521 -h $(hostname -f) oracle XE scm cloudera | |
# ORA-12516, TNS: listener could not find available handler with matching protocol stack' When Running the RunETL Process | |
vi /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora | |
job_queue_processes=400 | |
#ipv4 only | |
vi /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora | |
(ADDRESS = (PROTOCOL = TCP)(HOST = mke-4)(PORT = 1521)(IP=V4_ONLY)) | |
#!/bin/bash | |
# Oracle 11 Express (XE) Installer for Ubuntu | |
# by Carl Scharenberg, July 18, 2011, [email protected] | |
# Original blog post: http://blog.uncommonguy.com/?p=1234 | |
# | |
# Use as you like, but please leave original credits in place. | |
# Disclaimer: Use at your own risk. Don't ever blindly run scripts without | |
# knowing what they do, including this one. | |
# Assumption: you have downloaded the Oracle 11 Express debian package from | |
# http://www.oracle.com/technetwork/database/express-edition/11gxe-beta-download-302519.html | |
# http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html | |
# Change this if necessary. Perhaps version and filename will change at some point | |
ORACLE_FILE=oracle-xe_11.2.0-1.5_amd64.deb | |
# check for Oracle package in local dir | |
if [ ! -f $ORACLE_FILE ]; then | |
echo The Oracle 11 XE package $ORACLE_FILE was not found in the local dir. | |
echo | |
exit | |
fi | |
# install pre-reqs | |
echo Installing needed libraries | |
sudo apt-get -y install libaio1 bc | |
# create /sbin/chkconfig if it doesn't exist (like on Ubuntu) | |
if [[ ! -f /sbin/chkconfig ]]; then | |
echo Creating /sbin/chkconfig to emulate Red Hat control script | |
read -d '' TEXT <<"DELIM" | |
#!/bin/bash\\n | |
# Oracle 11gR2 XE installer chkconfig hack for Debian by Dude\\n | |
file=/etc/init.d/oracle-xe\\n | |
if [[ ! `tail -n1 $file | grep INIT` ]]; then\\n | |
echo >> $file\\n | |
echo '### BEGIN INIT INFO' >> $file\\n | |
echo '# Provides: OracleXE' >> $file\\n | |
echo '# Required-Start: $remote_fs $syslog' >> $file\\n | |
echo '# Required-Stop: $remote_fs $syslog' >> $file\\n | |
echo '# Default-Start: 2 3 4 5' >> $file\\n | |
echo '# Default-Stop: 0 1 6' >> $file\\n | |
echo '# Short-Description: Oracle 11g Express Edition' >> $file\\n | |
echo '### END INIT INFO' >> $file\\n | |
fi\\n | |
update-rc.d oracle-xe defaults 80 01\\n | |
DELIM | |
echo -e $TEXT > /tmp/chkconfig | |
chmod 755 /tmp/chkconfig | |
mv /tmp/chkconfig /sbin/chkconfig | |
fi | |
# install Oracle package | |
echo Starting Oracle install | |
sudo dpkg -i oracle-xe_11.2.0-1.5_amd64.deb | |
# configure Oracle | |
echo Configuring Oracle | |
sudo /etc/init.d/oracle-xe configure | |
# add Oracle environment variables to oracle user environment | |
echo "Adding environment variables to oracle user's .bashrc" | |
cat >> /u01/app/oracle/.bashrc << DELIM | |
export ORACLE_SID=XE | |
alias vi='vim' | |
export ORACLE_BASE=\$HOME | |
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/xe | |
export ORACLE_TERM=xterm | |
export _EDITOR=vim | |
export NLS_LANG=american_america.utf8 | |
export TNS_ADMIN=\$ORACLE_HOME/network/admin | |
export ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data | |
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib | |
export PATH=\$ORACLE_HOME/bin:\$PATH | |
DELIM | |
echo Finished | |
echo | |
echo Reconfigure: sudo /etc/init.d/oracle-xe configure | |
echo Stop: sudo /etc/init.d/oracle-xe stop | |
echo Start: sudo /etc/init.d/oracle-xe start | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment