Sunday, 10 September 2017

Oracle Database 12c Release 1 (12.1.0) Installation On Redhat 7/CentOS 7


This article is a walk-through on Oracle Database 12c Installation on CentOS7/Redhat 7
The article is based on a server installation with a minimum of 2G swap and secure Linux set to permissive.


Download Software

Oracle Database 12c Release 1 (12.1.0.2.0) 64Bit (Click here)

Download the Oracle software from OTN or MOS depending on your support status.

Unpack Files on mount

Unzip the database files :


mkdir /u01

unzip linuxamd64_12102_database_1of2.zip -d /u01
unzip linuxamd64_12102_database_2of2.zip -d /u01

You should now have a single directory called "database" containing installation files.

Hosts File


The "/etc/hosts" file must contain a fully qualified name for the server.


# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.202.131 prodserver11

Set the correct hostname in the "/etc/hostname" file.

Preparing for Oracle 12c Installation

1.  Make sure that all the packages currently installed on your RHEL/CentOS 7 system are updated to their latest versions.


$ yum -y update

2.  Add the following kernel parameters to /etc/sysctl.conf file.


vi /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

Run the following command's to change the current kernel parameters.


# sysctl -p
# sysctl -a

3.  Set the limits for oracle in /etc/security/limits.conf file.


oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

4.  Add the following line to the "/etc/pam.d/login" file, if it does not already exist.


vi /etc/pam.d/login

session    required     pam_limits.so

5.  Install all the required dependencies for the RDBMS, along with the zip and unzip          packages.


yum -y install binutils \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
gcc \
gcc-c++ \
glibc \
glibc.i686 \
glibc-devel \
glibc-devel.i686 \
ksh \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libXext \
libXext.i686 \
libXtst \
libXtst.i686 \
libX11 \
libX11.i686 \
libXau \
libXau.i686 \
libxcb \
libxcb.i686 \
libXi \
libXi.i686 \
make \
sysstat \
unixODBC \
unixODBC-devel \
zlib-devel \
xorg-x11-app* \
elfutils-libelf-devel  ;

6.  Create the user account and groups for Oracle.

# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle

Finally, set a password for the newly created oracle account.
passwd oracle

Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.


SELINUX=permissive

Once the change is complete, restart the server or run the following command.
# setenforce Permissive

Disable Firewall if required 
# systemctl stop firewalld
# systemctl disable firewalld

7.  Add oracle user to wheel group (optional)


# visudo

Find the lines in the file that grant sudo access to users in the group wheel when enabled.Uncomment it 
## Allows people in group wheel to run all commands
 %wheel        ALL=(ALL)       ALL


usermod -aG wheel oracle

8.  Before proceeding, create other directories that will be used during the actual              installation, and assign the necessary permissions.


# chown -R oracle:oinstall /u01
# chmod -R 775 /u01
# chmod g+s /u01

# mkdir -p /u01/app/oracle/product/12.1.0/dbhome_1
# chown -R oracle:oinstall /u01
# chmod g+s /u01

9.  Set Environmental Variables :

 Login as oracle using the password that was chosen previously and add the following lines      to .bash_profile file.


su - oracle 

vi .bash_profile

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=PRODSERVER11; export ORACLE_HOSTNAME
ORACLE_UNQNAME=PRODSERVER11; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=PRODSERVER11; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

Installation :

Login to console as root and open a terminal window within CDE. If you are using X emulation then set the DISPLAY environmental variable.


# DISPLAY=:0.0
# export DISPLAY
# xhost +

Log into the oracle user and then set the DISPLAY environmental variable


# su - oracle
# DISPLAY=:0.0
# export DISPLAY

Open a GUI session in the RHEL/CentOS 7 server and launch the installation script.


$ cd /u01/database 
./runInstaller

1.   Enter the email address associated with your Oracle account (optional).




2.  Select Install option :





3.  Select Server Class :




4.  Database Installation Option :




5.  Select Install Type :



6.  Typical Install Configuration :



7.  Create Inventory :



8.  Perform Prerequisite Checks:




9.  Install Product :



10.  Execute Configuration script 


# cd /u01/app/oraInventory
# ./orainstRoot.sh
# cd /u01/app/oracle/product/12.2.0/dbhome_1
# ./root.sh


11. Database Configuration Assistant



12.  Finish 




Set Oratab File :
When the oraenv script is run, it reads the oratab filefound in /etc to determine where the Oracle home for a given database is located. 
The oratab file contains entries in the form of ORACLE_SID:ORACLE_HOME:Y


$ vi /etc/oratab
 
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
prodserver:/u01/app/oracle/product/12.2.0/dbhome_1:Y


listener.ora
The "listerner.ora" file contains server side network configuration parameters. It can be found in the "$ORACLE_HOME/network/admin"



cd $ORACLE_HOME/network/admin

$ vi listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS =(PROTOCOL = TCP)(HOST = prodserver11)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = PRODSERV)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
      (SID_NAME = prodserver)
    )
  )

LISTENER_12C=
 (DESCRIPTION=
  (ADDRESS=(PROTOCOL=TCP)(HOST=prodserver11)(PORT=1526)))
ADR_BASE_LISTENER_12C = /u01/app/oracle/
LOG_DIRECTORY_LISTENER = /u01/app/oracle/product/12.2.0/dbhome_1/network/log
LOG_FILE_LISTENER = listener.log
TRACE_DIRECTORY_LISTENER = /u01/app/oracle/product/12.2.0/dbhome_1/network/trace

To get GLOBAL_DBNAME use :


SQL> SELECT * FROM GLOBAL_NAME;

GLOBAL_NAME
--------------------------------------------------------------------------------
PRODSERV


To get SID_NAME and SERVICE_NAME
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
prodserver

Here prodserver11 is the hostname


tnsnames.ora


The tnsnames.ora file is a configuration file that contains network service names mapped to connect descriptors for the local naming method, or net service names mapped to listener protocol addresses.It can be found in $ORACLE_HOME/network/admin

$ vi  tnsnames.ora

prodserv =
  (description =
    ( address = ( protocol = tcp ) ( host = prodserver11 ) ( port = 1521 ) )
    ( connect_data = ( service_name = prodserver ) )
  )

prodserv11 =
  (description =
    ( address = ( protocol = tcp ) ( host = prodserver11 ) ( port = 1526 ) )
    ( connect_data = ( service_name = prodserver ) )
  )


sqlnet.ora

The sqlnet.ora file is the profile configuration file. It resides on the client machines and the database server. 
Profiles are stored and implemented using this file. 
The database server can be configured with access control parameters in the sqlnet.ora file.


$ vi  sqlnet.ora

# sqlnet.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

#NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


Create table 


SQL> define ;
DEFINE _DATE           = "10-SEP-17" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "prodserver" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1202000100" (CHAR)
DEFINE _EDITOR         = "vi" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production" (CHAR)
DEFINE _O_RELEASE      = "1202000100" (CHAR)
SQL>

CREATE TABLE NamesTBL (id   NUMBER GENERATED AS IDENTITY,name VARCHAR2(20));


SQL> INSERT INTO NamesTBL (name) VALUES ('Gabriel');
SQL> INSERT INTO NamesTBL (name) VALUES ('Admin');
SQL> SELECT * FROM NamesTBL;

Check Instance Status 


$ ps -ef | grep smon
oracle   22481     1  0 16:34 ?        00:00:00 ora_smon_prodserver


SQL> SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS FROM V$INSTANCE;
SQL > SELECT OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;

Output :



SQL> SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS FROM V$INSTANCE;

INSTANCE_NAME    STATUS       DATABASE_STATUS
---------------- ------------ -----------------
prodserver       OPEN         ACTIVE


SQL> SELECT OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           PRIMARY


Startup Details :



set lines 150
column host_name format a13
col STARTUP_TIME for a24
select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,to_char(STARTUP_TIME,'DD/MM/YYYY HH:MI:SS AM') startup_time,STATUS,DATABASE_STATUS from gv$instance order by instance_number; 


INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME     STARTUP_TIME             STATUS       DATABASE_STATUS
--------------- ---------------- ------------- ------------------------ ------------ -----------------
              1 prodserver       prodserver11  10/09/2017 04:34:34 PM   OPEN         ACTIVE


Start Listener 

$ lsnrctl start LISTENER
$ lsnrctl start LISTENER_12C

Check the Status :

$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 10-SEP-2017 18:47:09

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=prodserver11)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                10-SEP-2017 16:22:06
Uptime                    0 days 2 hr. 25 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/prodserver11/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prodserver11)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "PRODSERV" has 1 instance(s).
  Instance "prodserver", status UNKNOWN, has 1 handler(s) for this service...
Service "prodserver" has 1 instance(s).
  Instance "prodserver", status READY, has 1 handler(s) for this service...
Service "prodserverXDB" has 1 instance(s).
  Instance "prodserver", status READY, has 1 handler(s) for this service...
The command completed successfully


$ lsnrctl status LISTENER_12C

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 10-SEP-2017 18:47:26

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=prodserver11)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_12C
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                10-SEP-2017 16:22:15
Uptime                    0 days 2 hr. 25 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/prodserver11/listener_12c/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prodserver11)(PORT=1526)))
The listener supports no services
The command completed successfully

Setup Database Recovery Destination :

The db_recovery_file_dest parameter defines the location of the Flash Recovery Area (FRA) and the db_recovery_file_dest parameter specifies the default location for the recovery area. 

SQL> show parameter db_recovery_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string
db_recovery_file_dest_size           big integer 0


$ cd /u01/app/oracle/
$ mkdir flash_recovery_area


ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 5G SCOPE=BOTH SID='*';
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/u01/app/oracle/flash_recovery_area' SCOPE=BOTH SID='*';


SQL> show parameter db_recovery_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/flash_recovery
                                                 _area
db_recovery_file_dest_size           big integer 5G


SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
SQL> SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE;

Trace file location :


SQL> SELECT VALUE FROM V$DIAG_INFO WHERE NAME = 'Default Trace File';

VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/prodserver/prodserver/trace/prodserver_ora_28250.trc

To determine the trace file for each Oracle Database process:

SELECT PID, PROGRAM, TRACEFILE FROM V$PROCESS;

Running a Database in ARCHIVELOG Mode

To change the archiving mode of the database, use the ALTER DATABASE statement with the ARCHIVELOG or NOARCHIVELOG clause.


SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch
Oldest online log sequence     11
Current log sequence           13

Shut down the database instance.


SQL> SHUTDOWN IMMEDIATE 

Start a new instance and mount


SQL> STARTUP MOUNT 

Change the database archiving mode. Then open the database for normal operations.


SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE OPEN;

Shut down the database.

SQL> SHUTDOWN IMMEDIATE


SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch
Oldest online log sequence     11
Next log sequence to archive   13
Current log sequence           13

You can switch to the log file to see that an archive is written to archive log location.

SQL> ALTER SYSTEM SWITCH LOGFILE;


$ cd /u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch
$ ls
1_13_951823349.dbf


SQL> SELECT LOG_MODE FROM V$DATABASE;

LOG_MODE
------------
ARCHIVELOG


$ ps -ef|grep -i _arc
oracle    7502     1  0 10:54 ?        00:00:00 ora_arc0_prodserver
oracle    7504     1  0 10:54 ?        00:00:00 ora_arc1_prodserver
oracle    7506     1  0 10:54 ?        00:00:00 ora_arc2_prodserver
oracle    7508     1  0 10:54 ?        00:00:00 ora_arc3_prodserver
oracle    8492  5013  0 11:11 pts/0    00:00:00 grep --color=auto -i _arc

Enable Automatic Archiving for Oracle at Instance Startup Using SPFILE

Verify the value of the log parameters by entering the following command at the SQL*Plus prompt:


SQL> SHOW PARAMETER LOG

If the parameters do not have the correct values, change them by entering the following commands at the SQL*Plus prompt after you shut down the server:


CONNECT SYS/SYS_PASSWORD AS SYSDBA 
STARTUP MOUNT EXCLUSIVE
ALTER SYSTEM SET LOG_ARCHIVE_START = TRUE SCOPE = SPFILE;
ALTER SYSTEM SET LOG_ARCHIVE_DEST="/u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch" SCOPE = SPFILE;
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT="arch_%r_%t_%s.arc" SCOPE = SPFILE;

Note: The actual value of LOG_ARCHIVE_DEST is specific to your environment.

Pfile Location :


/u01/app/oracle/admin/prodserver/pfile

SPFILE Location :


/u01/app/oracle/product/12.2.0/dbhome_1/dbs


Fix on Error :
ORA-19905: log_archive_format must contain %s, %t and %r


1. Create a copy of the init.ora file. 
2. Edit the above init.ora to reflect the log_archive_format and log_archive_dest_1 
log_archive_format = 'arch_%r_%t_%s.arc'
log_archive_dest_1 = 'LOCATION=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch'
3. Shutdown immediate and Startup nomount with the above pfile.
SQL> shutdown immediate
SQL> startup nomount pfile = '/u01/app/oracle/admin/prodserver/pfile/init.ora.712201711265'
4. Create spfile from pfile
SQL> create spfile from pfile='/u01/app/oracle/admin/prodserver/pfile/init.ora.712201711265' 
5. SQL> shutdown immediate
6. SQL> startup
7. SQL> archive log list 

Enabling Oracle to Start on System Boot

Create scripts and environment file called "setEnv.sh". 


$ mkdir /home/oracle/scripts

cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP

export ORACLE_HOSTNAME=prodserver11
export ORACLE_UNQNAME=prodserver
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_SID=prodserver

export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH

export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF


echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Create Start and Stop Script 


cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbstart \$ORACLE_HOME
EOF


cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbshut \$ORACLE_HOME
EOF


chown -R oracle.oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh

You should be able to start/stop the database with the following scripts run from the "oracle" user.

$ ~/scripts/start_all.sh
$ ~/scripts/stop_all.sh

Create the systemd service file called "/lib/systemd/system/dbora.service".


$ vi /lib/systemd/system/dbora.service

[Unit]
Description=The Oracle Database Service
After=syslog.target network.target

[Service]
# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.
# https://bugzilla.redhat.com/show_bug.cgi?id=754285
LimitMEMLOCK=infinity
LimitNOFILE=65535

#Type=simple
# idle: similar to simple, the actual execution of the service binary is delayed
#       until all jobs are finished, which avoids mixing the status output with shell output of services.
RemainAfterExit=yes
User=oracle
Group=oinstall
ExecStart=/home/oracle/scripts/start_all.sh
ExecStop=/home/oracle/scripts/stop_all.sh

[Install]
WantedBy=multi-user.target

Reload the system file :


systemctl daemon-reload
systemctl start dbora.service


systemctl enable dbora.service


# systemctl status dbora.service
● dbora.service - The Oracle Database Service
   Loaded: loaded (/usr/lib/systemd/system/dbora.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2017-08-15 14:45:07 IST; 1min 40s ago
 Main PID: 8976 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/dbora.service
           ├─9366 ora_pmon_prodserver
           ├─9368 ora_clmn_prodserver
           ├─9370 ora_psp0_prodserver
           ├─9372 ora_vktm_prodserver

Aug 15 14:45:07 prodserver11 systemd[1]: Started The Oracle Database Service.
Aug 15 14:45:07 prodserver11 systemd[1]: Starting The Oracle Database Service...
Aug 15 14:45:07 prodserver11 start_all.sh[8976]: The Oracle base remains unchanged with value /u01/app/oracle
Aug 15 14:45:07 prodserver11 start_all.sh[8976]: Processing Database instance "prodserver": log file /u01/app/oracle/product/12.2.0/...tup.log
Hint: Some lines were ellipsized, use -l to show in full.

For CentOs 6 Servers use :


You should be able to start/stop the database with the following scripts run from the "oracle" user.

$ ~/scripts/start_all.sh
$ ~/scripts/stop_all.sh

Create a file called "/etc/init.d/dbora" as the root user, containing the following.

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_OWNER to the user id of the owner of the 
# Oracle database software.

ORA_OWNER=oracle

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su $ORA_OWNER -c "/home/oracle/scripts/start_all.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" &

        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su $ORA_OWNER -c "/home/oracle/scripts/stop_all.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1"
        rm -f /var/lock/subsys/dbora
        ;;
esac
Use the chmod command to set the privileges to 750.

chmod 750 /etc/init.d/dbora
Associate the "dbora" service with the appropriate run levels and set it to auto-start using the following command.

chkconfig --add dbora
You can start and stop the database using the service, which is what will happen on a reboot.

# service dbora start
# service dbora stop

Check on configuring RMAN Backup  Click here


0 comments:

Post a Comment