Sunday, June 03, 2012

Restoring Archive Logs to a Different Location


In situations where the archived redo logs need to  be restored to a different location, from an existing backup, following steps could be followed.

1.Load the profile of the the database whose archivelog needs to be restored.
2.Connect to rman client.
@:oracle:/home/oracle> rman

Recovery Manager: Release 11.2.0.1.0 - Production on Thu May 31 10:05:37 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

3.Connect to target database.

RMAN> connect target /

connected to target database: PROD (DBID=3162812738)

4.Connect to catalog database.
RMAN> connect catalog rman/rman@RMAN

connected to recovery catalog database

5.Execute the below scripts to restore archivelogs from sequence 100278 to 100298 at location  '/stage'
RMAN>run
>{
>set archivelog destination to '/stage';
>restore archivelog from logseq 100278 until logseq 100298;
>}

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 31-MAY-12
configuration for SBT_TAPE channel 2 is ignored
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=1556 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Data Protection for Oracle: version 5.5.2.0
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 device type=DISK

channel ORA_SBT_TAPE_1: starting archived log restore to user-specified destination
archived log destination=/home/oracle
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=98529
channel ORA_SBT_TAPE_1: reading from backup piece arch_784714064_61569_1
channel ORA_SBT_TAPE_1: piece handle=arch_784714064_61569_1 tag=TAG20120531T080713
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:02:15
Finished restore at 31-MAY-12

RMAN>

6.Restore activity completed.

Monday, March 12, 2012

FAL[client]: Failed to request gap sequence

During my routine early morning checks one day, I noticed that there there is a huge sequence mismatch between primary and standby database.Checking the alert logs revealed the below error message.

Fetching gap sequence in thread 1, gap sequence 2150-2150
Sun Mar 11 17:54:40 2012
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 2150-2150
DBID 31666668 branch 7122030
FAL[client]: All defined FAL servers have been attempted.
-------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
-------------------------------------------------------------


Archived logs of a specific sequence was not available at the standby location.But was able to find this log at primary database(Thank God).


The solution was simple.Copy the specific logfile from primary to standby database.Let the standby database know about its availability.


alter database register logfile "dir+filename" ;


Recovery process would start automatically.Else stop the managed recovery and re-start it once again.

Thursday, February 23, 2012

Restarting an IMPDP Job

There is a unique feature in impdp by which we could re-start the job, from the exact position where it stopped.

The reason for the job getting stopped(or forcefully stopped) could be anything from lack of space or if in case of any database parameter change.

The steps are as below :

1. In the import window - Ctrl -C(to come out of the running job)
2. Import> stop_job=immediate
3. Do the necessary changes.
4. Find the job name (SELECT * FROM DBA_DATAPUMP_JOBS;)
5. Attach to the job - impdp system/xxxxxxxxxxx attach=SYS_IMPORT_FULL_01
6. Restart the job
Import> start_job
7. Check the status
Import> status

Tuesday, January 10, 2012

Database Point In Time Recovery

@:oracle:/home/oracle> sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 9 18:09:45 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2207208 bytes
Variable Size 1006633496 bytes
Database Buffers 587202560 bytes
Redo Buffers 7368704 bytes
Database mounted.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options

@:oracle:/home/oracle> rman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jan 9 18:10:38 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target /

connected to target database: TEST (DBID=3150684, not open)

RMAN> connect catalog rman/rman@RMAN

connected to recovery catalog database

RMAN>RUN
{
SET UNTIL SEQUENCE 109; -- V$LOG_HISTORY
#Alternatives:
#SET UNTIL SCN 1000;
#SET UNTIL TIME 'Nov 15 2004 09:00:00';
RESTORE DATABASE;
RECOVER DATABASE;
}

executing command: SET until clause

Starting restore at 09-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=66 device type=DISK
flashing back control file to SCN 3267640

Finished restore at 09-JAN-12

Starting recover at 09-JAN-12
using channel ORA_DISK_1

starting media recovery


xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx

media recovery complete, elapsed time: 00:00:47
Finished recover at 09-JAN-12

RMAN> alter database open resetlogs;

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>