Dream Always Dream , if you don't work on it : Real-world Oracle DBA troubleshooting guides for RAC, Data Guard, RMAN, performance tuning, upgrades, backups, and cloud migration. Tested in production environments.
Tuesday, June 25, 2013
RECOVERY USING RMAN IF ALL DATAFILE,CONTROLFILE,REDOLOGFILES
FIRST HAVE FULL BACKUP OF DATABASE
IF DATABASE OPEN THEN FIRST
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 25 15:58:42 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1334973392, not open)
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> STARTUP MOUNT;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 192941844 bytes
Database Buffers 411041792 bytes
Redo Buffers 2969600 bytes
RMAN> SHOW ALL;
RMAN configuration parameters 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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/db_1/dbs/snapcf_orcl.f'; # default
RMAN> BACKUP DATABASE;
Starting backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/product/10.2.0/oradata/orcl/system01.dbf
input datafile fno=00003 name=/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/oracle/product/10.2.0/oradata/orcl/example01.dbf
input datafile fno=00002 name=/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
input datafile fno=00004 name=/oracle/product/10.2.0/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-JUN-13
channel ORA_DISK_1: finished piece 1 at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:06
Finished backup at 25-JUN-13
Starting Control File and SPFILE Autobackup at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-JUN-13
DELETE ALL DATAFILES,CONTROLFILE AND REDO LOGFILES
RMAN> SHUTDOWN IMMEDIATE;
database dismounted
Oracle instance shut down
RMAN>
RMAN>
RMAN> STARTUP NOMOUNT;
connected to target database (not started)
Oracle instance started
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 192941844 bytes
Database Buffers 411041792 bytes
Redo Buffers 2969600 bytes
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
Starting restore at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
recovery area destination: /oracle/product/10.2.0/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/oracle/product/10.2.0/oradata/orcl/control01.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control02.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control03.ctl
Finished restore at 25-JUN-13
RMAN> ALTER DATABASE MOUNT;
database mounted
released channel: ORA_DISK_1
RMAN>
RMAN>
RMAN> RESTORE DATABASE;
Starting restore at 25-JUN-13
Starting implicit crosscheck backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 25-JUN-13
Starting implicit crosscheck copy at 25-JUN-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-JUN-13
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/product/10.2.0/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /oracle/product/10.2.0/oradata/orcl/users01.dbf
restoring datafile 00005 to /oracle/product/10.2.0/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 25-JUN-13
RMAN>
RMAN>
RMAN> RECOVER DATABASE;
Starting recover at 25-JUN-13
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/25/2013 16:23:28
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 550400
RMAN> ALTER DATABASE OPEN RESETLOGS;
database opened
RMAN>
THE DATABASE OPEN WITH RESETLOGS
SQL> ARCHIVE LOG LIST;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1
SQL>
IF DATABASE OPEN THEN FIRST
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 25 15:58:42 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1334973392, not open)
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> STARTUP MOUNT;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 192941844 bytes
Database Buffers 411041792 bytes
Redo Buffers 2969600 bytes
RMAN> SHOW ALL;
RMAN configuration parameters 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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/db_1/dbs/snapcf_orcl.f'; # default
RMAN> BACKUP DATABASE;
Starting backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/product/10.2.0/oradata/orcl/system01.dbf
input datafile fno=00003 name=/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/oracle/product/10.2.0/oradata/orcl/example01.dbf
input datafile fno=00002 name=/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
input datafile fno=00004 name=/oracle/product/10.2.0/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-JUN-13
channel ORA_DISK_1: finished piece 1 at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:06
Finished backup at 25-JUN-13
Starting Control File and SPFILE Autobackup at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-JUN-13
DELETE ALL DATAFILES,CONTROLFILE AND REDO LOGFILES
RMAN> SHUTDOWN IMMEDIATE;
database dismounted
Oracle instance shut down
RMAN>
RMAN>
RMAN> STARTUP NOMOUNT;
connected to target database (not started)
Oracle instance started
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 192941844 bytes
Database Buffers 411041792 bytes
Redo Buffers 2969600 bytes
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
Starting restore at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
recovery area destination: /oracle/product/10.2.0/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/oracle/product/10.2.0/oradata/orcl/control01.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control02.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control03.ctl
Finished restore at 25-JUN-13
RMAN> ALTER DATABASE MOUNT;
database mounted
released channel: ORA_DISK_1
RMAN>
RMAN>
RMAN> RESTORE DATABASE;
Starting restore at 25-JUN-13
Starting implicit crosscheck backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 25-JUN-13
Starting implicit crosscheck copy at 25-JUN-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-JUN-13
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/product/10.2.0/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /oracle/product/10.2.0/oradata/orcl/users01.dbf
restoring datafile 00005 to /oracle/product/10.2.0/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 25-JUN-13
RMAN>
RMAN>
RMAN> RECOVER DATABASE;
Starting recover at 25-JUN-13
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/25/2013 16:23:28
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 550400
RMAN> ALTER DATABASE OPEN RESETLOGS;
database opened
RMAN>
THE DATABASE OPEN WITH RESETLOGS
SQL> ARCHIVE LOG LIST;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1
SQL>
Friday, May 10, 2013
ORACLE FUNDAMENTAL CONCEPT
ORACLE INSTANCE: Oracle Instance is consist of SGA(System Global Area) memory structure and background process.an Instance can open and use only one database at time.
List of Physical files in Oracle Database
* Data files
* Redo log files
* Control files
* Parameter file(init.ora)
* password file
* Configuration files(sqlnet.ora,tnsnames.ora,listener.ora )
SQL Query Execution PHASE CYCLE
1*loading into Shared pool (sql code loaded into RAM)
2*Syntax Phase(Check for syntax error)
3*Semantic Phase(check table/column access)
4*Query Transformation(transform complex query into simple)
5*Optimization (Create Execution plan)
6*Create Executable
Memory Structure
*SGA
* PGA
*SGA(System/Shared Global Area):
it is a group of shard memory structure.
It's allocate when instance is startup.
its have several memory structure components.
it is use to store the information that is shared by oracle database and background process.
Mandatory memory structure
->Shard Pool : it is use to store most recently executed sql query and most recently used data definition.the shared pool area is RAM area with in RAM heap that is created start up time.
.it contain two performance related memory structure components
->Library Cache : its size depend on the shard pool size .its store information about the most
recently used sql and pl/sql statement. is manage by LRU(Least Recently Used
Algo). Library cache consist with two structure.
*Shard SQL: its store and share the information about execution plan and parse tree for sql
statement against run database.if second time again run same sql ans parse information is available in the shared sql area then not use resource to perform parse and execution plan.
if the cache memory is not available in LC then LRU Algo. is use to free memory for perform operation.
*Shard PL/SQL: its contain information about pl/sql statement execution plan and parse information . like(Procedure,Function,Trigger etc.)
->Dictionary Cache: it is a collection of most recent used definition in database.its include information about table,index,privilege user and other database objects.
during the parse phage the server process look in the data dictionary to validate statements.
in database two type parsing available
*Hard Parse: if execution plan and parse tree available in shared pool(LC+DC)
* Soft Parse: if server create execution plan and parse tree means not available in Shard pool(LC+DC)
->Database Buffer Cache: Its store copies of data block that have been retrieved from data files.
buffer cache organized two list(MRU,LRU)
->Redo log Buffer
Optional memory structure
-> Large Pool
-> Java Pool
-> Stream Pool
*PGA(Program/Process Global Area):It's allocated when server process start.
List of Physical files in Oracle Database
* Data files
* Redo log files
* Control files
* Parameter file(init.ora)
* password file
* Configuration files(sqlnet.ora,tnsnames.ora,listener.ora )
SQL Query Execution PHASE CYCLE
1*loading into Shared pool (sql code loaded into RAM)
2*Syntax Phase(Check for syntax error)
3*Semantic Phase(check table/column access)
4*Query Transformation(transform complex query into simple)
5*Optimization (Create Execution plan)
6*Create Executable
Memory Structure
*SGA
* PGA
*SGA(System/Shared Global Area):
it is a group of shard memory structure.
It's allocate when instance is startup.
its have several memory structure components.
it is use to store the information that is shared by oracle database and background process.
Mandatory memory structure
->Shard Pool : it is use to store most recently executed sql query and most recently used data definition.the shared pool area is RAM area with in RAM heap that is created start up time.
.it contain two performance related memory structure components
->Library Cache : its size depend on the shard pool size .its store information about the most
recently used sql and pl/sql statement. is manage by LRU(Least Recently Used
Algo). Library cache consist with two structure.
*Shard SQL: its store and share the information about execution plan and parse tree for sql
statement against run database.if second time again run same sql ans parse information is available in the shared sql area then not use resource to perform parse and execution plan.
if the cache memory is not available in LC then LRU Algo. is use to free memory for perform operation.
*Shard PL/SQL: its contain information about pl/sql statement execution plan and parse information . like(Procedure,Function,Trigger etc.)
->Dictionary Cache: it is a collection of most recent used definition in database.its include information about table,index,privilege user and other database objects.
during the parse phage the server process look in the data dictionary to validate statements.
in database two type parsing available
*Hard Parse: if execution plan and parse tree available in shared pool(LC+DC)
* Soft Parse: if server create execution plan and parse tree means not available in Shard pool(LC+DC)
->Database Buffer Cache: Its store copies of data block that have been retrieved from data files.
buffer cache organized two list(MRU,LRU)
->Redo log Buffer
Optional memory structure
-> Large Pool
-> Java Pool
-> Stream Pool
*PGA(Program/Process Global Area):It's allocated when server process start.
Subscribe to:
Posts (Atom)
Complex Oracle 19c to PostgreSQL 15 Database Migration
Production-oriented migration approach for a complex Oracle 19c to PostgreSQL 15 workload , covering assessment, schema and code conversion,...
-
C:\Users\Administrator.ANURAG-PC>tnsping ducat TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 27-DEC-2017 21:...
-
Error while starting ./runInstaller for oracle 19c installation on Linux 8 [oracle@ip-192-168-43-225 oracle]$ ./runInstaller /u01/or...
-
Install CSSCAN login with SYS user @?/rdbms/admin/csminst.sql ############### csscan \"sys as sysdba\" full=y ...