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>
 

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.

ABOUT RAID


#########################
ERROR FACING  FRM-92095
FRM-92095: Oracle JInitiator version too low. Please install version 1.1.8.2 You can use Java7 in Windows or Mac
In Control Panel of Java
click Java click view in version7 Parameters write:
write in runtime parameters field
-Djava.vendor="Sun Microsystems Inc."
Enjoy !

###########################


RAID (redundant array of independent disks; originally redundant array of inexpensive disks) is a way of storing the same data in different places (thus, redundantly) on multiple hard disks. By placing data on multiple disks, I/O (input/output) operations can overlap in a balanced way, improving performance. Since multiple disks increases the mean time between failures (MTBF), storing data redundantly also increases fault tolerance.

A RAID appears to the operating system to be a single logical hard disk. RAID employs the technique of disk striping, which involves partitioning each drive's storage space into units ranging from a sector (512 bytes) up to several megabytes. The stripes of all the disks are interleaved and addressed in order.
In a single-user system where large records, such as medical or other scientific images, are stored, the stripes are typically set up to be small (perhaps 512 bytes) so that a single record spans all disks and can be accessed quickly by reading all disks at the same time.
In a multi-user system, better performance requires establishing a stripe wide enough to hold the typical or maximum size record. This allows overlapped disk I/O across drives.
There are at least nine types of RAID plus a non-redundant array (RAID-0):
  • RAID-0: This technique has striping but no redundancy of data. It offers the best performance but no fault-tolerance.
  • RAID-1: This type is also known as disk mirroring and consists of at least two drives that duplicate the storage of data. There is no striping. Read performance is improved since either disk can be read at the same time. Write performance is the same as for single disk storage. RAID-1 provides the best performance and the best fault-tolerance in a multi-user system.
  • RAID-2: This type uses striping across disks with some disks storing error checking and correcting (ECC) information. It has no advantage over RAID-3.
  • RAID-3: This type uses striping and dedicates one drive to storing parity information. The embedded error checking (ECC) information is used to detect errors. Data recovery is accomplished by calculating the exclusive OR (XOR) of the information recorded on the other drives. Since an I/O operation addresses all drives at the same time, RAID-3 cannot overlap I/O. For this reason, RAID-3 is best for single-user systems with long record applications.
  • RAID-4: This type uses large stripes, which means you can read records from any single drive. This allows you to take advantage of overlapped I/O for read operations. Since all write operations have to update the parity drive, no I/O overlapping is possible. RAID-4 offers no advantage over RAID-5.
  • RAID-5: This type includes a rotating parity array, thus addressing the write limitation in RAID-4. Thus, all read and write operations can be overlapped. RAID-5 stores parity information but not redundant data (but parity information can be used to reconstruct data). RAID-5 requires at least three and usually five disks for the array. It's best for multi-user systems in which performance is not critical or which do few write operations.
  • RAID-6: This type is similar to RAID-5 but includes a second parity scheme that is distributed across different drives and thus offers extremely high fault- and drive-failure tolerance.
  • RAID-7: This type includes a real-time embedded operating system as a controller, caching via a high-speed bus, and other characteristics of a stand-alone computer. One vendor offers this system.
  • RAID-10: Combining RAID-0 and RAID-1 is often referred to as RAID-10, which offers higher performance than RAID-1 but at much higher cost. There are two subtypes: In RAID-0+1, data is organized as stripes across multiple disks, and then the striped disk sets are mirrored. In RAID-1+0, the data is mirrored and the mirrors are striped.
  • RAID-50 (or RAID-5+0): This type consists of a series of RAID-5 groups and striped in RAID-0 fashion to improve RAID-5 performance without reducing data protection.
  • RAID-53 (or RAID-5+3): This type uses striping (in RAID-0 style) for RAID-3's virtual disk blocks. This offers higher performance than RAID-3 but at much higher cost.
  • RAID-S (also known as Parity RAID): This is an alternate, proprietary method for striped parity RAID from EMC Symmetrix that is no longer in use on current equipment. It appears to be similar to RAID-5 with some performance enhancements as well as the enhancements that come from having a high-speed disk cache on the disk array.
  •  
  • to check
http://rog.asus.com/77402012/rampage-iv-motherboards/what-is-raid-setup-guide/ 

Wednesday, May 8, 2013

ORACLE 11G CONNECT WITH PHP ON WINDOWS




STEP-1

 CREATE DSN USING ADMINISTRATOR TOOL




<html>
<body>

<?php
$conn=odbc_connect('orcl11g','hr','hr');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM test";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>ID</th>";
echo "<th>Name</th></tr>";
while (odbc_fetch_row($rs))
  {
  $compname=odbc_result($rs,"id");
  $conname=odbc_result($rs,"name");
  echo "<tr><td>$compname</td>";
  echo "<td>$conname</td></tr>";
  }
odbc_close($conn);
echo "</table>";
?>

</body>
</html>