miércoles, 26 de junio de 2013

Oracle Agente de diagnóstico remoto (RDA) de utilidad

Oracle Agente de diagnóstico remoto (RDA) de utilidad



Oracle Remote Diagnostics Agent (RDA) is used primarily by Oracle Support. I've found that this information is very useful and have used to debug issues in my environment. It is a useful utility to me for particular situations.

The utility ships a readme.txt file for both WIndows and Unix that will help get you started. Rather than discuss everything about RDA and analyze the output it provides, I suggest you give it a whirl. Click on this link and you can view the RDA output.

Many of the most difficult Oracle problems to fix usually are due to some environmental issue or change. It was working yesterday, now it's not, what's different. I use the RDA for a comprehensive environment report. But you'll have to wait a bit, it's not exactly speedy. :-)  
You can download it from MetaLink - Doc ID: 314422.1

Steps and Commands:
UNIX / LINUX
WINDOWS
Unzip Files
use Unix/Linux utility
use any Windows utility
Instructions
README_Unix.txt/README_Linux.txt
README_Windows.txt
Verify Installation
rda.sh -cv
rda.cmd -cv
Run Setup
rda.sh -S or rda.pl -S
rda.cmd -S or rda.pl -S
Run RDA
rda.sh -v or rda.pl -v
rda.cmd -v
To view RDA
Open RDA_INDEX.htm from the RDA output directory


Connection to Database:
Open command prompt.
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
And you will be connected to the database.



Oracle Remote Diagnostic Agent (RDA) Report Generation:
Note: I am generating RDA Report on Windows for this article.
Unzip Files:
Unzip the downloaded RDA Utility to a directory ( Here E:/rda ).

Read Instructions:
Go to the directory, where we have unzipped the files and we can read the instructions given in the "Readme_O/S.txt" file.

Verify Installation:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -cv

Run Setup:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -S
 The script continues on for many more pages as part of the configuration. Choose the options according to your Report need.

Run RDA:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -v

View RDA Report:
Open "RDA__index.htm" from the RDA output directory to view the report.

Our RDA Report has been generated.


RMAN show all command

RMAN show all command


RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

http://dbaoracledba.blogspot.mx/2012/06/rman-show-all-command.html

martes, 25 de junio de 2013

12 eBooks gratuitos de Microsoft que no te pueden faltar.

12 eBooks gratuitos de Microsoft que no te pueden faltar.


How to remove a line/parameter from spfile?

How to remove a line/parameter from spfile?

alter system reset parameter scope=spfile sid='nodename';


Example:


alter system reset undo_tablespace scope=spfile sid='NODE11';

Redundancy Policy in RMAN

Redundancy Policy in RMAN

Configuring the Backup Retention Policy

Retention Policy is of two options:
Window-Based Retention Policy
Redundancy-Based Retention Policy

Configuring a Recovery Window-Based Retention Policy:
The recovery window parameters specifies the number of days between the current time and the earliest point of recoverability.

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
The above can recover the database to any point withing the last week.

RMAN does not automatically delete backups rendered obsolute by the recovery window. Instead RMAN marks them as OBSOLUTE in the REPORT OBSOLUTE output.
RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups.

Configuring a Redundancy-Based Retention Policy:
The redundancy parameter specified the number of backups that has to be maintained for the Datafile & Controlfile by RMAN.
RMAN will mark the backups to be obsoluted , if the number of backups for a specific datafile or control file exceeds the Redundancy Setting.
RMAN keeps a track of which ones to retain and which are obsoluted.

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
The above will set RMAN to have only 2 backups of the datafile or controlfile. If a backup is taken after that then the older one will be obsoluted.

RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups.

Configuring Control File and Server Parameter File Autobackup
RMAN can be configured to automatically back up the control file and server parameter file whenever the database structure metadata in the control file changes and whenever a backup record is added.
The autobackup enables RMAN to recover the database even if the current control file, catalog, and server parameter file are lost.

Enabling : CONFIGURE CONTROLFILE AUTOBACKUP ON;
Disabling: CONFIGURE CONTROLFILE AUTOBACKUP OFF;

The following command will configure RMAN the autobackup to write to an ASM DiskGroup

ASM Instance :
(To create the disk group )
CREATE DISKGROUP CONTROL
NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK 'ORCL:ASMD6'
FAILGROUP failure_group_2 DISK 'ORCL:ASMD7';

RMAN :
CONFIGURE CONTROLFILE AUTOBACKUP
FORMAT FOR DEVICE TYPE DISK TO '+CONTROL';

Image copy backup using RMAN



Backup Set:
 A standard RMAN backup set contains one or more backup pieces, and each of these pieces consists of the data blocks for a particular datafile stored in a special compressed format. When a datafile needs to be restored, therefore, the entire datafile essentially needs to be recreated from the blocks present in the backup piece.

Image Copy:
An image copy of a datafile, on the other hand, is much faster to restore because the physical structure of the datafile already exists. Oracle 10g now permit image copies to be created at the database, tablespace, or datafile level through the new RMAN directive BACKUP AS COPY. For example, here is a command script to create image copies for all datafiles in the entire database:
RUN {
# Set the default channel configuration. Note the use of the
# %U directive to insure unique file names for the image copies
ALLOCATE CHANNEL dbkp1 DEVICE TYPE DISK FORMAT 'D:\oracle\rman\ora10G\U%';
# Create an image copy of all datafiles in the database
BACKUP AS COPY DATABASE;
}

 why dont the client wants to have backupsets rather
than image copies? I know that Oracle first perfers to the image copies
compare to incremental or backupsets.

But, you know, image copy is just a block to block copy, no compression. It
would take good considerable time to finish the backup.

10g RMAN has very rich features, like BTC, binary compression and etc.

Vistas de catálogo de RMAN txt

-- Archived and unarchived redo logs
-- RC_ARCHIVED_LOG

SELECT * FROM V$ARCHIVED_LOG;

-- Control files in backup sets
--RC_BACKUP_CONTROLFILE

SELECT * FROM V$BACKUP_DATAFILE ;

-- Corrupt block ranges in datafile backups
-- RC_BACKUP_CORRUPTION
SELECT * FROM V$BACKUP_CORRUPTION ;

-- Datafiles in backup sets
-- RC_BACKUP_DATAFILE

SELECT * FROM V$BACKUP_DATAFILE ;

-- RMAN backups and copies in the repository.
-- RC_BACKUP_FILES
SELECT * FROM V$BACKUP_FILES  ;

-- Backup pieces
--  RC_BACKUP_PIECE
SELECT * FROM V$BACKUP_PIECE ;

-- Archived logs in backups
-- RC_BACKUP_REDOLOG
SELECT * FROM V$BACKUP_REDOLOG   ;

-- Backup sets
-- RC_BACKUP_SET
SELECT * FROM V$BACKUP_SET  ;

-- Server parameter files in backup sets
-- RC_BACKUP_SPFILE
SELECT * FROM V$BACKUP_SPFILE ;

-- Control file copies on disk
-- RC_CONTROLFILE_COPY
SELECT * FROM V$DATAFILE_COPY  ;

-- Ejemplo: /export/home/oracle/rda/output/TMP_RDA/RDA_BR_T28903_01_control.tmp

-- Control file copies on disk
-- RC_COPY_CORRUPTION
SELECT * FROM V$COPY_CORRUPTION ;

-- Databases registered in the recovery catalog (RC_DATABASE) or information about the currently
-- RC_DATABASE
SELECT * FROM V$DATABASE ;

-- Database blocks marked as corrupt in the most recent RMAN backup or copy
-- mounted database (V$DATABASE)
-- RC_DATABASE_BLOCK_CORRUPTION
SELECT * FROM V$DATABASE_BLOCK_CORRUPTION ;

-- All database incarnations registered in the catalog
-- RC_DATABASE_INCARNATION
SELECT * FROM V$DATABASE_INCARNATION ;

-- All datafiles registered in the recovery catalog
-- RC_DATAFILE
SELECT * FROM V$DATAFILE ;

-- Datafile image copies
-- RC_DATAFILE_COPY
SELECT * FROM V$DATAFILE_COPY ;

-- Historical information about online redo logs
-- RC_LOG_HISTORY
SELECT * FROM V$LOG_HISTORY ;

-- Offline ranges for datafiles
-- RC_OFFLINE_RANGE
SELECT * FROM V$OFFLINE_RANGE ;

-- Archived log backups created by proxy copy
-- RC_PROXY_ARCHIVEDLOG
SELECT * FROM V$PROXY_ARCHIVEDLOG ;

-- Control file backups created by proxy copy
-- RC_PROXY_CONTROLFILE
SELECT * FROM V$PROXY_DATAFILE ;

-- Datafile backups created by proxy copy
-- RC_PROXY_DATAFILE
SELECT * FROM V$PROXY_DATAFILE ;

-- Online redo logs for all incarnations of the database since the last catalog resynchronization
-- RC_REDO_LOG
-- V$LOG and V$LOGFILE
SELECT * FROM v$log  ;
SELECT * FROM v$logfile;

-- All redo threads for all incarnations of the database since the last catalog resynchronization
-- RC_RESYNC
-- RC_REDO_THREAD
SELECT * FROM V$THREAD;
-- n/a

-- Recovery catalog resynchronizations
-- RC_RMAN_CONFIGURATION
SELECT * FROM V$RMAN_CONFIGURATION;

-- RMAN persistent configuration settings
-- RC_TABLESPACE
SELECT * FROM V$TABLESPACE ;

How to find corrupted blocks when using rman with catalog

How to find corrupted blocks when using rman with catalog

This view lists corrupt block ranges in datafile backups, which may be detected when BACKUP VALIDATE is used or theMAXCORRUPT parameter is greater than 0. It corresponds to the V$BACKUP_CORRUPTION view in the control file. Note that corruptions are not tolerated in control file and archived redo log backups.


RC_BACKUP_CORRUPTION

Column
Datatype
Description
DB_KEY
NUMBER
The primary key for this database in the recovery catalog. Use this column to join with almost any other catalog view.
DBINC_KEY
NUMBER
The primary key for the incarnation of the target database. Use this column to join with RC_DATABASE_INCARNATION.
DB_NAME
VARCHAR2(8)
The DB_NAME of the database incarnation to which this record belongs.
RECID
NUMBER
The record identifier from V$BACKUP_CORRUPTIONRECID and STAMP form a concatenated primary key that uniquely identifies this record in the target database control file.
STAMP
NUMBER
The stamp propagated from V$BACKUP_CORRUPTIONRECID and STAMP form a concatenated primary key that uniquely identifies this record in the target database control file.
BS_KEY
NUMBER
The primary key of the backup set to which this record belongs in the recovery catalog. Use this column to join with RC_BACKUP_SET orRC_BACKUP_PIECE.
SET_STAMP
NUMBER
The SET_STAMP value from V$BACKUP_SETSET_STAMP and SET_COUNT form a concatenated key that uniquely identifies the backup set to which this record belongs in the target database control file.
SET_COUNT
NUMBER
The SET_COUNT value from V$BACKUP_SETSET_STAMP and SET_COUNT form a concatenated key that uniquely identifies the backup set to which this record belongs in the target database control file.
PIECE#
NUMBER
The backup piece that contains this corrupt block.
BDF_KEY
NUMBER
The primary key for the datafile backup or copy in the recovery catalog. Use this key to join with RC_BACKUP_DATAFILE. If you issue the LIST command while RMAN is connected to the recovery catalog, then this value appears in the KEY column of the output.
BDF_RECID
NUMBER
The RECID value from V$BACKUP_DATAFILE.
BDF_STAMP
NUMBER
The STAMP value from V$BACKUP_DATAFILE.
FILE#
NUMBER
The absolute file number for the datafile that contains the corrupt blocks.
CREATION_CHANGE#
NUMBER
The creation SCN of the datafile containing the corrupt blocks.
BLOCK#
NUMBER
The block number of the first corrupted block in this range of corrupted blocks.
BLOCKS
NUMBER
The number of corrupted blocks found beginning with BLOCK#.
CORRUPTION_CHANGE#
NUMBER
For media corrupt blocks, this value is zero. For logically corrupt blocks, this value is the lowest SCN in the blocks in this corrupt range.
MARKED_CORRUPT
VARCHAR2(3)
YES if this corruption was not previously detected by Oracle, or NO if Oracle had already discovered this corrupt block and marked it as corrupt in the database. Note that when a corrupt block is encountered in a backup, and was not already marked corrupt by Oracle, then the backup process does not mark the block as corrupt in the production datafile. Thus, this field may be YES for the same block in more than one backup set.
CORRUPTION_TYPE
VARCHAR2(9)
Same as RC_DATABASE_BLOCK_CORRUPTION.CORRUPTION_TYPE.