Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

11gr2 software post installation, dbstart/dbshut scripts which come with an Oracle install,shut down multiple db same time

You can use the dbstart/dbshut scripts which come with an Oracle install. They are available
under  $ORACLE_HOME/bin.

After a fresh install you have to edit the /etc/oratab file:
# cat /etc/oratab
# sed -i 's/:N$/:Y/' /etc/oratab

# grep my_sid /etc/oratab

Then you can use the scripts like this:
$ whoami
$ dbstart $ORACLE_HOME
$ # execute DB jobs ...
$ dbshut $ORACLE_HOME

dbstart brings all up which is needed for Pro*C/OCI programs.
Using dbstart/dbshut is an improvement above the custom method mentioned in the question:
method                time    called tools
dbstart              5.7 s    lsnrctl, sqlplus
dbshut               5.7 s    lsnrctl, sqlplus
custom startup      27.9 s    lsnrctl, sqlplus, emctl
custom shutdown     31.0 s    lsnrctl, sqlplus, emctl
(times on a Core i7/2.8GHz system, slow spinning hard disk.)

How dbstart/dbshut work
A dbstart $ORACLE_HOME$ call is basically equivalent to:
$ lsnrctl start
$ echo -e 'connect / as sysdba\nstartup\nquit'| sqlplus /nolog

And a dbshut $ORACLE_HOME$ is basically equivalent to:
$ lsnrctl stop
$ echo -e 'connect / as sysdba\nshutdown\nquit'| sqlplus /nolog
(you can verify if everything is shutdown via ps aux | grep 'tnsl\|ora')

Note that the order of the commands is important. That means when lsnrctl start is executed after the sqlplus-startup command then the Pro*C/OCI program still complains about an unavailable TNS-listener.
And this is exactly the problem with the command sequence in the question - where the emctl start just workarounds the wrong order because it fixes the TNS-listener setup part.
Also note that for executing Pro*C/OCI programs the EMCTL service is not needed.


Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction