Home » RDBMS Server » Backup & Recovery » shutdwon script before run coldback up script in linux
shutdwon script before run coldback up script in linux [message #218075] Tue, 06 February 2007 13:20 Go to next message
pavan27
Messages: 50
Registered: December 2006
Location: bangalore
Member
Hi to every one,

i an new to Oracle DBA. and i am doing R&D on backup's and shell script.

i have a cold backup script. before run the cold backup script o want to shutdown the database. i want shutdown and startup scripts. because i want to do it automated... i am using linux AS4..

can any one send me the scripts. i find some scripts but i am unable to understand.

thanks,
Re: shutdwon script before run coldback up script in linux [message #218076 is a reply to message #218075] Tue, 06 February 2007 13:27 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> i want shutdown and startup scripts. because i want to do it automated.
It is already done for you via dbstart and dbshut scripts supplied by oracle along with oracle installation.
Those are available in $ORACLE_HOME/bin.
Edit the oratab file and add appropriate entries.
All these are also said in documentation.
>> i find some scripts but i am unable to understand.
Post those here. Someone would be happy to explain them.

Again, search the board for startup/shutdown/oratab.
There are many many examples.
Re: shutdwon script before run coldback up script in linux [message #218079 is a reply to message #218076] Tue, 06 February 2007 14:15 Go to previous messageGo to next message
pavan27
Messages: 50
Registered: December 2006
Location: bangalore
Member
Hi i got this script in the net.

#!/sbin/sh
# Start/stop Oracle database(s) found in /var/opt/oracle/oratab
# NOTE that tns listener must start AFTER this script (S98tns start)
# and stop BEFORE (K20tns stop) this script.

case "$1" in
'start')
su oracle -c "/oracle/app/oracle/product/8.1.6/bin/dbstart"
;;
'stop')
su oracle -c "/oracle/app/oracle/product/8.1.6/bin/dbshut"
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0

can any one explain me above block

i wrote one script file like this

vi shutdown.sql
set echo off
set feed off
spool shutdown.sh
select 'sqlplus "/ as sysdba"' from dual;
select 'shut immediate' from dual;
spool off;

then i got shutdown.sh file
at $sh shutdown.sh
when i tried to execute this one two things are happening
1) i am connectiong to as sysdba
2) database is not shutting down.

why? can any one explain this concept.

[Updated on: Tue, 06 February 2007 14:22]

Report message to a moderator

Re: shutdwon script before run coldback up script in linux [message #218088 is a reply to message #218079] Tue, 06 February 2007 14:57 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
First bunch of code just calls the dbshut/dbstart i was talking earlier.

>> i wrote one script file like this ....
These scripts seems to be an overkill and makes less sense.
You are selecting the (sql)commands,spooling them and running
against shell.
Instead you can directly do it a shell script

oracle@mutation#somescript
Connected.
Database closed.
Database dismounted.
ORACLE instance shut down.
--
-- these are the contents. By default 
-- oracle database identified by ORACLE_SID will be shutdown.
--
oracle@mutation#cat somescript
sqlplus -s /nolog <<EOF
connect / as sysdba
shutdown immediate
exit;
EOF

As said before, you DO NOT NEED all this.
dbstart/dbshut scripts will do that for you.
Re: shutdwon script before run coldback up script in linux [message #218122 is a reply to message #218088] Tue, 06 February 2007 22:34 Go to previous messageGo to next message
pavan27
Messages: 50
Registered: December 2006
Location: bangalore
Member
Hi Rajendran,

thanks for your suggestion. but i did not understand the concept. can you pleae send me sample script on linux so i can understand.

in this oracle@mutation#somescript
what is oracle---- is it user name
mutation ---------database name
somescript---------my script

where i have to run this statement oracle@mutation#somescript.

plese could you please send me sample script

thanks
Re: shutdwon script before run coldback up script in linux [message #218178 is a reply to message #218122] Wed, 07 February 2007 02:14 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>what is oracle---- is it user name
yes
>>mutation ---------database name
My servername
>>somescript---------my script
just a script. you can call it anything.
>>where i have to run this statement oracle@mutation#somescript.
This is not a statement.
I just wrote an script called 'somescript' and executed it.
>>plese could you please send me sample script
The one i posted is the sample script.
Understand the concepts and Write your own. Else, you will end up
in above state. Totally confused Smile.
Again, there is NO NEED for a seperated script.
The scripts dbstart and dbshut are already available in $ORACLE_HOME/bin.
Just edit your oratab file to add entries.
Previous Topic: problem while taking cold backup
Next Topic: How to drop asm disk groups which can't be mounted
Goto Forum:
  


Current Time: Wed Dec 11 23:07:27 CST 2024