• No results found

COLD BACKUP

In document DBA Notes (Page 70-73)

CONTROL FILE MANAGEMENT

COLD BACKUP

Backup which is taken when the database is down is said to be cold backup.

Steps to perform the Cold backup:

1) List out the datafiles, Control files and Redolog files by using v$datafile, v$datafile, v$logfile.

Sql> select name from v$datafile;

Sql> select member from v$logfile;

Sql> select name from v$controlfile;

2) Shut down the database with shut immediate option.

Sql> shut immediate;

3) Now copy the crd files to backup location in OS level.

$cp /oraAPP/app/* /backup/

How can we check whether the cold backup is working properly or not?

 shutdown the database

 copy crd files

 start the database

 create a user and some folder in it.

 Remove crd files in OS level

 Resore from backup location (files must be restored exactly to same location)

 Start database and check the database for mewly created users and tables. [thwy will not exit,coz you restore the database from old backup]

How do we automate the cold backup?

By writing a shell script and submitting it to cron, we can automate hold backup . Cron should be scheduled as root.

SHELL SCRIPT for Cold Backup:

# !/bin/bash --- this indicates to execute this code in bash shell

###############################################################

## Name : cold.sh ##

## Description: This files takes cold backups of crd files ##

## Date: 13.6.08 ##

## Author: Ramesh ##

################################################################

# Set the environment

Export ORACLE_SID=dbkittu

Export ORACLE_HOME= /oraDB/chinni Export PATH=$PATH:$ORACLE_HOME/bin

#SHUT DOWM THE DATABASE SQLPLUS <<EOF

Sys as sysdba Shut immediate;

EoF

#copy the crd files to backup location

cp –r /oraAPP/kittu/db1’ /u001/chinni/backup/

#start the data base Sqlplus <<eof

Sys as sysdba Startup;

EoF

In the market there are many seheduling software Are available.

Ex: red wood

If we want to copy the crd files to tape tar cvf /tape/6102008.tar

$echo “select * from tab.”sqlplus system/manager

It will select hit the tables in $prompt by connecting as system and return back to

$ prompt after displaying output.

$echo select * from tab;| sqlplus -s system/manager it will just display output.

how can we make cold backup fast?

By copying crd files in parallel sessions i.e, copy some files in one session and copy files in one session.

in cold backup we take entire backup of all crd files.

Online redo lof files:

Redologs are absolutely necessary for recovery. For example, imagine that power outage occurs,it prevents oracle to write modify data to datafiles. In this situation an old data in datafiles can be combined with recent changes records in the online redo log to reconstruct what wsas lost every oracle database contains a set of two ir more online redo log files.

Oracle assign every redo logfile to with a log sequence number to uniquely identified it.

the of redo’s for a database is collectively know as database’s redo log.

Oracle uses redolog to record all changes made to data base. oracle record every changes in redo record. an entry in redo buffer describes what has changed assumes a user updates a payroll table from 5 to 7 oracle records the old value in undo and new valuesw in the redo record.

Since the redo log stored every changes to db the redo record for this transitioncontaions three paths.

Changes to the transation table of undo

Changes to undo data block

Changes to payroll table data block

If the user commit then update to permanent table to make change permanent oracle generate another redo record.

Archived redo log files:

• if archiving is disable a filled online redo log is available once the changes recorded in the log have been saved to the data file.

• If archiving is enabling a filled online redo log is available once the changes have been saved to the data files and the file has been archived.

Archived log files are redologs that are oracle has filled redo entries(rendered in active) and copied to one or more log archive destinations oracle can be run in either 2 modes.

*archive log:

Oracle archives the filled online redo files before reusing thenm in the cycle.

*No archiving::

Oracle does not archiving the filled online redo log fikes before reusing the in the cycle.

Running the database in archiving mode has the following benefits:

The database can be completely recovered from both instance and media failure The user perform online backups i.e is backup the ts when database is open and available for use.

Archive redologs can be transmitted applied to stand by database.

Oracle supports multiplexed archive logs ro avoid any possible single point of failure or the archive log .

The user has more options, such as the ability to perform tablespace-point-in –time recovery.

Running the database in noarchivelog mode has the following consequences.

The user can only back up the database while it is completely closed after a clean shutdown.

Typically the onlyu media recovery option is to restore the whole database which causes the loss of all transactions issued since the last backup

These archived logs should be hosted on separated physically disk.

In document DBA Notes (Page 70-73)