Pages

Popular Posts

Powered By Blogger

Sunday, August 29, 2010

WHEN TO REORGANIZE TABLES AND REBUILD INDEXES.

When to reorganize tables and rebuild indexes:

Table fragmentation:When rows are not stored contiguously or if rows are split auto more than one block,performance decrease because these rows required additional block accesses.
Note that table fragmentation is different from file fragmentation.When a lot of DML operations are applied on a table,the table will become fragmentation because DML does not release free space from the table below the HWM.
HWM is an indicator of used blocks in the database.Blocks below the high water mark (used blocks) have at least once contained data.This data might have been deleted.Since oracle knows that blocks before the high water mark didn't have data,it only reads block up to the high water when doing a full table scan.
*DDL statements always resets the HWM.

Table size (with fragmentation)
Sql>exec dbms_stat.gather_table_stats('SCOTT','BIG1');
Sql>select table_name,round((blocks*8),2)||'kb' "size" from user_tables where table_name='BIG1'
output of the command:
table_name size
BIG1 72952 kb

Actual data in table
Sql>select table_name,round((num_rows*avg_row_len/1024),||'kb' "size" from user_tables where table_name='BIG1';
output
table_name size
BIG1 30604.2 kb

72952-30604=42348 kb is wasted space in table
The difference between two values is 60% and pct free 10%(default)-so,the table has 50% extra space which is wasted becuase there is no data.
How to reset HWM/remove fragmentation ?
4 options:
1)alter table .. move to another tablespace.
2)export,truncate or drop import.
3)CTAS method
4)dbms_redifinition

To check indexes
sql>select status,index_name from user_indexes where table_name='BIG1';
output
status index_name
unusable bigidx
sql>alter index bigidx rebuild;
select del_lf_rows*100/decode(lf_rows,0,1,lf_rows) from index_stats where name='';
you may decide that index should be rebuilt if more than 20% of its rows are deleted.

How can you determine if an index needs to be dropped and rebuilt?
Level: Intermediate
Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio
BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3

To check the compress or not compress mode:
Sql>select compression from dba_tables where table_name in <'tablename'>;
If some times show actual size is greater than the table size it is due to in compress mode of table
If table is compress make this to no compress mode
Sql>alter table move nocompress;

MYSQL_DBA_BEGINNER.

MYSQL DOCUMENTATION

To install Mysql
#rpm -ivh mysql-server-community_x86-64.rpm

After installing immediately give password
#/usr/bin/mysqladmin -u root -p password "root123"

To start and stop mysql server

#/etc/init.d/mysql start
#/etc/init.d/mysql stop

To connect mysql
#mysql -u root -p

To check databases and use database
Mysql>show databases;
Mysql>use ;

To check tables and its contents and its use
Mysql>show tables;
Mysql>desc ;
Mysql>select * from ;

To create user
Mysql>create user 'khan'@'localhost' identified by 'khan';

To give Privileges
Mysql>grant select,insert,update,delete on *.* to 'khan';

To drop user
Mysql>drop user 'khan'@'localhost';

To check which database to connected
Mysql>select database ();

To check which user is connected
Mysql>select user ();

To check how many users have
Mysql>select distinct grantee from user_privileges;

Global privileges are administrative or apply to all databases on a given server. To assign global privileges, use ON *.* syntax:

GRANT ALL ON *.* TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON *.* TO 'someuser'@'somehost';

Only two rows information need give limit 2 in your query

In mysql by default database create in /var/lib/mysql

To create table
Mysql>create table oolaala(name varchar(20));

To check mysql version
#rpm -qa|grep -i mysql

Try this after relocating files if errors getting
#setsebool -p mysqld_disable_trans=1

Note:If not available my.cnf file or removed or '/home/oracle/data/three/redo01a.log' size 20m,lost we can copy the same file available in /usr/share/mysql (my_large.cnf)

MYISAM INNODB (engines of mysql)

By default tables create in MYISAM

To create tables in INNODB
set in my.cnf (uncomment#innodb parameter)

Mysql>create table pepsi(name varchar(10)) engine=innodb;

MYISAM is for OLAP and INNODB is for OLTP

To check connection errors or any errors
#/var/log/messages or /var/log/sys/logs of /var/lib/mysql/mysqld.log

How to rename and relocate on datafiles
1.Stop service
2.copy data directory on another mount point
3.vi /etc/my.cnf
#The MySQL server
[mysqld]
datadir=/home/mysql/data (five here different mount point)
user=mysql

To migrate from Oracle to Mysql
1.PhpAdmin tool use or
2.$mysql -u -p < abc.sql 3.mysql>source abc.sql

It helps to migrate from oracle to mysql

To create tables in oracle
set echo off
set heading off
spool t1_insert.txt
create table t1 (c1 number, c2 varchar2(10), c3 date);
insert into t1 values (1,'one', sysdate);
insert into t1 values (2,'two', sysdate);
commit;
select 'insert into t1 (c1, c2, c3) values (' || c1 || ', ' || c2 || ', ' || c3 || ');' from t1;
select 'insert into t1 (c1, c2, c3) values (' || c1 || ', ''' || c2 || ''', ''' || to_char(c3,'yyyy-mm-dd hh24:mi:ss') || ''');' from t1;
spool off

To create tables in Mysql
create table t1 (c1 int, c2 varchar(10), c3 datetime);
select '' || c1 || ', ''' || c2 || ''', ''' || to_char(c3,'yyyy-mm-dd hh24:mi:ss') || '''' from t1;

make t1_insert.txt to t1_insert.sql

to migrate
mysql>source t1_insert.sql

To take logical backup dump of mysql

#mysqldump -uroot -padmin --all-database >testmysql.sql
it generates file that we can read for import on mysql or oracle. For oracle change the data format and import by running sql file.

site to download mysql software
http://dev.mysql.com/

Sunday, June 6, 2010

ORACLE_11G_NEW_FEATURES

ORACLE 11G NEW FEATURES:

Installation, Database Upgrades and Change Management
Installation New Features Support
Role and Privilege Changes
Deprecated Components
New Initialization Parameters Affecting Database Creation
DBCA Enhancements
Upgrading to Oracle Database 11g
Database Replay
The SQL Performance Analyzer
Patching in Oracle Database Control
Database Diagnosis and Repair
Introducing Automatic Diagnostic Repository (ADR)
Configuring the ADR
Using adrci Tool
Using The Support Workbench in the OEM
Database Health Monitor
Data Recovery Advisor
SQL Test Case Builder
Data Block Corruption Parameters
Database Administration
Automatic Memory Management
Automatic Maintenance Tasks
Oracle Flashback-Related New Features
LogMiner Interface in Oracle Enterprise Manager
Oracle Flashback Transaction Backout
Flashback Data Archive
Virtual Columns
New Data Partitioning Schemes
DDL Lock Timeout
Explicit Locking of Tables
Invisible Indexes
Read-Only Tables
Shrinking Temporary Tablespaces and Tempfiles
Creating an Initialization Parameter File from Memory
Restore Point Enhancements
Database Resident Connection Pooling
Comparing and Synchronizing Database Objects
SQL*Plus New Features

Oracle 11g New Features for Administrators:-

Online Application Maintenance
Oracle Advanced Compression Option
Oracle Scheduler New Features
Lightweight Jobs
Remote External Jobs
Finer-grained Dependency Management
Enhancements in Oracle Database Resource Manager
Performance Tuning
PL/SQL Native Compilation
Server Result Cache
Client Side Result Cache
Enhanced Oracle Process Monitoring
Subprogram Inlining
SQL Tuning Automation
SQL Access Advisor Enhancements
Changing Statistics Preferences
Enhanced Statistics Maintenance
SQL Plan Management
ADDM New Features
AWR New Features
Setting Metric Thresholds for Baselines
Performance-Related Changes in Database Control
Miscellaneous New Performance Tuning Features
Real-Time SQL Monitoring
Adaptive Cursor Sharing
Database Security
Stronger Password Hash Algorithm
Security Out of the Box
Anti Network Attacks Parameters
Tablespace Encryption
Fine-Grained Access Control for UTL_* Packages
Further Security New Features
Backup and Recovery New Features
Enhanced Block Media Recovery
RMAN Substitution Variables
New RMAN Configuration Parameters
The Multisection Backups
Creating Archival Backups
VALIDATE Command
Configuring an Archived Redo Log Deletion Policy

Oracle 11g New Features for Administrators:-

Active Database Duplication
Importing and Moving Recovery Catalogs
Virtual Private Catalogs
Miscellaneous New Features in RMAN
Data Pump Utilities
Compression Enhancement
Encryption Enhancements
Reusing a Dump File
Remapping Data
Renaming Tables During Export or Import
Data Pump and Partitioned Tables
Ignoring Nondeferred Constraints
External Tables Based on Data Pump Driver
Enhancement in the Transportable Parameter
Automatic Storage Management (ASM)
SYSASM Privilege and OSASM Group
Upgrading ASM using DBUA
Upgrading ASM Manually
ASM Restricted Mode
Diskgroup Attributes
Checking Diskgroup
asmcmd Utility Commands
Fast Rebalance
The FORCE option with Drop Diskgroup Command
Miscellaneous ASM New Features
PL/SQL New Features
PL/SQL New Features
Data Warehousing
SecureFiles
Accessing a LOB Using SQL and PL/SQL
Online Redefinition
Partition Change Tracking (PCT)
Generating SQL Crosstab Report using PIVOT Operator
Partitioning Improvements

Below Topics Not covered:-

Oracle Streams
Data Guard
Oracle RAC
Oracle XML DB

Wednesday, December 23, 2009

PARALLEL PROCESS

PARALLEL PROCESS:

DEFINITION - In computers, parallel processing is the processing of program instructions by dividing them among multiple processors with the objective of running a program in less time. In the earliest computers, only one program ran at a time. A computation-intensive program that took one hour to run and a tape copying program that took one hour to run would take a total of two hours to run. An early form of parallel processing allowed the interleaved execution of both programs together. The computer would start an I/O operation, and while it was waiting for the operation to complete, it would execute the processor-intensive program. The total execution time for the two jobs would be a little over one hour.


The Oracle Parallel Query Option

Introduced in later versions of Oracle7 the parallel query option (PQO) allows multiple processes to simultaneously fetch records and perform sorting operations. This parallelization of operations can lead to impressive speed improvements in a properly set up parallel environment.

The most important item to specify in a parallel environment is the number of parallel query slaves. Too few and you don’t get the full benefits, too many and they end up competing with each other for resources. Of course parallel operations are of little or no benefit if your system doesn’t have parallel processors and your tables aren’t spread across multiple disks in a stripe set or partitioned. Along with the number of parallel query slaves the degree of parallel (DOP) for the tables and indexes needs to be set properly.

The maximum number of parallel query slaves should generally be set to at least twice the number of CPUs or to twice the number of disks that he object was spread across. The DOP can be determined by forcing a full table scan for tables (use a where 1=2 in a select count(*) from the table) and then timing the response for different DOP settings. These numbers are then adjusted up or down depending on performance.

Parallel query settings

There are several initialization parameters that pertain to parallel query:

parallel_adaptive_multi_user

TRUE or FALSE, defaults to FALSE, when set to TRUE, enables an adaptive algorithm designed to improve performance in multi-user environments that use Parallel Query(PQ). It does this by automatically reducing the requested degree of parallelism based on the current number of active PQ users on the system. The effective degree of parallelism will be based on the degree of parallelism from the table or hint divided by the total number of PQ users. The algorithm assumes that the degree of parallelism provided has been tuned for optimal performance in a single user environment.

At Oracle Openworld 2007, Oracle recommends never to turn-on the parallel_adaptive_multi_user parameter.

optimizer_percent_parallel

Specifies the amount of parallelism that the optimizer uses in its cost functions. The default of 0 means that the optimizer chooses the best serial plan. A value of 100 means that the optimizer uses each object's degree of parallelism in computing the cost of a full table scan operation. Low values favor indexes, and high values favor table scans.

Cost-based optimization will always be used for any query that references an object with a nonzero degree of parallelism. For such queries a RULE hint or optimizer mode or goal will be ignored. Use of a FIRST_ROWS hint or optimizer mode will override a nonzero setting of OPTIMIZER_PERCENT_PARALLEL.

parallel_min_percent

This specifies the minimum percent of threads required for parallel query. Setting this parameter ensures that a parallel query will not be executed sequentially if adequate resources are not available. The default value of 0 means that this parameter is not used.

If too few query slaves are available, an error message is displayed and the query is not executed. Consider the following settings:

PARALLEL_MIN_PERCENT = 50
PARALLEL_MIN_SERVERS = 5
PARALLEL_MAX_SERVERS = 10

In a system with 20 instances up and running, the system would have a maximum of 200 query slaves available. If 190 slaves are already in use and a new user wants to run a query with 40 slaves (for example, degree 2 instances 20), an error message would be returned because 20 instances (that is, 50% of 40) are not available.

parallel_min_servers

This specifies the minimum number of query server processes for an instance. This is also the number of query server processes Oracle creates when the instance is started.

parallel_max_servers

Parallel_max_servers specifies the maximum number of parallel query servers or parallel recovery processes for an instance. Oracle will increase the number of query servers as demand requires from the number created at instance startup up to this value. The same value should be used for all instances in a parallel server environment.

Proper setting of the PARALLEL_MAX_SERVERS parameter ensures that the number of query servers in use will not cause a memory resource shortage during periods of peak database use.

If PARALLEL_MAX_SERVERS is set too low, some queries may not have a query server available to them during query processing.

Setting PARALLEL_MAX_SERVERS too high leads to memory resource shortages during peak periods, which can degrade performance. For each instance to which you do not want to apply the parallel query option, set this initialization parameter to zero.

If you have reached the limit of PARALLEL_MAX_SERVERS on an instance and you attempt to query a GV$ view, one additional parallel server process will be spawned for this purpose. This extra process will serve any subsequent GV$ queries until expiration of the PARALLEL_SERVER_IDLE_TIME, at which point the process will terminate. The extra process is not available for any parallel operation other than GV$ queries.

Note that if PARALLEL_MAX_SERVERS is set to zero for an instance, then no additional parallel server process will be allocated to accommodate a GV$ query.

parallel_server_idle_time

Specifies the amount of idle time after which Oracle terminates a process for parallel operations (parallel query, parallel DML, or parallel DDL). This value is expressed in minutes. The parameter must be set to 1 or greater for the query processes to terminate. 0 means the processes are never terminated.

parallel_execution_message_size


Specifies the size of messages for parallel execution (Parallel Query, PDML, Parallel Recovery, replication). The default value should be adequate for most applications. Typical values are 2148 or 4096 bytes. Larger values would require a larger shared pool.

parallel_min_message_pool

The parallel_min_message_pool parameter defaults to (cpus*parallel_max_servers*1.5*(OS message buffer size) or cpus*5*1.5*(OS message size)). Specifies the minimum permanent amount of memory which will be allocated from the SHARED POOL, to be used for messages in parallel execution.

This memory is allocated at startup time if PARALLEL_MIN_SERVERS is set to a non-zero value, or when the server is first allocated. Setting this parameter is most effective when PARALLEL_MIN_SERVERS is set to a non-zero value, because the memory will be allocated in a contiguous section.

This parameter should only be set if the default formula is known to be significantly inaccurate. setting this parameter too high will lead to a shortage of memory for the shared pool; setting it too low will lead to costlier memory allocation when doing parallel execution. This parameter cannot be set to a number higher than 90% of the shared pool.

parallel_broadcast_enabled

This defaults to FALSE and allows you to improve performance in certain cases involving hash and merge joins. When set to TRUE, if you are joining a very large join result set with a very small result set (size being measured in bytes, rather than number of rows), the optimizer has the option of broadcasting the row sources of the small result set, such that a single table queue will send all of the small set's rows to each of the parallel servers which are processing the rows of the larger set. The result is enhanced performance.

shared_pool_size

The shared pool will have to be increased in size to accommodate the parallel query message areas and IO queues. I suggest that the LARGE POOL be designated to prevent PQO from causing shared pool problems.

large_pool_size


The large pool will automatically be configured at a minimum size of 600k if certain initialization parameters are set in Oracle8. I suggest manually setting the size.


Oracle Parallel Automatic tuning parameter:


Oracle parallel query (OPQ) is a great way to speed full full-scan operations, but Oracle parallelism can be problematic if it is not implemented properly.

Oracle provides a general method for implementing parallelism with the parallel_automatic_tuning=true parameter setting, but there are cases when using PAT can actually degrade your Oracle performance. The Oracle docs note:

"With parallel automatic tuning enabled, Oracle determines parameter settings for each environment based on the number of CPUs on your system and the value set for PARALLEL_THREADS_PER_CPU.

The default values Oracle sets for parallel execution processing when PARALLEL_AUTOMATIC_TUNING is TRUE are usually optimal for most environments. In most cases, Oracle's automatically derived settings are at least as effective as manually derived settings."

I disagree.

The parallel_automatic_tuning parameter feature was created for DSS and Data Warehouse environments using the all_rows optimizer mode on servers with many CPU processors to ensure that the common full table scans are parallelized to an optimal DEGREE.

However, parallel_automatic_tuning is not always appropriate for OLTP and online systems, where setting parallel_automatic_tuning may change the SQL optimizers perception of the costs of full scan operations, causing indexes not to be used.

For non-warehouse environments, I do not recommend setting parallel_automatic_tuning, or turning on parallel query at the system or table level. I get the best performance my manually adding the "parallel" hint to query where I want the full can to be done in parallel.


PARALLEL_THREADS_PER_CPU specifies the default degree of parallelism for the instance and determines the parallel adaptive and load balancing algorithms. The parameter describes the number of parallel execution processes or threads that a CPU can handle during parallel execution.

The default is platform-dependent and is adequate in most cases. You should decrease the value of this parameter if the machine appears to be overloaded when a representative parallel query is executed. You should increase the value if the system is I/O bound.

* Parallel query. The ability to break up the execution of a SELECT statement into multiple tasks, and then to execute those tasks in parallel using multiple processors.
* Parallel data loading. The ability to run multiple SQL*Loader sessions in parallel, which all load data into the same table.
* Parallel DML (Data Manipulation Language). The ability to parallelize INSERT, UPDATE, and DELETE statements.
* Parallel DDL (object creation). The ability to parallelize DDL statements such as CREATE TABLE, CREATE INDEX, and ALTER INDEX.
* Parallel recovery. The ability to use multiple processes to perform instance and media recovery.
* Parallel replication propagation. The ability to propagate changes from one database to another using multiple processes working together in parallel.

Tuesday, December 22, 2009

ORACLE HISTORY (CORPORATE,TECHNICAL,VERSION,EDITIONS,PLATFORMS,FEATURES,TOOLS,SUPPORT,CERTIFICATION etc)

Corporate/technical timeline

* 1977: Larry Ellison and friends founded Software Development Laboratories.
* 1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early commercially-available relational database system. The version did not support transactions, but implemented the basic SQL functionality of queries and joins. (RSI never released a version 1 - instead calling the first version version 2 as a marketing gimmick.)
* 1982: RSI in its turn changed its name, becoming known as "Oracle Corporation",to align itself more closely with its flagship product.
* 1983: The company released Oracle version 3, which it had re-written using the C programming language and which supported COMMIT and ROLLBACK functionality for transactions. Version 3 extended platform support from the existing Digital VAX/VMS systems to include Unix environments.
* 1984: Oracle Corporation released Oracle version 4, which supported read-consistency.
* 1985: Oracle Corporation released Oracle version 5, which supported the client-server model—a sign of networks becoming more widely available in the mid-1980s.
* 1986: Oracle version 5.1 started supporting distributed queries.
* 1988: Oracle RDBMS version 6 came out with support for PL/SQL embedded within Oracle Forms v3 (version 6 could not store PL/SQL in the database proper), row-level locking and hot backups.
* 1989: Oracle Corporation entered the application products market and developed its ERP product, (later to become part of the Oracle E-Business Suite), based on the Oracle relational database.
* 1990: the release of Oracle Applications release 8
* 1992: Oracle version 7 appeared with support for referential integrity, stored procedures and triggers.
* 1997: Oracle Corporation released version 8, which supported object-oriented development and multimedia applications.
* 1999: The release of Oracle8i aimed to provide a database inter-operating better with the Internet (the i in the name stands for "Internet"). The Oracle 8i database incorporated a native Java virtual machine (Oracle JVM).
* 2000: Oracle E-Business Suite 11i pioneers integrated enterprise application software
* 2001: Oracle9i went into release with 400 new features, including the ability to read and write XML documents. 9i also provided an option for Oracle RAC, or "Real Application Clusters", a computer-cluster database, as a replacement for the Oracle Parallel Server (OPS) option.
* 2003: Oracle Corporation released Oracle Database 10g. (The g stands for "grid"; emphasizing a marketing thrust of presenting 10g as "grid-computing ready".)
* 2005: Oracle Database 10.2.0.1—also known as Oracle Database 10g Release 2 (10gR2)—appeared.
* 2006: Oracle Corporation announces Unbreakable Linux
* 2007: Oracle Database 10g release 2 sets a new world record TPC-H 3000 GB benchmark result
* 2007: Oracle Corporation released Oracle Database 11g for Linux and for Microsoft Windows.
* 2008: Oracle Corporation acquires BEA Systems.
* 2009: Oracle Corporation acquires Sun Microsystems. Note: as of November 2009 the acquisition awaits approval from the European Commission.


Version numbering

Oracle products have historically followed their own release-numbering and naming conventions. With the Oracle RDBMS 10g release, Oracle Corporation started standardizing all current versions of its major products using the "10g" label, although some sources continued to refer to Oracle Applications Release 11i as Oracle 11i. Major database-related products and some of their versions include:

* Oracle Application Server 10g (also known as "Oracle AS 10g"): a middleware product;
* Oracle Applications Release 11i (aka Oracle e-Business Suite, Oracle Financials or Oracle 11i): a suite of business applications;
* Oracle Developer Suite 10g (9.0.4);
* Oracle JDeveloper 10g: a Java integrated development environment;

Since version 5, Oracle's RDBMS release numbering has used the following codes:

* Oracle5
* Oracle6
* Oracle7: 7.0.16—7.3.4
* Oracle8 Database: 8.0.3—8.0.6
* Oracle8i Database Release 1: 8.1.5.0—8.1.5.1
* Oracle8i Database Release 2: 8.1.6.0—8.1.6.3
* Oracle8i Database Release 3: 8.1.7.0—8.1.7.4
* Oracle9i Database Release 1: 9.0.1.0—9.0.1.5 (patchset as of December 2003)
* Oracle9i Database Release 2: 9.2.0.1—9.2.0.8 (patchset as of April 2007)
* Oracle Database 10g Release 1: 10.1.0.2—10.1.0.5 (patchset as of February 2006)
* Oracle Database 10g Release 2: 10.2.0.1—10.2.0.4 (patchset as of April 2008)
* Oracle Database 11g Release 1: 11.1.0.6—11.1.0.7 (patchset as of September 2008)
* Oracle Database 11g Release 2: 11.2.0.1 (released 2009-09-01)

The version-numbering syntax within each release follows the pattern: major.maintenance.application-server.component-specific.platform-specific.

For example, "10.2.0.1 for 64-bit Solaris" means: 10th major version of Oracle, maintenance level 2, Oracle Application Server (OracleAS) 0, level 1 for Solaris 64-bit.


List of claimed firsts

Oracle Corporation claims to have provided:

* the first commercially-available SQL-based database (1979)
* the first database to support symmetric multiprocessing (SMP) (1983)
* the first distributed database (1986)
* the first database product tested to comply with the ANSI SQL standard (1993)
* the first 64-bit database (1995)
* the first database to incorporate a native JRE (1998)
* the first proprietary RDBMS to become available on Linux (1998)
* the first database to support XML (1999)


Editions

Over and above the different versions of the Oracle database management software, Oracle Corporation subdivides its product into varying "editions" - apparently for marketing and license-tracking reasons. In approximate order of decreasing scale, we find:

* Enterprise Edition (EE) includes more features than the 'Standard Edition', especially in the areas of performance and security. Oracle Corporation licenses this product on the basis of users or of processors, typically for servers running 4 or more CPUs. EE has no memory limits, and can utilize clustering using Oracle RAC software.
* Standard Edition (SE) contains base database functionality. Oracle Corporation licenses this product on the basis of users or of processors, typically for servers running from one to four CPUs. If the number of CPUs exceeds 4 CPUs, the user must convert to an Enterprise license. SE has no memory limits, and can utilize clustering with Oracle RAC at no additional charge.
* Standard Edition One, introduced with Oracle 10g, has some additional feature-restrictions. Oracle Corporation markets it for use on systems with one or two CPUs. It has no memory limitations.
* Express Edition ('Oracle Database XE'), introduced in 2005, offers Oracle 10g free to distribute on Windows and Linux platforms. It has a footprint of only 150 MB and is restricted to the use of a single CPU, a maximum of 4 GB of user data. Although it can install on a server with any amount of memory, it uses a maximum of 1 GB. Support for this version comes exclusively through on-line forums and not through Oracle support.
* Oracle Database Lite, intended for running on mobile devices. The database located on the mobile device can synchronize with a server-based installation.


Host platforms

Prior to releasing Oracle9i in 2001, Oracle Corporation ported its database product to a wide variety of platforms. More recently Oracle Corporation has consolidated on a smaller range of operating-system platforms.

As of October 2006, Oracle Corporation supported the following operating systems and hardware platforms for Oracle Database 10g:

* Apple Mac OS X Server: PowerPC
* HP HP-UX: PA-RISC, Itanium
* HP Tru64 UNIX: Alpha
* HP OpenVMS: Alpha, Itanium
* IBM AIX5L: IBM POWER
* IBM z/OS: zSeries
* Linux: x86, x86-64, PowerPC, zSeries, Itanium
* Microsoft Windows: x86, x86-64, Itanium
* Sun Solaris: SPARC, x86, x86-64


Database options

Oracle Corporation refers to some extensions to the core functionality of the Oracle database as "database options". As of 2008 such options include:

* Active Data Guard (extends Oracle Data Guard physical standby functionality in 11g)
* Advanced Security (adds data encryption methods)
* Content database (provides a centralized repository for unstructured information)
* Database Vault (enforces extra security on data access)
* Data Mining (ODM) (mines for patterns in existing data)
* In-Memory Database Cache (utilizes TimesTen technology)
* Label Security (enforces row-level security)
* Management Packs (various)
* Oracle Answers (for ad-hoc analysis and reporting)
* Oracle OLAP (adds analytical processing)
* Oracle Programmer (provides programmatic access to Oracle databases via precompilers, interfaces and bindings)
* Partitioning (granularizes tables and indexes for efficiency)
* Real Application Clusters (RAC) (coordinates multiple database servers, together accessing the same database)
* Oracle Real Application Testing (new at version 11g)—including Database Replay (for testing workloads) and SQL Performance Analyzer (SPA) (for preserving SQL efficiency in changing environments)
* Records database (a records management application)
* Oracle Spatial (integrates relational data with geographic information systems (GIS))
* Transparent Gateway for connecting to non-Oracle systems. Offers optimized solution, with more functionality and better performance than Oracle Generic Connectivity.
* Total Recall (optimizes long-term storage of historical data)
* Oracle Warehouse Builder (in various forms and sub-options)

This list is incomplete; you can help by expanding it.

In most cases, using these options entails extra licensing costs.


Suites

In addition to its RDBMS, Oracle Corporation has released several related suites of tools and applications relating to implementations of Oracle databases. For example:

* Oracle Application Server, a J2EE-based application server, aids in developing and deploying applications which utilise Internet technologies and a browser.
* Oracle Collaboration Suite contains messaging, groupware and collaboration applications.
* Oracle Developer Suite contains software development tools, including JDeveloper.
* Oracle E-Business Suite collects together applications for enterprise resource planning (including Oracle Financials), customer relationship management and human resources management (Oracle HR).
* Oracle Enterprise Manager (OEM) used by database administrators (DBAs) to manage the DBMS, and recently in version 10g, a web-based rewrite of OEM called "Oracle Enterprise Manager Database Control". Oracle Corporation has dubbed the super-Enterprise-Manager used to manage a grid of multiple DBMS and Application Servers "Oracle Enterprise Manager Grid Control".
* Oracle Programmer/2000, a bundling of interfaces for 3GL programming languages, marketed with Oracle7 and Oracle8.


Database "features"

Apart from the clearly-defined database options, Oracle databases may include many semi-autonomous software sub-systems, which Oracle Corporation sometimes refers to as "features" in a sense subtly different from the normal usage of the word. For example, Oracle Data Guard counts officially as a "feature", but the command-stack within SQL*Plus, though a usability feature, does not appear in the list of "features" in Oracle's list. Such "features" may include (for example):

* Active Session History (ASH), the collection of data for immediate monitoring of very recent database activity.
* Automatic Workload Repository (AWR), providing monitoring services to Oracle database installations from Oracle version 10. Prior to the release of Oracle version 10, the Statspack facility provided similar functionality.
* Clusterware
* Data Aggregation and Consolidation
* Data Guard for high availability
* Generic Connectivity for connecting to non-Oracle systems.
* Data Pump utilities, which aid in importing and exporting data and metadata between databases
* Database Resource Manager (DRM), which controls the use of computing resources.
* Fine-grained auditing (FGA) (in Oracle Enterprise Edition) supplements standard security-auditing features
* Flashback for selective data recovery and reconstruction
* iSQL*Plus, a web-browser-based graphical user interface (GUI) for Oracle database data-manipulation (compare SQL*Plus)
* Oracle Data Access Components (ODAC), tools which consist of:
o Oracle Data Provider for .NET (ODP.NET)
o Oracle Developer Tools (ODT) for Visual Studio
o Oracle Providers for ASP.NET
o Oracle Database Extensions for .NET
o Oracle Provider for OLE DB
o Oracle Objects for OLE
o Oracle Services for Microsoft Transaction Server
* Oracle-managed files (OMF) -- a feature allowing automated naming, creation and deletion of datafiles at the operating-system level.
* Recovery Manager (rman) for database backup, restoration and recovery
* SQL*Plus, a program that allows users to interact with Oracle database(s) via SQL and PL/SQL commands on a command-line. Compare iSQL*Plus.

This list is incomplete; you can help by expanding it.


Standalone tools

Users can develop applications in Java and PL/SQL using tools such as Oracle JDeveloper, Oracle Forms, or Oracle Reports. Oracle Corporation has started a drive toward 'wizard'-driven environments with a view to enabling non-programmers to produce simple data-driven applications.

Oracle SQL Developer, a free graphical tool for database development, allows developers to browse database objects, run SQL statements and SQL scripts, and edit and debug PL/SQL statements. It incorporates standard and customized reporting.


Other databases marketed by Oracle Corporation

By acquiring other technology in the database field, Oracle Corporation has taken over:

* TimesTen, a memory-resident database that can cache transactions and synchronize data with a centralized Oracle database server. It functions as a real-time infrastructure software product intended for the management of low-latency, high-volume data, of events and of transactions.
* BerkeleyDB, a simple, high-performance, embedded database
* Oracle Rdb, a legacy relational database for the OpenVMS operating system
* MySQL a relational database purchased as part of its immediate previous owner, Sun Microsystems


Use

The Oracle RDBMS has had a reputation among novice users as difficult to install on Linux systems. Oracle Corporation has packaged recent versions for several popular Linux distributions in an attempt to minimize installation challenges beyond the level of technical expertise required to install a database server.


Official support

Users who have Oracle support contracts can use Oracle's MetaLink web site. MetaLink provides users of Oracle Corporation products with a repository of reported problems, diagnostic scripts and solutions. It also integrates with the provision of support tools, patches and upgrades.

The Remote Diagnostic Agent or RDA can operate as a command-line diagnostic tool executing a script. The data captured provides an overview of the Oracle Database environment intended for diagnostic and trouble-shooting. Within RDA, the HCVE (Health Check Validation Engine) can verify and isolate host system environmental issues that may affect the performance of Oracle software.


Database-related guidelines

Oracle Corporation also endorses certain practices and conventions as enhancing the use of its database products. These include:

* Oracle Maximum Availability Architecture (MAA), guidelines on developing high-availability systems
* Optimal Flexible Architecture (OFA), blueprints for mapping Oracle-database objects to file-systems


Oracle Certification Program

Main article: Oracle Certification Program

The Oracle Certification Program, a professional certification program, includes the administration of Oracle Databases as one of its main certification paths. It contains three levels not upto limits.

1. Oracle Certified Associate (OCA)
2. Oracle Certified Professional (OCP)
3. Oracle Certified Master (OCM)


User groups

A variety of official (Oracle-sponsored) and unofficial Oracle User Groups has grown up of users and developers of Oracle databases. They include:

* Oracle Technology Network
* Independent Oracle Users Group
* Geographical/regional user groups
* Product-centric user groups
* Industry-centric user groups
* The Oak Table Network
* Usenet newsgroups


Market position

In the market for relational databases, Oracle Database competes against commercial products such as IBM's DB2 UDB and Microsoft SQL Server. Oracle and IBM tend to battle for the mid-range database market on UNIX and Linux platforms, while Microsoft dominates the mid-range database market on Microsoft Windows platforms. However, since they share many of the same customers, Oracle and IBM tend to support each other's products in many middleware and application categories (for example: WebSphere, PeopleSoft, and Siebel Systems CRM), and IBM's hardware divisions work closely with Oracle on performance-optimizing server-technologies (for example, Linux on zSeries). The two companies have a relationship perhaps best described as "coopetition". Niche commercial competitors include Teradata (in data warehousing and business intelligence), Software AG's ADABAS, Sybase, and IBM's Informix, among many others.

Increasingly, the Oracle database products compete against open-source relational database systems, particularly PostgreSQL, Firebird, and MySQL. Oracle acquired Innobase, supplier of the InnoDB codebase to MySQL, in part to compete better in the open source market. Database products developed on the basis of the open-source model generally cost significantly less to acquire than Oracle systems.

In 2007, competition with SAP AG occasioned litigation from Oracle Corporation.


Pricing

Oracle Corporation offers term licensing for all Oracle products. It bases the list price for a term-license on a specific percentage of the perpetual license price.

Enterprise Edition
As of March 2006, the database that costs the most per machine-processor among Oracle database editions.
Standard Edition
Cheaper: it can run on up to four processors but has fewer features than Enterprise Edition—it lacks proper parallelization,etc; but remains quite suitable for running medium-sized applications.
Standard ONE
Sells even more cheaply, but remains limited to two CPUs. Standard Edition ONE sells on a per-seat basis with a five-user minimum. Oracle Corporation usually sells the licenses with an extra 22% cost for support and upgrades (access to MetaLink—Oracle Corporation's support site) which customers need to renew annually.
Oracle Express Edition (Oracle XE)
An addition to the Oracle database product family (beta version released in 2005, production version released in February 2006), offers a free version of the Oracle RDBMS, but one limited to 4 GB of user data and to 1 GB of RAM (SGA+PGA). XE will use no more than one CPU and lacks an internal JVM. XE runs only on Windows and on Linux, not on AIX, Solaris, HP-UX and the other operating systems available for other editions.

As computers running Oracle often have eight or more processors, the software price can rise into the hundreds of thousands of dollars. The total cost of ownership often exceeds this, as large Oracle installations usually require experienced and trained database administrators to do the set-up properly. Because of the product's large installed base and available training courses, Oracle specialists in some areas have become a more abundant resource than those for more exotic databases. Oracle frequently provides special training offers for database-administrators.

On Linux, Oracle's certified configurations include mostly commercial Linux distributions (Red Hat Enterprise Linux 3 and 4, SuSE SLES8 and 9, Asianux) which can cost in a range from a few hundred to a few thousand USD per year (depending on processor architecture and the support package purchased).

The Oracle database system can also install and run on freely-available Linux distributions such as the Red Hat-based Centos,or Debian-based systems.

Monday, December 21, 2009

Oracle Upgradation from 10g to 11g

Oracle 11g Database software must be installed in new ORACLE_HOME

For some database version direct upgrade to 11g is NOT supported

7.3.3 (or lower) -> 7.3.4 -> 9.2.0.8 -> 11.1
8.0.5 (or lower) -> 8.0.6 -> 9.2.0.8 -> 11.1
8.1.7 (or lower) -> 8.1.7.4 -> 9.2.0.8 -> 11.1
9.0.1.3 (or lower) -> 9.0.1.4 -> 9.2.0.8 -> 11.1
9.2.0.3 (or lower) -> 9.2.0.8 -> 11.1


Direct upgrade to 11g is supported from following version

9.2.0.4 and higher -> 11.1
10.1.0.2 and higher -> 11.1
10.2.0.1 and higher -> 11.1

Tools and methods to upgrade database


1. DBUA (DataBase Upgrade Assistant) Utility - GUI
2. Manual Upgradeusing SQL scripts and Utilities - Command line tool (catupgrd.sql..)


Top level steps for Oracle Database 11g upgarde

1. Prepare Upgrade to 11g Database
2. Backup existing database software and database
3. Analyze the database using Pre-Upgrade Information Tool
4. Install Oracle 11g software in new ORACLE_HOME
5. Run Pre-upgrade information tool
SQL>spool upgrd_info.sql
SQL>@?/rdbms/admin/utlu111i.sql (check output and modify).
6. Check Invalid objects.
SQL>select object_name,owner,object_type from all_objects where status like 'INVALID';
7. Check version and status of all database components.
SQL>select comp_name,version,status from dba_registry;
8. Change compatibility in init.ora
9. Startup upgrade
SQL>spool upgrade.log
SQL>@?/rdbms/admin/catupgrd.sql
10.Run post-upgrade status tool provides a summary of the upgrade.
SQL>@?/rdbms/admin/utlu111s.sql

Friday, December 18, 2009

Oracle: Recover a deleted datafile without backup even your DB in no archive mode from unix/linux when database is still up

How to use Linux behavior to recover an accidentally delete file when the database is still open.

On Unix/Linux, when a file is deleted, but a process still has the file open, the file is still there in the filesystem, and only the inode is removed.
But the process can continue to use its file handle, and the file can also be accessible under /proc//fd .

In the following example, we use that behaviour to recover a lost datafile after is has been dropped from the os (with rm) but the datafile is still open by the background processes.

First, we create a tablespace, and populate a table in it.

SQL> REM we create a tablespace:
SQL> create tablespace TEST_RM datafile '/oradata/tmp/test_rm.dbf' size 10M;
Tablespace created.

SQL> REM we create a table in it:
SQL> create table KHAN_TEST tablespace test_rm as select * from dba_objects;
Table created.

SQL> REM we check that table data is accessible:
SQL> select count(*) from KHAN_TEST;
COUNT(*)
----------
12708

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

Then, we drop the datafile from unix prompt.

here is the datafile
ls -l /oradata/tmp/test_rm.dbf
-rw-r----- 1 oracle dba 10493952 Sep 26 14:25 /oradata/tmp/test_rm.dbf

we 'accidently' drop the datafile
rm /oradata/tmp/test_rm.dbf
ls -l /oradata/tmp/test_rm.dbf
ls: /oradata/tmp/test_rm.dbf: no such file or directory

Here the datafile is lost.
Now we connect again.

sqlplus / as sysdba

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> REM and we check if table data is accessible:
SQL> select count(*) from KHAN_TEMP;

select * from khan_temp
*
ERROR at line 1:
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/oradata/tmp/test_rm.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

The datafile is lost and data is not accessible.

However, the datafile should still have an open file descriptor by an oracle background process

we check the dbwriter pid:
ps -edf | grep dbw
oracle 2661 1 0 Sep26 ? 00:00:06 xe_dbw0_XE
oracle 7044 7037 0 14:40 pts/1 00:00:00 /bin/bash -c ps -edf | grep dbw
oracle 7046 7044 0 14:40 pts/1 00:00:00 grep dbw

and we check its opened file descriptors for our file:
ls -l /proc/2661/fd | grep test_rm
lrwx------ 1 oracle dba 64 Sep 26 14:02 66 -> /oradata/tmp/test_rm.dbf (deleted)

here it is:
ls -l /proc/2661/fd/66
lrwx------ 1 oracle dba 64 Sep 26 14:02 /proc/2661/fd/66 -> /oradata/tmp/test_rm.dbf (deleted)

In some other unix, lsof may be needed to map the file descriptor with the deleted file name

first we set a symbolic link so that oracle can see it as it was before the delete:
ln -s /proc/2661/fd/66 /oradata/tmp/test_rm.dbf

here data is accessible, but that will be lost if dbwriter closes it file handle (i.e if the database is closed)

However we can now set the tablespace read only so that it is checkpointed, and no writes occurs on it.

SQL> alter tablespace TEST_RM read only;
Tablespace altered.

We can now copy the file safely.

then we drop the symbolic link:
rm /oradata/tmp/test_rm.dbf
ls -l /oradata/tmp/test_rm.dbf

ls: /oradata/tmp/test_rm.dbf: No such file or directory

and we can now copy the file
cp -p /proc/2661/fd/66 /oradata/tmp/test_rm.dbf
ls -l /oradata/tmp/test_rm.dbf

-rw-r----- 1 oracle dba 10493952 Mar 26 14:54 /oradata/tmp/test_rm.dbf

And datafile is now available again.

SQL> REM we have it back, lets put the tablespace back in read/write
SQL> alter tablespace test_rm read write;
Tablespace altered.

SQL> REM and we check data is still there:
SQL> select count(*) from FRANCK;

COUNT(*)
----------
12708

Note:This is not to be used like that in production. This is unsupported and may behave differently on different unix/linux or oracle versions.

Thursday, November 26, 2009

ORA-27054 on NFS file system on SUSE 10 SP2 for archives to be create directly on standby server.

On SUSE 10 SP 2 which is the supported version to be used with LOCAL,SAN,NAS devices and database 10gR2 although you create nfs filesystems archiver process reports the following error :

ORA-27054: NFS file system where the file is created or resides is not mounted with correct options

This is happening because on Oracle 10gR2 Oracle checks the options with which a NFS mount is mounted on the filesystem.
Correct option for SUSE datafiles,archives and backup are :
cio,rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,vers=3,timeo=600

If you mount your NFS filesystems and you got on this error this is due to bug 5146667

If available apply patch. Else use the following work around:

1) set the Event 10298 in the init file event="10298 trace name context forever, level 32"

If you are using the spfile then :


SQL> alter system set event='10298 trace name context forever, level 32'scope= spfile sid='*';

Once you set the above parameter bounce the instance to effect parameter.

Check as follows

SQL> select name, value from v$parameter where name = 'event';
NAME VALUE
---------- ------------------------------------------------------------
Event 10298 trace name context forever, level 32

Then try by switching logfile again.

sid='*' is for RAC. For single instance do not use it.

Monday, November 23, 2009

[Oracle Net Service]WARNING: inbound connection timed out (ORA-3136)

This problem can occur on any platform, When you use Oracle Net services.

Because; The Oracle Net 10G parameter "SQLNET.INBOUND_CONNECT_TIMEOUT and INBOUND_CONNECT_TIMEOUT_listenername default to 0 in 10.1.
To address Denial of Service (DOS) issues, the parameter were set to have a default of 60 (seconds) in 10.2

The following may be seen in the alert log: WARNING: inbound connection timed out (ORA-3136)

SQLNET.INBOUND_CONNECT_TIMEOUT is set to a value in seconds and determines how long a client has to provide the necessary authentication information to a database.

INBOUND_CONNECT_TIMEOUT_listenername is set to a value in seconds and determines how long a client has to complete its connect request to the listener after the network connection has been established.

To protect both the listener and the database server, Oracle Corporation recommends setting INBOUND_CONNECT_TIMEOUT_listenername in combination with the SQLNET.INBOUND_CONNECT_TIMEOUT parameter.

Cause:
Whenever default timeouts are assigned to a parameter, there may be cases where this default does not work well with a particular application. However, some type of timeout on the connection establishment is necessary to combat Denial of Service attacks on the database. In this case, SQLNET.INBOUND_CONNECT__TIMEOUT and INBOUND_CONNECT_TIMEOUT_listenername were given default values of 60 seconds in Oracle 10.2. It is these timeout values that can cause the errors described in this note.

Also note that it is possilbe the reason the database is slow to authenticate, may be due to an overloaded Oracle database or node.

Solution:

Set the parameters SQLNET.INBOUND_CONNECT_TIMEOUT and INBOUND_CONNECT_TIMEOUT_listenername to 0 (indefinite) or to an approprate value for the application yet still combat DOS attacks (120 for example).

These parameters are set on the SERVER side:
listener.ora: INBOUND_CONNECT_TIMEOUT_listenername
sqlnet.ora: SQLNET.INBOUND_CONNECT_TIMEOUT

After setup this parameter in listener reload the listener by issuing command reload on o/s level.Below is the example

$lsnrctl reload

Note:Further tuning of these parameters may be needed is the problem persists.

Sunday, November 15, 2009

IMPORT ZIP DUMP WITHOUT UNZIP



Script to import zip dump

Here I'm creating script on o/s level

$ vi imp_compress_dump.sh

#/bin/bash

# Example Script to Import an Object from a Compressed Export File
# without compressing it, by using FIFO (named_pipes)
# Use when uncompressing an export is not possible
# due to space and/or time constraints

# Declare the name of the named pipe

NAMED_PIPE=mypipe.pipe;

# Make the named pipe (FIFO)

mknod $NAMED_PIPE p;

# Use zcat to read compressed file and direct the standard out to the named pipe created earlier

zcat expfull_test_16-nov-09_test_export.dmp.gz > $NAMED_PIPE &

# A sample imp using the named pipe

imp file=$NAMED_PIPE userid=test/test commit=y compile=n buffer=2000000000;

# Remove the named pipe

rm $NAMED_PIPE;

# Exit the script

exit;

:wq (save and exit)

--------example------------

$ sqlplus "/ as sysdba"

SQL> create user test identified by test;

User created.

SQL> grant connect, dba to test;

Grant succeeded.

SQL> connect test/test
Connected.
SQL> create table test_export (id number not null);

Table created.

SQL> insert into test_export values (1);

1 row created.

SQL> commit;

Commit complete.

SQL> ! exp userid=test/test file=expfull_test_16-nov-09_test_export.dmp log=exfutest_16-nov-09.log buffer=2000000000 statistics=none

About to export specified tables via Conventional Path ...
. . exporting table TEST_EXPORT 1 rows
exported
Export terminated successfully without warnings.

SQL> ! gzip expfull_test_16-nov-09_test_export.dmp

SQL> ! ls -ltr *.gz
-rw-r--r-- 1 oracle oinstall 459 Nov 16 09:22 expfull_test_16-nov-09_test_export.dmp.gz

SQL> exit

$ ./imp_compress_dump.sh

Export file created by EXPORT:V09.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing TEST's objects into TEST
. . importing table "TEST_EXPORT" 1 rows
imported
Import terminated successfully without warnings.

$ sqlplus test/test


SQL> select * from test_export;

ID
----------
1