Created
April 18, 2017 22:27
-
-
Save yonglai/367712ec7c925a5ab07e7798649b0469 to your computer and use it in GitHub Desktop.
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
#! /bin/bash | |
echo run generated script | |
/opt/oracle/product/12.1.0/dbhome_1/root.sh | |
/opt/oraInventory/orainstRoot.sh | |
echo configure Oracle | |
su -l oracle -c "touch /home/oracle/cfgrsp.properties" | |
chmod 600 /home/oracle/cfgrsp.properties | |
su -l oracle -c "cat <<EOT >> /home/oracle/cfgrsp.properties | |
oracle.assistants.server|S_SYSPASSWORD=Oracle123 | |
oracle.assistants.server|S_SYSTEMPASSWORD=Oracle123 | |
oracle.assistants.server|S_DBSNMPPASSWORD=Oracle123 | |
oracle.assistants.server|S_PDBADMINPASSWORD=Oracle123 | |
oracle.assistants.server|S_EMADMINPASSWORD=Oracle123 | |
oracle.assistants.server|S_ASMSNMPPASSWORD=Oracle123 | |
EOT" | |
su -l oracle -c "/opt/oracle/product/12.1.0/dbhome_1/cfgtoollogs/configToolAllCommands RESPONSE_FILE=/home/oracle/cfgrsp.properties" | |
su -l oracle -c "cat <<EOT >> /home/oracle/.bashrc | |
ORACLE_HOME=/opt/oracle/product/12.1.0/dbhome_1 | |
ORACLE_SID=orcl | |
export ORACLE_HOME ORACLE_SID | |
export PATH=$PATH:/opt/oracle/product/12.1.0/dbhome_1/bin | |
EOT" | |
echo create Oracle startup script | |
touch /etc/systemd/system/oracle.service | |
chmod 644 /etc/systemd/system/oracle.service | |
cat <<EOT >> /etc/systemd/system/oracle.service | |
[Unit] | |
Description=Oracle database server | |
After=syslog.target network.target | |
[Service] | |
Type=oneshot | |
User=oracle | |
Group=oinstall | |
RemainAfterExit=yes | |
ExecStart=/bin/oracle.sh | |
Environment=ORACLE_HOME=/opt/oracle/product/12.1.0/dbhome_1 | |
Environment=ORACLE_BASE=/opt/oracle | |
Environment=ORACLE_SID=orcl | |
[Install] | |
WantedBy=multi-user.target | |
EOT | |
touch /bin/oracle.sh | |
chown :oinstall /bin/oracle.sh | |
chmod 750 /bin/oracle.sh | |
cat <<EOT >> /bin/oracle.sh | |
#! /bin/bash | |
# script used by oracle.service | |
/opt/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start | |
/opt/oracle/product/12.1.0/dbhome_1/bin/dbstart /opt/oracle/product/12.1.0/dbhome_1 | |
EOT | |
sed -i 's/N/Y/g' /etc/oratab | |
systemctl daemon-reload | |
systemctl enable oracle.service | |
echo create bpmadm user in Oracle | |
su -l oracle -c "sqlplus / as sysdba <<EOF | |
create user bpmadm identified by bpmadm; | |
grant connect, all privileges to bpmadm; | |
EOF | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment