Monday 27 October 2014

Function to start and stop ASM and database




Update .bashrc file with the below function to start and stop the ASM and database.

startdb()
{
. oraenv <<EOI
+ASM
EOI

echo Starting ASM

srvctl start asm

echo ASM Startup Completed

echo Starting the orcl database

srvctl start database -d orcl

echo Database Startup completed

. oraenv <<EOI
orcl
EOI

echo Starting dbconsole
emctl start dbconsole
}


stopdb()
{
. oraenv <<EOI
orcl
EOI
echo Stopping dbconsole
emctl stop dbconsole

. oraenv <<EOI
+ASM
EOI

echo Stopping the orcl database
srvctl stop database -d orcl -o immediate

echo Database Shutdown completed

echo Stopping the ASM

srvctl stop asm -f

echo ASM Shutdown completed

echo Stopping Listener
srvctl stop listener -f

echo Listener is down
}

No comments:

Post a Comment