Pages

Tuesday, June 28, 2011

database recovery queries

check the OS is 32bit or 64bit------->uname -m

invalidate all the objects----------->run utlirp.sql

recompile all the invalidated objects-------->run utlrp.sql

Check the status of the objects onto the database--->select * from dba_registry

select count(*) from dba_objects where status != 'VALID';

Enabling ARCHIVELOG Mode

start by checking the current archive modE--->SELECT LOG_MODE FROM SYS.V$DATABASE

V$DATABASE---Identifies whether the database is in ARCHIVELOG or NOARCHIVELOG mode and whether MANUAL (archiving mode) has been specified.

V$ARCHIVED_LOG--->Displays historical archived log information from the control file. If you use a recovery catalog, the RC_ARCHIVED_LOG view contains similar information.

V$ARCHIVE_DEST--->Describes the current instance, all archive destinations, and the current value, mode, and status of these destinations.

V$ARCHIVE_PROCESSES--->Displays information about the state of the various archive processes for an instance.

V$BACKUP_REDOLOG------>Contains information about any backups of archived logs. If you use a recovery catalog, the RC_BACKUP_REDOLOG contains similar information.

V$LOG--->Displays all redo log groups for the database and indicates which need to be archived.

V$LOG_HISTORY--->Contains log history information such as which logs have been archived and the SCN range for each archived log.

How can enable ARCHIVELOG MODE


ALTER SYSTEM ARCHIVE LOG START;

show parameter LOG_ARCHIVE_START------->chech the log archive status

ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;

show parameter log_archive_format

ALTER DATABASE ARCHIVELOG MANUAL--->enable archive log

Adjusting the Number of Archiver Processes--->ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=3;

---------
show parameter LOG_ARCHIVE_TRACE;
ALTER SYSTEM SET LOG_ARCHIVE_TRACE=12;
-----------
query displays which redo log group requires archiving:

SELECT GROUP#, ARCHIVED FROM SYS.V$LOG;
--------------------
To see the current archiving mode, query the V$DATABASE view:

SELECT LOG_MODE FROM SYS.V$DATABASE;

-------------------
db_archive_dest_size-------->display the size of archive

------------------------
v$parameter - Shows the location of the flash recovery area where archived redo logs are created.
v$archived_log - Information about archived redo logs.
v$log_history - Contains information on previous redo logs
redo log size---->select optimal_logfile_size from v$instance_recovery;