Monday, August 31, 2015

Installing ODT and ODAC ?


     source : https://community.oracle.com/thread/483439


ODAC will be required by all clients that uses Oracle Data Provider for .NET to access Oracle Database. ODAC installation includes Oracle Client, so you don't need to install Oracle Client separately because ODAC already does it for you.
Are the "Oracle Development tools" and "Oracle Extensions for .Net" the same thing?
"Oracle Development tools" (or ODT) is a tool to access oracle directly from VS.NET IDE
"Oracle Extensions for .Net" (or ODE) is an extension to enable you code stored procedure using .NET languages.
Do I install them on the server or the client
install ODT only on development machine which usually has VS.NET installed.
install ODE only on server machine to enable developer deploys their .NET stored procedures
install ODAC (which includes Oracle Client) on all client computers which need access to oracle database, you don't need to install ODAC on database server.

Sunday, August 30, 2015

Connecting to Oracle from SQL Server



          source : http://www.ideaexcursion.com/2009/01/05/connecting-to-oracle-from-sql-server/

Unfortunately, setting up a linked server to Oracle is not as easy as it should be. In fact, you”ll have to install some software on your server to make things work. I”ve put together a short guide on connecting to Oracle from SQL Server. The process doesn”t take very long but there are several hoops to jump through.
  1. Install Oracle Database 10g Client Release 2
    1. Install using the InstantClient option
  2. Install Oracle 10g Release 2 ODAC (64-bit32-bit)
    1. Select the Oracle Data Access Components option (not .NET!)
  3. Edit TNSNAMES.ora
    1. Product10.2.0ClientnetworkADMINTNSNAMES.ora (i.e. C:OracleProduct10.2.0ClientnetworkADMINTNSNAMES.ora)
    2. There is a very specific format to the network configuration file. Here is an example to get you started (just copy & paste multiple entries if necessary):
      DMDEV =
       (DESCRIPTION =
       (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME)(PORT = 1521))
       )
       (CONNECT_DATA =
       (SERVICE_NAME = FRIENDLYNAME)
       )
       )
      There are a couple of things you need to change:
      • HOST = SERVERNAME. The casino online real money value SERVERNAME should be changed to reflect the actual address or hostname of the target system.
      • SERVICE_NAME = FRIENDLYNAME. FRIENDLYNAME is the name by which you refer to this actual connection.
  4. REBOOT!
  5. Configure provider in SQL Server
      OraOLEDB.Oracle Provider Menu Item
      OraOLEDB.Oracle Provider Menu Item
    1. Databases→DBName→Server Objects→Linked Servers→Providers→OraOLEDB.Oracle→Properties→Enable “Allow inprocess”
    2. Enable "Allow inprocess"
  6. Create a linked server to the Oracle Database
    1. General
      1. Linked Server: A name of your choosing which you will use when querying using four-part naming conventions.
      2. Provider: Oracle Provider for OLE DB
      3. Product Name: “Oracle” is fine here
      4. Data Source: This should match the HOST you defined in TNSNAMES.ora
      5. Create a Linked Server
        Create a Linked Server
    2. Security
      1. Select Be made using this security context and supply the remote login and password
  7. Query the linked server:
    SELECT TOP 10 * FROM LINKEDSERVERNAME..SYS.HELP 

Saturday, August 29, 2015

What is Database Atomicity Consistency Isolation Durability (ACID) !!



Techopedia explains Atomicity Consistency Isolation Durability (ACID)


A database guarantees the following four properties to ensure database reliability, as follows: 

Atomicity: A database follows the all or nothing rule, i.e., the database considers all transaction operations as one whole unit or atom. Thus, when a database processes a transaction, it is either fully completed or not executed at all.

Consistency: Ensures that only valid data following all rules and constraints is written in the database. When a transaction results in invalid data, the database reverts to its previous state, which abides by all customary rules and constraints.

Isolation: Ensures that transactions are securely and independently processed at the same time without interference, but it does not ensure the order of transactions. For example, user A withdraws $100 and user B withdraws $250 from user Z’s account, which has a balance of $1000. Since both A and B draw from Z’s account, one of the users is required to wait until the other user transaction is completed, avoiding inconsistent data. If B is required to wait, then B must wait until A’s transaction is completed, and Z’s account balance changes to $900. Now, B can withdraw $250 from this $900 balance.

Durability: In the above example, user B may withdraw $100 only after user A’s transaction is completed and is updated in the database. If the system fails before A’s transaction is logged in the database, A cannot withdraw any money, and Z’s account returns to its previous consistent state.

Thursday, August 27, 2015

How To Archive Table Rows In Oracle 12c

source : http://dbaclass.com/index.php/article/how-to-archive-rows-in-oracle-12c/

In oracle 12c a new feature called In-Database Archiving has been introduced. With this we can archive specific rows of a table as per our requirement. This is very helpful,when table contains lot of historical data and for full scan it is taking a lot of time.Using this we can archive the historical data.
We will see an example:
You can check the explain plan( Scanning all 8 rows)
Enable archiving of that table.
This will create one invisible column ORA_ARCHIVE_STATE:(0/1)
ORA_ARCHIVE_STATE:0 – Means that row is not archived
ORA_ARCHIVE_STATE:1 – Means that row is archived
Lets archive the rows whose EMP is 1 or 2 .
Now we can see the table has 6 rows and rest were archived.
If you check the explain ( It will scan only 6 rows, excluding the archival rows)
If you want to see the rows including archived rows at session level , then use
For disabling archiving:
This will drop that invisible colum