Sunday, November 16, 2014

Simple Backup and Recovery using Oracle Reocovery Manager RMAN

First of all i wanted to know which instance i am connected.
select instance_name from v$instance






Instance name is ORCL

Then you need to connect to rman target (which is in a nocatalog mode) Inside control file it will store the back up details.

os> rman target /







Now you will list down  the current backup details.
rman >list backup summary;






determine which database files need backup under a specific retention policy
rman> report need backup;

show all configured parameter values
rman> show all;



Now backup the database

rman > backup database;



There it shows the backup location of controlfiles,spfile and datafiles.


shutdown the database
rman>shutdown immediate;






Now you need to delete the database files,control files,redo log files manually on the physical disk.

now exit from rman and connect again






you need to restore the datafiles,control files,spfiles

First of all you need to restore control files  from the backup

Since we have the spfile we can startup database to nomount mode
rman>startup nomount;

now you can restore the database using the backup.

First restore control file location
rman>'D:\Oracle\fast_recovery_area\ORCL\BACKUPSET\2014_11_16\O1_MF_NCSNF_TAG20141116T120250_B6JKBGCF_.bkp';


Now you can open database on mount mode

rman>alter database mount;



Now you can restore the datafiles.No need to specify the datafiles individually.
rman>restore database;


//still redo log files are not created.

now you need to recover  the database with archive logs
rman> recover database;


Now you need the database with RESETLOGS option
rman>alter database open resetlogs;





Thursday, October 16, 2014

Register to Oracle Linux Unbreakable Network using Oracle CSI


When you want to register  for Unbreakable Linux Network  use following steps

type uln_register on  cmd prompt


Then this window will appear.It will ask for Oracle SSO details and CSI number.
Enter them and Forward .Then you will be registered for the network.

After registering you can upgrade your repository and download latest RPMs.  ;)


Knowledge Base -Grid Infrastructure Installation Failed with libcap.so.1

When I was installing Grid Infrastructure for Stand Alone Server  following script was to run

/u01/app/11.2.0/grid/root.sh

while running this following error was given.
error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory .

[root@asm3 /]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory

/u01/app/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory
Failed to create keys in the OLR, rc = 127, Message
:
  
Failed to create keys in the OLR at /u01/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 7660.
/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl execution failed
[root@asm3 /]#

Solution:-
For this error what i did was installed following rpms

[root@asm3 /]# yum install libcap.x86_64
[root@asm3 /]# yum install compat-libcap1.*
[root@asm3 /]#yum install compat-libcap2.*
[root@asm3 /]#yum install libcap*

 [root@asm3 /]# /u01/app//11.2.0/grid/crs/install/roothas.pl -deconfig
 [root@asm3 /]# rm /etc/oracle/olr.loc 

 Again you can run the script again

 [root@asm3 /]# /u01/app/11.2.0/grid/root.sh


Successfully Message appears

Configure Oracle Grid Infrastructure for a Cluster ... succeeded




Wednesday, September 24, 2014

AWR Reports -Create Manual snapshots and Genarate AWR Reports









AWR Reports ,Snap shots Overview

 Automatic workload repository(AWR)  is a collection  of system performance statistics.This stats are owned by SYS user contained in SYSAUX tablespace.Snapshot is a set of performance    statistics  captured  at a certain time and stored in AWR.Snapshots are used to compute the  rate      of  change of a statistics.Each snapshot is identified by a snapshot sequence number (snap_id).By Default snapshot interval is 1 hour.You can change the  frequency by changing  snapshot INTERVAL parameter.
 
You can take manual snapshots by  using  Database Control (EM) and DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT  stored procedure.

  • Log in to database using SYS user

  • Create a manual snapshot  by executing  the dbms_workload_repository.create_snapshot() procedure.
                                EXEC  dbms_workload_repository.create_snapshot()
  • Wait for required time(may be 15 mins,30mins,45 mins )  and then create another manual snap shot by executing dbms_workload_repository.create_snapshot() procedure.



Now you can generate AWR Report using these snapshots.

To generate AWR Reports there is  a script awrrpt.sql located in the  $ORACLE_HOME\RDBMS\ADMIN  folder

  • In the SQL command prompt  execute the awrrpt.sql
                     SQL>@C:\oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN\awrrpt.sql
 
  • This will ask for the  out put file should be a text file or a HTML file.

  •  This will ask for number of days  to list down snap_id's.
 

  • Then ask for beginning snapshot id and ending snapshot id's.

  •  Then it will as for a name for the file name. 








All the step are as follows.