Home » Infrastructure » Unix » unix shell script (AIX 5.3)
unix shell script [message #456406] Mon, 17 May 2010 13:39 Go to next message
medamadhu1
Messages: 4
Registered: May 2010
Junior Member
I am not much familar with the shell scripts.I am really having hard time with the below script,can some one please help me.


1.Validate db file placement is correct (ie. each file should be on mount point shown and no other files should be in those dirs with the exception of oradata07)

/local/$APP_NAME/oradata02/$ORACLE_SID/system_01.dbf
/local/$APP_NAME/oradata02/$ORACLE_SID/sysaux_01.dbf
/local/$APP_NAME/oradata06/$ORACLE_SID/undo_01.dbf
/local/$APP_NAME/oradata03/$ORACLE_SID/temp_01.dbf
/local/$APP_NAME/oradata07/$ORACLE_SID/tools_01.dbf
/local/$APP_NAME/oradata07/$ORACLE_SID/users_01.dbf

Redo logs make sure there are at least 3 groups with two members each and "a" files are on oradata04 and "b" files are on oradata05.
GROUP 1 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo01a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo01b.log' )
GROUP 2 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo02a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo02b.log' )
GROUP 3 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo03a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo03b.log' )

Re: unix shell script [message #456810 is a reply to message #456406] Wed, 19 May 2010 09:54 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Why do you need a shell script for this?
All these information can be retrieved from database. A simple sql can validate it.
Re: unix shell script [message #456851 is a reply to message #456810] Wed, 19 May 2010 12:38 Go to previous messageGo to next message
medamadhu1
Messages: 4
Registered: May 2010
Junior Member
Mahesh Rajendhran,

Thanks for your reply.It's actually a long task which i have broken into two parts.I was able to write a script for the 1st part but i need some help with the 2nd part.Please have a look at the whole task and let me know if u have any questions.


DB Validation:
1. Verify init.ora params are set correctly

audit_trail = DB
audit_sys_operations=TRUE
background_dump_dest = /orcl01/app/oracle/admin/$ORACLE_SID/bdump
compatible = 10.2.0
control_files = (/local/<APP_NAME>/oradata02/$ORACLE_SID /control01.ctl,
/local/<APP_NAME>/oradata06/$ORACLE_SID /control02.ctl,
/local/<APP_NAME>/oradata07/$ORACLE_SID /control03.ctl)
core_dump_dest = /orcl01/app/oracle/admin/$ORACLE_SID /cdump
log_archive_dest = /orcl01/app/oracle/admin/$ORACLE_SID /arch
log_archive_format = arc_<SID>_%s_%t_%r.log
os_authent_prefix = ""
Recyclebin = off
remote_os_authent = false
resource_limit = true
SQL92_SECURITY = TRUE
user_dump_dest = /orcl01/app/oracle/admin/$ORACLE_SID/udump

2. Validate db file placement is correct (ie. each file should be on mount point shown and no other files should be in those dirs with the exception of oradata07)

/local/$APP_NAME/oradata02/$ORACLE_SID/system_01.dbf
/local/$APP_NAME/oradata02/$ORACLE_SID/sysaux_01.dbf
/local/$APP_NAME/oradata06/$ORACLE_SID/undo_01.dbf
/local/$APP_NAME/oradata03/$ORACLE_SID/temp_01.dbf
/local/$APP_NAME/oradata07/$ORACLE_SID/tools_01.dbf
/local/$APP_NAME/oradata07/$ORACLE_SID/users_01.dbf

Redo logs make sure there are at least 3 groups with two members each and "a" files are on oradata04 and "b" files are on oradata05.
GROUP 1 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo01a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo01b.log' )
GROUP 2 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo02a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo02b.log' )
GROUP 3 ( '/local/$APP_NAME/oradata04/$DB_NAME/redo03a.log', '/local/$APP_NAME/oradata05/$DB_NAME/redo03b.log' )

Re: unix shell script [message #456855 is a reply to message #456851] Wed, 19 May 2010 13:18 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I was able to write a script for the 1st part
Please post it
Re: unix shell script [message #456856 is a reply to message #456855] Wed, 19 May 2010 14:09 Go to previous messageGo to next message
medamadhu1
Messages: 4
Registered: May 2010
Junior Member
Hi Blackswan,

Please find the script below for the first part.

#!/bin/ksh
echo
echo 'Enter Oracle Home Directory:'
read ora_home
echo
echo 'Enter init.ora file name:'
read initora
echo
echo "Please enter the app name that was used to name the mount points: "
read APP_NAME
echo "Please enter the Oracle SID: "
read DB_NAME
echo
echo


audit_trail=`grep "audit_trail" $ora_home/dbs/$initora|cut -f2 -d"="`

audit_sys_operation=`grep "audit_sys_operation" $ora_home/dbs/$initora|cut -f2 -d"="`

background_dump_dest=`grep "background_dump_dest" $ora_home/dbs/$initora|cut -f2 -d"="`

compatible=`grep "compatible" $ora_home/dbs/$initora|cut -f2 -d"="`

core_dump_dest=`grep "core_dump_dest" $ora_home/dbs/$initora|cut -f2 -d"="`

log_archive_dest=`grep "log_archive_dest" $ora_home/dbs/$initora|cut -f2 -d"="`

log_archive_format=`grep "log_archive_format" $ora_home/dbs/$initora|cut -f2 -d"="`

os_authent_prefix=`grep "os_authent_prefix" $ora_home/dbs/$initora|cut -f2 -d"="`

Recyclebin='grep "Recyclebin" $ora_home/dbs/$initora|cut -f2 -d"="`

remote_os_authent=`grep "remote_os_authent" $ora_home/dbs/$init.ora|cut -f2 -d"="`

resoucre_limit=`grep "resource_limit" $ora_home/dbs/$initora|cut -f2 -d"="`

SQL92_SECURITY=`grep "SQL92_SECURITY" $ora_home/dbs/$initora|cut -f2 -d"="`

user_dump_dest=`grep "user_dump_dest" $ora_home/dbs/$initora|cut -f2 -d"="`

control_files=`grep "control_files" $ora_home/dbs/$initora|cut -f2 -d"="`


if ( [ ${audit_trail:-1} = "DB" ])
then
echo "audit_trail parameter matched"
else
echo "audit_trail parameter not matched"
fi

if ( [ ${audit_sys_operation:-1} = "TRUE" ])
then
echo "audit_sys_operation parameter matched"
else
echo "audit_sys_operation parameter not matched"
fi

if ( [ ${background_dump_dest:-1} = "/orcl01/app/oracle/admin/$ORACLE_SID/bdump"])
then
echo "background_dump_dest parameter matched"
else
echo "background_dump_dest parameter not matched"
fi

if ( [ ${compatible:-1} = "10.2.0"])
then
echo "compatible matched"
else
echo " compatible not matched"
fi

if ( [ ${core_dump_dest:-1} = "/orcl01/app/oracle/admin/$ORACLE_SID /cdump"])
then
echo "core_dump_dest parameter matched"
else
echo "core_dump_dest parameter not matched"
fi

if ( [ ${log_archive_dest:-1} = "/orcl01/app/oracle/admin/$ORACLE_SID /arch"])
then
echo "log_archive_dest parameter matched"
else
echo "log_archive_dest parameter not matched"
fi

if ( [ ${"log_archive_format:-1} = "arc_<SID>_%s_%t_%r.log"])
then
echo "log_archive_format parameter matched"
else
echo " log_archive_format parameter not matched"
fi

if ( [ ${"os_authent_prefix:-1} = ""])
then
echo "os_authent_prefix parameter matched"
else
echo "os_authent_prefix parameter not matched"
fi

if ( [ ${"Recyclebin:-1} = "off"])
then
echo "Recyclebin matched"
else
echo " Recyclebin not matched"
fi

if ( [ ${"remote_os_authent:-1} = "false"])
then
echo "remote_os_authent parameter matched"
else
echo "remote-os_authent parameter not matched"
fi

if ( [ ${"resource_limit:-1} = "true"])
then
echo "resource_limit parameter matched"
else
echo "resource_limit parameter not matched"
fi

if ( [ ${"SQL92_SECURITY:-1} = "TRUE"])
then
echo "SQL92_SECURITY parameter matched"
else
echo "SQL92_SECURITY parameter not matched"
fi

if ( [ ${"user_dump_dest:-1} = "/orcl01/app/oracle/admin/$ORACLE_SID/udump"])
then
echo "user_dump_dest parameter matched"
else
echo " user_dump_dest parameter not matched"
fi

if ( [ ${"control_files:-1} = "(/local/<APP_NAME>/oradata02/$ORACLE_SID /control01.ctl,
/local/<APP_NAME>/oradata06/$ORACLE_SID /control02.ctl,
/local/<APP_NAME>/oradata07/$ORACLE_SID /control03.ctl)"])
then
echo "control_files parameter matched"
else
echo "control_files parameter not matched"
fi

done
Re: unix shell script [message #456858 is a reply to message #456856] Wed, 19 May 2010 14:21 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
In my opinion using shell script to "check" contents of DB is like using a hammer to divide a board into 2 pieces of lumber.

If you created a lookup table inside the DB containing parameter name & value, a single SELECT does the same as your whole script.
Previous Topic: Uninstalling Oracle on Solaris 10 x86
Next Topic: errors while running the script
Goto Forum:
  


Current Time: Thu Nov 21 10:12:16 CST 2024