Sunday 24 November 2019

HOW TO RESTORE ARCHIVE LOG FROM RMAN BACKUP

                             
                        Steps to restore missing or deleted archive logs from rman backup :


[root@localhost Desktop]# su - oracle
[oracle@localhost ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 22 16:15:48 2019

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, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> archive log list;
Database log mode        Archive Mode
Automatic archival                Enabled
Archive destination            +ORA_FRA
Oldest online log sequence       42
Next log sequence to archive    44
Current log sequence           44
   
SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL>/

System altered.

SQL> archive log list;

Database log mode        Archive Mode
Automatic archival              Enabled
Archive destination          +ORA_FRA
Oldest online log sequence        47
Next log sequence to archive     49
Current log sequence            49

(I generated new archives by commenting alter system switch logfile)

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

[oracle@localhost ~]$ su - oraasm
[oraasm@localhost ~]$ asmcmd
ASMCMD> cd /ORA_FRA/ORCL/ARCHIVELOG/2019_11_22/
ASMCMD> lsASMCMD> ls
thread_1_seq_33.278.1025001321
thread_1_seq_34.285.1025006701
thread_1_seq_35.282.1025006703
thread_1_seq_36.284.1025006701
thread_1_seq_37.286.1025006701
thread_1_seq_38.281.1025006703
thread_1_seq_39.283.1025006701
thread_1_seq_40.280.1025006703
thread_1_seq_41.279.1025006703
thread_1_seq_42.287.1025004541
thread_1_seq_43.288.1025004593
thread_1_seq_44.289.1025021797
thread_1_seq_45.290.1025021797
thread_1_seq_46.291.1025021799
thread_1_seq_47.292.1025021803
thread_1_seq_48.293.1025021813
ASMCMD> exit

[oraasm@localhost ~]$ exit
logout
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Nov 22 16:20:16 2019

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

connected to target database: ORCL (DBID=1545186911)

RMAN> backup database plus archivelog;


Starting backup at 22-NOV-19
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_34.279.1025001919 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 34
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_35.280.1025001919 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 35
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_36.281.1025001923 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 36
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_37.282.1025002441 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 37
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_38.283.1025002443 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 38
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_39.284.1025002445 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 39
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_40.285.1025002447 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 40
archived log +ORA_FRA/orcl/archivelog/2019_11_22/thread_1_seq_41.286.1025002449 not found or out of sync with catalog
trying alternate file for archived log of thread 1 with sequence 41
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=28 RECID=14 STAMP=1024651471
input archived log thread=1 sequence=29 RECID=15 STAMP=1024742576
input archived log thread=1 sequence=30 RECID=16 STAMP=1024743125
input archived log thread=1 sequence=31 RECID=17 STAMP=1024743168
input archived log thread=1 sequence=32 RECID=18 STAMP=1024914078
input archived log thread=1 sequence=33 RECID=19 STAMP=1025001324
input archived log thread=1 sequence=34 RECID=31 STAMP=1025006701
input archived log thread=1 sequence=35 RECID=34 STAMP=1025006702
input archived log thread=1 sequence=36 RECID=32 STAMP=1025006701
input archived log thread=1 sequence=37 RECID=30 STAMP=1025006701
input archived log thread=1 sequence=38 RECID=35 STAMP=1025006702
input archived log thread=1 sequence=39 RECID=33 STAMP=1025006702
input archived log thread=1 sequence=40 RECID=36 STAMP=1025006702
input archived log thread=1 sequence=41 RECID=37 STAMP=1025006702
input archived log thread=1 sequence=42 RECID=28 STAMP=1025004540
input archived log thread=1 sequence=43 RECID=29 STAMP=1025004593
input archived log thread=1 sequence=44 RECID=38 STAMP=1025021797
input archived log thread=1 sequence=45 RECID=39 STAMP=1025021798
input archived log thread=1 sequence=46 RECID=40 STAMP=1025021799
input archived log thread=1 sequence=47 RECID=41 STAMP=1025021803
input archived log thread=1 sequence=48 RECID=42 STAMP=1025021813
input archived log thread=1 sequence=49 RECID=43 STAMP=1025022031
channel ORA_DISK_1: starting piece 1 at 22-NOV-19
channel ORA_DISK_1: finished piece 1 at 22-NOV-19
piece handle=/apps/oracle/rdbms/product/11.2.0/db_home/dbs/0quhh62g_1_1 tag=TAG20191122T162031 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 22-NOV-19

Starting backup at 22-NOV-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+ORA_DATA/orcl/datafile/system.260.1017406203
input datafile file number=00002 name=+ORA_DATA/orcl/datafile/sysaux.261.1017406247
input datafile file number=00003 name=+ORA_DATA/orcl/datafile/undotbs1.262.1017406285
input datafile file number=00004 name=+ORA_DATA/orcl/datafile/users.264.1017406313
channel ORA_DISK_1: starting piece 1 at 22-NOV-19
channel ORA_DISK_1: finished piece 1 at 22-NOV-19
piece handle=/apps/oracle/rdbms/product/11.2.0/db_home/dbs/0ruhh62o_1_1 tag=TAG20191122T162040 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 22-NOV-19

Starting backup at 22-NOV-19
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=50 RECID=44 STAMP=1025022066
channel ORA_DISK_1: starting piece 1 at 22-NOV-19
channel ORA_DISK_1: finished piece 1 at 22-NOV-19
piece handle=/apps/oracle/rdbms/product/11.2.0/db_home/dbs/0suhh63i_1_1 tag=TAG20191122T162106 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-NOV-19

Starting Control File and SPFILE Autobackup at 22-NOV-19
piece handle=/apps/oracle/rdbms/product/11.2.0/db_home/dbs/c-1545186911-20191122-01 comment=NONE
Finished Control File and SPFILE Autobackup at 22-NOV-19

RMAN> exit
Recovery Manager complete.

[oracle@localhost ~]$ su - oraasm
[oraasm@localhost ~]$ asmcmd
ASMCMD> cd /ORA_FRA/ORCL/ARCHIVELOG/2019_11_22/
ASMCMD> ls
thread_1_seq_33.278.1025001321
thread_1_seq_34.285.1025006701
thread_1_seq_35.282.1025006703
thread_1_seq_36.284.1025006701
thread_1_seq_37.286.1025006701
thread_1_seq_38.281.1025006703
thread_1_seq_39.283.1025006701
thread_1_seq_40.280.1025006703
thread_1_seq_41.279.1025006703
thread_1_seq_42.287.1025004541
thread_1_seq_43.288.1025004593
thread_1_seq_44.289.1025021797
thread_1_seq_45.290.1025021797
thread_1_seq_46.291.1025021799
thread_1_seq_47.292.1025021803
thread_1_seq_48.293.1025021813
thread_1_seq_49.294.1025022031
thread_1_seq_50.295.1025022067

Here by deleting some archives manually;

[ Note: Before deleting archives make sure that you have taken full database backup ]

ASMCMD> rm thread_1_seq_36.284.1025006701 thread_1_seq_37.286.1025006701 thread_1_seq_38.281.1025006703 thread_1_seq_39.283.1025006701 thread_1_seq_40.280.1025006703 thread_1_seq_41.279.1025006703 thread_1_seq_42.287.1025004541

ASMCMD> exit
[oraasm@localhost ~]$ exit
logout
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Nov 22 16:25:09 2019

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

connected to target database: ORCL (DBID=1545186911)

RMAN> run
{
set archivelog destination to '+ORA_FRA/ORCL/ARCHIVELOG/ARCHIVELOG1';
restore archivelog from logseq=36 until logseq=42;
}

(You can set archivelog destination to '     '; whatever as present )
( I have deleted archivelog from logsequence 36 to 42 so i have mentioned above)

executing command: SET ARCHIVELOG DESTINATION
using target database control file instead of recovery catalog

Starting restore at 22-NOV-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK

channel ORA_DISK_1: starting archived log restore to user-specified destination
archived log destination=+ORA_FRA/ORCL/ARCHIVELOG/ARCHIVELOG1
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=36
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=37
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=38
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=39
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=40
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=41
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=42
channel ORA_DISK_1: reading from backup piece /apps/oracle/rdbms/product/11.2.0/db_home/dbs/0quhh62g_1_1
channel ORA_DISK_1: piece handle=/apps/oracle/rdbms/product/11.2.0/db_home/dbs/0quhh62g_1_1 tag=TAG20191122T162031
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 22-NOV-19

RMAN> exit


Recovery Manager complete.
[oracle@localhost ~]$ su - oraasm
Password:
[oraasm@localhost ~]$ asmcmd
ASMCMD> cd /ORA_FRA/ORCL/ARCHIVELOG/ARCHIVELOG1
ASMCMD> ls
1_34_1017406175.arch
1_35_1017406175.arch
1_36_1017406175.arch
1_37_1017406175.arch
1_38_1017406175.arch
1_39_1017406175.arch
1_40_1017406175.arch
1_41_1017406175.arch
1_42_1017406175.arch

ASMCMD> exit

                   
                            To restore archivelg from rman backup is completed successfully.


                                               
                                                     "Thankyou, Have a nice-day"



HOW TO RESIZE SGA AND PGA SIZE IN ORACLE

                                               TO INCREASE SGA SIZE: SQL> show parameter sga NAME      TYPE        VALUE ---...