Some Oracle Basics

Startup and shutdown

Shutdown

There are three shutdown options, abort, immediate and normal

abort: fast shutdown, immediate, no grace period

immediate: terminates executing SQL and rolls back transactions

normal: waits for users to terminate sessions (not often practiced as always someone logged on!)

  1. su - oracle

  2. svrmgrl

  3. connect internal

  4. shutdown option

  5. exit

Startup

At system boot this is done via the dbstart script. This reads /etc/oratab and starts everything listed with the third parameter set to Y.

Manually this can be done as follows:

  1. su - oracle

  2. svrmgrl

  3. connect internal

  4. startup option

  5. exit

There are three optional parameters to the startup command, nomount , mount and open .

nomount: Oracle reads parm file, allocates SGA (System Global Area), starts background processes and opens trace and alert file. Used before database has been created

mount: as per nomount but opens control file as well. used for DBA operations such as recovery or changing archive modes

open as per mount but also checks and opens online data files and redo logs. Used for normal database access

Backups

All files should be backed up - parm file, database files, redo logs, etc. Normally this involves shutting down oracle and/or having a static copy of the files to backup e.g. by breaking a mirror. Oracle Recovery

Recovery with roll forward

  1. Recover database from known good backup

  2. Ensure latest control files, online redo logs and offline redo logs present

  3. svrmgrl -> connect internal -> startup mount

  4. either

    • recover database -> auto (automatic roll forward) or
    • recover database until cancel , select rollforward logs until required place then type cancel (roll forward to selected point)
  5. alter database open resetlogs;

  6. exit

Location of Archived Redo Logs can be found in $ORACLE_HOME/dbs/initSID.ora . This is also the location of the control file

To switch logfiles, i.e. archive the online redo logs to offline archived redo logs:

svrmgrl

connect internal

alter system switch logfile;

exit

This needs to be repeated for each logfile present. The number of logfiles can be found by:

svrmgrl

connect internal

select from sys.v$logfile

exit

To find out if archiving is active:

svrmgrl

connect internal

select from sys.v$database

exit