Initial Commit

This commit is contained in:
Tekaoh
2020-04-12 19:40:11 -04:00
commit ff41e8f705
8 changed files with 171 additions and 0 deletions

18
includes/odb/odb-start.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_HOSTNAME=swg;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/18/dbhome_1;
export ORACLE_SID=swg;
export ORACLE_UNQNAME=$ORACLE_SID;
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64;
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
lsnrctl start
sqlplus "/as sysdba" << EOF
startup;
exit;
EOF

18
includes/odb/odb-stop.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_HOSTNAME=swg;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/18/dbhome_1;
export ORACLE_SID=swg;
export ORACLE_UNQNAME=$ORACLE_SID;
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64;
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
sqlplus "/as sysdba" << EOF
shutdown;
exit;
EOF
lsnrctl stop

17
includes/odb/odb.service Normal file
View File

@@ -0,0 +1,17 @@
[Unit]
Description=Oracle Database Autostart
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65536
Type=simple
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/etc/odb-start.sh >> /home/oracle/odbstart.log 2>&1
ExecStop=/etc/odb-stop.sh >> /home/oracle/odbstop.log 2>&1
[Install]
WantedBy=multi-user.target

74
oinit.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/bash
#Install the dependencies
apt-get install alien autoconf automake autotools-dev binutils build-essential bzip2 elfutils expat g++ g++-multilib gawk gcc gcc-multilib ksh less lib32ncurses5 lib32z1 libaio-dev libc6 libc6-dev libc6-dev-i386 libc6-i386 libelf-dev libltdl-dev libmotif-common libmrm4 libmrm4:i386 libodbcinstq4-1 libpth-dev libpthread-stubs0-dev libstdc++5 libuil4 libuil4:i386 libxm4 libxm4:i386 rlwrap rpm sysstat unixodbc unixodbc-dev unzip zenity zlibc -y
#Setup groups and an oracle user
groupadd oinstall
groupadd dba
groupadd oper
groupadd nobody
groupadd asmadmin
useradd -g oinstall -G dba,asmadmin,oper -s /bin/bash -m oracle
echo "oracle:swg" | chpasswd
#Edit Parameters
echo '#### Oracle Kernel Parameters ####' | tee -a /etc/sysctl.conf
echo 'fs.suid_dumpable = 1' | tee -a /etc/sysctl.conf
echo 'fs.aio-max-nr = 1048576' | tee -a /etc/sysctl.conf
echo 'fs.file-max = 6815744' | tee -a /etc/sysctl.conf
echo 'kernel.shmall = 818227' | tee -a /etc/sysctl.conf
echo 'kernel.shmmax = 4189323264' | tee -a /etc/sysctl.conf
echo 'kernel.shmmni = 4096' | tee -a /etc/sysctl.conf
echo 'kernel.panic_on_oops = 1' | tee -a /etc/sysctl.conf
echo 'kernel.sem = 250 32000 100 128' | tee -a /etc/sysctl.conf
echo 'net.ipv4.ip_local_port_range = 9000 65500' | tee -a /etc/sysctl.conf
echo 'net.core.rmem_default=262144' | tee -a /etc/sysctl.conf
echo 'net.core.rmem_max=4194304' | tee -a /etc/sysctl.conf
echo 'net.core.wmem_default=262144' | tee -a /etc/sysctl.conf
echo 'net.core.wmem_max=1048576' | tee -a /etc/sysctl.conf
echo '#### Oracle User Settings ####' | tee -a /etc/security/limits.conf
echo 'oracle soft nproc 2047' | tee -a /etc/security/limits.conf
echo 'oracle hard nproc 16384' | tee -a /etc/security/limits.conf
echo 'oracle soft nofile 1024' | tee -a /etc/security/limits.conf
echo 'oracle hard nofile 65536' | tee -a /etc/security/limits.conf
echo 'oracle soft stack 10240' | tee -a /etc/security/limits.conf
/sbin/sysctl -p
#Set symlinks
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1
ln -sf /bin/bash /bin/sh
#Set Paths in Oracle bashrc
echo '# Oracle Settings' | tee -a /home/oracle/.bashrc
echo 'export TMP=/tmp;' | tee -a /home/oracle/.bashrc
echo 'export TMPDIR=$TMP;' | tee -a /home/oracle/.bashrc
echo 'export ORACLE_HOSTNAME=swg;' | tee -a /home/oracle/.bashrc
echo 'export ORACLE_BASE=/u01/app/oracle;' | tee -a /home/oracle/.bashrc
echo 'export ORACLE_HOME=$ORACLE_BASE/product/18/dbhome_1;' | tee -a /home/oracle/.bashrc
echo 'export ORACLE_SID=swg;' | tee -a /home/oracle/.bashrc
echo 'export ORACLE_UNQNAME=$ORACLE_SID;' | tee -a /home/oracle/.bashrc
echo 'export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH;' | tee -a /home/oracle/.bashrc
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64;' | tee -a /home/oracle/.bashrc
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;' | tee -a /home/oracle/.bashrc
#let's download and unpack the binary
wget https://github.com/tekaohswg/gdown.pl/archive/v1.4.zip
unzip v1.4.zip
rm v1.4.zip
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=17wfbfZuL90z4Z_FZPHK7l8FecepZ3dyP' 'LINUX.X64_180000_db_home.zip'
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=1xb0S2cYAmXZurIkzuUuVOPDw-CcjDioL' 'oracle-instantclient12.2-basiclite-12.2.0.1.0-1.i386.rpm'
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=15s_e_Z4BMxpAqsIUFwyO1tbM9SS1XFVZ' 'oracle-instantclient12.2-devel-12.2.0.1.0-1.i386.rpm'
./gdown.pl-1.4/gdown.pl 'https://drive.google.com/open?id=1FUVe89ZObP_LQN63xD1kQEpBgTmV3wbX' 'oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.i386.rpm'
rm -r gdown.pl-1.4
mkdir -p /u01/app/oracle/product/18/dbhome_1
unzip -d /u01/app/oracle/product/18/dbhome_1/ LINUX.X64_180000_db_home.zip
chown -R oracle:oinstall /u01
chmod -R 775 /u01

7
orelink.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
cd /u01/app/oracle/product/18/dbhome_1/lib/stubs
rm libc.*
cd /u01/app/oracle/product/18/dbhome_1/bin
./relink all
cd

6
oservice.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
cp ~/swg-prepare/includes/odb/odb.service /etc/systemd/system/
cp ~/swg-prepare/includes/odb/odb-start.sh /etc/
cp ~/swg-prepare/includes/odb/odb-stop.sh /etc/
systemctl enable odb.service

23
swginit.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
#get some dependencies
apt-get install alien ant bc bison build-essential clang clang-3.9 cmake default-jdk flex g++-6-multilib gcc-6-multilib git-core lib32ncurses5 lib32z1 libaio1 libaio1:i386 libboost-dev libboost-program-options-dev libc6-dbg libc6-dbg:i386 libc6-dev:i386 libc6-i686:i386 libc6:i386 libcurl4-gnutls-dev:i386 libgcc1:i386 libncurses5-dev:i386 libpcre3-dev:i386 libsqlite3-dev libxml2-dev:i386 linux-libc-dev:i386 openjdk-11-jdk:i386 openjdk-11-jdk psmisc python-ply sqlite3 zlib1g-dev:i386 zlib1g:i386 -y
apt-get remove libncurses-dev:amd64 libxml2-dev:amd64 zlib1g-dev:amd64 -y
#install oracle instantclients
alien -i --target=amd64 ~/oracle-instantclient12.2-basiclite-12.2.0.1.0-1.i386.rpm
alien -i --target=amd64 ~/oracle-instantclient12.2-devel-12.2.0.1.0-1.i386.rpm
alien -i --target=amd64 ~/oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.i386.rpm
#set env vars
touch /etc/ld.so.conf.d/oracle.conf
touch /etc/profile.d/oracle.sh
echo "/usr/lib/oracle/12.2/client/lib" | tee -a /etc/ld.so.conf.d/oracle.conf
echo "export ORACLE_HOME=/usr/lib/oracle/12.2/client" | tee -a /etc/profile.d/oracle.sh
echo "export PATH=\$PATH:/usr/lib/oracle/12.2/client/bin" | tee -a /etc/profile.d/oracle.sh
echo "export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib:/usr/include/oracle/12.2/client" | tee -a /etc/profile.d/oracle.sh
ln -s /usr/include/oracle/12.2/client $ORACLE_HOME/include
ldconfig
touch /etc/profile.d/java.sh
echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64" | tee -a /etc/profile.d/java.sh

8
swgusr.sql Normal file
View File

@@ -0,0 +1,8 @@
ALTER USER SYSTEM IDENTIFIED by "swg";
ALTER SESSION SET "_ORACLE_SCRIPT"=true;
CREATE USER swg IDENTIFIED by "swg";
GRANT ALL PRIVILEGES TO swg;
GRANT UNLIMITED TABLESPACE TO swg;
alter system set sessions=3000 scope=spfile;
alter system set processes=3000 scope=spfile;
alter profile default limit password_life_time unlimited;