Wednesday, May 25, 2016

Restore Oracle11gr2 RMAN Backup to Another Server

In this article we are showing how to restore oracle11gr2 RMAN backup to different server:

[oracle@bkuptest ~]$ echo $ORACLE_SID
remitdb
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon May 16 11:14:06 2016

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

connected to target database (not started)

RMAN>

RMAN>

--==Startup database in nomount mode==
RMAN> startup nomount force;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/soft/app/oracle/product/11.2.0.4.0/dbhome_1/dbs/initremitdb.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                285213576 bytes
Database Buffers             775946240 bytes
Redo Buffers                   5517312 bytes

--==Restore spfile from RMAN backup==
RMAN> restore spfile from '/soft/spf_1_29228_150520161256.bkp';

Starting restore at 16-MAY-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=429 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /soft/spf_1_29228_150520161256.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 16-MAY-16

RMAN>

--===Create PFILE from SPFILE==
oracle@bkuptest ~]$
[oracle@bkuptest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 16 11:34:59 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> create pfile from spfile;

File created.

SQL>

--===PFILE parameter changes as require===
*.audit_file_dest='/soft/app/oracle/admin/bkuptest/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/data/bkuptest/control01.ctl','/fra/bkuptest/control02.ctl'
*.db_block_size=8192
*.db_domain='nblbd.com'
*.db_name='remitdb'
*.db_recovery_file_dest='/fra'
*.db_recovery_file_dest_size=193273528320
*.diagnostic_dest='/soft/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=remitdbXDB)'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=30
*.memory_max_target=7516192768
*.memory_target=7516192768
*.open_cursors=300
*.processes=5000
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

--===Create SPFILE from PFILE==
SQL> create spfile from pfile;

File created.

--==Shutdown Database ===
RMAN> shutdown immediate

Oracle instance shut down


--===Startup  database in no mount===
RMAN> startup nomount pfile='/soft/app/oracle/product/11.2.0.4.0/dbhome_1/dbs/initremitdb.ora';

connected to target database (not started)
Oracle instance started

Total System Global Area    7482626048 bytes

Fixed Size                     2267792 bytes
Variable Size               5804918128 bytes
Database Buffers            1660944384 bytes
Redo Buffers                  14495744 bytes

--===Set DBID ===
RMAN> set dbid=4077401740

executing command: SET DBID

--===Restore Control file from BACKUP===
RMAN> restore controlfile from '/soft/ctl_1_29227_150520161256.bkp';

Starting restore at 16-MAY-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5644 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output file name=/data/bkuptest/control01.ctl
output file name=/fra/bkuptest/control02.ctl
Finished restore at 16-MAY-16

--===Database mount===
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1


--==To let RMAN know about the backup in /soft, we use the CATALOG command===
RMAN>
RMAN> catalog start with '/soft';

Starting implicit crosscheck backup at 16-MAY-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1885 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=5650 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=6 device type=DISK
Crosschecked 3 objects
Crosschecked 154 objects
Finished implicit crosscheck backup at 16-MAY-16

Starting implicit crosscheck copy at 16-MAY-16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
Crosschecked 2 objects
Finished implicit crosscheck copy at 16-MAY-16

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /soft
no files found to be unknown to the database

RMAN>

--==Restore database== RMAN> restore database;

Starting restore at 16-MAY-16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/remitdb/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/remitdb/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/remitdb/qpaydbindex01.dbf
channel ORA_DISK_1: reading from backup piece /soft/db_1_29225_150520161256.bkp
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /u01/app/oracle/oradata/remitdb/system01.dbf
channel ORA_DISK_2: restoring datafile 00004 to /u01/app/oracle/oradata/remitdb/users01.dbf
channel ORA_DISK_2: restoring datafile 00007 to /u01/app/oracle/oradata/remitdb/nblqp2fa01.dbf
channel ORA_DISK_2: reading from backup piece /soft/db_1_29224_150520161256.bkp
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00005 to /u01/app/oracle/oradata/remitdb/qpaydb01.dbf
channel ORA_DISK_3: restoring datafile 00008 to /u01/app/oracle/oradata/remitdbuser2fa.DBF
channel ORA_DISK_3: reading from backup piece /soft/db_1_29223_150520161256.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /soft/db_1_29225_150520161256.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/remitdb/undotbs01.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1

channel ORA_DISK_2: ORA-19870: error while restoring backup piece /soft/db_1_29224_150520161256.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/remitdb/system01.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1

channel ORA_DISK_3: ORA-19870: error while restoring backup piece /soft/db_1_29223_150520161256.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/remitdb/qpaydb01.dbf"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1

failover to previous backup

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/16/2016 13:06:46
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

RMAN>


--====RESTORE and RECOVER the database==
RMAN> run{
SET NEWNAME FOR DATAFILE 1 TO '/data/bkuptest/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/data/bkuptest/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/data/bkuptest/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/data/bkuptest/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/data/bkuptest/qpaydb01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/data/bkuptest/qpaydbindex01.dbf';
SET NEWNAME FOR DATAFILE 7 TO '/data/bkuptest/nblqp2fa01.dbf';
SET NEWNAME FOR DATAFILE 8 TO '/data/bkuptest/remitdbuser2fa.DBF';
restore database;
switch datafile all;
recover database;}

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 16-MAY-16
Starting implicit crosscheck backup at 16-MAY-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1885 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=5650 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=6 device type=DISK
Crosschecked 3 objects
Crosschecked 154 objects
Finished implicit crosscheck backup at 16-MAY-16

Starting implicit crosscheck copy at 16-MAY-16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
Crosschecked 2 objects
Finished implicit crosscheck copy at 16-MAY-16

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /data/bkuptest/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /data/bkuptest/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /data/bkuptest/qpaydbindex01.dbf
channel ORA_DISK_1: reading from backup piece /soft/db_1_29225_150520161256.bkp
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /data/bkuptest/system01.dbf
channel ORA_DISK_2: restoring datafile 00004 to /data/bkuptest/users01.dbf
channel ORA_DISK_2: restoring datafile 00007 to /data/bkuptest/nblqp2fa01.dbf
channel ORA_DISK_2: reading from backup piece /soft/db_1_29224_150520161256.bkp
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00005 to /data/bkuptest/qpaydb01.dbf
channel ORA_DISK_3: restoring datafile 00008 to /data/bkuptest/remitdbuser2fa.DBF
channel ORA_DISK_3: reading from backup piece /soft/db_1_29223_150520161256.bkp
channel ORA_DISK_1: piece handle=/soft/db_1_29225_150520161256.bkp tag=DB_150520161256
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:05
channel ORA_DISK_2: piece handle=/soft/db_1_29224_150520161256.bkp tag=DB_150520161256
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:10:25
channel ORA_DISK_3: piece handle=/soft/db_1_29223_150520161256.bkp tag=DB_150520161256
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:14:36
Finished restore at 16-MAY-16

datafile 1 switched to datafile copy
input datafile copy RECID=11 STAMP=912002223 file name=/data/bkuptest/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=12 STAMP=912002224 file name=/data/bkuptest/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=13 STAMP=912002225 file name=/data/bkuptest/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=14 STAMP=912002226 file name=/data/bkuptest/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=15 STAMP=912002227 file name=/data/bkuptest/qpaydb01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=16 STAMP=912002228 file name=/data/bkuptest/qpaydbindex01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=17 STAMP=912002229 file name=/data/bkuptest/nblqp2fa01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=18 STAMP=912002230 file name=/data/bkuptest/remitdbuser2fa.DBF

Starting recover at 16-MAY-16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

starting media recovery

Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/data/bkuptest/system01.dbf'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/16/2016 13:57:21
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 961622 and starting SCN of 649440238 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 961621 and starting SCN of 649432402 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 961620 and starting SCN of 649423457 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 961619 and starting SCN of 649413447 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 961618 and starting SCN of 649405456 found to restore

RMAN>

Copy above specified Archivelog (sequence 961618,961619,961620,961621,961622) to following new server directory /fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/ then recover database

=================================================================
RMAN> RECOVER DATABASE;

Starting recover at 16-MAY-16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

starting media recovery

archived log for thread 1 with sequence 961619 is already on disk as file /fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961619_cmj84crz_.arc
archived log for thread 1 with sequence 961620 is already on disk as file /fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961620_cmj8kj68_.arc
archived log for thread 1 with sequence 961621 is already on disk as file /fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961621_cmj8xllx_.arc
archived log for thread 1 with sequence 961622 is already on disk as file /fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961622_cmj93x7z_.arc
archived log file name=/fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961619_cmj84crz_.arc thread=1 sequence=961619
archived log file name=/fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961620_cmj8kj68_.arc thread=1 sequence=961620
archived log file name=/fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961621_cmj8xllx_.arc thread=1 sequence=961621
archived log file name=/fra/fast_recovery_area/REMITDB/archivelog/2016_05_15/o1_mf_1_961622_cmj93x7z_.arc thread=1 sequence=961622
unable to find archived log
archived log thread=1 sequence=961623
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/16/2016 15:32:28
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 961623 and starting SCN of 649445097

Note: this error can be ignore as RMAN has applied all the available archivelog files and is now trying to apply a non-existent archive log file.


--====Change and Rename Redo Logs location=====
alter database rename file '/u01/app/oracle/oradata/remitdb/redo01a.log' to '/data/bkuptest/redo01a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo01b.log' to '/data/bkuptest/redo01b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo02a.log' to '/data/bkuptest/redo02a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo02b.log' to '/data/bkuptest/redo02b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo03a.log' to '/data/bkuptest/redo03a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo03b.log' to '/data/bkuptest/redo03b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo04a.log' to '/data/bkuptest/redo04a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo04b.log' to '/data/bkuptest/redo04b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo05a.log' to '/data/bkuptest/redo05a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/redo05b.log' to '/data/bkuptest/redo05b.log' ;


SQL>
SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo01a.log' to '/data/bkuptest/redo01a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo01b.log' to '/data/bkuptest/redo01b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo02a.log' to '/data/bkuptest/redo02a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo02b.log' to '/data/bkuptest/redo02b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo03a.log' to '/data/bkuptest/redo03a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo03b.log' to '/data/bkuptest/redo03b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo04a.log' to '/data/bkuptest/redo04a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo04b.log' to '/data/bkuptest/redo04b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo05a.log' to '/data/bkuptest/redo05a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/redo05b.log' to '/data/bkuptest/redo05b.log' ;

Database altered.

SQL>

alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo01a.log' to '/data/bkuptest/standby_redo01a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo01b.log' to '/data/bkuptest/standby_redo01b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo02a.log' to '/data/bkuptest/standby_redo02a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo02b.log' to '/data/bkuptest/standby_redo02b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo03a.log' to '/data/bkuptest/standby_redo03a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo03b.log' to '/data/bkuptest/standby_redo03b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo04a.log' to '/data/bkuptest/standby_redo04a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo04b.log' to '/data/bkuptest/standby_redo04b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo05a.log' to '/data/bkuptest/standby_redo05a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo05b.log' to '/data/bkuptest/standby_redo05b.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo06a.log' to '/data/bkuptest/standby_redo06a.log' ;
alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo06b.log' to '/data/bkuptest/standby_redo06b.log' ;

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo01a.log' to '/data/bkuptest/standby_redo01a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo01b.log' to '/data/bkuptest/standby_redo01b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo02a.log' to '/data/bkuptest/standby_redo02a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo02b.log' to '/data/bkuptest/standby_redo02b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo03a.log' to '/data/bkuptest/standby_redo03a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo03b.log' to '/data/bkuptest/standby_redo03b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo04a.log' to '/data/bkuptest/standby_redo04a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo04b.log' to '/data/bkuptest/standby_redo04b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo05a.log' to '/data/bkuptest/standby_redo05a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo05b.log' to '/data/bkuptest/standby_redo05b.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo06a.log' to '/data/bkuptest/standby_redo06a.log' ;

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/remitdb/standby_redo06b.log' to '/data/bkuptest/standby_redo06b.log' ;

Database altered.

SQL>

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 3 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 3 thread 1: '/data/bkuptest/redo03a.log'
ORA-00312: online log 3 thread 1: '/data/bkuptest/redo03b.log'


SQL> select group#, status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CLEARING
         2 CLEARING
         5 CLEARING
         4 CLEARING
         3 CLEARING_CURRENT

SQL>
SQL> alter database clear logfile group 1;

Database altered.

SQL> alter database clear logfile group 2;

Database altered.

SQL> alter database clear logfile group 3;

Database altered.

SQL> alter database clear logfile group 4;

Database altered.

SQL> alter database clear logfile group 5;

Database altered.

SQL> select group#, status from v$log;

    GROUP# STATUS
---------- ----------------
         1 UNUSED
         2 UNUSED
         5 UNUSED
         4 UNUSED
         3 CURRENT

SQL>

--====


SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 3689
Session ID: 5644 Serial number: 5


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 16 16:52:00 2016

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 7482626048 bytes
Fixed Size                  2267792 bytes
Variable Size            5804918128 bytes
Database Buffers         1660944384 bytes
Redo Buffers               14495744 bytes
Database mounted.
SQL>  select open_mode, DATABASE_ROLE, guard_status, SWITCHOVER_STATUS from v$database;

OPEN_MODE            DATABASE_ROLE    GUARD_S SWITCHOVER_STATUS
-------------------- ---------------- ------- --------------------
MOUNTED              PRIMARY          NONE    NOT ALLOWED

SQL> alter database set standby database to maximize performance;

Database altered.

SQL>
SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 7482626048 bytes
Fixed Size                  2267792 bytes
Variable Size            5804918128 bytes
Database Buffers         1660944384 bytes
Redo Buffers               14495744 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 3887
Session ID: 5644 Serial number: 5


SQL>

ORA-39700: database must be opened with upgrade option

After restore database another server appear this error, because on older server database version was 11.2.0.1.0 and on new server database version is 11.2.0.4.0, therefore we need:
1) open with upgrade option
2) upgrade database – it means run script $ORACLE_HOME/rdbms/admin/catupgrd.sql
3) shutdown clearly and startup
4) run script $ORACLE_HOME/rdbms/admin/utlrp.sql – for recompile all invalid PL/SQL packages

sqlplus / as sysdba
SQL> startup upgrade;
SQL> @/soft/app/oracle/product/11.2.0.4.0/dbhome_1//rdbms/admin/catupgrd.sql
SQL> shutdown immediate;
SQL> startup;
SQL> @/soft/app/oracle/product/11.2.0.4.0/dbhome_1//rdbms/admin/utlrp.sql





SQL> startup upgrade;
ORACLE instance started.

Total System Global Area 7482626048 bytes
Fixed Size                  2267792 bytes
Variable Size            6023021936 bytes
Database Buffers         1442840576 bytes
Redo Buffers               14495744 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>
SQL> @/soft/app/oracle/product/11.2.0.4.0/dbhome_1//rdbms/admin/catupgrd.sql
.................
................running....
...............
DOC>   Next restart for normal operation, and then run utlrp.sql to
DOC>   recompile any invalid application objects.
DOC>
DOC>   If the source database had an older time zone version prior to
DOC>   upgrade, then please run the DBMS_DST package.  DBMS_DST will upgrade
DOC>   TIMESTAMP WITH TIME ZONE data to use the latest time zone file shipped
DOC>   with Oracle.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL>
SQL> Rem Set errorlogging off
SQL> SET ERRORLOGGING OFF;
SQL>
SQL> REM END OF CATUPGRD.SQL
SQL>
SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
SQL> REM                This forces user to start a new sqlplus session in order
SQL> REM                to connect to the upgraded db.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$
[oracle@bkuptest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 16 17:58:53 2016

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 7482626048 bytes
Fixed Size                  2267792 bytes
Variable Size            6023021936 bytes
Database Buffers         1442840576 bytes
Redo Buffers               14495744 bytes
Database mounted.
Database opened.
SQL> @/soft/app/oracle/product/11.2.0.4.0/dbhome_1//rdbms/admin/utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2016-05-16 17:59:33

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
...............
................
.....................
Function dropped.

Warning: XDB now invalid, could not find xdbconfig
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110:
data file 201: '/u01/app/oracle/oradata/remitdb/temp01.dbf'
ORA-01403: no data
found

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> exit
[oracle@bkuptest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 16 18:00:09 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL>
SQL>

Tuesday, May 24, 2016

ORA-31634: job already exists,ORA-31664: unable to construct unique job name when defaulted (DATAPUMP fails)

[oracle@qpaydb soft]$ expdp xxx directory=recon_dir dumpfile=qpay_24516.dmp

Export: Release 11.2.0.4.0 - Production on Tue May 24 14:36:07 2016

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31634: job already exists
ORA-31664: unable to construct unique job name when defaulted


Cause
If the entries in DBA_DATAPUMP_JOBS table become equals to 99 for any particular schema then “ORA-31634 : job already exists”

SELECT owner_name,job_name,operation,state FROM DBA_DATAPUMP_JOBS;


Solution
select owner,table_name from dba_tables where table_name like '%SYS%EXPORT%';

SQL> select owner,table_name from dba_tables where table_name like '%SYS%EXPORT%';

SQL> select owner,table_name from dba_tables where table_name like '%SYS%EXPORT%';

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_46
xxx                         SYS_EXPORT_SCHEMA_45
xxx                         SYS_EXPORT_SCHEMA_44
xxx                         SYS_EXPORT_SCHEMA_43
xxx                         SYS_EXPORT_SCHEMA_42
xxx                         SYS_EXPORT_SCHEMA_41
xxx                         SYS_EXPORT_SCHEMA_40
xxx                         SYS_EXPORT_SCHEMA_39
xxx                         SYS_EXPORT_SCHEMA_38
xxx                         SYS_EXPORT_SCHEMA_37
xxx                         SYS_EXPORT_SCHEMA_36

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_35
xxx                         SYS_EXPORT_SCHEMA_34
xxx                         SYS_EXPORT_SCHEMA_33
xxx                         SYS_EXPORT_SCHEMA_32
xxx                         SYS_EXPORT_SCHEMA_31
xxx                         SYS_EXPORT_SCHEMA_30
xxx                         SYS_EXPORT_SCHEMA_29
xxx                         SYS_EXPORT_SCHEMA_28
xxx                         SYS_EXPORT_SCHEMA_27
xxx                         SYS_EXPORT_SCHEMA_26
xxx                         SYS_EXPORT_SCHEMA_25

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_24
xxx                         SYS_EXPORT_SCHEMA_23
xxx                         SYS_EXPORT_SCHEMA_22
xxx                         SYS_EXPORT_SCHEMA_21
xxx                         SYS_EXPORT_SCHEMA_20
xxx                         SYS_EXPORT_SCHEMA_19
xxx                         SYS_EXPORT_SCHEMA_18
xxx                         SYS_EXPORT_SCHEMA_17
xxx                         SYS_EXPORT_SCHEMA_16
xxx                         SYS_EXPORT_SCHEMA_15
xxx                         SYS_EXPORT_SCHEMA_14

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_13
xxx                         SYS_EXPORT_SCHEMA_12
xxx                         SYS_EXPORT_SCHEMA_11
xxx                         SYS_EXPORT_SCHEMA_10
xxx                         SYS_EXPORT_SCHEMA_09
xxx                         SYS_EXPORT_SCHEMA_08
xxx                         SYS_EXPORT_SCHEMA_07
xxx                         SYS_EXPORT_SCHEMA_06
xxx                         SYS_EXPORT_SCHEMA_05
xxx                         SYS_EXPORT_SCHEMA_04
xxx                         SYS_EXPORT_SCHEMA_03

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_02
xxx                         SYS_EXPORT_SCHEMA_01
xxx                         SYS_EXPORT_SCHEMA_99
xxx                         SYS_EXPORT_SCHEMA_98
xxx                         SYS_EXPORT_SCHEMA_97
xxx                         SYS_EXPORT_SCHEMA_96
xxx                         SYS_EXPORT_SCHEMA_95
xxx                         SYS_EXPORT_SCHEMA_94
xxx                         SYS_EXPORT_SCHEMA_93
xxx                         SYS_EXPORT_SCHEMA_92
xxx                         SYS_EXPORT_SCHEMA_91

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_90
xxx                         SYS_EXPORT_SCHEMA_89
xxx                         SYS_EXPORT_SCHEMA_88
xxx                         SYS_EXPORT_SCHEMA_87
xxx                         SYS_EXPORT_SCHEMA_86
xxx                         SYS_EXPORT_SCHEMA_85
xxx                         SYS_EXPORT_SCHEMA_84
xxx                         SYS_EXPORT_SCHEMA_83
xxx                         SYS_EXPORT_SCHEMA_82
xxx                         SYS_EXPORT_SCHEMA_81
xxx                         SYS_EXPORT_SCHEMA_80

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_79
xxx                         SYS_EXPORT_SCHEMA_78
xxx                         SYS_EXPORT_SCHEMA_77
xxx                         SYS_EXPORT_SCHEMA_76
xxx                         SYS_EXPORT_SCHEMA_75
xxx                         SYS_EXPORT_SCHEMA_74
xxx                         SYS_EXPORT_SCHEMA_73
xxx                         SYS_EXPORT_SCHEMA_72
xxx                         SYS_EXPORT_SCHEMA_71
xxx                         SYS_EXPORT_SCHEMA_70
xxx                         SYS_EXPORT_SCHEMA_69

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_68
xxx                         SYS_EXPORT_SCHEMA_67
xxx                         SYS_EXPORT_SCHEMA_66
xxx                         SYS_EXPORT_SCHEMA_65
xxx                         SYS_EXPORT_SCHEMA_64
xxx                         SYS_EXPORT_SCHEMA_63
xxx                         SYS_EXPORT_SCHEMA_62
xxx                         SYS_EXPORT_SCHEMA_61
xxx                         SYS_EXPORT_SCHEMA_60
xxx                         SYS_EXPORT_SCHEMA_59
xxx                         SYS_EXPORT_SCHEMA_58

OWNER                          TABLE_NAME
------------------------------ ------------------------------
xxx                         SYS_EXPORT_SCHEMA_57
xxx                         SYS_EXPORT_SCHEMA_56
xxx                         SYS_EXPORT_SCHEMA_55
xxx                         SYS_EXPORT_SCHEMA_54
xxx                         SYS_EXPORT_SCHEMA_53
xxx                         SYS_EXPORT_SCHEMA_52
xxx                         SYS_EXPORT_SCHEMA_51
xxx                         SYS_EXPORT_SCHEMA_50
xxx                         SYS_EXPORT_SCHEMA_49
xxx                         SYS_EXPORT_SCHEMA_48
xxx                         SYS_EXPORT_SCHEMA_47

99 rows selected.

SQL>

Drop the SYSTEM.SYS_EXPORT_FULL_01 until 99 tables and re-try running the expdp backup

SQL> drop table xxx.SYS_EXPORT_SCHEMA_01;

Table dropped.

SQL> drop table xxx.SYS_EXPORT_SCHEMA_02;

Table dropped.

SQL> drop table xxx.SYS_EXPORT_SCHEMA_03;

Table dropped.
...............
.................
SQL> drop table xxx.SYS_EXPORT_SCHEMA_99;