.com Solutions Inc. - logo  
Products - Header Buttons
.
Repgen bullet item 7b Installgen bullet item 7b FmPro Migratorbullet item 7b CGIScripter
.
.
.

.
.

Installgen - sol901 - Title Graphic

Installgen Features and Benefits

Installgen Demo Available for download...

.

#!/bin/sh
# script: 9_sol_901_ora_post_install_1.sh
# Features: This shell script creates the spfile, new Oracle DBA accounts
# changes default passwords, patches the database, installs
# database startup, backup, export and performance tuning scripts.
#
# Script Sequence#: 9
# Used By: run manually as oracle UNIX user
# Copyright 2002 by .com Solutions Inc.
#
# ---------------------- Revision History ---------------
# Date By Changes
# 9-29-2001 dsimpson Initial Release
# 9-30-2001 dsimpson Added use of environment variables for paths
# 12-18-2001 dsimpson Added change of SYS account password.
# 05-11-2002 dsimpson Moved application of patch closed to start of file,
# Added granting of execute privilege on on SYS.LT_EXPORT_PKG.
# Patch 9.0.1.3.0 is now applied to the database.
# Improved OEM setup instructions.
# 11-04-2002 dsimpson Updated for Oracle 9.2.0
# Added workaround for Oracle bug# 2448243 when
# executing SYS.LT_EXPORT_PKG during full databse exports.
# Added prompt for install of patch file.

# This output file was created by Installgen version 1.38 on Sun Nov 10 14:51:56 2002. By .com Solutions Inc. www.dotcomsolutionsinc.net

# define globally used paths/variables
ORACLE_BASE=/u01/v901
ORACLE_HOME=/u01/v901
ORACLE_OWNER=oracle
ORACLE_OWNER_PATH=/export/oracle
ORACLE_GROUP=dba
ORACLE_HOME=/u01/v901
ORACLE_SID=prod1
LD_LIBRARY_PATH=/u01/v901/lib:/u01/v901/lib64:/usr/dt/lib
CLASSPATH=$ORACLE_HOME/jdbc/lib/classes111.zip
ORAENV_ASK=NO
TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=/usr/sbin/:/bin:/usr/bin:/usr/ccs/bin:/usr/ucb/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/opt/bin:/usr/opt/SUNWmd/sbin:/usr/platform/sun4u/sbin:/opt/sfw/bin:.:/usr/local/sbin:/u01/v901/bin
TERM=vt100
NLS_LANG=AMERICAN_AMERICA.US7ASCII

export ORACLE_OWNER ORACLE_OWNER_PATH ORACLE_GROUP ORACLE_HOME ORACLE_SID ORA_BDUMP_DIR LD_LIBRARY_PATH PATH ORAENV_ASK TNS_ADMIN TERM NLS_LANG

# the rman_oem_backup variable will be =1 if rman backups are scheduled via OEM/OMS jobs
rman_oem_backup=0

# make sure the oracle user is running this script
if [ ! $LOGNAME = "$ORACLE_OWNER" ]
then
# the user running this script is not $ORACLE_OWNER - exit
echo "You must be logged in as the $ORACLE_OWNER user to run this script, exiting...."
# exit immediately!
exit
fi

echo ""
echo "Adding DBA accounts..."
echo ""
echo "Changing default Oracle database passwords:"
echo "username: SYS=s9_21sv"
echo "username: SYSTEM=Wt_47i"
echo "username: OUTLN=Wt_47i"
echo "username: DBSNMP=Wt_47i"
echo "username: ORDSYS=re-ulh"
echo "username: CTXSYS=re-ulh"
echo "username: MDSYS=re-ulh"
echo "username: WKSYS=re-ulh"


$ORACLE_HOME/bin/sqlplus /nolog << EOF
connect / as SYSDBA
set echo on
spool /u01/v901/assistants/dbca/logs/postDBCreation.log

-- enable archivelog mode
shutdown immediate;
startup mount pfile="/u01/v901/dbs/initprod1.ora";
alter database archivelog;
alter database open;
alter system archive log start;
-- change default passwords
ALTER USER SYS IDENTIFIED BY s9_21sv;
ALTER USER SYSTEM IDENTIFIED BY Wt_47i;
ALTER USER OUTLN IDENTIFIED BY Wt_47i;
ALTER USER DBSNMP IDENTIFIED BY Wt_47i;
ALTER USER ORDSYS IDENTIFIED BY "re-ulh";
ALTER USER CTXSYS IDENTIFIED BY "re-ulh";
ALTER USER MDSYS IDENTIFIED BY "re-ulh";
ALTER USER WKSYS IDENTIFIED BY "re-ulh";
ALTER USER ctxsys IDENTIFIED BY re-ulh ACCOUNT UNLOCK;
ALTER USER wksys IDENTIFIED BY re-ulh ACCOUNT UNLOCK;

-- create Oracle dba accounts
create user admin identified by zx-vnm
default tablespace users
temporary tablespace temp
quota unlimited on users;
grant connect to admin;
grant resource to admin;
grant exp_full_database to admin;
grant imp_full_database to admin;
grant sysdba to admin;
grant OEM_MONITOR to admin;
-- grant execute on LT_EXPORT_PKG to fix Bug# 1828996 referenced in
-- Oracle Support Note#159695 on 12-27-2001
grant execute on SYS.LT_EXPORT_PKG to EXP_FULL_DATABASE;
-- grant select any sequence to EXP_FULL_DATABASE role to fix Bug# 2448243
-- for Oracle 9.2.0 during full database exports.
grant select any sequence to EXP_FULL_DATABASE;
create user thedba identified by e2-76
default tablespace users
temporary tablespace temp
quota unlimited on users;
grant connect to thedba;
grant resource to thedba;
grant exp_full_database to thedba;
grant imp_full_database to thedba;
grant sysdba to thedba;
grant OEM_MONITOR to thedba;
-- grant execute on LT_EXPORT_PKG to fix Bug# 1828996 referenced in
-- Oracle Support Note#159695 on 12-27-2001
grant execute on SYS.LT_EXPORT_PKG to EXP_FULL_DATABASE;
-- grant select any sequence to EXP_FULL_DATABASE role to fix Bug# 2448243
-- for Oracle 9.2.0 during full database exports.
grant select any sequence to EXP_FULL_DATABASE;
exit;
EOF

# change Intelligent Agent password to match DBSNMP Oracle database account password
echo ""
echo "Changing Intelligent Agent password to match DBSNMP Oracle account password..."
echo "Note: Any existing OEM jobs submitted to this server will be lost."
echo "(there shouldn't be any OEM jobs yet - since this is a new server)"

/u01/v901/bin/agentctl stop
# append dbsnmp password info to snmp_rw.ora file
echo "snmp.connect.PROD1.EAST.name=\"dbsnmp\"" >> /u01/v901/network/admin/snmp_rw.ora
echo "snmp.connect.PROD1.EAST.password=\"Wt_47i\"" >> /u01/v901/network/admin/snmp_rw.ora
echo ""
echo "Please verify that the following two lines within the /u01/v901/network/admin/snmp_rw.ora file are not repeated more than once:"
echo "snmp.connect.PROD1.EAST.name=\"dbsnmp\""
echo "snmp.connect.PROD1.EAST.password=\"Wt_47i\""
echo ""
echo "--------------- snmp_rw.ora file data follows: ---------------"
cat /u01/v901/network/admin/snmp_rw.ora
echo "--------------- end of snmp_rw.ora file data ---------------"
# removing services.ora - it will be automaticall rebuilt when the agent restarts
rm /u01/v901/network/agent/services.ora
rm /u01/v901/network/agent/*.q
/u01/v901/bin/agentctl start

# ask whether to install the latest major database patch
echo "Install the latest major database patch file?(y/n)"
echo "[Select (n) if you did not download any patch files via Oracle Metalink.]"
read answer
if [ "$answer" = "y" ]
then
# apply the patch
echo ""
/export/oracle/52_sol_901_patch_db_1.sh
fi

echo ""
echo "Copying new database oratab file - to allow automatic startup of instance."
echo ""
mv /var/opt/oracle/oratab /var/opt/oracle/orig-oratab
cp /export/oracle/46_sol_oratab_1.txt /var/opt/oracle/oratab

#if [ $rman_oem_backup -eq 1 ]
#then
# determine if this machine is the OEM server - set up OEM/RMAN Repositories
if [ $ORACLE_SID = "oem1" ]
then
# The server running this script is also the OEM/OMS server
# create OMS tablespace and owner account first

$ORACLE_HOME/bin/sqlplus /nolog << "EOF"
connect / as SYSDBA
CREATE TABLESPACE "OEMTBS
HOST3" LOGGING DATAFILE '/u02/prod1/oemtbs01.dbf' SIZE 10M AUTOEXTEND ON NEXT 1M MAXSIZE 100M EXTENT MANAGEMENT LOCAL;
CREATE TABLESPACE "RMANTBS" LOGGING DATAFILE '/u02/prod1/rmantbs01.dbf' SIZE 10M AUTOEXTEND ON NEXT 1M MAXSIZE 100M EXTENT MANAGEMENT LOCAL;

create user oemuser identified by e4-43
default tablespace oemtbs
host3
temporary tablespace temp
quota unlimited on oemtbs
host3;
grant connect to oemuser;
grant resource to oemuser;
grant select_catalog_role to oemuser;
grant create trigger to oemuser;
grant create procedure to oemuser;
grant execute any procedure to oemuser;
grant create type to oemuser;
grant execute any type to oemuser;
grant select any table to oemuser;
grant select any dictionary to oemuser;

create user rman identified by rt-ut
default tablespace rmantbs
temporary tablespace temp
quota unlimited on rmantbs;
grant connect to rman;
grant resource to rman;
grant recovery_catalog_owner to rman;
exit;
EOF

echo "Step 1)The Enterprise Manager Configuration Assistant will now"
echo "be run in order to create the OEM repository on this server. "
echo ""
echo "Please peform the following steps within EMCA:"
echo "Select Configure local Oracle Management Server, press the Next button."
echo "Select Create a new repository, press the Next button."
echo "Select Custom (do not create a new database), press the Next button."
echo "Select In another existing database, press the Next button."
echo "On the Select Database for Repository page."
echo "Leave the existing SYS account name and password."
echo "Enter Service: prod1."
echo "Press the Next button."
echo "Enter User name: oemuser"
echo "Enter Password: e4-43"
echo "Confirm password: e4-43, press the Next button."
echo "Click Yes button if username is unique, otherwise enter a new user name."
echo "Press the Finish button."
echo ""
echo "After EMCA has completed, please press the Return key."
xhost + localhost
/u01/v901/bin/emca &
read answer

echo "Starting the Oracle Management Server."
/u01/v901/bin/oemctl start oms

echo "Starting the Oracle Intelligent Agent on Oracle instance oem1."
/u01/v901/bin/agentctl start

echo "Please start the Oracle Intelligent Agent on each of the other Oracle servers (using: agentctl start), then press the Return key."
read answer

echo "Step 2)The Enterprise Manager Console will now"
echo "be run in order to allow you to create the OEM administrator accounts. "
echo ""
echo "Log into the OEM Repository using the following information:"
echo "username: sysman"
echo "password: oem_temp"
echo "Note: Please change the sysman account password to: zx-vnm"
echo ""
echo "Please create the following OEM account with Super Administrator priviledges:"
echo "username: admin"
echo "password: zx-vnm"
echo ""
echo "After creating this account, please set up preferred credentials for this account for automatic database/host login."
echo ""
echo "Then log out of the Enterprise Manager Console"
echo "Please press the Return key to continue."
/u01/v901/bin/oemapp console &
read answer

echo "Step 3)Use the Enterprise Manager Console to register each database into the OEM Repository."
echo ""
echo "Log back into the Enterprise Manager Console using the new Super Administrator accoount which was just created."
echo ""
echo "Use the Enterprise Manager Console to discover all of the database nodes and databases."
echo ""
echo "Forward and reverse DNS needs to be set up for each database server host"
echo "which is managed by OEM."
echo ""
echo "The Oracle Intelligent Agent needs started on each database server (agentctl start)."
echo ""
echo "After all of the database server hosts and instances have been registered into the OEM repository, please press the Return key."
/u01/v901/bin/oemapp console &
read answer

echo "Creating RMAN repository in oem1 database instance."
/u01/v901/bin/rman << EOF
connect catalog rman/rt-ut@oem1
create catalog tablespace RMANTBS;
exit;
EOF

echo "Step 4)Run setup script 9_sol_901_ora_post_install_1.sh at each of the production servers to register each database into the RMAN repository."
echo ""
echo "Please press the Return key to continue."
read answer

echo "Step 5)Use the Enterprise Manager Console to schedule the following jobs on the OEM server:"
echo ""
echo "Nightly backups for each production database server scheduled at (4:03), using the RMAN scripts already registerd into the RMAN repository."
echo "Please press the Return key to continue."
read answer

fi
#fi

if [ $rman_oem_backup -eq 1 ]
then
# perform the following tasks if RMAN backups are scheduled via
# OEM/OMS jobs

echo "Starting Oracle Intelligent Agent..."
/u01/v901/bin/agentctl start &
echo ""

# execute the setup script to register the database into the RMAN repository and create the backup script
echo "The database prod1 is about to be registered into the RMAN catalog in the oem1 database. Please make sure that the "
echo "OMS/OEM server containing the RMAN catalog and its database oem1 is running."
echo "Then press the Return key to continue."
read answer
27_sol_901_rman_oem_setup_1.sh

echo "Please schedule the following jobs via OEM:"
echo "These jobs should be scheduled as Node/Run OS Command tasks."
echo "It is recommended that each job be submitted to the Job Library, then submitted for execution from the library."
echo ""

echo " ******** Nighly RMAN full database backup job at 4:03 ********"
echo "/opt/server_scripts/prod1_rman_oem_backup_job_1.sh"
echo "It is recommended that a full backup be immediately scheduled in order to test the OEM job subsystem."
# copy RMAN oem backup script to /opt/server_scripts directory
cp 62_sol_901_prod1_rman_oem_backup_job_1.sh /opt/server_scripts/prod1_rman_oem_backup_job_1.sh
echo ""
echo " ******** Full Oracle Database Export nightly at 11:50PM ********"
echo "/opt/server_scripts/prod1_export_full_db_1.sh"
# copy export script to /opt/server_scripts directory
cp 35_sol_prod1_export_full_db_1.sh /opt/server_scripts/prod1_export_full_db_1.sh
echo ""
echo "The OEM Console is being launched in another window."
echo "Log in with the following account info once the OEM accounts have been created on the OEM server and each of the databases have been discovered."
echo "Username: admin"
echo "Password: zx-vnm"
echo "Press the Return key once these jobs have been scheduled in OEM."
/u01/v901/bin/oemapp console &
read answer

# ask whether to install performance monitoring scripts via OEM based scheduling
echo "Install performance monitoring scripts scheduled via OEM?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# copy script to /opt/server_scripts directory
cp 59_sol_901_prod1_gather_stats_day_job_1.sh /opt/server_scripts/prod1_gather_stats_day_job_1.sh
cp 60_sol_901_prod1_gather_stats_night_job_1.sh /opt/server_scripts/prod1_gather_stats_night_job_1.sh
cp 57_sol_901_prod1_import_stats_day_job_1.sh /opt/server_scripts/prod1_import_stats_day_job_1.sh
cp 58_sol_901_prod1_import_stats_night_job_1.sh /opt/server_scripts/prod1_import_stats_night_job_1.sh
cp 56_sol_901_prod1_schema_stats_job_1.sh /opt/server_scripts/prod1_schema_stats_job_1.sh

echo "Gather daytime Oracle CBO stats Mondays at 9:00AM"
echo "/opt/server_scripts/prod1_gather_stats_day_job_1.sh"
echo "Gather nightly batch Oracle CBO stats Mondays at 9:00PM"
echo "/opt/server_scripts/prod1_gather_stats_night_job_1.sh"
echo "Import daytime Oracle CBO stats weekdays daily at 5:00AM"
echo "/opt/server_scripts/prod1_import_stats_day_job_1.sh"
echo "Import nightly Oracle CBO stats weekdays daily at 6:00PM"
echo "/opt/server_scripts/prod1_import_stats_night_job_1.sh"
echo "Gather all schema stats Fridays 9:00PM"
echo "/opt/server_scripts/prod1_schema_stats_job_1.sh"
echo ""
echo "DBMS.STATS table being created in SYS schema..."

# create the overall database stats table in the SYS schema
$ORACLE_HOME/bin/sqlplus /nolog<< EOF
connect / as SYSDBA
EXEC DBMS_STATS.CREATE_STAT_TABLE(OWNNAME=>'SYS',STATTAB=>'SYSSTATS');
exit;
EOF
echo "Press the Return key once these jobs have been scheduled in OEM."
read answer
fi
fi

if [ $rman_oem_backup -eq 0 ]
then
# ask whether to install scripts for non-OEM based scheduling
echo "Install controlfile backup to trace script?y/n"
read answer
if [ "$answer" = "y" ]
then
# copy script to /opt/server_scripts directory
cp 36_sol_prod1_controlfile_backup_to_trace_1.sh /opt/server_scripts/prod1_controlfile_backup_to_trace_1.sh

echo "This job needs to be executed via an oracle UNIX account CRON job as follows:"
echo "# ******** Nightly backup of controlfile to trace at 11:51PM ********"
echo "51 23 * * 0-6 /opt/server_scripts/prod1_controlfile_backup_to_trace_1.sh"
echo "Press the Return key once this CRON job has been entered."
read answer

fi

echo "Install RMAN backup script which doesn't use OEM server? y/n"
read answer
if [ "$answer" = "y" ]
then

# copy backup script to /opt/server_scripts directory
cp 29_sol_901_rman_backup_job_1.sh /opt/server_scripts/prod1_rman_backup_job_1.sh

# copy the restore script to /opt/server_scripts directory
cp 30_sol_901_prod1_rman_restore_db_1.sh /opt/server_scripts/prod1_rman_restore_db_1.sh

echo "This job needs to be executed via an oracle UNIX account CRON job as follows:"
echo "# ******** RMAN Full Oracle Database nightly backup at 4:03 ********"
echo "03 4 * * 0-6 /opt/server_scripts/prod1_rman_backup_job_1.sh"
echo "Press the Return key once this CRON job has been entered."
read answer

fi

echo "Install Nightly Full Database Export script - scheduled via CRON? y/n"
read answer
if [ "$answer" = "y" ]
then

# copy export script to /opt/server_scripts directory
cp 35_sol_prod1_export_full_db_1.sh /opt/server_scripts/prod1_export_full_db_1.sh

echo "This job needs to be executed via an oracle UNIX account CRON job as follows:"
echo "# ******** Full Oracle Database Export nightly at 11:50PM ********"
echo "50 23 * * 0-6 /opt/server_scripts/prod1_export_full_db_1.sh"
echo "Press the Return key once this CRON job has been entered."
read answer

fi

echo "Install Nightly Closed Database backup job - scheduled via CRON? y/n"
read answer
if [ "$answer" = "y" ]
then

# copy export script to /opt/server_scripts directory
cp 31_sol_prod1_closed_db_backup_job_1.sh /opt/server_scripts/prod1_closed_db_backup_job_1.sh

echo "This job needs to be executed via an oracle UNIX account CRON job as follows:"
echo "# ******** Closed Oracle Database backup nightly at 4:03 ********"
echo "03 4 * * 0-6 /opt/server_scripts/prod1_closed_db_backup_job_1.sh"
echo "Press the Return key once this CRON job has been entered."
read answer

fi

echo "Install Nightly Open Database backup job - scheduled via CRON? y/n"
read answer
if [ "$answer" = "y" ]
then

# copy export script to /opt/server_scripts directory
cp 33_sol_prod1_open_db_backup_job_1.sh /opt/server_scripts/prod1_open_db_backup_job_1.sh

echo "This job needs to be executed via an oracle UNIX account CRON job as follows:"
echo "# ******** Open Oracle Database backup nightly at 4:03 ********"
echo "03 4 * * 0-6 /opt/server_scripts/prod1_open_db_backup_job_1.sh"
echo "Press the Return key once this CRON job has been entered."
read answer

fi

# ask whether to install performance monitoring scripts via CRON based scheduling
echo "Install performance monitoring scripts scheduled via CRON?y/n"
read answer
if [ "$answer" = "y" ]
then
# copy script to /opt/server_scripts directory
cp 59_sol_901_prod1_gather_stats_day_job_1.sh /opt/server_scripts/prod1_gather_stats_day_job_1.sh
cp 60_sol_901_prod1_gather_stats_night_job_1.sh /opt/server_scripts/prod1_gather_stats_night_job_1.sh
cp 57_sol_901_prod1_import_stats_day_job_1.sh /opt/server_scripts/prod1_import_stats_day_job_1.sh
cp 58_sol_901_prod1_import_stats_night_job_1.sh /opt/server_scripts/prod1_import_stats_night_job_1.sh
cp 56_sol_901_prod1_schema_stats_job_1.sh /opt/server_scripts/prod1_schema_stats_job_1.sh

echo "These jobs need to be executed via oracle UNIX account CRON jobs as follows:"
echo "# ******* Gather daytime Oracle CBO stats Mondays at 9:00AM ********"
echo "00 09 * * 1 /opt/server_scripts/prod1_gather_stats_day_job_1.sh"

echo "# ******** Gather nightly batch Oracle CBO stats Mondays at 9:00PM ********"
echo "00 21 * * 1 /opt/server_scripts/prod1_gather_stats_night_job_1.sh"

echo "# ******** Import daytime Oracle CBO stats weekdays daily at 5:00AM ********"
echo "00 05 * * 1-5 /opt/server_scripts/prod1_import_stats_day_job_1.sh"

echo "# ******** Import nightly Oracle CBO stats weekdays daily at 6:00PM ********"
echo "00 18 * * 1-5 /opt/server_scripts/prod1_import_stats_night_job_1.sh"

echo "# ******** Gather Oracle CBO schema stats Fridays at 9:00PM ********"
echo "00 21 * * 5 /opt/server_scripts/prod1_schema_stats_job_1.sh"

# create the overall database stats table in the SYS schema
$ORACLE_HOME/bin/sqlplus /nolog<< EOF
connect / as SYSDBA
EXEC DBMS_STATS.CREATE_STAT_TABLE(OWNNAME=>'SYS',STATTAB=>'SYSSTATS');
exit;
EOF

echo "Press the Return key once these CRON jobs have been entered."
read answer

fi
fi

# install new version of dbshut script to insure that database can
# be shut down when the operating system goes down
mv $ORACLE_HOME/bin/dbshut $ORACLE_HOME/bin/orig-dbshut
cp 55_sol_901_dbshut_1.sh $ORACLE_HOME/bin/dbshut
chmod +x $ORACLE_HOME/bin/dbshut

# rename tasklist spreadsheet
mv 40_sol_prod1_tasklist_sheet_1.slk prod1_tasklist_sheet_1.sh

# rename timeline spreadsheet
mv 43_sol_prod1_backup_timeline_1.slk prod1_backup_timeline_1.slk


# check to see what is shared
dfshares
# ask whether to disable NFS server for Oracle CD data
echo "Disable NFS shares for Oracle CD data?y/n"

read answer
if [ "$answer" = "y" ]
then
echo "Issue the following commands from a root terminal session:"
echo ""
echo "/etc/rc3.d/S15nfs.server stop"
echo "rm /etc/dfs/dfstab"
echo "mv /etc/dfs/orig-dfstab /etc/dfs/dfstab"

fi

echo ""
echo "Removing script 41_sol_remove_oracle_1.sh for safety..."
echo ""
rm 41_sol_remove_oracle_1.sh

echo ""
echo "Making all perl and shell scripts in /opt/server_scripts executable."
echo ""
chmod +x /opt/server_scripts/*.sh
chmod +x /opt/server_scripts/*.pl



.

hline

. .

.

. .
 

Home | Products | Services | Downloads | Order | Support | Contact

Legal Notices

.
.   .
.
Home Products Services Downloads Order Support Contact