Backup and Recovery -1
- Prerequisite to install oracle on Linux? Explain kernel parameters.
a) Recommended minimum RAM needed for Oracle is 2GB or more. Swap must be enabled double the size of RAM. Disk space must be more than 8GB, it depends on edition which are we going to choose for installing. /tmp directory must have free space more than 1GB for error free installation
Automatic setup:
# Yum install oracle-database-server-12cR2-preinstall -y
Manual Setup:
If you have not used the “oracle-database-server-12cR2-preinstall” package to perform all prerequisites, you will need to manually perform the following setup tasks.
Add the following lines to the “/etc/sysctl.conf” file, or in a file called “/etc/sysctl.d/98-oracle.conf”.
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
b) SGA and PGA, semaphores are the kernel parameters
Oracle specifies semaphore values for semmsl, semmns, semopm and semmni as 250, 3200, 100 and 128, respectively. These can be found in the output of the sysctl command in this same order.
# /sbin/sysctl -a | grep sem
kernel.sem = 250 32000 32 128
The values for the semaphores represent the following:
semmsl: The number of semaphores per set
semmns: The total number of semaphores available
semopm: The number of operations which can be made per semaphore call
semmni: The maximum number of shared memory segments available in the system - Steps to configure silent mode installation?
*Overview – Usually to create database we will use DBCA graphical user interface.
Sometimes may not have access to a graphical user interface then we can use the DBCA silent mode to create a database.
*Set the environment – Oracle_home, Oracle_base, Oracle_SID
*Create Database using DBCA silent mode.
*Verify the DB - Explain PATH, ORACLE_HOME, ORACLE_BASE, DISPLAY variables
–> PATH: while sqlplus starts,it checked with bash and the PATH variable to be set
–> ORACLE_HOME: Where the software was installed,
–> ORACLE_BASE: Oracle_Base contains one or more ORACLE_HOME (binaries) like 9i,10g,11g,12c etc. The home directory for the Oracle software
–> Display variables: X host +, export DISPLAY: =0.0 - How to create database using dbca using putty with GUI terminal.
By using XMING in windows, we have to create DBCA in putty with GUI terminal - What is OMF? How will you use it?
a) Oracle Managed Files (OMF) simplifies the creation of databases as Oracle does all OS operations and file naming. It has several advantages. Automatic clean-up of the filesystem when database objects are dropped.
*Oracle Managed Files (OMF) simplifies the creation of databases as Oracle does all OS operations and file naming. It has several advantages.
*Automatic clean-up of the filesystem when database objects are dropped.
*Standardised naming of database files.
*Increased portability since file specifications are not needed.
*Simplified creation of test systems on differing operating systems.
*No unused files wasting disk space.
b) ALTER SYSTEM SET DB_CREATE_FILE_DEST=’/u02/oradata’; - what is oratab? What is the use of it?
a) Oratab is a colon-delimited text file on Unix and Linux systems that associates ORACLE_SID and ORACLE_HOME values.This file is either found in the /var/opt/oracle or the /etc directories.
b) Scripts like oraenv, dbhome, dbstart and dbshut use the oratab file. - Steps to configure automatic start and shut options? What is the use of chkconfig command?
a) su – oracle
change from N to Y in db path(/etc/oratab)
vi /etc/oratab
dev: /u01/app/oracle/product/12.2.0.1/db_1: Y
su -root
cd /etc/init.d/
vi DBNAME
#!/bin/sh -x
# file: /etc/init.d/dbora
# chkconfig: 2345 80 30
# Description: sss
# The user that oracle runs as (default: oracle)
ORACLE=oracle
# Database instance id
ORACLE_SID=DBNAME
# ORACLE_HOME (file system) path
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
PATH=${PATH}:$ORACLE_HOME/bin
export ORACLE_SID ORACLE_HOME PATH
case $1 in
‘start’)
su – $ORACLE -c $ORACLE_HOME/bin/dbstart ;;
‘stop’)
su – $ORACLE -c $ORACLE_HOME/bin/dbshut
;;
*)
echo “usage: $0 {start|stop}”
;;
esac
exit
:wq
. .bash_profile
chkconfig –add DBNAME
chkconfig DBNAME on
chkconfig
b) *chkconfig command is used to list all available services and view or update their run level settings.
*In simple words it is used to list current startup information of services or any particular service, updating runlevel settings of service and adding or removing service from management - what will happen if you execute root.sh?
It Creates oratab file in /etc. This is the file which we use to make automatic Database startup and shutdown. - What is rpm? How will you install rpm? How to check the existance of rpm?
* Redhat package manager is a program for installing, uninstalling, and managing software packages in Linux.
*$ rpm -i filename.rpm (or) yum -y install oracle-database-ee-18c
*$ rpm -q apache - Explain all the linux compression commands?
–> ZIP – will use to compress the normal size of volume files
–> GZIP – Gzip is faster than ZIP while compressing and decompressing,When we use to compress cmd, a huge no.of files will go with gzip for the best performance
–> TAR – It used to convert the directory into files,Tar is an archiver used to to combine multiple files into one - Explain crontab and its parameters?
Crontab is a time base job scheduler in linux OS
* (0-59 min) * (0-23 hr) *(1-31 day of month) * (1-12 month) * (0-6 week) filename
• Crontab -e Edit your crontab file, or create one if it doesn’t already exist.
• Crontab -l Display your crontab file.
• Crontab –r Remove your crontab file.
• Crontab -v Display the last time you edited your crontab file - What is logical and physical backup? hot and cold backup?
a) Logical Backup – A logical database backup is a copy of the logical information of a database extracted and stored in a binary format
Physical Backup – A Physical database backup is a copy of the complete database contents, structure, tables and all relevant transactions you need to restore your database.
b) *A hot backup is nothing but online backup
*A cold backup is nothing but offline backup - Explain the internals of hot backup in UMB?
Begin Backup:
*Datafile header get freeze or scn will freeze
*Partial check point occurs
*More redolog will generates
*More Block will occur
End Backup:
*Data file header get unfreeze or scn will unfreeze
*Partial check point occurs
*Redo logfile -> Datafiles (Archive should be enable) - Explain the steps to take hot backup in UMB?
Step 1:DB should be Up.
Step 2: Archive log must be enabled
Step 3: Determine where to copy the backup files
Step 4: Identify the files which needs to be copy
Step 5: Alter database begin backup;
Step 6: Copy the datafiles with an OS utility
Step 7: Alter database end backup; - How to recover a system datafile/ non system datafile that is running in a Production env?
=> By using RMAN backup we can recover both system/non system datafile in a mount stage.
In Mount stage:
• Alter database datafile ‘system/non system’ offline;
• Rman target / (By using backup set and backup piece we are going to take the backup of system/non system)
• Restore datafile system/non system
• Recover datafile system/non system
• Alter database datafile ‘system/non system’ online;
• Startup the DB and connect - How to recover a UNDO datafile/ tempfile that is running in a Production env?
For Undo Corruption:
• We need to create a new Undo-tablespace.
• Offline the Corruption undo and shut down the DB.
• Then we need to tell in pfile as the current Undo get corrupted –> “_corrupted_rollback_segment”=’corrupted undo name’;
• Startup the DB and set the new undo as a default –> alter system set undo_tablespace=”newundo” scope=both;
• Then drop the Old Corruption undo tablespace.
=> UNDO and temp,both needs to be recreate as a new file and set as default
=> Make sure before creating, get the both undo and temp into offline and create a new one then drops the old one. - How to recover a corrupted logfile, controlfile, spfile?
Logfile:
* We can’t recover the current or active logfile–> we need to set a parameter as _allow_resetlogs_corruption=true in pfile
* We can recover the inactive logfiles:
SQL> alter database logfile ‘path’ offline;
SQL> alter database add logfile member ‘path’ to group 1;
SQL> alter system switch logfile;
SQL> alter database logfile ‘path’ online
Control file:
*We can recover it, only when we have a backupset of the control file.
*RMAN> backup current control file
SPfile:
*RMAN> backup spfile –> By using Rman backup
*From alertlog we can recover the spfile or pfile - How to take a backup using rman and location should be in “/backup”?
SQL > backup database format ‘/backup’; - How to increase the performance of RMAN backup and explain it advantages over UMB?
=> By using Channel,
=> Another way is BCT (Block change tracking) parameters we can increase the performance of Rman backup. (Rman > alter database enable block change tracking) - What is the use of crosscheck, obsolete, expired commands?
• Crosscheck – To Check the missed files in OS level and it show Expired if file not in OS level
• Obsolete – Unwanted backups except redundancy
• Expired – To check the Expired backup
parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
<Previous> | <Next> |