updated-min=2009-0101T00:00:00%2B04:00&updated-max=2010-01-01T00:00:00%2B04:00&maxresults=15
1.
2.
3.
4.
5.
6.
1.
2.
3.
4.
5.
It is a logical storage area which is created by collection of multiple disk partitions onto
which we can create any type of file system.
It supports storage of multiple file in a single volume.
Online resizing is possible
Supports collection of I/O statistics
It improves the I/O performance & availability with the help of software level RAID
techniques*.
Types of LVMs & Vendors:
LVMs
1.
VERITAS Volume Manager
2.
Tivole Volume Manager
3.
Sun
Volume
Manager
(SVM)
4.
ASM(from oracle 10g)
Vendors
Symantec
IBM
Oracle
SUN
Oracle
ASM:
It is a type of LVM supported from oracle 10g and has a special type of instance.
INSTANCE_TYPE=ASM. & has a small footprint of SGA with size 100-128 MB.
It supports for creation of logical volume known as disk groups, internally uses both
strIPing and mirroring.
Hence it does not have any control file to mount, so its least and last stage is nomount.
It has to mount the diskgroups
Diskgroup is a logical storage area which is created by collection of multiple disk
partitions.
ASM supports storage of multiple database related files like control files, redo, data,
archive logs, flashback logs, RMAN backup pieces, spfile etc. but it will not support the
storage of static files like pfile, listener.ora. tnsnames.ora sqlnet.ora etc.
From 11.2 onwards, by using ADVM (ASM dynamic volume manager) & ACFS (ASM
cluster file system) we can store static files also.
1.
2.
3.
4.
5.
$ crontab -l
50 23 * * 0,1,2,3,4,5,6 /u06/abc/scripts/expdp.sh
It will generate dumpfile datewise.
Enable Crontab
Giving Crontab permission to new os user
Login as root
Goto /etc/cron.d directory
Add the user entry (ex. ota ) in cron.allow file
Note: if cron.allow files doesn't exists then create it
Login as o/s user
Set the editor in .profile or .bash_profile
Example: EDITOR=vi;export EDITOR
Now you can schedule cron jobs.
To setup cronjob
crontab -l( list current jobs in cron)
crontab -e ( edit current jobs in cron)
_1_ _2_ _3_ _4_ _5_ executable_or_job
Where
1 Minutes (0-59)
2 Hours ( 0-24)
3 day of month ( 1- 31 )
4 Month ( 1-12)
5 A day of week ( 0- 6 ) 0 -> sunday 1-> monday
e.g. 0 3 * * 6 Means run job at 3AM every saturday
This is useful for scheduling tablespace threshold, ftp, rman backup or removed old log files,
or other scripts regularly.
Sample Scheduled backup:
$ crontab l
OTA Database:
50
23
50
23
15
14
*
*
*
*
*
*
0,2,3,6
1,4
0,1,2,3,4,6
/u01/ota/dailyexp_ota.sh
/u01/ota/offbkup_ota.sh
/u01/ota/morning_arch.sh
If you do not run the Oracle Database Upgrade Assistant then the
following errors are displayed:
ORA-01092: ORACLE instance terminated.
ORA-39700: database must be opened with UPGRADE option.
$ dbua
Complete the following steps displayed in the Oracle DBUA
On the Welcome screen, click Next.
On the Databases screen, select the name of the Oracle Database that you want to
update, then click Next.
On the Recompile Invalid Objects screen, select the Recompile the invalid objects at
the end of upgradeoption, then click next.
If you have not taken the back up of the database earlier, on the Backup screen, select
the I would like to take this tool to backup the database option
On the Summary screen, check the summary, and then click Finish.
SQL> @ORACLE_BASE\ORACLE_HOME\rdbms\admin\utlrp.sql
SQL> select * from v$version;
BANNER
---------------------------------------------------------------Oracle Database 10g Release 10.2.0.4.0 - Production
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
----Screenshots----
2.
3.
DEFER:
ALTERNATE:
RESET:
LOG_ARCHIVE_DEST_1='LOCATION=/ARCH1/CHICAGO/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)'
DB_UNIQUE_NAME: Specified unique database name in Oracle Data Guard conf.
Used along with LOG_ARCHIVE_CONFIG.
Ex:
DB_NAME=chicago
DB_UNIQUE_NAME=chicago
LOG_ARCHIVE_CONFIG='DG_CONFIG= (chicago, boston)'
LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago/ VALID_FOR= (ALL_LOGFILES,
ALL_ROLES)
LOG_ARCHIVE_DEST_2= 'SERVICE=boston LGWR ASYNCVALID_FOR= (ONLINE_LOGFILES,
PRIMARY_ROLE)
DB_UNIQUE_NAME=boston'
The LOG_ARCHIVE_CONFIG parameter also has SEND, NOSEND, RECEIVE, and
NORECEIVE attributes:
- SEND enables a database to send redo data to remote destinations
- RECEIVE enables the standby database to receive redo from another database
To disable these settings, use the NOSEND and NORECEIVE keywords
Ex: LOG_ARCHIVE_CONFIG='NORECEIVE, DG_CONFIG= (chicago,boston)'
Use of these parameters can effect the role transition. Therefore trys to remove them before
doing any role transitions
Handling Errors while transmitting redo:
Options when archiving fails
Retry the archival operations (control the number of retry operations)
Use an Alternate destinations
Ex: LOG_ARCHIVE_DEST_1='LOCATION=/arc_dest REOPEN=60 MAX_FAILURE=3's
Other parameters used:
REOPEN: default value is 300 seconds, 0 turns off this option
MAXIMUM _FAILURE: Maximum number of failures
MAXIMUM AVAILIBLITY
MAXIMUX PERFOMANCE
(Default)
MAXIMUM
AVAILIBLITY
MAXIMUM
PERFOMANCE
LGWR
LGWR
LGWR OR ARCH
Network transmission
mode
SYNC
SYNC
AFFIRM
AFFIRM
AFFIRM OR NO AFFIRM
YES
YES
NO BUT
RECOMMENDED
Note: oracle recommends that on Oracle Data Guard configurations that is running on
maximum protection mode contains atleast two Standby Database meeting the above
requirements so that the Primary Database continue processing without shutting down if
one of the Standby Database cannot receive redo data from Primary Database.
Managing log files:
1. Specify alternate directory for archived redologs.
- Redo received from Primary Database is identified by location attribute of the
parameterLOG_ARCHIVE_DEST_n.
- Alternate directory can be specified by using parameter STANDBY_ARCHIVE_DEST.
- If both parameters are specified then STANDBY_ARCHIVE_DEST overrides
LOG_ARCHIVE_DEST_n parameter.
- query v$arvhive_dest to check the value of STANDBY_ARCHIVE_DEST parameter
SQL> SELECT DEST_NAME, DESTINATION FROM V$ARCHIVE_DEST
WHEREDEST_NAME='STANDBY_ARCHIVE_DEST';
- Filesnames are generated in the format specified LOG_ARCHIVE_FORMAT=log%t_%s_
%r.arc
Note: Redo Transport Service stores the fully qualified domain name of these files in
Standby Database control file and redo apply uses this information to perform recovery.
- view v$archived_log
- checking archived redos log files that are on the standby system
SQL> SELECT NAME FROM V$ARCHIVED_LOG;
2. Reusing Online Redo Log Files
1. Specify alternate directory for archived redolog files
- redo received from Primary Database is identified by location attribute of the parameter
LOG_ARCHIVE_DEST_n
- Alternate directory can be specified by using parameter STANDBY_ARCHIVE_DEST
If 8k is the block size (8124) then the maximum control file size will be 156 MB.
As long as the archived redo logs are generated or RMAN backups are taken records are
added to the control file. If control file reaches its maximum size then these records are
reused.
Parameter used to specify the time for keeping control file records is
control_file_record_keep_time value ranges from 0-365 days (default is 7 days)
Note: Keep the control_file_record_keep_time value atleast upto last 2 full backups
period.
In case if redo is planned to apply with delay then set this value to more no. of days.
5. Sharing a log file destinations among multiple Standby Databases:
Ex:
LOG_ARCHIVE_DEST_1=LOCATION=disk1 MANDATORY
LOG_ARCHIVE_DEST_2 =SERCIVE=standby1 optional
LOG_ARCHIVE_DEST_3 =SERCIVE=standby2 optional dependency LOG_ARCHIVE_DEST_2
In this case DEPENDENCY attribute is set to second standby db which takes the redo data
from LOG_ARCHIVE_DEST_2.
This kind of setup can be used if
Primary Database & Standby Database resides on the same system.
Physical Standby Database & Logical Standby Database resides on the same system.
When clustered file system is used.
When network file system is used
MANAGING ARCHIVE GAPS:
Oracle Data Guard resolves the gaps automatically
Gaps can happen due to network failure or archiving problem on Primary Database.
Primary Database polls Standby Database every minute to detect the gaps [polling
mechanism]
In case Primary Database is not available then we have to resolve the gaps manually by
applying redo from one of the Standby Database.
No extra configurations are required to resolve the gaps automatically.
1. Using FAL [fetch archive logs mechanism] to resolve gaps.
Find the missing logs on Primary Database and copy them to the Physical Standby
Database.
SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND
SEQUENCE# BETWEEN 7 AND 10;
NAME
------------------------------------------------------------------------/primary/thread1_dest/arcr_1_7.arc
/primary/thread1_dest/arcr_1_8.arc
/primary/thread1_dest/arcr_1_9.arc
1
Once these log files are copied on Physical Standby Database then we have to
register them with Physical Standby Database
Same procedure as Physical Standby Database but the view used is dba_logstdby_log
instead of v$archive_gap
Steps:
a.
SQL> COLUMN FILE_NAME FORMAT a55
SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L
WHERE NEXT_CHANGE# NOT IN
(SELECT FIRST_CHANGE# FROM DBA_LOGSTDBY_LOG WHERE L.THREAD# = THREAD#)
ORDER BY THREAD#,SEQUENCE#;
THREAD# SEQUENCE# FILE_NAME
---------- ---------- ----------------------------------------------1 6 /disk1/oracle/dbs/log-1292880008_6.arc
1 10 /disk1/oracle/dbs/log-1292880008_10.arc
Note: If there is a gap then only one file is hsown for each thread. Otherwise it shows two
files for each thread
In the above examples missing files are 7,8,9.
b. copy these file on Logical Standby Database location.
c. register these files with Logical Standby Database
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE 'file_name';
d. Restart SQL Apply
Verification:
1. Check the status of online redofile on Primary Database
SQL> SELECT THREAD#, SEQUENCE#, ARCHIVED, STATUS FROM V$LOG;
2. determine is the most recent archive file on Primary Database
SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY
THREAD#;
3. Use the following query on Primary Database to check which is the most recently
transmitted archive log file to each destination
SQL> SELECT DESTINATION, STATUS, ARCHIVED_THREAD#, ARCHIVED_SEQ#
FROM V$ARCHIVE_DEST_STATUS
WHERE STATUS <> 'DEFERRED' AND STATUS <> 'INACTIVE';
4. Use the following query on Primary Database to find out the archive redolog files not
received at each destination
SQL> SELECT LOCAL.THREAD#, LOCAL.SEQUENCE# FROM
(SELECT THREAD#, SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=1)
LOCAL WHERE LOCAL.SEQUENCE# NOT IN
(SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND
THREAD# = LOCAL.THREAD#);
5. Set log_archive_trace parameter in Primary Database & Standby Database to see the
transmission of redo data
Monitoring the Performance of Redo Transport Services
View: v$system_event
Parameter: log_archive_dest_n
Attributes: ARCH
LGWR ( SYNC/ASYNC)
Waits Events to monitor:
1
10
Enable Archiving
3. Configure standby redo logs for maximum availability & data protection.
LGWR ASYNC transport mode is preferred.
If possible multiples the standby redo logs files
Use identical sizes for PDB and SDB redo log files determine appropriate no of redo log
files.
Formula: ( max no. of log files per group +1 ) x no. of log groups ex : 2 groups with 2
members each; thenthe no. of standby redo logs should be ( 2+1) x 2 = 3 x 2 = 6 standby
redo log groups
Check for maxlogfiles & maxlogmembers clauses. If there is a limit then you have to
recreate the DB or the controlfile.
Adding a standby redolog file group to a specific thread
SQL> alter database add standby logfile thread 5 size 20m
Adding a standby redolog file group to a specific group
SQL> alter database add standby logfile group 10 size 20m
Note: If we skip group no. using 10, 20 & so on we will end up using additional space in
Standby Database controlfile.
Here we have configured standby redolog files as primary db in order to make switch over
easy if required. i.e... Primary Database =Standby Database
Verify standby redolog file group creation.
SQL> select group#, thread#, sequence#, archived, status from v$standby_logs
D. Setting Primary Database Initialization parameters
prod.__db_cache_size=184549376
prod.__java_pool_size=4194304
prod.__large_pool_size=4194304
prod.__shared_pool_size=88080384
prod.__streams_pool_size=0
*.audit_file_dest=/oracle10g/product/10.2.0/db_1/admin/prod/adump
*.background_dump_dest=/oracle10g/product/10.2.0/db_1/admin/prod/bdump
*.compatible=10.2.0.1.0
*.control_files=/oracle10g/product/10.2.0/oradata/prod/control01.ctl
*.core_dump_dest=/oracle10g/product/10.2.0/db_1/admin/prod/cdump
*.db_block_size=8192
*.db_domain=
*.db_file_multiblock_read_count=16
*.db_flashback_retention_target=3600
*.db_name=prod
*.db_recovery_file_dest=/oracle10g/arch
*.db_recovery_file_dest_size=21474836480
*.db_unique_name=standby
*.dispatchers=(PROTOCOL=TCP) (SERVICE=prodXDB)
*.fal_client=STANDBY
*.fal_server=PROD
*.fast_start_mttr_target=17
*.job_queue_processes=10
*.log_archive_config=DG_CONFIG=(prod,standby)
*.log_archive_dest_1=LOCATION=/oracle10g/arch1_prod
VALID_FOR=(ALL_LOGFILES,ALL
_ROLES) DB_UNIQUE_NAME=standby
*.log_archive_dest_2=SERVICE=prod
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_U
NIQUE_NAME=prod
*.log_archive_dest_state_1=ENABLE
*.log_archive_dest_state_2=ENABLE
*.log_archive_format=prod_%s_%t_%r.arc
*.log_archive_max_processes=4
*.log_buffer=262144
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile=EXCLUSIVE
*.sga_target=283115520
*.standby_archive_dest=/oracle10g/arch1_prod/
*.standby_fIle_management=AUTO
*.undo_management=AUTO
*.undo_retention=3600
*.undo_tablespace=UNDOTBS
*.user_dump_dest=/oracle10g/product/10.2.0/db_1/admin/prod/udump
Creation of physical standby database:
1
1. Making a backup copy of Primary Database data files: (on Primary Database
system)
Any backup copy can be used
Use RMAN utility
2. Creating controlfle for Standby Database (on Primary Database system)
SQL> shutdown immediate (then take offline backup of datafiles cold backup)
SQL> startup mount;
SQL> alter database create standby controlfile as /u01/oracle/standby.ctl;
*.db_block_size=8192
*.db_domain='global.com'
*.db_file_multiblock_read_count=16
*.db_flashback_retention_target=3600
*.db_name='prod'
*.db_recovery_file_dest_size=21474836480
*.db_recovery_file_dest='/u01/oracle/flash'
*.db_unique_name='standby'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'
*.FAL_CLIENT='standby'
*.FAL_SERVER='prod'
*.global_names=TRUE
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(prod,standby)'
*.log_archive_dest_1='LOCATION=/u01/oracle/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=prod
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prod'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='standby_%s_%t_%r.arc'
*.log_archive_max_processes=4
*.open_cursors=300
*.pga_aggregate_target=197132288
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=592445440
*.standby_archive_dest='/u01/oracle/arch'
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u00/app/oracle/admin/standby/udump'
4. Copy files for primary db:
Copy data files/standby control file and pfile to the standby system using O/S commands
(ftp)
5. Setting up the environment to support Standby Database (on Standby
Database)
Create the service standby and password file using oradim utility on windows.
If UNIX; just create password file
$ orapwd file=orapwprod password=oracle entries=100
Note: the password file for sys user should have the same password as both PDB and SDB.
Configure listener.ora
Configure net service name on both system for both databases.
Note: connect descriptor should specify the usage of dedicated server
Listener.ora on primary db:
# listener.ora Network Configuration File:
/u00/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u00/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = prod.global.com)
(ORACLE_HOME = /u00/app/oracle/product/10.2.0/db_1)
(SID_NAME = prod)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ans.global.com)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
Listener.ora on standby db:
stener.ora Network Configuration File:
/u00/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u00/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = standby.global.com)
(ORACLE_HOME = /u00/app/oracle/product/10.2.0/db_1)
(SID_NAME = standby)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 100.100.112.72)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
tnsnames.ora on primary db:
# tnsnames.ora Network Configuration File:
/u00/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ans.global.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prod.global.com)
(INSTANCE_NAME = prod)
)
(HS = OK)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 100.100.112.72)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standby.global.com)
(INSTANCE_NAME = standby)
)
(HS = OK)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
tnsnames.ora on standby db:
names.ora Network Configuration File:
/u00/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 100.100.101.44)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prod.global.com)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 100.100.112.72)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standby.global.com)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
6. Start Physical Standby Database
Create spfile from pfile on standby db from the text parameter file that was edited for
Standby Database
SQL> create spfile from pfile=initstandby.ora;
Start Standby Database
SQL> startup mount;
Start applying redo
SQL> alter database recover managed standby database disconnect from session;
Test archival operation to the Standby Database
SQL> alter system switch logfile; (Primary Database)
7. Verify Physical Standby Database
SQL> select sequence#,first_time,next_time from v$archived_log order by sequence#; ( on
Primary Database and Standby Database )
Verify the logs applied by the following command (On Standby Database)
SQL> select sequence#, applied from v$archived_log order by sequence#;
RMAN Script: POINT IN TIME RECOVERY
[point_intime_recovery.scp]
# This scenario assumes that all initializaiton filesa nd the current controlfile arein place and
you want to recover to a point in time '2001-04-09"14:30:00'.
# You must take a new whole database backup after resetlogs,since backups of previous
incarnation are not easily usable
# You should use RMAN to recover a backup controlfile only if you have lost all copies of the current
controlfile, because after restoring a backup controlfile, you will have to open RESETLOGS and take a
new whole database backup.
# This section assumes that all copies of the current controlfile have been lost, and than all initialization
parameter files, datafiles and online logs are intact.
# Ensure you set your NLS_LANG environment variable e.g. in unix (csh):
# >setenv NLS_LANG american_america.we8dec
# Start RMAN without the TARGET option, and use the following commands to restore and recover the
database;
# SET DBID ; use database id from RMAN output; not required if using recovery catalog
connect target sys/password@omr
startup nomount;
run
{
# you need to allocate channels if not using recovery catalog.
# allocate channel foo type sbt parms'';
allocate channel c1 type disk;
restore controlfile from autobackup # or ;
alter database mount;
recover database;
alter database open resetlogs;
}
# you must take a new whole database backup after reerlogs, since backups of pre
vious incarnation are not easily usable
$
restore datafile 5;
# if you restored to a different locatin, uncomment the command below to
# switch the controlfile to point to the file in the new location
# SWITCH DATAFILE ALL;
recover datafile 5;
sql 'alter database datafile 5 online';
}
run
{
allocate channel c1 type disk;
backup incremental level 2 cumulative
tag omr_cm2
format '/u10/catdb/backup/cm2_%d_%s_%p_%t'
(database);
release channel c1;
#backing up controlfile to the specified destination keeping autobakup copy
configure controlfile autobackup format for device type disk to '/u10/catdb/back
up/auto_cntrl_%F';
configure controlfile autobackup on;
#backup up archivelog files
allocate channel c2 type disk;
backup
format '/u10/catdb/backup/cm2_%d_%s_%p_%t'
(archivelog all);
release channel c2;
}
#!/bin/ksh
export ORACLE_HOME="/u01/app/oracle/product/10.2.0"
export ORACLE_SID="omr"
PATH=$PATH:$ORACLE_HOME/bin
rman target sys/password@omr catalog rman/rman1956@rman
cmdfile='/u04/rman/rman/scripts/omr_archflush.scp'
exit
[omr_archflush.scp]
# RMAN SCRIPT: DELETING ARCHIVE LOGS
run
{
allocate channel c1 type disk;
delete archivelog until time 'SYSDATE-8';
# OR delete archivelog until sequence=;
#or RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
release channel c1;
As DBA you need to use frequent OS command, here I would like to share you
some of the important day to day commands:
1. To delete files older than N number of days ? (Useful in delete log, trace, tmp file )
find . -name *.* -mtime +[N in days] -exec rm {} \;
Example : find . -mtime +5 -exec rm {} \;
(This command will delete files older then N days in that directory
12. To setup cronjob (cronjob is used to schedule job in Unix at O.s. Level )
crontab -l( list current jobs in cron)
crontab -e ( edit current jobs in cron)
20
1,4
/u07/rman/scripts/call_dbbkup_cm0.scp
00
15
/u07/rman/scripts/offbkup_rman.sh
00
20
0,2,3,6
/u07/rman/scripts/call_arch_bkup.scp
OTA Database:
50
23
0,2,3,6
/u01/ota/dailyexp_ota.sh
50
23
1,4
/u01/ota/offbkup_ota.sh
15
14
0,1,2,3,4,6
/u01/ota/morning_arch.sh
How to kill all similar processes with single command (in this case opmn)
ps -ef | grep opmn |grep -v grep | awk {print $2} |xargs -i kill -9 {}
To remove a specific column of output from a UNIX command for example to determine
the UNIX process Ids for all Oracle processes on server (second column)
ps -ef |grep -i oracle |awk '{ print $2 }'
Display amount of occupied space (in KB) for a file or collection of files in a
directory or sub-directory
du -ks * | sort -n| tail
Cleanup any unwanted trace files more than seven days old
find . *.trc -mtime +7 -exec rm {} \;
Locate recently created UNIX files (in the past one day)
find . -mtime -1 -print
Crontab :
To submit a task every Tuesday (day 2) at 2:45PM
45 14 2 * * /opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1
To submit a task to run every hour at 15 minutes past the hour on weekends (days 6 and 0)
15 * 0,6 * * opt/oracle/scripts/tr_listener.sh > /dev/null 2>&1
CLUSTER ADMINISTRATION
2.
3.
OEM
4.
SRVCTL Service Control:
-
Node applications
2.
ASM instances
3.
Databases
4.
Database instances
5.
Database services.
Both OLR & GPNP profile needed by lower/HAS stack & OCR, VD is needed by
upper / CSR Stack.
If OLR or GPNP got corrupted, the corresponding node will go down where as if OCR,
VD gets corrupted the complete Cluster will go down.
-
Every daemon of the node will communicate with the peer (same) daemon nodes.
Oracle availability perform OLR backup at the time of execution of root.sh scrIPt of
grid infrastructure installation & stores in the location $
GRID_HOME/cdata//backup_date_time.olr.
-
Restoring OLR:
-
Restore the OLR from the backup location # ./ocrconfig local restore
Start cluster
Change the init level to either 3 or 5 (init 3 for CLI and init 5 for GUI mode)
It is a critical & shared Clusterware file and contains the complete cluster information like
cluster node name, their corresponding IPs, CSS parameters, OCR autobackup information
& registered resources like nodeapps, ASM instances with their corresponding node names,
databases & database instances & database services
CRSD daemon is responsible for updating OCR file whenever the utilities like srvctl, dbca,
oem, netca etc.
CSSD daemon automatically brings up online all the cluster resources which got registered
in OCR file
Automatic
2.
Physical
3.
Logical
1.
Automatic:
Oracle automatically perform OCR backup for every regular interval of 4 hrs since the CRS
start time and stores in master node.
Backup location:
$ G_H/cdata/
Backup00.ocr (latest)
Backup01.ocr
Backup02.ocr
Day.ocr
Week.ocr
Oracle retains the latest three 4 hours backup, similarly one latest day backup and one
latest week backup by purging all the remaining backup.
Manual Backup:
Restoring OCR:
-
Stop the complete cluster on all the nodes # ./crsctl stop crs
Check the integrity of the restored OCR backup # ./cluvfy comp ocr n all
verbose
2.
Physical backup: Oracle supports image or sector level backup of OCR using dd
utility(if OCR in on raw devices). & cp,(if OCR is on general file system)
# ./ cp
# dd if= of= //if: input file, of: output file.
Restoring:
# ./ cp
# dd if= of= //if: input file, of: output file.
3.
Logical backup:
# ./ocrconfig export
# ./ocrconfig import
Note: Oracle recommends taking the backup of OCR file whenever the cluster configuration
got modified (ex: adding a node/ deleting a node)
OCR Multiplexing: To avoid OCR lost &the complete cluster goes down due to the single
point of failure (SPF) of OCR, Oracle supports OCR multiplexing from 10.2 onwards in max 2
locations (1 as primary other as mirror copy) but from 11.2 onwards it is supporting max 5
locations (1 as primary and remaining as mirror copies)
Note: from 11.2 onwards, oracle support storage of OCR in ASM diskgroups so it provides
mirroring depending on the redundancy level.
It contains basic cluster information like location of voting disk, ASM spfile location,
all the IP addresses and their subnet masks
-
It is another & shared file which contains the node membership of all the nodes
within the cluster
CSSD Daemon is responsible for sending the heartbeat messages to other nodes for
every 1 sec and write the response into VD
VD Backup:
-
From 11.2 onwards, oracle not recommend to take the backup of VD because it
automatically maintains VD backup into OCR file
Restoring VD:
1.
2.
3.
4.
Check the integrity of restored VD. # ./cluvfy comp vdisk n all verbose
VD Multiplexing: To avoid VD lost and the complete cluster goes down, due to SPF of VD,
oracle supports multiplexing of VC from 10.2 onwards in max 31 locations, but from 11.2 it
is supporting in max 15 locations.
Node Eviction:
CSS Parameter:
1.
Miscount: default 30 sec: It specifies the maximum private network latency to wait
before triggering node eviction process by the master node.
2.
Disk timeout: Default is 200 sec: It specifies the VD access latency if elapsed to
have node eviction process by the master node.
3.
Reboot Time: default 3 sec: The affected node waits till the reboot time elapsed for
actual node reboot process (this is to make some 3rd party application goes down properly)
CLUSTER COMPONENTS
OCR file contains the complete cluster information which is required for CRSD
Daemon.
VD Voting Disk:
-
GMNPD
GSD: From 10g it is duplicated, it is responsible for performing the administrative tasks
whenever GUI application like NETCA or DBCA invoked.
ONS Oracle Notification Server: It is responsible for publishing the notification events
thru FAN (Fast Application Notifications)
It is registered as a resource into OCR and maintained the status into OCR.
For Release 2 onwards, we require every node specific one private IP in one subnet
mask and one public IP & VIP on other subnet mask and 3 unused scan VIPs on the same
subnet mask of public.
Types of Storage:
Types of Storage:
NAS: Network Attached Storage: It supports file level I/O
NAS
S
P
A
M
SAN
S
P
A
M
Types of Clusters:
1.
2.
Hardware level
3.
Network level
4.
Application level
a.
Failover cluster
b.
Parallel cluster
c.
Hybrid cluster
Failover Cluster:
Advantages:
1.
2.
3.
4.
5.
Hybrid Cluster:
Types
1.
Vendor
Hp Service Guard
Kernel level
HP
2.
Sun Cluster
Oracle SUN
3.
VERITAS cluster (failover +
parallel)
4.
User / Application
level
Symantec
Oracle
2.
Global Resource directory (GRD) = Global cache service (GCS) + Global Enqueue Services
(GES)
GRD = GCS + GES
RAC is not software; it is a concept in which multiple instances (each on separate node) and
can access a common (single) database
Advantages of RAC:
1.
It offers SPAM
a.
S Scalability
b.
P Performance
c.
A Availability
d.
M Manageability
2.
It Supports HA (high availability) operations to the services like VIPs, Scan IPs etc
3.
4.
5.
Cluster Component:
1.
2.
3.
Clusterware Software
Private Interconnect
Shared Storage
Clusterware software:
It coordinates and manages all the cluster nodes of a cluster by treating all the nodes as a
single large logical server
Version
9i
Linux/windows)
10.1
10.2
11.2
a.
Supports HA operations
High performance
Grid Infrastructure
b.
Combination of Clusterware binaries and ASM
binaries
Oracle Homes
10.1
ASM_HOME (ASM)
CRS_HOME (Clusterware)
ORACLE_HOME (RDBMS)
10.2
CRS_HOME
ORACLE_HOME (Clusterware + ASM)
11.2
High Availability
Availability:
1.
Low Availability:
Recovery)
2.
Medium Availability:
Recovery)
3.
High Availability:
Recovery)
(Incomplete
(Complete
(Complete
Low Availability:
ICR - Loss of redo log files or current control file.
Medium Availability:
It is a complete recovery example Data guard
Max. Performance: This is the default mode
Max Availability:
Max Protection:
A few times I have faced ASM disk failures when redundancy (mirroring) was enabled and
none of them resulted in an issue for an end user. ASM automatically detects the disk failure
and services Oracle SQL requests by retrieving information from the mirrored (other) disk.
Such a failure is handled gracefully and entirely managed by Oracle. I am very impressed by
the fault tolerance capability in ASM.
But soon the Oracle DBA must work with the system administrator to replaced the failed
disk. If the mirrored disk also fails before the replacement, then Oracle SQL by end users
will error because both the primary and mirrored disks have failed.
This post assumes that you are using ASM redundancy (Normal or High) and that you are
not using ASMLib program. The commands and syntax could be different if you are using
ASMLib.
An ASM disk failure as noted below is transparent to end users and one can be caught
unaware if one is not proactive in database monitoring. The DBA can write a program that
constantly checks the database alert logfile or a SQL script that checks for any read/write
errors.
If either of the below queries return rows, then it is confirmed there are one or more ASM
After a few min/hours the above gets completed (no rows returned)
5) The disk add operation is now considered complete.
How to decrease the ASM re-balance operation time
While the above ASM re-balancing operation is in progress, the DBA can let it complete
quickly by changing 'ASM power' by running the below command for example.
alter diskgroup #name# rebalance power 8;
The default power is 1 (i.e ASM starts one re-balance background process to handle the rebalancing work, called ARB process). The above command dynamically starts 8 ARB
processes (ARB0 to ARB7), which can dramatically decrease the time to re-balance. The
maximum power limit in 11g R1 is 11 (upto 11 ARB processes can be started).
Conclusion
None of the above maintenance operations (disk drop, disk add) causes a downtime to the
end user and therefore can be completed during normal business hours. The re-balance
operation can cause slight degradation of performance and hence increase the power limit
to let it complete quickly.
Oracle ASM disk failure - Part 2
Introduction
In Part 1, I wrote about a scenario when ASM detects READ_ERRS/WRITE_ERRS and
updates these columns in v$asm_disk for the ASM disk. The DBA has to explicitly drop the
disk in ASM. This article is about a different scenario when ASM instance itself performs the
'drop disk' operation.
This post assumes that you are using ASM redundancy (Normal or High) and that you are
not using ASMLib program. The commands and syntax could be different if you are using
ASMLib.
Scenario
Unlike scenario 1 discussed in Part 1 of the ASM series, ASM instance can initiate the 'drop
disk' by itself in some situations. Let the failed disk be '/dev/sds1'.
select path
from v$asm_disk
where read_errs is NULL;
/dev/sds1
select path
from v$asm_disk
where write_errs is NULL
/dev/sds1
Additionally, the HEADER_STATUS in v$asm_disk returns a value of UNKNOWN.
select mount_status,header_status,mode_status,state
from v$asm_disk
where path = '/dev/sds1';
CLOSED UNKNOWN ONLINE NORMAL
Compare this scenario with that of the scenario mentioned in Part 1, when the
HEADER_STATUS is still shown as MEMBER and the READ_ERRS/WRITE_ERRS has a value >
0.
The following are the errors mentioned in the +ASM alert log file when the failure was first
noticed.
owner. For example let the disk path after partitioning be /dev/sdk12)select distinct
header_status from v$asm_disk where name = '/dev/sdk1'; (Must show as CANDIDATE)
3)alter diskgroup #name# add disk '/dev/sdk1';
4)ASM starts the re-balancing operation due to the above disk add command. One can
monitor the progress of the re-balance operation by checking v$asm_operation.
select state,power,group_number,EST_MINUTES
from v$asm_operation;
After a few min/hours the above gets completed (no rows returned)
5)The disk add operation is now considered complete.
How to decrease the ASM re-balance operation time
While the above ASM re-balancing operation is in progress, the DBA can let it complete
quickly by changing 'ASM power' by running the below command for example.
I start my day checking any system alerts such as database performance problems, backup
failures etc. We are using Oracle's Enterprise Manager which is a web-based software that
sends email alerts to us automatically whenever it detects a problem based on certain
criteria. I spend most of the day working on current projects such as database upgrades,
migrations, new installations etc. I also help application developers and end-users whenever
they have a database related question or problem.
2) What does it take to be a successful Oracle DBA?
Most of today's E-Business and IT applications are entirely web-based and hence the
underlying databases have to be highly available 24*7. Responsibility, proactive
attitude and emergency preparedness are some of the key characteristics that can
make a successful Oracle DBA. IT application developers and the end-user communities rely
heavily on the database administrator for their day-to-day database issues, questions and
projects. An Oracle DBA should be polite and must treat every one in the organization with
courtesy and respect.
3) Has your job description evolved over time?
Yes indeed ! The definition of an Oracle DBA has a much broader scope today. I started
with just "database work" in my first job. Today my responsibilities include Oracle systems
design and architecture, including Oracle E-Business Suite administration, Oracle
Application Server setup and administration, setting up of Continuity of Business systems
(Disaster Recovery preparedness), setup and administration of Oracle Fusion Middleware
components such as Oracle Portal Server, Identity Management etc. I am also expected to
work on hardware specifications and requirements for upgrading existing Oracle installations
or setting new ones. Whereas the traditional "Oracle DBA" designation has remained the
same, it has a much wider scope and responsibility today.
4) How do you keep up with new features and changes & advancements in database
technology?
Every major Oracle database release comes with a lot of exciting new features which can be
leveraged for simplicity, automation or better database management.
a)I am an avid reader of the bi-monthly Oracle Magazine. The subscription is free and it is
available online as well. The magazine covers the latest in Oracle, contains a lot of expert
articles with a practical outlook to tackle business problems.
b)I have also subscribed to rss feeds in http://otn.oracle.com/ so that i get updated
whenever there is a new knowledge based article. This a popular site for the Oracle
community and most of the technology articles are posted by Oracle ACEs and Oracle ACE
Directors who are proven and recognized individuals by Oracle Corporation.
c)I also recommend aspiring DBAs to register in the Official Oracle Forum , thanks to the
many experts who generously contribute to this discussion board, virtually any of your
database related questions can get answered here.
5.What is the best feature you like about oracle DB, what needs improvement compared to
other databases in the market?
My favorite Oracle database feature is Real Application Clusters (RAC). Using RAC
technology, Oracle databases can be setup for high availability and virtually unlimited
scalability. I did not get a chance to fully evaluate other databases in the market vis-a-vis
the Oracle database. Oracle is the recognized Industry leader as per various results
published by market research companies such as IDC and Gartner.
6.Has any of the following major macro trends affected you personally, whats your opinion?
a.Outsourcing & Offshoring
No. Oracle DBA is one of the few jobs that had a lesser impact by Outsourcing. A DBA is
critical to the success of an IT department requiring a lot of technical understanding,
emotional maturity, ability to handle pressure and crisis and one that comes with a lot of
responsibility. Infact, all the Dice Reports this year show Oracle database as one of the top
technology skills in the market in the USA.
b.Virtualization
Remote Service and Tele-commuting are only for low profile work such as after-hours
support etc. Most of the managers prefer Oracle DBAs to work onsite and with direct
supervision.
The Oracle DBA is usually less impacted by Client-server to Web-based migrations. Oracle
databases can work with both client-server systems and web-based systems.
7.Your advice to people who are evaluating Oracle DB administration as a career.
The IT industry is facing a shortage of quality Oracle DBAs. Oracle database administration
is a good career option with long-term benefits. I have been working as an Oracle database
administrator since more than 6 years and the experience is very rewarding. It has also
given me the confidence to architect and build large scale IT systems. I was able to
positively impact the experience of the end-user community and positively contribute to
various IT departments.