Tag Archives: oracle database

Automatically start oracle database on linux after server reboot

Here i show you how to configure system for automatically start oracle database after server reboot.
oracle database 11g — Oracle Linux 6.3
First of all, you need to make sure that any database instances you want to auto start are set to “Y” in the /etc/oratab file

#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u0/app/oracle/product/11.2.0/dbhome_1:Y

Oracle 11g includes 2 scripts which can be used to start or shut down Oracle databases on Linux. Both scripts are in $ORACLE_HOME/bin and called dbstart and dbshut. We can add some more actions for example start enterprise manager if we create our scripts. Let’s make two scripts db_start.sh and db_stop.sh
vi /u0/app/oracle/db_start.sh

# script to start the Oracle database, listener and dbconsole
. ~/.bash_profile
# start the listener and the database
$ORACLE_HOME/bin/dbstart $ORACLE_HOME
# start the Enterprise Manager db console
$ORACLE_HOME/bin/emctl start dbconsole
exit 0

vi /u0/app/oracle/db_stop.sh

# script to stop the Oracle database, listener and dbconsole
. ~/.bash_profile
# stop the Enterprise Manager db console
$ORACLE_HOME/bin/emctl stop dbconsole
# stop the listener and the database
$ORACLE_HOME/bin/dbshut $ORACLE_HOME
exit 0

inside script we are calling the .bash_profile file of the user “oracle” for export environment variables, we need it for $ORACLE_HOME.
give execute right:
chmod u+x db_start.sh db_stop.sh
With user root, create a file called “oracle” under /etc/init.d
vi /etc/init.d/oracle

ORA_OWNER=oracle
RETVAL=0
 
case "$1" in
    'start')
        # Start the Oracle databases:
        su - $ORA_OWNER -c "/u0/app/oracle/db_start.sh"
        touch /var/lock/subsys/oracle
        ;;
    'stop')
        # Stop the Oracle databases:
        su - $ORA_OWNER -c "/u0/app/oracle/db_stop.sh"
        rm -f /var/lock/subsys/oracle
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        RETVAL=1
esac
exit $RETVAL

change permission for /etc/init.d/oracle file:
chmod 750 /etc/init.d/oracle
to create service of this script:

chkconfig --add oracle

and now we can start and stop database with:

service oracle stop
service oracle stop

Now it’s time to test our automatically startup procedure, for this reboot your server and check if your database starts automatically after reboot.

ORA-03113: end-of-file on communication channel

Hello,
While trying to open database encounter that error : ORA-03113: end-of-file on communication channel

[oracle@oel6 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Productionon Tue Sep 3 14:31:43 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size		    2232960 bytes
Variable Size		  637537664 bytes
Database Buffers	  188743680 bytes
Redo Buffers		    6590464 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 13889
Session ID: 10 Serial number: 3
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

Now see alert.log file

[oracle@oel6 admin]$ cd /u0/app/oracle/diag/rdbms/orcl/orcl/trace/
tail -100 alert_orcl.log

shows last 100 row in alert log file, which tells that
ORA-19815: WARNING: db_recovery_file_dest_size of 5368709120 bytes is 100.00% used, and has 0 remaining bytes available.
We have following choices
1) Add disk space and increase db_recovery_file_dest_size parameter
2) Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
now we show second method, delete archivelogs with operating system command.

[oracle@oel6 trace]$ . oraenv
ORACLE_SID = [+ASM] ? 
The Oracle base remains unchanged with value /u0/app/oracle
[oracle@oel6 trace]$ asmcmd
ASMCMD> cd Disks/orcl/archivelog
ASMCMD> ls
2013_06_30/
2013_07_01/
2013_07_02/
2013_07_03/
2013_07_04/
2013_07_05/
2013_07_06/
2013_07_07/
2013_07_08/
2013_07_09/
2013_07_10/
2013_07_11/
2013_07_12/
2013_09_03/
ASMCMD> rm -rf 2013_06_30/
ASMCMD> rm -rf 2013_07_01/ 
ASMCMD> rm -rf 2013_07_02/ 2013_07_03/
ASMCMD> rm -rf 2013_07_04/ 2013_07_05/ 2013_07_06/ 2013_07_07/ 2013_07_08/ 2013_07_09/ 2013_07_10/ 2013_07_11/ 2013_07_12/

after that we can startup database

[oracle@oel6 trace]$ . oraenv
ORACLE_SID = [+ASM] ? orcl
The Oracle base remains unchanged with value /u0/app/oracle
[oracle@oel6 trace]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 3 15:28:41 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size		    2232960 bytes
Variable Size		  637537664 bytes
Database Buffers	  188743680 bytes
Redo Buffers		    6590464 bytes
Database mounted.
Database opened.
SQL> 

And then use crosschek and delete expired commands.

SQL> !rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Sep 3 15:32:32 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1332821480)

RMAN> crosscheck archivelog all;
................................
................................
RMAN> delete expired archivelog all;

that’s all.
thank you.