Thursday, February 11, 2010

Tools for monitoring the general health and performance of an oracle database



Statspack

Statspack is a set of performance monitoring and reporting utilities provided by Oracle starting from Oracle 8i and above. Statspack provides improved BSTAT/ESTAT functionality, though the old BSTAT/ESTAT scripts are still available. For more information about STATSPACK, read the documentation in file $ORACLE_HOME/rdbms/admin/spdoc.txt.

Install statspack

cd $ORACLE_HOME/rdbms/admin
sqlplus "/ as sysdba" @spdrop.sql -- Drop and install statspack
sqlplus "/ as sysdba" @spcreate.sql -- Enter tablespace names when prompted

Take performance snapshots of the database

sqlplus perfstat/perfstat
exec statspack.snap; -- Take a performance snapshots
-- or :
exec perfstat.statspack.snap(i_snap_level=>10); -- or instruct statspack to do gather more details in the snapshot
-- (look up which oracle version supports which level).

The spauto.sql script can be customized and executed to schedule the collection of STATPACK snapshots.

Statspack reporting

-- Get a list of snapshots
select SNAP_ID, SNAP_TIME from STATS$SNAPSHOT;

@spreport.sql -- Enter two snapshot id's for difference report

Other statspack scripts
Some of the other statspack scripts are:

* sppurge.sql - Purge (delete) a range of Snapshot Id's between the specified begin and end Snap Id's
* spauto.sql - Schedule a dbms_job to automate the collection of STATPACK statistics
* spcreate.sql - Installs the STATSPACK user, tables and package on a database (Run as SYS).
* spdrop.sql - Deinstall STATSPACK from database (Run as SYS)
* spreport.sql - Report on differences between values recorded in two snapshots
* sptrunc.sql - Truncates all data in Statspack tables

Potential problems

Statpack reporting suffers from the following problems:

* Some statistics may only be reported on COMPLETION of a query. For example, if a query runs for 12 hours, its processing won't be reported during any of the snapshots taken while the query was busy executing.

* If queries are aged out of the shared pool, the stats from V$SQL are reset. This can throw off the delta calculations and even make it negative. For example, query A has 10,000 buffer_gets at snapshot 1, but at snapshot #2, it has been aged out of the pool and reloaded and now shows only 1,000 buffer_gets. So, when you run spreport.sql from snapshot 1 to 2, you'll get 1,000-10,000 = -9,000 for this query.


Proactive Database Monitoring

The Oracle Database makes it easy to proactively monitor the health and performance of your database. It monitors the vital signs (or metrics) related to database health, analyzes the workload running against the database, and automatically identifies any issues that need your attention as an administrator. The identified issues are either presented as alerts and performance findings in Enterprise Manager or, if you prefer, can be sent to you through e-mail.

Alerts

Alerts help you monitor your database. Most alerts notify you of when particular metric thresholds are crossed. For each alert, you can set critical and warning threshold values. These threshold values are meant to be boundary values that when crossed indicate that the system is in an undesirable state. For example, when a tablespace becomes 97 percent full this can be considered undesirable, and Oracle will generate a critical alert.

Other alerts correspond to database events such as Snapshot Too Old or Resumable Session suspended. These types of alerts indicate that the event has occurred.

In addition to notification, you can set alerts to perform some action such as running a script. For instance, scripts that shrink tablespace objects can be useful for a Tablespace Usage warning alert.

By default, Oracle enables the following alerts:

* Table Space Usage (warning at 85 percent full, critical at 97 percent full)
* Snapshot Too Old
* Recovery Area Low on Free Space
* Resumable Session Suspended

You can modify these alerts or enable others by setting their metrics.

Performance Self-Diagnostics: Automatic Database Diagnostics Monitor

Oracle Database includes a self-diagnostic engine called the Automatic Database Diagnostic Monitor (ADDM). ADDM makes it possible for the Oracle Database to diagnose its own performance and determine how any identified problems can be resolved.To facilitate automatic performance diagnosis using ADDM, Oracle Database periodically collects snapshots of the database state and workload. The default collection interval is one hour. Snapshots provide a statistical summary of the state of the system at any point in time. These snapshots are stored in the Automatic Workload Repository (AWR), residing in the SYSAUX tablespace. The snapshots are stored in this repository for a set time (a week by default) before they are purged to make room for new snapshots.ADDM analyses data captured in AWR to determine the major problems in the system and in many cases recommends solutions and quantifies expected benefits.

Generally, the performance problems ADDM can flag include the following:

* Resource bottlenecks, such as when your database is using large amounts of CPU time or memory, for example as a result of high load SQL statements
* Poor connection management, such as when your application is making too many logons to the database
* Lock contention in a multiuser environment, when a lock to update data causes other sessions to wait, slowing down the database


Monitoring General Database State and Workload

The Enterprise Manager home page enables you to monitor the health of your database. It provides a central place for general database state information and is updated periodically. This page reports information that is helpful for monitoring database state and workload


The General section provides a quick view of the database, such as whether the database is Up or Down, the time the database was last started, instance name, and host name.

The Host CPU section shows the percentage of CPU time used in the overall system. This chart breaks down CPU percentage into time used by the database and time used by other processes. If your database is taking up most of the CPU time, you can explore the cause further by looking at the Active Sessions summary. This summary tells you what the database processes are doing, such as which ones are using CPU, or waiting on I/O. You can drill down for more information by clicking a link, such as CPU.

If other processes are taking up most of your CPU time, this indicates that some other application running on the database machine may be causing the performance problems. To investigate this further, click the Host link under the General section. This link takes you to the machine overview page where you can see some general information about the machine, such as what operating system it is running, how long the machine has been up, and any potential problems.

Click the Performance property page to see a summary of CPU utilization, average active sessions, instance disk I/O, and instance throughput. Additional Monitoring Links enable you to drill down to Top Activity and other data. The type of actions you can take to improve host performance depends on your system, but can include eliminating unnecessary processes, adding memory, or adding CPUs.

On the Home page, the Diagnostic Summary summarizes the latest ADDM performance findings. This section also summarizes any critical or warning alerts listed in the Alerts section.

The Alerts table provides information about any alerts that have been issued along with the severity rating of each. An alert is a notification that a metric threshold has been crossed. For example, an alert can be triggered when a tablespace is running out of space.

When an alert is triggered, the name of the metric causing it is displayed in the Name column. The severity icon (Warning or Critical) is displayed, along with time of alert, and alert value. You can click the message to learn more about the cause. For more information, see "Alerts" .

The Performance Analysis section provides a quick summary of the latest ADDM findings, highlighting the issues that are causing the most significant performance impact. This analysis can identify problems such as SQL statements that are consuming significant database time.

Managing Alerts

The following sections describe how to manage alerts.
Viewing Metrics and Thresholds

Metrics are a set of statistics for certain system attributes as defined by Oracle. They are computed and stored by the Automatic Workload Repository, and are displayed on the All Metrics page, which is viewable by clicking All Metrics under Related Links on the Database Home page.

For each of these metrics, you are able to define warning and critical threshold values, and whenever the threshold is crossed, Oracle issues an alert.

Alerts are displayed on the Database Home page under the Alerts heading (or Related Alerts for non-database alerts such as a component of Oracle Net).

Also you can see following tools

Saturday, February 6, 2010

Get Oracle BLOB and save as JPG using ASP.NET

/*
The following code snippet shows how to retrieve an Oracle BLOB column data and save it as a JPEG file. Before using this code, you must create an OracleCommand object with a valid Oracle connection. To see how to create an OracleCommand and OracleConnection, see ADO.NET section of this site.
*/
public string ReadLob(OracleCommand cmd)
{

int actual = 0;
string acid = string.Empty;
OracleDataReader reader = cmd.ExecuteReader();
using(reader)
{
while (reader.Read()) //Obtain the a row of data.
{

//Obtain the LOB
acid = reader.GetString(0);
OracleLob blob = reader.GetOracleLob(1);

//to save the lob as a picture.. naming it by its ID
string filename = " \\" + acid + ".jpg ";
ListBox1.Items.Add(filename);

//file for buffered stream and the stream itself
Stream outputStream = File.OpenWrite(@filename);
BufferedStream bufferedOutput = new BufferedStream(outputStream);

//Example - Reading binary data (in chunks).
byte[] buffer = new byte[100];
while ((actual = blob.Read(buffer, 0, buffer.Length)) > 0)
{
bufferedOutput.Write(buffer, 0, buffer.Length);
bufferedOutput.Flush();
}
bufferedOutput.Close();
}//end of while
}
return acid;
}

Wednesday, February 3, 2010

Test-driven development options

Yes, I know, this topic doesn't contain any information related to Oracle, but in my opinion it also very important part of development.

This goes against traditional programming; instead of writing functional code and then testing code as an afterthought (if testing is performed at all), you start with the test code.


You make sure the test is correct according to the necessary logic. With the test complete, it is available when the code is ready, and you quickly know if the code performs as desired. Basically, you develop code that will pass the test.

Visual Studio add-ons

There are a few Visual Studio add-ons that make it easier to use the various testing frameworks within the IDE. One of the more popular products is TestDriven.NET; however, unlike the testing frameworks, it is not free. TestDriven.NET allows you to use the features of the testing framework from within Visual Studio via one click of the mouse. It works with all versions of Visual Studio.

A key part of test-driven development is the automated unit test that properly tests code functionality. Testing frameworks provide a vehicle for creating and running these tests. Various frameworks exist for .NET developers, including the following:

QuickUnit.net: A simple testing framework written in C# for .NET applications. It is a minimalist approach to testing for developers who ignore writing unit tests and test-driven development. It can be used as a first step to become familiar with testing.
NUnit: An open source unit-testing framework for the .NET platform. It is the leader in this category, as it mimics the JUnit Java offering for the .NET platform; that is, it brings test-driven development to .NET. NUnit provides both a GUI and command-line interface. It also promotes unit testing your .NET code after coding is complete or using the test-driven approach to development. (Learn more about this framework by reading my article, “NUnit allows effective unit testing with .NET applications.”)
MbUnit: MbUnit or the Generative Unit Test Framework for the .NET Framework is offered free of charge. It was built using the .NET Framework, and it promotes test-driven development. It offers both command-line and GUI interfaces along the lines of the same features available in NUnit.
xUnit.net: A freely available testing framework available via Microsoft’s version of open source with the CodePlex site. It was designed with a goal of closely aligning itself with the .NET Framework. (One of the developers of xUnit.net originally worked on NUnit.) xUnit.net was built using .NET Framework 2.0; it does not require any installation, and it offers better integration with source control tools. xUnit.net focuses heavily on test-driven development as opposed to just testing, so there are some differences with NUnit. xUnit.net is the latest to join the pool of testing frameworks.
csUnit: A freely available testing framework that promotes test-driven development. It offers a graphical interface and easy integration with Visual Studio 2005/2008.

Monday, February 1, 2010

Caching Oracle Data for ASP.NET Applications

Introduction
For building scalable and high-performance Web based applications, ASP.NET provides a feature called data caching. Data caching enables programmatic storing of frequently accessed data objects in memory. This feature can be extended to vastly improve performance for ASP.NET applications that query data stored in an Oracle database. This article describes a strategy for caching Oracle database data in ASP.NET Web applications deployed using a Web Farm environment. This technique enables caching of frequently accessed Oracle database data in memory rather than making frequent database calls to retrieve the data. This helps to avoid unnecessary roundtrips to the Oracle database server. Further the article proposes an implementation for maintaining the cached data so it is always in sync with the corresponding data in the Oracle database.

Data Caching in ASP.NET

Data Caching in ASP.NET is facilitated via the Cache class and the CacheDependency class in the System.Web.Caching namespace. The Cache class provides methods for inserting data and retrieving data from the cache. The CacheDependency class enables dependencies to be specified for the data items placed in the cache. An expiration policy for an item can be specified when we add it to the cache using the Insert method or Add method. We can define the life span for an item in the cache by using the absoluteExpiration parameter in the Insert method. This parameter allows one to specify the exact datetime that the corresponding data item will expire. One can also use the slidingExpiration parameter, specifying the elapsed time before the item will expire based on the time it was accessed. Once the item expires, it is removed from the cache. Attempts to access it will return a null value unless the item is added to the Cache again.

Specifying Dependencies for Cache

ASP.NET allows us to define the dependency of a cached item based on an external file, a directory, or another cached item. These are described as file dependencies and key dependencies. If a dependency changes, the cached item gets automatically invalidated and removed from the cache. We can use this approach to delete items from the cache when the corresponding data source changes. For example, if we write an application that retrieves data from an XML file and displays it in a grid, we can store the data from the file in the Cache and specify a Cache dependency on the XML file. When the XML file is updated, the data item gets removed from the cache. When this event occurs, the application reads the XML file again, and the latest copy of the data item is inserted into the cache again. Further, callback event handlers can be specified as a listener for getting notified when the cache item gets deleted from the cache. This eliminates the need to continuously poll the cache to determine whether the data item has been invalidated.

ASP.NET Cache Dependency on Oracle Database

Let us consider a scenario where data is stored in the Oracle database and accessed by an ASP.NET application using ADO.NET. Furthermore, let us assume that the data in the database table(s) is generally static but accessed frequently by the Web application. In a nutshell, there are very few DML operations on the table but lots of Selects on the data. Such a scenario is ideal for data caching. But unfortunately, ASP.NET does not allow a dependency to be specified whereby a cache item is dependent on data stored in a database table. Furthermore, in real world Web based systems, the Web server and the Oracle database server could be potentially running on different machines, making this cache invalidation process more challenging. Also most Web-based applications are deployed using Web farms with instances of the same application running on multiple Web servers for load balancing. This scenario makes the database caching problem slightly more complex.

For exploring the solution to the above problem, let's put together a sample Web application to illustrate how it can be implemented. For our example, we use ASP.NET application implemented in VB .Net communicating with the Oracle 9i database using Oracle Data Provider for .NET (ODP).

In this example, consider a table named Employee in the Oracle database. We define a trigger for insert, update and delete operations on the Employee table. This trigger calls a PL/SQL function that serves as a wrapper for a Java stored procedure. This Java stored procedure in turn will be responsible for updating the Cache dependency file.

ASP.NET Tier Implementation Using VB.NET

On the ASP.NET tier, we have a listener class containing a callback method to handle the notification when the cache item gets invalidated.

The callback method RemovedCallback is registered by using a delegate function. The callback method onRemove declaration must have the same signature as the CacheItemRemovedCallback delegate declaration.

Dim onRemove As CacheItemRemovedCallback = Nothing

onRemove = New CacheItemRemovedCallback(AddressOf RemovedCallback)

The definition for the listener event handler method RemovedCallback responsible for handling the notification from the database trigger is illustrated below. When the cache item gets invalidated, data is retrieved from the database by using the database method call getRecordFromdatabase(). The parameter "key" refers to the index location for the item removed from the cache. The parameter "value" refers to the data object removed from the cache. The parameter "CacheItemRemovedReason" specifies the reason causing the data item to be removed from the cache.

PublicSub RemovedCallback(ByVal key AsString, ByVal value AsObject,

ByVal reason As CacheItemRemovedReason)



Dim Source As DataView



Source = getRecordFromdatabase()



Cache.Insert("employeeTable ", Source, New

System.Web.Caching.CacheDependency("d:\download\tblemployee.txt"),

Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration,

CacheItemPriority.Normal, onRemove)



EndSub

The method getRecordFromdatabase() is responsible for querying the database table Employee and it returns a DataView object reference. It makes use of a stored procedure called getEmployee to abstract the SQL for retrieving the data from the Employee table. The method expects a parameter called p_empid representing the primary key for the Employee table.

PublicFunction getRecordFromdatabase (ByVal p_empid As Int32) As DataView



Dim con As OracleConnection = Nothing

Dim cmd As OracleCommand = Nothing

Dim ds As DataSet = Nothing



Try

con = getDatabaseConnection(

"UserId=scott;Password=tiger;Data Source=testingdb;")



cmd = New OracleCommand("Administrator.getEmployee", con)

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add(New OracleParameter("employeeId",

OracleDbType.Int64)).Value = p_empid



Dim param AsNew OracleParameter("RC1", OracleDbType.RefCursor)

cmd.Parameters.Add(param).Direction = ParameterDirection.Output



Dim myCommand AsNew OracleDataAdapter(cmd)

ds = New DataSet

myCommand.Fill(ds)



Dim table As DataTable = ds.Tables(0)

Dim index As Int32 = table.Rows.Count



Return ds.Tables(0).DefaultView



Catch ex As Exception

ThrowNew Exception("Exception in Database Tier Method

getRecordFromdatabase () " + ex.Message, ex)

Finally

Try

cmd.Dispose()

Catch ex As Exception

Finally

cmd = Nothing

EndTry

Try

con.Close()

Catch ex As Exception

Finally

con = Nothing

EndTry

EndTry

EndFunction

The function getDatabaseConnection accepts a connectionstring as an argument and returns an OracleConnection object reference.



PublicFunction getDatabaseConnection(ByVal strconnection as string) As

OracleConnection



Dim con As Oracle.DataAccess.Client.OracleConnection = Nothing

Try

con = New Oracle.DataAccess.Client.OracleConnection

con.ConnectionString = strconnection

con.Open()

Return con

Catch ex As Exception

ThrowNew Exception("Exception in Database Tier Method

getOracleConnection() " + ex.Message, ex)

EndTry

EndFunction

Oracle Database Tier Implementation

The Trigger body defined for DML events on the Employee Table is shown below. This trigger simply invokes a PL/SQL wrapper function for updating an operating system file called tblemployee.txt. Copies of this file are updated on two different machines called machine1 and machine2 that are running different instances of the same Web application to enable load balancing. Here administrator refers to the owner of the schema objects in the Oracle database.

begin

administrator.plfile('machine1\\download\\ tblemployee.txt');

administrator.plfile('machine2\\download\\ tblemployee.txt');

end;

For updating the cache dependency file, we will need to write a C function or a Java stored procedure. In our example, we chose a Java stored procedure since Oracle database server has a built-in JVM, making it easy to write Java stored procedures. Adequate memory must be allocated for the Java Pool in the System global area (SGA) of the Oracle instance. The static method updateFile accepts an absolute pathname as a parameter and creates the cache dependency file in the appropriate directory. If the file already exists, it is deleted and created again.

import java.io.*;



public class UpdFile {



public static void updateFile(String filename) {



try {

File f = new File(filename);

f.delete();

f.createNewFile();

}

catch (IOException e)

{

// log exception

}

}

};

The pl/sql wrapper implementation is shown below. The wrapper function accepts the filename as a parameter and invokes the method updateFile in the Java stored procedure.

(p_filename IN VARCHAR2)

AS LANGUAGE JAVA

NAME 'UpdFile.updateFile (java.lang.String)';

Database Caching in a Web Farm Deployment

As illustrated in the example we have discussed, Web Servers machine1 and machine2 constitute the Web farm to provide load balancing for our Web application. Each machine runs an instance of the same Web application. In this scenario, each instance of the Web application can have its own copy of the cached data stored in its Cache object. When the employee table changes, the corresponding database trigger updates the file tblemployee.txt on both of these machines. Each instance of the Web application specifies a cache dependency on the local file tblemployee.txt, and the cache for both the instances in the Web Farm gets updated correctly, enabling the data cache on both the instances to remain in sync with the database table Employee.

Conclusion

Data Caching can be an effective technique for optimizing ASP.NET applications using the Oracle database. Although ASP.NET does not allow database dependency to be specified for the cache, Oracle triggers in conjunction with Java stored procedures can be used to extend the power of the ASP.NET cache to enable Oracle database caching. This technique can also be applied to Web Farm deployments.

Taked from 15seconds.com

Oracle Client Error OCI-22053 Overflow Error in .NET Framework

Its not a problem.
You can
1. Convert in Oracle all number to varchar and then in .Net again to number,
2. use round() func in all oracle querys that return number
for example : select round (t.nstartKm, 4) as nstartKm from ias_meta.v_ias_thread;

I found some links about that:
link 1

link 2

Using Oracle Providers for ASP.NET






Purpose

This tutorial demonstrates Oracle Providers for ASP.NET usage and how tightly the providers integrate with existing ASP.NET management tools, controls, and services.

This tutorial covers the following topics:
Overview
Prerequisites
Enabling a Web Site for Authentication
Enabling Oracle Providers for ASP.NET and Creating a Web User
Testing Web Site Authentication
Summary

Overview

Oracle Providers for ASP.NET integrates directly with Microsoft ASP.NET controls and services to provide state management capabilities for web sites. State management is critical for managing persistent data, such as user information, user roles, and session information.

This tutorial builds upon the "Building ASP.NET Web Applications with Oracle Developer Tools for Visual Studio" tutorial. In that tutorial, you created a data grid retrieving employee information. In this tutorial, you now want to secure this employee data to ensure only authorized users can view the data. To accomplish this task, you will create an ASP.NET web user using the Oracle Membership Provider and test the web site's authentication with the provider with valid and invalid credentials.

Prerequisites

Before you perform this tutorial, you should:
1. Install Microsoft Visual Studio 2005 or 2008
2. Install Oracle Database 10g or later or Database XE. You may want to configure an Oracle NET connection alias if you do not have one already.
3. Install Oracle 11g Oracle Data Access Components (ODAC) with Oracle Developer Tools for Visual Studio version 11.1.0.6.20 or later from OTN
4. Setup an Oracle database schema for storing data from the Oracle Providers for ASP.NET. Follow these steps if you have not created and configured an Oracle database schema for this purpose yet.
5. (Optional) Complete the Building ASP.NET Web Applications with Oracle Developer Tools for Visual Studio OBE.


Enabling a Web Site for Authentication.

This section shows you how to add web site authentication to limit the users that can access the employee data. You will authenticate using an ASP.NET login control, verifying against users created and stored with the Oracle Providers for ASP.NET. Perform the following steps:

1. Reopen the web site you created in the Building ASP.NET Web Applications
with Oracle Developer Tools for Visual Studio tutorial.

2. Select View > Solution Explorer.


3. Right-click on the web site and Add New Item.

4. Select Web Form, enter the name login.aspx and click Add.

5. When the login.aspx page appears, switch to the Design tab.

6. From the View menu, open the Toolbox, expand the Login section, and drag and drop the login control onto the form, into the dotted rectangle labeled div.

7. The Login control is displayed. This is a standard ASP.NET login control, which can retrieve and verify user login credentials stored in the Oracle database.

8. Right-click the login control and select Properties.
9. Under the Behavior section, for DestinationPageUrl, select "..." button

10. Select Default.aspx and click OK.
When a user successfully logs in, that user will be directed to the Default.aspx page, which contains the employee data. If a user does not successfully log in, they will be redirected back to the login page.

11. The value now appears for DestinationPageUrl in the properties window.
12. Select File > Save Login.aspx.


Enabling Oracle Providers for ASP.NET and Creating a Web User

In this section, you will use the ASP.NET Web Site Administration Tool to direct the web site to use the Oracle ASP.NET providers and create a new web user specific to this web site to demonstrate the authentication features for the login page you created in the previous section. Perform the following steps:
1. Select Website > ASP.NET Configuration.

2. The ASP.NET Web Site Administration Tool appears in a browser window. Select the Provider tab.

3. On the Provider page, select the second link: Select a different provider for each feature (advanced).

4. When the Provider page reappears, change the Membership Provider to OracleMembershipProvider and Role Provider to OracleRoleProvider and select the Security tab.

5. Under Users, click Select authentication type.
By default, the ASP.NET site uses Windows authentication to identify users. You are building a web site that will identify users by their site-specific logins and passwords. Therefore, the site must be configured to expect to use logins and passwords.

6. Select From the internet and click Done.

7. Select Create user.

8. In the Create User section, enter your name and a password that contains at least 7 characters, including one non-alphanumeric character. Enter your email, and a security question and answer, then click Create User.

9. The user account has been created. Click the Security tab.

Note: If you click Continue, you will be allowed to enter another user.

10. Note that there is now one existing user. Under Access Rules, select Manage access rules.

11. Select Add new access rule.

12. Select Anonymous users and Deny, then click OK.
By default, anonymous access to the web site is enabled. The above settings secure the web site by disabling anonymous access. Now, only authenticated users can view the employee data.

13. The access rule was created successfully. The web site will now deny anonymous users access to the site. Click Done.
14. Close the browser.


Testing Web Site Authentication

Now that you have created a web user specific to this web site, the web site will allow this user access to the employee data and deny access to all other users, including anonymous users. In this section, you will attempt to access the employee data as an anonymous user, as an unauthorized user, as an authorized user with an incorrect password, and finally as an authorized user with the correct password. Only in the last scenario will the web site grant access to the employee data. Perform the following steps:

Note: Five or more consecutive invalid passwords entered for an ASP.NET provider user within a ten minute period will lock the account to prevent unauthorized users from gaining access through password guessing. Oracle Membership Provider sets these security measures through the following properties, which you can modify in the machine.config file or web.config files: MaxInvalidPasswordAttempts (default: 5 attempts) and PasswordAttemptWindow (default: 10 minutes). If the account is locked, then you can unlock the user by calling the UnlockUser method.
1. Switch to Microsoft Visual Studio. Select Debug > Start Without Debugging.

2. The login web page appears.
3. Change the URL to end with Default.aspx rather than login.aspx and press the enter key. You are denied access and redirected back to the login page. This shows that anonymous users cannot browse the web site; only users with credentials have access. If you are experimenting with the authentication mechanism, you will likely repeat this step or try variations. For each variation, either start a new browser or clear the browser cache. Because browsers cache web pages, if you access Default.aspx again, you may see the cached version of this web page. This is not the intended behavior, rather the web page should undergo the ASP.NET provider authentication process, which is accomplished by using a new browser instance or clearing the browser cache.

4. Remove the text of the URL after login.aspx. This returns the URL back to the original state when you first accessed the site. Enter some other username and password which is different than the user you created earlier in the ASP.NET Web Site Administration Tool. Then click Log In.
5. Notice that you receive an error indicating that the user you entered is not valid. The web site correctly denies access to the user.
6. Enter the user name you entered in the in the ASP.NET Web Site Administration Tool but with an incorrect password for that web site user. Click Log In. As the screen shot indicates, the user is denied access, demonstrating that the control could not verify this user's credentials with those stored by the Oracle Membership Provider.

7. Enter the correct username and password for the web site user. Click Log In. The employee data appears. This demonstrates that only authorized users can access the data. Thus, Oracle Providers for ASP.NET provided web site security in a very simple manner.

You have now built a data-driven ASP.NET web application. It performs authentication and retrieves employee data from the database.

Summary

In this tutorial, you learned how to:
Enable a web site for authentication
Enable Oracle Providers for ASP.NET and create a web user
Test web site authentication


Oracle Providers for ASP.NET

Beginning with .NET Framework 2.0, ASP.NET includes service providers that store state in databases. By storing this state in a database, applications can ensure high availability of data, while making the data equally available to all web servers.

With Oracle Providers for ASP.NET, Oracle supports these service providers for use with the Oracle database. For .NET developers already familiar with ASP.NET providers, the Oracle Providers for ASP.NET are easy to learn and use as they share a common schema and API with existing ASP.NET providers. They integrate seamlessly with existing ASP.NET services and controls, similar to other ASP.NET providers.

Oracle offers the following providers:

* Membership Provider
* Role Provider
* Site Map Provider
* Session State Provider
* Profile Provider
* Web Events Provider
* Web Parts Personalization Provider
* Cache Dependency Provider

takes from oracle.com