Thursday, June 21, 2012

ORACLE DBA NOTES PART 2

Row Chaning and Migration

Row Migration:
A row migrates when an update to that row would cause it to not fit on the block anymore (with all of the other data that exists there currently).  A migration means that the entire row will move and we just leave behind the «forwarding address». So, the original block just has the rowid of the new block and the entire row is moved.

Row Chaining:
A row is too large to fit into a single database block. For example, if you use a 4KB blocksize for your database, and you need to insert a row of 8KB into it, Oracle will use 3 blocks and store the row in pieces.

Some conditions that will cause row chaining are: Tables whose rowsize exceeds the blocksize. Tables with LONG and LONG RAW columns are prone to having chained rows. Tables with more then 255 columns will have chained rows as Oracle break wide tables up into pieces.

So, instead of just having a forwarding address on one block and the data on another we have data on two or more blocks.

Real Application Clusters

Oracle RAC is a cluster database with a shared cache architecture that overcomes the limitations of traditional shared-nothing and shared-disk approaches to provide a highly scalable and available database solution for all your business applications. Oracle RAC provides the foundation for enterprise grid computing.

Oracle’s Real Application Clusters (RAC) option supports the transparent deployment of a single database across a cluster of servers, providing fault tolerance from hardware failures or planned outages. Oracle RAC running on clusters provides Oracle’s highest level of capability in terms of availability, scalability, and low-cost computing.

One DB opened by multipe instances so the the db will be Highly Available if an instance crashes.
Cluster Software.
 Oracles Clusterware or products like Veritas Volume Manager are required to provide the cluster support and allow each node to know which nodes belong to the cluster and are available and with Oracle Cluterware to know which nodes have failed and to eject then from the cluster, so that errors on that node can be cleared.

Oracle Clusterware has two key components Cluster Registry OCR and Voting Disk.
The cluster registry holds all information about nodes, instances, services and ASM storage if used, it also contains state information ie they are available and up or similar.

The voting disk is used to determine if a node has failed, i.e. become separated from the majority. If a node is deemed to no longer belong to the majority then it is forcibly rebooted and will after the reboot add itself again the the surviving cluster nodes.
http://pocketoracle.blogspot.com/  Oracle Architecture

 An Oracle server:

a DBMS that provides an open, comprehensive, integrated approach to information management,
Consists of an Instance and a database.

An Oracle Instance:
a means to access an Oracle database,
always opens one and only one database and consists of memory structures and background process.

An Oracle database:
a collection of data that is treated as a unit,
Consists of Datafiles, Control files, Redo log files. (optional param file, passwd file, archived log)

Parameter Files - The Oracle Parameter File (PFILE or SPFILE) holds initialization parameters which indicate where the control files are, how memory is allocated, how logging is performed, and other characteristics of the Oracle instance.
Control Files - The Control File stores information needed to verify that the database is consistent, including a list of all database files making up the instance and other important data.
Redo Log Files - The Redo Log files store a sequence of entries describing all actions taken against the database. This data is used to recover a database in the event of instance failure.
Data Files - The Data Files contain blocks of data which store database objects (e.g., tables, indexes, materialized views, etc.) in the database.
Temp Files - The Temp files contains data used temporarily including intermediate results, sort results and so forth.
Data and Temp files are grouped into tablespaces
Instance memory Structures:

System Global Area (SGA):
Allocated at instance startup, and is a fundamental component of an Oracle Instance.

SGA Memory structures:
Includes Shared Pool,  Database Buffer Cache, Redo Log Buffer among others.

Shared Pool :
Consists of two key performance-related memory structures Library Cache and  Data Dictionary Cache.

Library Cache:
Stores information about the most recently used SQL and PL/SQL statements and enables the sharing of commonly used statements.

Data Dictionary Cache :
Stores collection of the most recently used definitions in the database Includes db files, tables, indexes, columns etc. Improves perf. During the parse phase, the server process looks at the data dictionary for information to resolve object names and validate access.

Database Buffer Cache:
Stores copies of data blocks that have been retrieved from the datafiles. Everything done here.

Redo Log Buffer :
Records all changes made to the database data blocks, Primary purpose is recovery. Redo entries contain information to reconstruct or redo changes.

User process:
Started at the time a database User requests connection to the Oracle server. requests interaction with the Oracle server, does not interact directly with the Oracle server.

Server process:
Connects to the Oracle Instance and is Started when a user establishes a session.
fulfills calls generated and returns results.
Each server process has its own nonshared PGA when the process is started.
Server Process Parses and run SQL statements issued through the application, Reads necessary data blocks from datafiles on disk into the shared database buffers of the SGA, if the blocks are not already present in the SGA and Return results in such a way that the application can process the information.

In some situations when the application and Oracle Database operate on the same computer, it is possible to combine the user process and corresponding server process into a single process to reduce system overhead.

Program Global Area (PGA): 
The PGA (Program or Process Global Area) is a memory area (RAM) that stores data and control information for a single process. For example, it typically contains a sort area, hash area, session cursor cache, etc.

Memory area used by a single Oracle server process.
Allocated when the server process is started,
deallocated when the process is terminated and
used by only one process.
Used to process SQL statements and
to hold logon and other session information.

Background processes:
Started when an Oracle Instance is started.

Background Processes Maintains and enforces relationships between physical and memory structures
There are two types of database processes:

            1.         Mandatory background processes
            2.         Optional background processes

Mandatory background processes:
– DBWn, PMON, CKPT,  LGWR,  SMON

Optional background processes:
– ARCn, LMDn, RECO, CJQ0, LMON, Snnn, Dnnn, Pnnn, LCKn, QMNn

DBWn writes when:
• Checkpoint occurs
• Dirty buffers reach threshold
• There are no free buffers
• Timeout occurs
• RAC ping request is made
• Tablespace OFFLINE
• Tablespace READ ONLY
• Table DROP or TRUNCATE
• Tablespace BEGIN BACKUP

Log Writer (LGWR) writes:
• At commit
• When 1/3rd full
• When there is 1 MB of redo
• Every 3 seconds
• Before DBWn writes
System Monitor (SMON) Responsibilities:
• Instance recovery
– Rolls forward changes in redo logs
– Opens database for user access
– Rolls back uncommitted transactions
• Coalesces free space
• Deallocates temporary segments.

Process Monitor (PMON) Cleans up after failed processes by:
• Rolling back the transaction
• Releasing locks
• Releasing other resources
• Restarting dead dispatchers

Checkpoint (CKPT) Responsible for:
• Signaling DBWn at checkpoints
• Updating datafile headers with checkpoint information
• Updating control files with checkpoint information

CKPT (Oracle Checkpoint Process) is an Oracle background process that timestamps all datafiles and control files to indicate that a checkpoint has occurred.
The "DBWR checkpoints" statistic (v$sysstat) indicates the number of checkpoint requests completed.
A checkpoint occurs when the DBWR (database writer) process writes all modified buffers in the SGA buffer cache to the database data files. Data file headers are also updated with the latest checkpoint SCN, even if the file had no changed blocks.
Checkpoints occur AFTER (not during) every redo log switch and also at intervals specified by initialization parameters.
Set parameter LOG_CHECKPOINTS_TO_ALERT=TRUE to observe checkpoint start and end times in the database alert log.
Checkpoints can be forced with the ALTER SYSTEM CHECKPOINT; command.

Archiver (ARCn)
• Optional background process
• Automatically archives online redo logs when ARCHIVELOG mode is set
• Preserves the record of all changes made to the database
Database Concepts and Architecture
http://www.orafaq.com/wiki/Database_Concepts_and_Architecture

What is an Oracle Database?
A database is a collection of data. An Oracle database holds its data in a coordinated set of files stored on disk, including following types:
Parameter Files - The Oracle Parameter File (PFILE or SPFILE) holds initialization parameters which indicate where the control files are, how memory is allocated, how logging is performed, and other characteristics of the Oracle instance.
Control Files - The Control File stores information needed to verify that the database is consistent, including a list of all database files making up the instance and other important data.
Redo Log Files - The Redo Log files store a sequence of entries describing all actions taken against the database. This data is used to recover a database in the event of instance failure.
Data Files - The Data Files contain blocks of data which store database objects (e.g., tables, indexes, materialized views, etc.) in the database.
Temp Files - The Temp files contains data used temporarily including intermediate results, sort results and so forth.
Data and Temp files are grouped into tablespaces (see definition below).

What is an Instance?
An instance is a collection of Oracle background processes and shared memory structures.
Memory Areas
SGA - System Global Area
The SGA consists of the following four (five if MTS) parts:
§          Fixed Portion
§          Variable Portion
§          Shared pool
§          java pool
§        PGA - Process Global Area
§        UGA - User Global Area
Processes
Oracle uses many small (focused) processes to manage and control the Oracle instance. This allows for optimum execution on multi-processor systems using multi-core and multi-threaded technology. Some of these processes include:
§        PMON - Process Monitor
§        SMON - System Monitor
§        ARCn - Redo Log Archiver
§        LGWR - Redo Log Writer
§        DBWn - Database Writer
§        CKPT - Checkpoint process
§        RECO - Recoverer
§        CJQn - Job Queue Coordinator
§        QMNn - Queue-monitor processes
§        Dnnn - Dispatcher Processes (multiplex server-processes on behalf of users)
§        Snnn - Shared server processes (serve client-requests)
§        MMAN - Memory Manager process which will help in automatic memory management when use sga_target,memory_target
§        LSP0 - Logical standby coordinator process (controls Data Guard log-application)
§        MRP - Media-recovery process (detached recovery-server process)
§        MMON - This is the process which will write to AWR base tables ie WR$ tables
§        MMNL - Memory monitor light (gathers and stores AWR statistics)
§        PSP0 - Process-spawner (spawns Oracle processes)
§        RFS - Remote file server process (archive to a remote site)
§        DBRM - DB resource manager (new in 11g)
§        DIAGn - Diagnosability process (new in 11g)
§        FBDA - Flashback data archiver process (new in 11g)
§        VKTM - Virtual Timekeeper (new in 11g)
§        Wnnn - Space Management Co-ordination process (new in 11g)
§        SMCn - Space Manager process (new in 11g)
An instance can mount and open one and only one database.
A database can normally only be mounted and opened by one instance. However, when using Real Application Clusters (RAC) a database can be mounted and opened by many instances.

The PGA (Program or Process Global Area) is a memory area (RAM) that stores data and control information for a single process. For example, it typically contains a sort area, hash area, session cursor cache, etc.
http://www.orafaq.com/wiki/PGA

The User Global Area (UGA) is a memory area (RAM) that holds session-based information.
PMON (Process MONitor) is an Oracle background process created when you start a database instance.
The PMON process will free up resources if a user process fails (eg. release database locks).
PMON normally wakes up every 3 seconds to perform its housekeeping activities.
PMON must always be running for an instance. If not, the instance will terminate.
To speed-up housekeeping, one may also wake-up PMON (process 2 below) manually:
SQL> oradebug setmypid
SQL> oradebug wakeup 2

SMON (System MONitor) is an Oracle background process created when you start a database instance.
The SMON process performs instance recovery, cleans up after dirty shutdowns and coalesces adjacent free extents into larger free extents.
SMON wakes up every 5 minutes to perform housekeeping activities.
SMON must always be running for an instance. If not, the instance will terminate.

CKPT (Oracle Checkpoint Process) is an Oracle background process that timestamps all datafiles and control files to indicate that a checkpoint has occurred.
The "DBWR checkpoints" statistic (v$sysstat) indicates the number of checkpoint requests completed.
A checkpoint occurs when the DBWR (database writer) process writes all modified buffers in the SGA buffer cache to the database data files. Data file headers are also updated with the latest checkpoint SCN, even if the file had no changed blocks.
Checkpoints occur AFTER (not during) every redo log switch and also at intervals specified by initialization parameters.
Set parameter LOG_CHECKPOINTS_TO_ALERT=TRUE to observe checkpoint start and end times in the database alert log.
Checkpoints can be forced with the ALTER SYSTEM CHECKPOINT; command.

Pfile parameters:
          Compatible
·           Db_name
·           Instance_name
·           Control_files=’__’,’___’
·           Db_block_size
·           Db_block_buffers (now it is db_cache_size)
·           Db_files
·           Undo_tablespace=undo1
·           Undo_management
·           Background_dump_dest
·           User_dump_dest
·           Core_dump_dest
·           Shared_pool_size
·           Log_buffer
·           Remote_login_password
·           Sql_trace
·           Timed_statistics
·           Max_dump_file_size
·           Processes (Number of OS processes to release)
·           IFile (name of another pfile embedded within current pfile)





AWR Reports - Top five events
###########################
Please find the documentation for few of the top five events,hope it will help.I will keep you updated about the other events as well, need more time to analyze.Please correct me if you find any discrepancy .

Wait events are statistics that are increment by a server process or thread to indicate that it had to wait for an event to complete before being able to continue processing.
Db File Scattered Oracle Metric Event :
Definition
: It signifies the user process is reading buffers into the SGA buffer cache and is waiting for a physical I/O call to return.
Explanation
:The db file scattered read wait event identifies that a full table scan is occurring. When performing a full table scan into the buffer cache, the blocks read are read into memory locations that are not physically adjacent to each other.Such reads are called scattered read calls, because the blocks are scattered throughout memory.Multiblock (up to DB_FILE_MULTIBLOCK_READ_COUNT blocks) reads due to full table scans into the buffer cache show up as waits for 'db file scattered read'."

Db File Sequential Oracle Event :
Definition
: A db file sequential read is an event that shows a wait for a foreground process while doing a sequential read from the database.
Explanation
:This is an o/s operation, most commonly used for single block reads. Single block reads are mostly commonly seen for index block access or table block access by a rowid (Eg: to access a table block after an index entry has been seen)

NOTE:
A db file scattered read is the same type of event as "db file sequential read", except
that Oracle will read multiple data blocks. Multi-block reads are typically used on full
table scans. The name "scattered read" may seem misleading but it refers to the fact that
multiple blocks are read into DB block buffers that are 'scattered' throughout memory.

Log File sync:
Definition
: Oracle foreground processes are waiting for a COMMIT or ROLLBACK to complete
Explanation:
The log file sync Oracle metric indicates the process is waiting for LGWR to finish flushing the log buffer to disk. This occurs when a user commits a transaction (a transaction is not considered committed until all of the redo to recover the transaction has been successfully written to disk).
Ways to tune it :
a)Tune LGWR will help out to solve the wait issue eg: Do not put redo logs on RAID5
b)Reduce overall number of commits by batching transactions so that there are fewer distinct COMMIT operations
c) Metalink notes
Reference Note# 34592.1
High Waits on log file sync Note# 125269.1
Tuning the Redo log Buffer Cache and Resolving Redo Latch Contention Note# 147471.1
######################
SQL> show parameter pga

SQL>SELECT PGA_TARGET_FOR_ESTIMATE,PGA_TARGET_FACTOR,BYTES_PROCESSED,ESTD_EXTRA_BYTES_RW,ESTD_PGA_CACHE_HIT_PERCENTAGE,ESTD_OVERALLOC_COUNT FROM V$PGA_TARGET_ADVICE;
##########################

Resolving Your Wait Events
The following are 10 of the most common causes for wait events, along with explanations and potential solutions:

1. DB File Scattered Read
This generally indicates waits related to full table scans. As full table scans are pulled into memory, they rarely fall into contiguous buffers but instead are scattered throughout the buffer cache. A large number here indicates that your table may have missing or suppressed indexes. Although it may be more efficient in your situation to perform a full table scan than an index scan, check to ensure that full table scans are necessary when you see these waits. Try to cache small tables to avoid reading them in over and over again, since a full table scan is put at the cold end of the LRU (Least Recently Used) list.

2. DB File Sequential Read
This event generally indicates a single block read (an index read, for example). A large number of waits here could indicate poor joining orders of tables, or unselective indexing. It is normal for this number to be large for a high-transaction, well-tuned system, but it can indicate problems in some circumstances. You should correlate this wait statistic with other known issues within the Statspack report, such as inefficient SQL. Check to ensure that index scans are necessary, and check join orders for multiple table joins. The DB_CACHE_SIZE will also be a determining factor in how often these waits show up. Problematic hash-area joins should show up in the PGA memory, but they're also memory hogs that could cause high wait numbers for sequential reads. They can also show up as direct path read/write waits.

3. Free Buffer
This indicates your system is waiting for a buffer in memory, because none is currently available. Waits in this category may indicate that you need to increase the DB_BUFFER_CACHE, if all your SQL is tuned. Free buffer waits could also indicate that unselective SQL is causing data to flood the buffer cache with index blocks, leaving none for this particular statement that is waiting for the system to process. This normally indicates that there is a substantial amount of DML (insert/update/delete) being done and that the Database Writer (DBWR) is not writing quickly enough; the buffer cache could be full of multiple versions of the same buffer, causing great inefficiency. To address this, you may want to consider accelerating incremental checkpointing, using more DBWR processes, or increasing the number of physical disks.

4. Buffer Busy
This is a wait for a buffer that is being used in an unshareable way or is being read into the buffer cache. Buffer busy waits should not be greater than 1 percent. Check the Buffer Wait Statistics section (or V$WAITSTAT) to find out if the wait is on a segment header. If this is the case, increase the freelist groups or increase the pctused to pctfree gap. If the wait is on an undo header, you can address this by adding rollback segments; if it's on an undo block, you need to reduce the data density on the table driving this consistent read or increase the DB_CACHE_SIZE. If the wait is on a data block, you can move data to another block to avoid this hot block, increase the freelists on the table, or use Locally Managed Tablespaces (LMTs). If it's on an index block, you should rebuild the index, partition the index, or use a reverse key index. To prevent buffer busy waits related to data blocks, you can also use a smaller block size: fewer records fall within a single block in this case, so it's not as "hot." When a DML (insert/update/ delete) occurs, Oracle Database writes information into the block, including all users who are "interested" in the state of the block (Interested Transaction List, ITL). To decrease waits in this area, you can increase theinitrans, which will create the space in the block to allow multiple ITL slots. You can also increase the pctfree on the table where this block exists (this writes the ITL information up to the number specified by maxtrans, when there are not enough slots built with the initrans that is specified).

5. Latch Free
Latches are low-level queuing mechanisms (they're accurately referred to as mutual exclusion mechanisms) used to protect shared memory structures in the system global area (SGA). Latches are like locks on memory that are very quickly obtained and released. Latches are used to preventconcurrent access to a shared memory structure. If the latch is not available, a latch free miss is recorded. Most latch problems are related to the failure to use bind variables (library cache latch), redo generation issues (redo allocation latch), buffer cache contention issues (cache buffers LRU chain), and hot blocks in the buffer cache (cache buffers chain). There are also latch waits related to bugs; check MetaLink for bug reports if you suspect this is the case. When latch miss ratios are greater than 0.5 percent, you should investigate the issue.

6. Enqueue
An enqueue is a lock that protects a shared resource. Locks protect shared resources, such as data in a record, to prevent two people from updating the same data at the same time. An enqueue includes a queuing mechanism, which is FIFO (first in, first out). Note that Oracle's latching mechanism is not FIFO. Enqueue waits usually point to the ST enqueue, the HW enqueue, the TX4 enqueue, and the TM enqueue. The ST enqueue is used for space management and allocation for dictionary-managed tablespaces. Use LMTs, or try to preallocate extents or at least make the next extent larger for problematic dictionary-managed tablespaces. HW enqueues are used with the high-water mark of a segment; manually allocating the extents can circumvent this wait. TX4s are the most common enqueue waits. TX4 enqueue waits are usually the result of one of three issues. The first issue is duplicates in a unique index; you need to commit/rollback to free the enqueue. The second is multiple updates to the same bitmap index fragment. Since a single bitmap fragment may contain multiple rowids, you need to issue a commit or rollback to free the enqueue when multiple users are trying to update the same fragment. The third and most likely issue is when multiple users are updating the same block. If there are no free ITL slots, a block-level lock could occur. You can easily avoid this scenario by increasing the initrans and/ormaxtrans to allow multiple ITL slots and/or by increasing the pctfree on the table. Finally, TM enqueues occur during DML to prevent DDL to the affected object. If you have foreign keys, be sure to index them to avoid this general locking issue.

7. Log Buffer Space
This wait occurs because you are writing the log buffer faster than LGWR can write it to the redo logs, or because log switches are too slow. To address this problem, increase the size of the log files, or increase the size of the log buffer, or get faster disks to write to. You might even consider using solid-state disks, for their high speed.

8. Log File Switch
All commit requests are waiting for "logfile switch (archiving needed)" or "logfile switch (Checkpoint. Incomplete)." Ensure that the archive disk is not full or slow. DBWR may be too slow because of I/O. You may need to add more or larger redo logs, and you may potentially need to add database writers if the DBWR is the problem.

9. Log File Sync
When a user commits or rolls back data, the LGWR flushes the session's redo from the log buffer to the redo logs. The log file sync process must wait for this to successfully complete. To reduce wait events here, try to commit more records (try to commit a batch of 50 instead of one at a time, for example). Put redo logs on a faster disk, or alternate redo logs on different physical disks, to reduce the archiving effect on LGWR. Don't use RAID 5, since it is very slow for applications that write a lot; potentially consider using file system direct I/O or raw devices, which are very fast at writing information.

10. Idle Event.
There are several idle wait events listed after the output; you can ignore them. Idle events are generally listed at the bottom of each section and include such things as SQL*Net message to/from client and other background-related timings. Idle events are listed in the stats$idle_event table.

Index unusable: Skip_unusable_indexes oracle10g/oracle11g

http://www.orafaq.com/node/2384

Index unusable: Skip_unusable_indexes oracle10g/oracle11g       
www.dbarajabaskar.blogspot.com
Why indexes are going to unusable status?
When will the indexes goes for unusable state?
1.Any maintenance activity in partition table – Alter command
1.Truncate the table partition
2.Drop the table partition
3.Split Part/Sub Partition
2.Any maintenance activity in table – Table Reorganization.
1.Move the table.
2.Online redefinition
More details about online redefinition -
http://dbarajabaskar.blogspot.com/2010/04/online-redefintion-in-oracle-table.html
3.Oracle Import – While import the data with skip_unusable_indexes=y.
To improve the performance of import, we can unusable the indexes manually.
After import the data, we rebuild the indexes.
4.SQL LOADER – Using sqlldr to load the data using direct load.
5.User can manually unusable the indexes for performance improvement.
How skip_unusable_indexes works?
In oracle9i release, we don’t have skip_unusable_indexes parameter.
I have faced several issues regarding this.
Sometimes indexes status went to unusable state for above reasons.
While batch cycle were failed due to indexes unusable. Application team notified to DBA group,
DBA team rebuilds the indexes & asked to application team to rerun the batch cycle.
In oracle 10g/ oracle 11g provides skip_unusable_indexes=TRUE (default) feature.
If any index status is unusable in database its skip the unusable indexes and supporting the DML operations.
But index unusable status is affecting the database performance.
While running a query using index scan it will take less time compare as full table scan.
I have tested the below scenario in 11.1.0.7 version.
SQL> create user raja identified by raja;
User created.
SQL> grant connect,resource,dba to raja;
Grant succeeded.
Default parameter value is TRUE.
SQL> show parameter skip_unusable_indexes
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------
skip_unusable_indexes boolean TRUE
SQL> create table raja.test as select * from scott.emp;
Table created.
SQL> create index raja.test_idx on raja.test(empno);
Index created.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA TEST_IDX VALID
SQL> select ename,job from raja.test where empno=7844;
ENAME JOB
---------- ---------
TURNER SALESMAN
Gather the statistics
SQL> exec DBMS_STATS.GATHER_TABLE_STATS (ownname => 'RAJA' , tabname => 'TEST',cascade => true, estimate_percent => 100,method_opt=>'for all indexed columns size 1', granularity => 'ALL', degree => 4);
PL/SQL procedure successfully completed.
SQL> explain plan for select ename,job from raja.test where empno=7844;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------
Plan hash value: 1389866015
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 17 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 17 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | TEST_IDX | 1 | | 1 (0)| 00:00:01 |
-----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("EMPNO"=7844)
14 rows selected.
Query is going INDEX SCAN & COST is 2.
Now move table to same tablespace itself.
SQL> alter table raja.test move;
Table altered.
Now indexes status is unusable.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA TEST_IDX UNUSABLE
While index is unusable status, we are able to do select/DML operations. Because skip_unusable_indexes=true.
SQL> select ename,job from raja.test where empno=7844;
ENAME JOB
---------- ---------
TURNER SALESMAN
After index unusable, explain plan was changed. Now query is going to full table scan & cost is 3. Unusable indexes impacting the query performance.
SQL> explain plan for select ename,job from raja.test where empno=7844;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 17 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| TEST | 1 | 17 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("EMPNO"=7844)
13 rows selected.
Now we changed the parameter skip_unusable_indexes=FALSE & tested SELECT/DML operations failed.
SQL> alter system set skip_unusable_indexes=false;
System altered.
SQL> show parameter skip_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
skip_unusable_indexes boolean FALSE
SQL> select ename,job from raja.test where empno=7844;
select ename,job from raja.test where empno=7844
*
ERROR at line 1:
ORA-01502: index 'RAJA.TEST_IDX' or partition of such index is in unusable state
SQL> insert into raja.test ( select * from raja.test);
insert into raja.test ( select * from raja.test)
*
ERROR at line 1:
ORA-01502: index 'RAJA.TEST_IDX' or partition of such index is in unusable state
SQL> delete from raja.test where empno=7844;
delete from raja.test where empno=7844
*
ERROR at line 1:
ORA-01502: index 'RAJA.TEST_IDX' or partition of such index is in unusable state
Now we changed the parameter skip_unusable_indexes=TRUE & tested SELECT/DML operations were running fine.
SQL> alter system set skip_unusable_indexes=true;
System altered.
SQL> select ename,job from raja.test where empno=7844;
ENAME JOB
---------- ---------
TURNER SALESMAN
SQL> insert into raja.test (select * from raja.test);
14 rows created.
SQL> commit;
Commit complete.
SQL> delete from raja.test where empno=7844;
2 rows deleted.
SQL> commit;
Commit complete.
*************************************************
Now we changed the parameter skip_unusable_indexes=FALSE .
SQL> alter system set skip_unusable_indexes=false;
System altered.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA TEST_IDX UNUSABLE
Rebuild the index
SQL> alter index raja.test_idx rebuild online;
Index altered.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA TEST_IDX VALID
SQL> insert into raja.test ( select * from raja.test);
SQL> commit;
Commit complete.
SQL> delete from raja.test where empno=7844;
2 rows deleted.
SQL> commit;
Commit complete.
*************************************************

Note:
If an index is used to enforce a UNIQUE constraint on a table, then allowing insert and update operations on the table might violate the constraint. Therefore, this setting does not disable error reporting for unusable indexes that are unique.
We only select the table while index status is unusable (for unique only).
Scenario:
We created the table with unique key. Currently parameter value is skip_unusable_indexes=true.
SQL> drop table raja.test;
Table dropped.
SQL> create table raja.test as select * from scott.emp;
Table created.
SQL> alter table raja.test add constraint empno_pk unique (empno);
Table altered.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA EMPNO_PK VALID
SQL> alter table raja.test move;
Table altered.
SQL> select owner, index_name, status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA EMPNO_PK UNUSABLE
SQL> select ename,job from raja.test where empno=7844;
ENAME JOB
---------- ---------
TURNER SALESMAN
SQL> delete from raja.test where empno=7844;
delete from raja.test where empno=7844
*
ERROR at line 1:
ORA-01502: index 'RAJA.EMPNO_PK' or partition of such index is in unusable state
SQL> insert into raja.test ( select * from raja.test);
insert into raja.test ( select * from raja.test)
*
ERROR at line 1:
ORA-01502: index 'RAJA.EMPNO_PK' or partition of such index is in unusable state
SQL> alter index raja.empno_pk rebuild;
Index altered.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
------------------------------ ------------------------------ --------
RAJA EMPNO_PK VALID
SQL> select ename,job from raja.test where empno=7844;
ENAME JOB
---------- ---------
TURNER SALESMAN
SQL> delete from raja.test where empno=7844;
1 row deleted.
SQL> commit;
Commit complete.
SQL> insert into raja.test ( select * from raja.test);
insert into raja.test ( select * from raja.test)
*
ERROR at line 1:
ORA-00001: unique constraint (RAJA.EMPNO_PK) violated
Which situation user manually unusable the index?
Scenario:
Sometimes user loads the bulk data into table. To improve the performance they change unusable the indexes.
SQL> drop table raja.test;
Table dropped.
SQL> show parameter skip
NAME TYPE VALUE
------------------------------------ ----------- ---------------
skip_unusable_indexes boolean TRUE
SQL> create table raja.test as select * from dba_objects;
Table created.
SQL> create index raja.test_idx on raja.test(object_id);
Index created.
SQL> select owner, segment_name,bytes from dba_segments where owner='RAJA';
OWNER SEGMENT_NAME BYTES
---------- -------------------- ----------
RAJA TEST_IDX 2097152
RAJA TEST 9437184
Truncate the table
SQL> truncate table raja.test;
Table truncated.
SQL> show parameter skip
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------
skip_unusable_indexes boolean TRUE
SQL> alter system set skip_unusable_indexes=false;
System altered.
Unusable the index
SQL> alter index raja.test_idx unusable;
Index altered.
SQL> select owner, segment_name,bytes from dba_segments where owner='RAJA';
OWNER SEGMENT_NAME BYTES
---------- -------------------- ----------
RAJA TEST_IDX 65536
RAJA TEST 65536
SQL> select owner, index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
---------- ------------------------------ --------
RAJA TEST_IDX UNUSABLE
SQL> show parameter skip
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------
skip_unusable_indexes boolean TRUE
Load the data after index unusable
SQL> insert into raja.test (select * from dba_objects);
69326 rows created.
SQL> commit;
Commit complete.
SQL> select owner, segment_name,bytes from dba_segments where owner='RAJA';
OWNER SEGMENT_NAME BYTES
---------- -------------------- ----------
RAJA TEST_IDX 65536  Index segment is not grow
RAJA TEST 9437184
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
---------- ------------------------------ --------
RAJA TEST_IDX UNUSABLE
SQL> alter index raja.test_idx rebuild;
Index altered.
SQL> select owner,index_name,status from dba_indexes where owner='RAJA';
OWNER INDEX_NAME STATUS
---------- ------------------------------ --------
RAJA TEST_IDX VALID
SQL> select owner, segment_name,bytes from dba_segments where owner='RAJA';
OWNER SEGMENT_NAME BYTES
---------- -------------------- ----------
RAJA TEST 9437184
RAJA TEST_IDX 2097152  after rebuild index size grown
If any index status is going to unusable we don’t know & also it affecting the database performance.
In oracle 10g/11g, I suggest to setup the monitor index unusable script is better.

Wednesday, June 20, 2012

REFERENCE WEBSITES

REFERENCE WEBSITES



ASM
===
http://rohitguptaoracletips.blogspot.in/2008/07/basics-of-asm-automatic-storage.html


DATAGUARD
=========
Architecture
http://www.datadisk.co.uk/html_docs/oracle_dg/architecture.htm


Oracle Data Guard Overview
http://andrewfraserdba.com/2011/08/09/oracle-data-guard-overview/


Introduction to Oracle Data Guard
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10823/concepts.htm
============================================================================================================
Oracle® Data Guard Broker
10g Release 1 (10.1)
Part Number B10822-01


5 Data Guard Scenarios - Using Oracle Enterprise Manager


http://docs.oracle.com/cd/B14117_01/server.101/b10822/gui.htm
============================================================================================================
Oracle® Data Guard Concepts and Administration
10g Release 2 (10.2)
Part Number B14239-05


http://docs.oracle.com/cd/B19306_01/server.102/b14239/scenarios.htm
============================================================================================================
Oracle® Data Guard Concepts and Administration
11g Release 1 (11.1)
Part Number B28294-03


http://docs.oracle.com/cd/B28359_01/server.111/b28294/rman.htm#i1024051
============================================================================================================
13 Data Guard Scenarios


Oracle® Data Guard Concepts and Administration
11g Release 2 (11.2)
Part Number E25608-03
Steps for creating Physical standby database


http://docs.oracle.com/cd/E11882_01/server.112/e25608/scenarios.htm#i1008082
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Steps for creating Physical standby database
http://anandrathinam.blogspot.in/2008/06/steps-for-creating-physical-standby.html
============================================================================================================
Create single instance standby database for RAC Database
http://oracleinstance.blogspot.in/2012/01/create-single-instance-standby-database.html
============================================================================================================
Physical Data Guard scenario in 10G on Linux
http://webgeek-tutorials.blogspot.in/2011/02/physical-data-guard-scenario-in-10g-on.html
============================================================================================================
Recover Dataguard With Lost Archivelogs
http://emrebaransel.blogspot.in/2008/12/recover-dataguard-from-lost-archivelog.html
============================================================================================================
Data Guard Redo Apply and Media Recovery Best Practices 10g
http://tonguc.wordpress.com/2008/05/05/data-guard-redo-apply-and-media-recovery-best-practices-10g/
============================================================================================================
11gR2 RAC-Dataguard Sync issue Between Primary & Standby
http://www.oracledbasupport.co.uk/11gr2-rac-dataguard-sync-issue-between-primary-standby/
============================================================================================================
How to recover Standby database from a missing archivelog
http://dbaregistry.blogspot.in/2010/01/how-to-recover-standby-database-from.html
============================================================================================================
Resolving missing archive log gap at Standby Database
http://shrikantrao.wordpress.com/2011/04/28/resolving-missing-archive-log-gap-at-standby-database/
============================================================================================================
RMAN Incremental Backups to Roll Forward a Physical Standby DatabaseFebruary 14th, 2012 | Posted by Nassyam Basha in Data Guard
http://www.oracle-ckpt.com/rman-incremental-backups-to-roll-forward-a-physical-standby-database-2/
============================================================================================================
Resolving Gaps in Data Guard Apply Using Incremental RMAN BAckup
http://arup.blogspot.in/2009/12/resolving-gaps-in-data-guard-apply.html
============================================================================================================
http://rohitguptastandbydbtips.blogspot.in/
============================================================================================================
Steps to recover the primary database's datafile using a copy of a standby database's datafile
Steps to recover the standby database's datafile using a copy of a primary database's datafile.
http://dbaregistry.blogspot.in/2010/01/steps-to-recover-primary-databases.html
============================================================================================================


DATA PUMP
=========
Data Pump in Oracle Database 10g
http://webgeek-tutorials.blogspot.in/2012/02/data-pump-in-oracle-database-10g.html


How to change the table name during import?
http://dbaregistry.blogspot.in/2010/02/how-to-change-table-name-during-import.html


LINUX
=====
http://www.freeos.com/guides/lsst/index.html
http://blog.contractoracle.com/2008/08/tar-and-gzip-via-unix-pipe-to-save.html


METALINK NOTES
==============
Note 839182 - Installing patches using OPatch
http://www.stechno.net/sap-notes.html?view=sapnote&id=839182


Note 871735 - Current patch set for Oracle 10.2.0
http://www.stechno.net/sap-notes.html?view=sapnote&id=871735


Note 912620 - FAQ: Oracle indexes
http://www.stechno.net/sap-notes.html?view=sapnote&id=912620


Note 771929 - FAQ: Index fragmentation
http://www.stechno.net/sap-notes.html?view=sapnote&id=771929


Note 910389 - FAQ: Oracle Segment Shrinking
http://www.stechno.net/sap-notes.html?view=sapnote&id=910389


Note 659946 - FAQ: Temporary tablespaces
http://www.stechno.net/sap-notes.html?view=sapnote&id=659946


Note 619188 - FAQ: Oracle wait events
http://www.stechno.net/sap-notes.html?view=sapnote&id=659946


Note 712624 - High CPU consumption by Oracle
http://www.stechno.net/sap-notes.html?view=sapnote&id=712624


ORA-ERRORS
==========
http://searchoracle.techtarget.com/answer/Resolving-the-ORA-1630-error
http://searchoracle.techtarget.com/answer/ORA-01654-even-though-maxextents-defined-as-unlimited
http://searchoracle.techtarget.com/tip/Creating-an-INDEX-on-primary-key-columns-before-creating-a-primary-key
http://searchoracle.techtarget.com/answer/Temp-segment-not-created-in-temp-tablespace
http://searchoracle.techtarget.com/tutorial/Solving-common-Oracle-errors-guide


http://www-wnt.gsi.de/oragsi/problems.html


http://www.arikaplan.com/oracle.html


while importing a full database I am getting these errors. I wonder how this happens and how to handle them.
http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=4513


To fix the ORA-1630 error, you'll need to change the STORAGE limits on the index. You can do this by issuing the following command:


ALTER INDEX index_name STORAGE (MAXEXTENTS 500);
Now the index can allocate up to 500 extents (more than the 249).


PERFORMANCE TUNING
==================
Oracle Wait Events
http://dbaregistry.blogspot.in/2010/01/oracle-wait-events.html


http://blog.contractoracle.com/2010/05/diagnosing-rac-cluster-waits.html


Latches and Latch Contention
http://dbaregistry.blogspot.in/2010/01/latches-and-latch-contention.html


DBA Interview questions
http://dbaregistry.blogspot.in/2010/01/dba-interview-questions.html


Direct-Path INSERT
http://dbaregistry.blogspot.in/2010/03/direct-path-insert.html


http://oraclespin.wordpress.com/2012/05/27/how-to-see-current-utilization-of-processessessions-and-max-utilization/


http://nadvi.blogspot.in/2012/02/10053-trace-with-dbmssqldiagdumptrace.html


http://www.oracledbasupport.co.uk/virtual-memory-statistics-vmstat/


http://www.oracledbasupport.co.uk/awr-how-to-run-reports/


Auditing in Oracle
http://satya-dba.blogspot.in/2009/05/auditing-in-oracle.html


RAC
===
Oracle RAC Interview questions and answers
http://dbaregistry.blogspot.in/2010/02/oracle-rac-interview-questions.html


RAC Load Balancing, TAF , FAN
http://dbaregistry.blogspot.in/2010/02/rac-load-balancing-taf-fan.html


Oracle Real Application Clusters (RAC)
http://www.datadisk.co.uk/html_docs/rac/rac.htm


RAC Architecture
http://www.datadisk.co.uk/html_docs/rac/architecture.htm


RAC Troubleshooting
http://www.datadisk.co.uk/html_docs/rac/troubleshooting.htm#performance_issues


RAC Performance
http://www.datadisk.co.uk/html_docs/rac/performance.htm


How to move OCR and Voting disk to new storage device?
http://dbaregistry.blogspot.in/2010/01/how-to-move-ocr-and-voting-disk-to-new.html


SQL SCRIPTS
===========
Useful SQL Scripts for day-to-day DBA tasks.
http://dbaregistry.blogspot.in/2010/02/useful-sql-scripts.html


Oracle DBA Script : Keep tablespace usage less than 80%
http://webgeek-tutorials.blogspot.in/2012/06/oracle-dba-script-keep-tablespace-usage.html


Health Check script for RAC DB
http://www.reachdba.com/showthread.php?284-Health-Check-script-for-RAC-DB


http://myoraclediaryforme.blogspot.in/2011_12_01_archive.html


http://myoracleguide.com/s/metadata_object_types.htm


http://oracleandunix.blogspot.in/2009/07/dbmsmetadatagetddl.html


http://mnsinger.wordpress.com/2012/02/01/useful-sql-queries-and-oracle-code/


http://www.optimaldba.com/scripts/


http://vamshiappsdba.blogspot.in/2011_09_01_archive.html


http://shailapps.blogspot.in/2008_05_01_archive.html


http://oraclespin.wordpress.com/category/general-dba/dataguard-general-dba/
http://blog.contractoracle.com/2008/08/dataguard-diagnostics-select-statements.html
http://blog.contractoracle.com/2009/11/maa-for-active-dataguard.html
http://blog.contractoracle.com/2010/03/create-dataguard-broker-configuration.html
http://blog.contractoracle.com/2008/08/setup-dataguard-broker.html
http://blog.contractoracle.com/2009/11/enable-active-standby-on-database-with.html
http://blog.contractoracle.com/2008/08/manual-dataguard-switchover.html
http://blog.contractoracle.com/2008/08/test-impact-of-nologging-on-oracle.html
http://blog.contractoracle.com/2009/09/recover-standby-database-using.html
http://blog.contractoracle.com/2010/03/duplicate-database-from-active.html


http://blog.contractoracle.com/2008/09/moving-indexes-index-partitions-index.html
http://blog.contractoracle.com/2010/05/rebuilding-unusable-indexes-index.html
http://blog.contractoracle.com/2009/09/index-monitoring-to-identify-unused.html
http://blog.contractoracle.com/2009/10/identifying-low-cardinality-indexes.html


http://blog.contractoracle.com/2009/12/using-flashback-archive-to-avoid-ora.html
http://blog.contractoracle.com/2008/09/if-db-recovery-file-dest-fills-up.html


http://newgendba.blogspot.in/2009/04/rman-set-newname-command-using-sql.html
http://blog.contractoracle.com/2008/08/rman-examples.html


http://blog.contractoracle.com/2010/01/asm-diagnostics-report.html
http://blog.contractoracle.com/2008/08/asm-diagnostics-statements.html
http://blog.contractoracle.com/2008/09/asm-rebalance-power.html
http://blog.contractoracle.com/2008/08/copy-archivelog-file-from-asm-to-disk.html


http://blog.contractoracle.com/2008/08/undo-tablespace-usage.html
http://blog.contractoracle.com/2008/08/temp-tablespace-usage.html


http://blog.contractoracle.com/2008/08/rollback-patch-with-opatch.html


http://yaping123.wordpress.com/2008/09/02/db-link/
http://oraclespin.wordpress.com/2008/03/28/how-to-extract-the-db-links-ddl-with-the-password/


http://rohitguptaoracletips.blogspot.in/


UPGRADE
=======
Performing a Manual Upgrade
http://anandrathinam.blogspot.in/2008/05/performing-manual-upgrade.html


BOOKS PDFS DL
=============
http://freedownload.is/ppt/powerpoint-presentation-8492037.html
http://freedownload.is/ppt/oracle-10g-database-administrator-implementation-and-administration-8378076.html
http://www.ebook3000.com/OCA--Oracle-10g-Administration-I-Study-Guide--1Z0-042-_106621.html
http://www.ebook3000.com/Oracle-Database-11g-R2-Performance-Tuning-Cookbook_154865.html
http://www.free-download-ebooks.com/Expert-Oracle-Database-10g-Administration_284588.html



"Hope for the best, Prepare for the worst"

-Dharmendra


Tuesday, June 19, 2012


Monday, June 18, 2012

STEPS - SCHEMA REFRESH


@ Source

========
connect to Putty
enter the hostname
select load

enter userid and pwd

set the environment for the database
$ uname
AIX
$ cat /etc/oratab
export ORACLE_SID=DBNAME
export ORACLE_HOME=/usr/app/oracle/product/10.2.0/
export PATH=$PATH:$ORACLE_HOME/bin

$ uname
SunOS
$ cat /var/opt/oracle/oratab
export ORACLE_SID=DBNAME
export ORACLE_HOME=/usr/app/oracle/product/10.2.0/
export PATH=$PATH:$ORACLE_HOME/bin

To Check Database

---------------------
sqlplus "/as sysdba"
set pages 200 lines 170
col HOST_NAME for a15
select instance_name,name db_name,host_name,version db_version from gv$instance,v$database;


select username from dba_users where username=upper('&username');
select sum(bytes)/1024/1024/1024 from dba_segments where owner=upper('&owner');
select object_type,count(*) from dba_objects where owner=upper('&username') group by object_type;


Table Space Report
---------------------
col tablespace_name format a15
col TABLESPACE_NAME heading "Tablespace|Name"
col Allocated_size heading "Allocated|Size(MB)" form 99999999.99
col Current_size heading "Current|Size(MB)" form 99999999.99
col Used_size heading "Used|Size(MB)" form 99999999.99
col Available_size heading "Available|Size(MB)" form 99999999.99
col Pct_used heading "%Used(vs)|(Allocated)" form 99999999.99
select a.tablespace_name
        ,a.alloc_size/1024/1024 Allocated_size
        ,a.cur_size/1024/1024 Current_Size
        ,(u.used+a.file_count*65536)/1024/1024 Used_size
        ,(a.alloc_size-(u.used+a.file_count*65536))/1024/1024 Available_size
        ,((u.used+a.file_count*65536)*100)/a.alloc_size Pct_used
from     dba_tablespaces t
        ,(select t1.tablespace_name
                ,nvl(sum(s.bytes),0) used
          from  dba_segments s
               ,dba_tablespaces t1
          where t1.tablespace_name=s.tablespace_name(+)
          group by t1.tablespace_name) u
        ,(select d.tablespace_name
                ,sum(greatest(d.bytes,nvl(d.maxbytes,0))) alloc_size
                ,sum(d.bytes) cur_size
                ,count(*) file_count
          from dba_data_files d
          group by d.tablespace_name) a
where t.tablespace_name=u.tablespace_name
  and t.tablespace_name=a.tablespace_name
order by t.tablespace_name;

Datafiles of a particular TableSpace
-------------------------------------
set pages 200
set lines 175
col tablespace_name for a27
col file_name for a70
select tablespace_name,file_name,bytes/1024/1024 Size_MB,autoextensible,maxbytes/1024/1024 MAX_MB from dba_data_files  where tablespace_name='TABLESPACENAME' order by 1,2;



ASM Space Report
--------------------
SET LINESIZE 150
SET PAGESIZE 9999
SET VERIFY off
COLUMN group_name             FORMAT a20           HEAD 'Disk Group|Name'
COLUMN sector_size            FORMAT 99,999        HEAD 'Sector|Size'
COLUMN block_size             FORMAT 99,999        HEAD 'Block|Size'
COLUMN allocation_unit_size   FORMAT 999,999,999   HEAD 'Allocation|Unit Size'
COLUMN state                  FORMAT a11           HEAD 'State'
COLUMN type                   FORMAT a6            HEAD 'Type'
COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
COLUMN pct_used               FORMAT 999.99        HEAD 'Pct. Used'

SELECT
    distinct name                                     group_name
  , sector_size                              sector_size
  , block_size                               block_size
  , allocation_unit_size                     allocation_unit_size
  , state                                    state
  , type                                     type
  , total_mb                                 total_mb
  , (total_mb - free_mb)                     used_mb
  , ROUND((1- (free_mb / total_mb))*100, 2)  pct_used
FROM
    gv$asm_diskgroup
ORDER BY
    name;
/

OTHER ASM QUERIES
--------------------------
select distinct name, total_mb/1024 , (total_mb-free_mb)/1024 , free_mb/1024, SYSDATE from GV$ASM_DISKGROUP;

select GROUP_NUMBER,NAME,TOTAL_MB,FREE_MB from gv$asm_diskgroup order by NAME;
select table_name from dict where table_name like '%ASM%';
select GROUP_NUMBER,DISK_NUMBER,TOTAL_MB,FREE_MB,NAME,MOUNT_STATUS from v$asm_disk;
select INST_ID,GROUP_NUMBER,DISK_NUMBER,TOTAL_MB,FREE_MB,NAME,MOUNT_STATUS from gv$asm_disk;


col file_name for a70
set linesize 150
set pagesize 100
select file_name,bytes/1024/1024 from dba_data_files where tablespace_name='TABLESPACENAME' order by file_name;
FILE_NAME                                                    BYTES/1024/1024
------------------------------------------------------------ ---------------
/FILE/LOCATION/

Check for the space availability for taking backup:
>! df -h /FILE/LOCATION/

cd /source/backup/location/
mkdir EXPORT_REF_NO
cd EXPORT_REF_NO
$pwd
/source/backup/location/EXPORT_REF_NO

NOTE: If the size is less better to go for EXP/IMP

A. For schema backup (EXPDP/IMPDP)
create or replace directory <EXPDPDIR> as '/directory/location/';
Directory created.

GRANT read,write ON DIRECTORY <EXPDPDIR> to <user>;
Grant succeeded.

nohup expdp <user>/`pwd` logfile=schemaname.log directory=EXPDPDIR dumpfile=schemaname_`date +\%b\%d`_%U.dmp schemas=schemaname exclude=statistics PARALLEL=4 &
For schema backup (EXP/IMP)

B. For schema backup (EXP/IMP)
nohup exp <user>/`pwd` file=source_schemaname_exp.dmp log=source_schemaname_exp.log owner=schemaname statistics=NONE resumable=y resumable_name=continue resumable_timeout=18000 &

Check the status of EXPORT:

$jobs or $ps -ef| grep expdp or $ps -ef| grep exp or ps -ef|grep <processid>
[1]+  Running
[1]+  Done
$ls -lrt
source_schemaname_exp
$cat source_schemaname_exp.log

@ Target
========
connect to Putty
enter the hostname
select load

enter userid and pwd

set the environment for the database


To Check Database

---------------------
sqlplus "/as sysdba"
set pages 200 lines 170
col HOST_NAME for a15
select instance_name,name db_name,host_name,version db_version from gv$instance,v$database;


select username from dba_users where username=upper('&username');
select sum(bytes)/1024/1024/1024 from dba_segments where owner=upper('&owner');
select object_type,count(*) from dba_objects where owner=upper('&username') group by object_type;


Check for the space availabilty for taking backup:
df -h
cd /target/backup/location/
mkdir EXPORT_REF_NO
cd EXPORT_REF_NO
$pwd
/target/backup/location/EXPORT_REF_NO

NOTE: If the size is less better to go for EXP/IMP

A. For schema backup (EXPDP/IMPDP)
create or replace directory <EXPDPDIR> as '/directory/location/';
GRANT read,write ON DIRECTORY <EXPDPDIR> to <user>;

nohup expdp <user>/`pwd` logfile=schemaname.log directory=EXPDPDIR dumpfile=schemaname_`date +\%b\%d`_%U.dmp schemas=schemaname exclude=statistics PARALLEL=4 &

B. For schema backup (EXP/IMP)
nohup exp <user>/`pwd` file=target_schemaname_exp.dmp log=target_schemaname_exp.log owner=schemaname statistics=NONE resumable=y resumable_name=continue resumable_timeout=18000 &

Check the status of EXPORT:
$jobs or $ps -ef| grep exp
$ls -lrt
target_schemaname_exp.log
$cat target_schemaname_exp.log

@ Source
========
scp source_schemaname_exp.dmp oracle@target_hostname:/target/backup/location/EXPORT_REF_NO/

@ Target
========
cd /target/backup/location/EXPORT_REF_NO/
ls -lrt
source_schemaname_exp.dmp

sqlplus "/as sysdba"
select name from v$database;

DROP SCHEMA OBJECTS
-------------------
set head off
set pagesize 0
set linesize 100
select 'drop table '||Table_name||' cascade constraints;' from user_tables;

set pagesize 200
select 'drop '||object_type||' '||object_name||';' from user_objects where object_type not in ('DATABASE LINK');

or

spool target_schemaname_drop_obj.sql
select 'drop '||object_type||' '||owner||'.'||object_name||DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS;',';')
from dba_objects
where owner in ('SCHEMANAME') and OBJECT_TYPE not in ('DATABASE LINK') order by object_type,object_name;
spool off;

OTHERS
------
select 'DROP '||decode(object_type, 'PACKAGE BODY', 'PACKAGE',object_type)|| ' '||owner||'.'||object_name|| decode(object_type,'TABLE',' CASCADE CONSTRAINTS;',';')
from dba_objects
where owner=upper('&Schema')
--and object_type not in ('TABLE');

exit

ls -lrt
target_schemaname_drop_obj.sql
vi target_schemaname_drop_obj.sql
edit and save using :wq

sqlplus "/as sysdba"
select name from v$database;

@target_schemaname_drop_obj.sql

schema object count:
select object_type,count(*) from dba_objects where owner=upper('&username') group by object_type;
exit

pwd
/target/backup/location/EXPORT_REF_NO/

ls -lrt
source_schemaname_exp.dmp

Restore schema backup:
---------------------
A. For schema import (EXPDP/IMPDP)
nohup impdp system/`pwd` logfile=source_schemaname_exp_import.log directory=EXPDPDIR remap_schema=sourceschemaname:targetschemaname dumpfile=source_schemaname_exp.dmp exclude=statistics PARALLEL=4 &

B. For schema import (EXP/IMP)
nohup imp system/`pwd` file=source_schemaname_exp.dmp log=source_schemaname_exp_import.log fromuser=schemaname touser=schemaname ignore=y statistics=NONE commit=y resumable=y resumable_name=continue resumable_timeout=18000 &

Check the status of IMPORT:
$jobs or $ps -ef| grep imp
$ls -lrt
$cat source_schemaname_exp_import.log

sqlplus "/as sysdba"
select name from v$database;
schema object count:
select object_type,count(*) from dba_objects where owner=upper('&username') group by object_type;

NOTE: THE TARGET SCHEMA OBJECT COUNT SHOULD BE SAME AS THE SOURCE SCHEMA OBJECT COUNT CAPTURED

DBLINKS DETAILS
---------------
set pages 100 lines 150
col owner for a15
col username for a15
col host for a35
col created for a20
select owner, db_link, username, host, to_char(created,'dd-mon-yyy hh24:mi:ss') CREATED from dba_db_links order by owner, db_link;
OWNER           DB_LINK                             USERNAME        HOST                                CREATED
--------------- ----------------------------------- --------------- ----------------------------------- --------------------
exit

Gather schema stats after schema refresh
----------------------------------------
set timing on
exec dbms_stats.gather_schema_stats(ownname=>'schemaname',CASCADE=>TRUE,ESTIMATE_PERCENT=>30,degree =>4);

NOTE: ONCE TASK COMPLETED AT PRODUCTION SERVER IMMEDIATLY DO EXIT.



"Hope for the best, prepare for the worst"
-Dharmendra

Sunday, June 10, 2012

STEPS - DATABASE REFRESH

Database refresh with EXP/IMP & EXPDP/IMPDP 

===================================
Backup
======
Backup must be taken in the source side at the backup location using EXPORT or EXPDP.If required, at target side too.

EXP/IMP
----------
Full Database export
nohup exp <userid>/<password>  file=filename.dmp log=filename.log CONSISTENT=Y full=y &

Pre-checks
========
SOURCE SIDE & TARGET SIDE (STEP 1 AND STEP2)
============================================
step 1:
------
source and target users must me same.
NOTE: Otherwise, create new user in target side before import

To Check Database
---------------------
sqlplus "/as sysdba"
set pages 200 lines 170
col HOST_NAME for a15
select instance_name,name db_name,host_name,version db_version from gv$instance,v$database;

SQL>select count(*) from dba_users;
SQL>select username from dba_users;

step 2:
------
source and target tablespaces must be same and check the space avilabilty too.
NOTE: Otherwise, need to create new tablespace in target side before import

Tablespace size including pct free
----------------------------------
select
   fs.tablespace_name                          "Tablespace",
  df.totalspace                               "TOT_SIZE",
  fs.freespace                                "TOT_FREE",
  (round(100 * (fs.freespace / df.totalspace))) pct_Free
from
   (select      tablespace_name,
      round(sum(bytes) / 1048576) TotalSpace
   from
      dba_data_files
   group by
      tablespace_name
   ) df,
   (select
      tablespace_name,
      round(sum(bytes) / 1048576) FreeSpace  
   from
      dba_free_space
   group by
      tablespace_name  ) fs
where   (df.tablespace_name = fs.tablespace_name ) ORDER BY pct_free DESC ;

Target side
===========
step 3:
------
passwords bkp:
-------------
select 'alter user '||username||' identified by values '||password||';' from dba_users; --10g

select 'alter user '||name||' identified by values '||password||';' from SYS.USER$;  --11g

Before droping all users take DDL of each user in the target.
set long 100000
select dbms_metadata.get_ddl('USER','USERNAME') from dual;

Before droping user:(super Script---> colecting all grants of user):
--------------------------------------------------------------------
set long 100000

select dbms_metadata.get_ddl('USER',upper('&username')) from dual;
select dbms_metadata.get_granted_ddl( 'SYSTEM_GRANT', upper('&username') ) from dual;
select DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT',upper('&username')) FROM dual;
select GRANTEE,TABLE_NAME from dba_tab_privs where GRANTEE=upper('&username');
select dbms_metadata.get_granted_ddl( 'ROLE_GRANT', upper('&username')) from dual;

Drop the all users except the default users (sys,system,DBSNMP,OUTLN,DIP,TSMSYS,)
DROP USER <USERNAME> CASCADE

OTHER QUERIES
-----------------------
SELECT 'alter system kill session ''' || SID || ',' || serial# || ''' immediate;' FROM v$session where username=upper('&username') and status ='INACTIVE';

SELECT 'alter system kill session ''' || SID || ',' || serial# || ''' immediate;' FROM v$session where username=upper('&username') and status ='ACTIVE';

select sid,username,terminal,program,logon_time,status from v$session where username=upper('&username');

select SID,USERNAME,STATUS from v$session where status='ACTIVE';

step 4:
------
create all users using DDLs taken before.

step 5:
------
EXP/IMP
-------
Full Database import
nohup imp <userid>/<password>  file=filename.dmp log=filename.log buffer=2000000 full=y &

step 6:
------
Take DDL of all users in the target.


Gather schema stats after schema refresh
----------------------------------------
set timing on

set long 100000
select dbms_metadata.get_ddl('USER','USERNAME') from dual;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


EXPDP/IMPDP
-----------------
create or replace directory <EXPDP_DIR> as '/location/of/directory';
grant read,write ON DIRECTORY <EXPDP_DIR> to <USER>;

select * from dba_directories;

Full Database export
nohup expdp <userid>/<password> directory=<EXPDP_DIR> logfile=filename.log dumpfile=dumpfile_`date +\%b\%d`_%U.dmp PARALLEL=6 full=y &

Full Database import
nohup impdp userid=<userid>/<password> directory=<EXPDP_DIR> logfile=filename.log dumpfile=filename.dmp PARALLEL=6 full=y &

Pre-checks
----------
All steps same as EXP/IMP.

NOTE: Before doing Full database refresh with EXP/IMP & EXPDP/IMPDP, need to confirm with requestor whether they need Full database refresh or only some schemas refresh.


NOTE: ONCE TASK COMPLETED AT PRODUCTION SERVER IMMEDIATLY DO EXIT. 

"Hope for the best, prepare for the worst"
-Dharmendra

Friday, June 8, 2012

WEBSITES

ORA-ERRORS

http://nimishgarg.blogspot.in/search/label/Ora-Codes
http://docs.oracle.com/cd/B19306_01/server.102/b14219/e0.htm#sthref17

PERFORMANCE TUNING

http://ayyudba.blogspot.in/2007/10/tuning-io-related-waits.html


Websites Handy 4 Reference

Websites Handy 4 Reference
 
http://www.orafaq.com/wiki/Papers
http://www.dba-oracle.com/articles.htm
https://sites.google.com/site/hemantswebsite/oracle-diagnostics
http://www.dbspecialists.com/presentations.html
http://www.shutdownabort.com/quickguides/vi4dbas.php
http://dba-zone.blogspot.in/2009/11/vi-editor-reference.html
http://www.oracle-base.com/dba/Scripts.php
http://www.idevelopment.info/data/Oracle/DBA_scripts/

ARCHITECHTURE

http://pocketoracle.blogspot.com/

Database Background Processes
http://www.dbas-oracle.com/2011/07/database-background-processes.html

Step by Step Guide to Oracle Parsing
http://www.articles.freemegazone.com/oracle-parsing.php

Oracle Architecture Overview Database Quick Reference Presentation Video 1080p HD
http://www.youtube.com/watch?v=1BQbVIziGzY&feature=related

A10 - Oracle Administration Tutorial - Oracle Server Basics (Part 2)
http://www.youtube.com/watch?v=Kj09QNKfQWs&feature=related

A13 - Oracle Administration Tutorial - Memory Structures of the Oracle Instance
http://www.youtube.com/watch?v=e5_LtnnfHZA&feature=related

A14 - Oracle Administration Tutorial - Background processes of the Oracle Instance
http://www.youtube.com/watch?v=evhD4g9cRqU&feature=player_embedded

NEW FEATURES

http://pocketoracle.blogspot.com/search/label/10g%20New%20Features

http://pocketoracle.blogspot.com/search/label/11g%20New%20Features

Oracle backup Types

http://www.oracle-mag.com/oracle-database-articles/backup-and-recovery
http://www.oracle-mag.com/oracle-database-articles/backup-and-recovery/types-of-backup
http://www.dbarajabaskar.blogspot.com/2009/02/user-managed-backup-oracle.html
http://www.oracleracexpert.com/2009/08/block-corruption-and-recovery.html
http://managingoracle.blogspot.com/2010/08/oracle-table-reorganization-online-or.html

DATAGUARD

http://www.orafaq.com/node/957
http://docs.oracle.com/cd/E11882_01/server.112/e17022/create_ps.htm
http://www.jmoracle.com/Oracle10gPhysicalStandby/index.html

Setting up Oracle DataGuard for 10g
http://avdeo.com/2007/06/12/setting-up-oracle-dataguard-for-10g/

Step by Step Oracle 11gR2 Physical Standby Database Setup
http://www.mydbspace.com/?p=345

Oracle Data Guard Interview Questions
http://shailapps.blogspot.com/search?updated-min=2012-01-01T00:00:00-08:00&updated-max=2013-01-01T00:00:00-08:00&max-results=1

Refresh

Refreshing schemas in oracle Databases

http://rafioracledba.blogspot.com/search/label/Database%20Refresh

Database refresh process

http://rafioracledba.blogspot.com/2011/01/database-refresh-process.html

CLONING

Cloning and Refreshing an Oracle Database
http://sabdarsyed.blogspot.com/2008/08/cloning-and-refreshing-oracle-database.html

Clone an Oracle database using RMAN duplicate (same server)

http://www.shutdownabort.com/quickguides/clone_rman.php
http://www.shutdownabort.com/quickguides/clone_cold.php
http://www.dbarajabaskar.blogspot.com/2009/02/cloning-oracle-database-cold-cloning.html
http://www.dbarajabaskar.blogspot.com/2010/04/rman-cloning-using-active-database-11g.html

Migration
Step by step migration of schemas from Windows server Oracle10g Database to Linux Oracle 11g Database

http://rafioracledba.blogspot.com/search/label/Database%20Migrations

Upgrading

http://www.oracle.com/technetwork/database/upgrade/index.html

Upgrade Steps From 10g to 11gR2
http://www.franklinfaces.com/Topic416-97-1.aspx

Step by Step Upgrading Oracle 10g to Oracle 11g
http://samadhandba.wordpress.com/2011/02/24/step-by-step-upgrading-oracle-10g-to-oracle-11g/

Manual Upgrade Database from Oracle 10.2.0.4 to Oracle 11.2.0.2
http://www.dbas-oracle.com/2011/06/manual-upgrade-database-from-oracle.html

Step By Step Manual Database Upgrade to 11.2.0.2
http://www.dbas-oracle.com/2011/06/step-by-step-manual-database-upgrade-to.html
upgradation from oracle 9i to oracle 10g

http://oracleinstance.blogspot.com/2009/05/upgradation-from-oracle-9i-to-oracle.html

Upgrade Oracle 10g Release 2 from 10201 to 10204
http://www.oracleflash.com/29/Upgrade-Oracle-10g-Release-2-from-10201-to-10204.html

upgrade oracle version from 10.2.0.x to 10.2.0.4.
http://www.oracleracexpert.com/2009/10/oracle-version-upgrade-from-1020x-to.html

steps to upgrade your database from 10.2.0.x to 10.2.0.4
http://www.oracleracexpert.com/search/label/Upgrade%20to%2010.2.0.4

Upgrade Oracle 10g Release 2 to Oracle 11g Release 1
http://www.oracleflash.com/39/Upgrade-Oracle-10g-Release-2-to-Oracle-11g-Release-1.html

Upgrading to Oracle Database 11g
http://www.oracle-base.com/articles/11g/UpgradingTo11g.php

http://docs.oracle.com/cd/B28359_01/server.111/b28300/upgrade.htm

Upgrade Steps From 10g to 11gR2
http://www.franklinfaces.com/Topic416-97-1.aspx

http://www-css.fnal.gov/dsg/external/oracle_dcm/v11.2.0.2/server.112/e17222/intro.htm

Upgrading Oracle Databases from 11.2.0.1 to 11.2.0.2
http://www.mydbspace.com/?p=58

Upgrading 10g to 11g R 2 with DBUA

http://asanga-pradeep.blogspot.com/2009/09/upgrading-10g-to-11g-r-2-with-dbua.html
Step by Step Upgrading Oracle 10g to Oracle 11g

http://debaatobiee.wordpress.com/2009/10/17/step-by-step-upgrading-oracle-10g-to-oracle-11g/

Upgrading from 10.2.0.4 to 11.2.0.3

http://asanga-pradeep.blogspot.com/2011/12/upgrading-from-10204-to-11203.html

Upgrade Oracle Database from 10g to 11g with Data Pump

http://oraclepoint.com/oralife/2010/07/28/upgrade-oracle-database-from-10g-to-11g-with-data-pump-3/
Manual upgrade from 9i to 10g Release 2

http://www.oracle-base.com/articles/10g/UpgradingTo10g.php

http://www.shutdownabort.com/quickguides/upgrade_9_to_10.php

Learn about Upgrading to 11g in Oracle 11g New Features Part 1

http://www.youtube.com/watch?v=QWuimw2le98

PATCHES

Oracle: Quick Guide to Opatch - (Oracle Database Patching utility)

http://www.dbalifeline.com/content/oracle-quick-guide-opatch-oracle-database-patching-utility

OPATCH Utility (Oracle RDBMS Patching)

http://avdeo.com/2008/08/19/opatch-utility-oracle-rdbms-patching/

How to apply Database Patches

http://rafioracledba.blogspot.com/search/label/Database%20Patches

Redhat / Oracle compatibility matrix

http://pbraun.nethence.com/oracle/install_compatibility.html

Critical Patch Updates, Security Alerts and Third Party Bulletin

http://www.oracle.com/technetwork/topics/security/alerts-086861.html

Oracle Database 11.2.0.2 Patch Set (English)

http://www.dbacomp.com.br/blog/?p=69

http://hendrydasan.com/2010/05/21/apply-oracle-cpuapr2010-9352191-for-oracle10-2-0-4-in-aix5l/

http://asanga-pradeep.blogspot.com/2011/03/upgrading-from-11201-to-11202.html

Upgrading from 11.2.0.1 to 11.2.0.2

"Starting with the 11.2.0.2 patch set, Oracle Database patch sets are full installations of the Oracle Database software. This means that you do not need to install Oracle Database 11g Release 2 (11.2.0.1) before installing Oracle Database 11g Release 2 (11.2.0.2).

Installation

Install Oracle Database 10g R1 on Linux using ASM - (RHEL 4)

http://www.idevelopment.info/data/Oracle/DBA_tips/Linux/LINUX_12.shtml#Disk%20Configuration%20-%20%28Internal%20Disk%20for%20ORACLE_HOME%29

DATAPUMP

https://communities.bmc.com/communities/docs/DOC-10074

DATA PUMP Utility
http://www.oracle-dba-online.com/data_pump_utility.htm

Overview of Oracle Data Pump
http://docs.oracle.com/cd/E11882_01/server.112/e16536/dp_overview.htm

Oracle Data Pump - Export Utility     OEM 

http://www.oraclecoach.com/oracle-tutorials-articles/38/101-oracle-data-pump-export-utility.html

EXPLAIN PLAN and TKPROF

Use EXPLAIN PLAN and TKPROF To Tune Your Applications

http://www.dbspecialists.com/files/presentations/use_explain.html

RMAN

RMAN COMMANDS
http://rafioracledba.blogspot.com/2011/09/rman-commands.html

RMAN backup types and Usage
http://rafioracledba.blogspot.com/2011/07/rman-backup-types-and-usage.html

RMAN Recovery Catalog Database Creation and Configuration
http://rafioracledba.blogspot.com/2011/07/rman-recovery-catalog-database-creation.html

Scheduling RMAN cold backup and copy controlfile
http://rafioracledba.blogspot.com/2011/06/scheduling-rman-cold-backup-and-copy.html

Register a Target database in RMAN catalog
http://dba-zone.blogspot.in/2009/09/registerunregister-target-in-rman.html

Chapter 23 – Getting Started with Oracle Recovery Manager
http://mnsinger.wordpress.com/2006/09/13/chapter-23-getting-started-with-oracle-recovery-manager/

Chapter 24 – Using RMAN to Back Up Databases
http://mnsinger.wordpress.com/2006/09/14/chapter-24-using-rman-to-back-up-databases/

http://psoug.org/reference/rman_demos.html

RMAN COLD BACKUP
http://searchoracle.techtarget.com/answer/Cold-backup-using-RMAN

RMAN COLD BACKUP IN RAC
http://jose-valerio.com.ar/blog/?p=190 
 

Preparing the RMAN DUPLICATE Auxiliary Instance: Basic Steps
http://web.njit.edu/info/limpid/DOC/backup.102/b14191/rcmdupdb004.htm

Duplicating Database using RMAN duplicate command
Using RMAN DUPLICATE DATABASE: Examples

http://www.shutdownabort.com/quickguides/clone_rman.php
http://www.akadia.com/services/ora_duplicate_database_rman.html
http://www.oracle-base.com/articles/11g/DuplicateDatabaseUsingRMAN_11gR2.php
http://www.oracle-base.com/articles/9i/DuplicateDatabaseUsingRMAN9i.php
http://web.njit.edu/info/limpid/DOC/backup.102/b14191/rcmdupdb006.htm
http://blog.bensmann.com/duplicate-an-oracle-database-with-rman
http://www.oracle-mag.com/oracle-database-articles/backup-and-recovery/duplicating-database-using-rman-duplicate-command
 

Standby database using RMAN duplicate
http://orafaq.com/node/2503
http://www.oracleracexpert.com/2009/12/duplicate-rac-database-using-rman.html

Finding Backup details from 11g RMAN respository tables
http://www.oracledbasupport.co.uk/finding-backup-details-from-11g-rman-respository-tables/

Rman: Ora-01008 When Connecting To Target in 11.2.0.2
http://hendrydasan.com/category/oracle11gr2/rman11g/

TUNING

Collecting and analyzing the AWR reports for Oracle Database:

http://rafioracledba.blogspot.com/search/label/INTERVIEWS
 

Solving common Oracle Wait Events for performance tunning
http://samadhandba.wordpress.com/2011/12/09/top-wait-events-resolving-common-oracle-wait-events/

Chapter 25 – Diagnosing Oracle Database Issues
http://mnsinger.wordpress.com/2006/09/15/chapter-25-diagnosing-oracle-database-issues-2/

Intelligent Oracle DBA Maintenance
http://www.dba-oracle.com/oracle_tips_intelligent_10g_DBA_maintenance.htm

Monitoring CPU Usage – Oracle Database 10g
http://avdeo.com/2007/06/18/monitoring-cpu-usage-oracle-database-10g/

High CPU usage-spike-load on Database Server
http://www.oracledatabaseissues.com/2009/12/high-cpu-usage-spike-load-on-database.html

Performace Tuning Oracle Database 10g
http://avdeo.com/2007/06/09/performace-tuning-oracle-database-10g/
Identifying Locks on Objects using V$LOCKS

http://avdeo.com/2008/06/21/identifying-locks-on-objects-using-vlocks/

Locking issues in Oracle Database 10g
http://avdeo.com/2007/06/08/locking-issues-in-oracle-database-10g/
Database Wait Statistics – Oracle Database 10g

http://avdeo.com/2007/06/29/database-wait-statistics-oracle-database-10g/

Monitoring IO statistics – Oracle Database 10g
http://avdeo.com/2007/06/20/monitoring-io-statistics-oracle-database-10g/

Tuning PGA Memory – Oracle database 10g
http://avdeo.com/2007/06/17/tuning-pga-memory-oracle-database-10g/

Tuning Shared pool – Oracle Database 10g
http://avdeo.com/2007/06/10/tuning-shared-pool-oracle-database-10g/

Tuning Buffer cache – Oracle Database 10g
http://avdeo.com/2007/06/13/tuning-buffer-cache-oracle-database-10g/

Row Chaining and Migeration
http://avdeo.com/2010/11/01/row-chaining-and-migeration/

Oracle Database 11g new feature – Automatic Memory Management
avdeo.com/2011/01/08/oracle-database-11g-new-feature-automatic-memory-management/

Checking Database Growth Trend
http://avdeo.com/2011/01/07/checking-database-growth-trend/

Useful SQL Queries and Oracle Code

http://mnsinger.wordpress.com/2012/02/01/useful-sql-queries-and-oracle-code/
http://oracle-online-help.blogspot.in/search/label/Tuning
https://communities.bmc.com/communities/docs/DOC-9942
http://www.oracledbasupport.co.uk/virtual-memory-statistics-vmstat/
http://www.oracledbasupport.co.uk/awr-how-to-run-reports/

Interpreting Wait Events to Boost System Performance
http://www.dbspecialists.com/files/presentations/wait_events.html

http://pocketoracle.blogspot.com/search/label/Performance%20Tuning
http://www.juliandyke.com/Diagnostics/Trace/EnablingTrace.html
http://www.petefinnigan.com/ramblings/how_to_set_trace.htm
http://psoug.org/reference/trace_tkprof.html
http://www.orafaq.com/wiki/SQL_Trace
http://www.oracle-mag.com/oracle-database-articles/performance-tuning
http://www.oracle-mag.com/oracle-database-articles/performance-tuning/tuning-using-sql-plus-autotrace
http://www.oracle-mag.com/oracle-database-articles/performance-tuning/explain-plan
http://www.oracle-mag.com/oracle-database-articles/performance-tuning/tuning-with-tkprof-a-sql-trace-part-1
http://www.oracle-mag.com/oracle-database-articles/performance-tuning/tuning-examples-using-tkprof-a-sql-trace-part-2
http://www.oracle-mag.com/oracle-database-articles/performance-tuning/query-optimizer

SCPT 41: Types of Locks and Latches in Oracle
http://www.youtube.com/watch?v=Bk-JYbs0D8g

hot backup

User Managed hot backup of oracle database

http://samadhandba.wordpress.com/2011/02/10/user-managed-hot-backup-of-oracle-database/
What happens during oracle database hot backup

http://samadhandba.wordpress.com/2011/02/10/what-happens-during-oracle-database-hot-backup/

RAC

*** RAC Interview Questions ***
https://sites.google.com/site/oraclerac009/rac-q-a

10g Clusterware Presentation
http://www.youtube.com/watch?v=M14glhy_1uU&feature=related

http://shailapps.blogspot.com/2009/09/managing-crs-commands.html
10g RAC Install under RHEL/OEL 4.5

http://shailapps.blogspot.com/2009/09/10g-rac-install-under-rheloel-4.html

http://www.kevinloney.com/free/events.htm
Capture all SQL run between two points in time

http://www.shutdownabort.com/quickguides/query_capture.php

Waits and Statistics for RAC Monitoring
http://www.dba-oracle.com/real_application_clusters_rac_grid/rac_monitoring.html

Change database name using DBNEWID utility
http://dba-zone.blogspot.in/2010/02/change-database-name-using-dbnewid.html

Create 10g ASM instance manually
http://dba-zone.blogspot.in/2010/01/create-10g-asm-instance-manually.html

http://oracle-online-help.blogspot.com/search/label/Execution%20Plan
http://oracle-online-help.blogspot.com/2007/02/size-your-undo-tablespace.html
http://oracle-online-help.blogspot.com/search/label/Tuning                                
*********
Top SQL's
Bad SQL design
Consider declaring NOT NULL columns

http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
http://www.dicka.eclipse.co.uk/oracle_trace_event_10046_notes.htm
http://www.juliandyke.com/Diagnostics/Trace/EnablingTrace.html
http://www.dba-oracle.com/t_10046_enable_trace.htm
http://www.dbmotive.com/2010/11/19/enable-10046-trace-in-a-session/
http://psoug.org/reference/trace_tkprof.html
http://www.orafaq.com/wiki/Trace_events

http://www.dba-oracle.com/oracle_tips_load_speed.htm

http://oracle-online-help.blogspot.com/search/label/Oracle%2011g%20new%20features

Password is case sensitive now - Oracle 11g

Oracle has introduced 2 new parameters (along with many others!) - MEMORY_TARGET and MEMORY_MAX_TARGET
Using these parameters, you can manage SGA and PGA together rather than managing them separately (using SGA_TARGET, SGA_MAX_SIZE , PGA_AGGREGATE_TARGET and WORKAREA_SIZE_POLICY in 10g)

Query result cache in 11g
In 11g its possible to store the result of the SQL in a special section of shared pool called RESULT CACHE.
As the name suggests, this cache stores results. This makes subsequent SQLs run damn fast resulting in better performance.

http://msutic.blogspot.com/2010/08/recovering-from-lost-controlfile.html
http://help.sap.com/saphelp_dm40/helpdata/en/0d/d2ffba4a0c11d182b80000e829fbfe/content.htm
http://dbaforums.org/oracle/index.php?showtopic=19427
http://www.oreilly.co.jp/BOOK/unixback/download/oracle.html

http://download.oracle.com/docs/cd/A97630_01/server.920/a96521/control.htm

database reorg/schema refresh

http://dbarajabaskar.blogspot.com/2008/09/schema-refresh-on-same-database.html
http://deepakdba.wordpress.com/category/dba-activities/schema-refresh/
http://www.in-oracle.com/Oracle-DBA/DBA-I/schema-refresh-Data-Pump.php        Schema refresh using Data Pump in 10g
http://www.dbasupport.com/forums/archive/index.php/t-31910.html
http://www.dba-oracle.com/t_refreshing_test_database_from_production.htm

Oracle® Database High Availability Architecture and Best Practices
10g Release 1 (10.1)
7 Oracle Configuration Best Practices         
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10726/configbp.htm

dedicated/shared architecture/server

i think RMAN's duplicate database utility is more straightforward and fuss free!

>> I meant database refreshing which is quite similar to database cloning.

I have my notes here, a fast refresh:
http://www.dba-oracle.com/oracle_tips_db_copy.htm

How To Automate DB Refresh Through Import
http://www.dbasupport.com/forums/showthread.php?t=31910

Database refresh using cold backup
http://manib.wordpress.com/2008/01/28/database-refresh-using-cold-backup/

http://www.orafaq.com/node/2532

Oracle® Database Backup and Recovery Advanced User's Guide
10g Release 2 (10.2)
http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/toc.htm

Oracle RMAN Reporting
http://www.orafaq.com/node/2553

Reclaiming Unused Space in Datafiles
http://www.oracle-base.com/articles/misc/ReclaimingUnusedSpace.php

Managing Patches
http://pafumi.net/Applying_Patches_Oracle.html

Interpreting Wait Events
http://pafumi.net/Wait_Events.html

Analyzing a Statspack Report
http://pafumi.net/Statspack_Analysis.html

Run a STATSPACK Exception Report
http://www.remote-dba.cc/t_lessons_exception_report.htm

AWR Reports
http://pafumi.net/AWR%20Reports.html

New 10g Features on RMAN
http://pafumi.net/RMAN_10g_New_Features.html

Rman output script for creating DUPLICATE database
http://www.runningoracle.com/product_info.php?products_id=349

Cloning and Refreshing an Oracle Database
http://sabdarsyed.blogspot.com/2008/08/cloning-and-refreshing-oracle-database.html
  
Refresh test database from production schema
http://www.dba-oracle.com/t_refreshing_test_database_from_production.htm

Super fast Database Copying/Cloning
http://www.dba-oracle.com/oracle_tips_db_copy.htm

Cloning a large RAC database
http://www.dba-oracle.com/t_cloning_rac_large_database.htm

Oracle Database 10g: The Top 20 Features for DBAs
http://www.oracle.com/technetwork/articles/sql/index-082320.html

Oracle Database 11g High Availability
http://www.exitcertified.com/newsletter/2007-august/resources/high-availability-11g-whitepaper.pdf

Oracle® Database High Availability Architecture and Best Practices
10 Detailed Recovery Steps
http://download.oracle.com/docs/cd/B14117_01/server.101/b10726/recover.htm

http://pafumi.net/Performance_Tuning.pdf

Brain Cramps:  How simple mistakes can cripple your database
http://www.praetoriate.com/t_brain_cramps.htm

Oracle RAC instance affinity tips
http://www.dba-oracle.com/t_rac_instance_affinity.htm

Obsolete Database Parameters
http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_14.shtml


Performance Tuning
http://www.runningoracle.com/index.php?cPath=1

Oracle Administration Reducing disk I/O in UNIX
http://www.dba-oracle.com/unix_linux/io_unix.htm

Oracle online table reorganization
http://www.dba-oracle.com/t_online_table_reorganization.htm

Oracle 11g - Reorganizing Tables with Oracle Utilities
http://www.remote-dba.net/t_oracle_net_reorganize_tables.htm

Database reorganization in 9i
http://www.oraclefans.com/forums/viewtopic.php?f=5&t=3614

Database Reorganization - Sample Log of Steps for Our Site
http://www.oracletips.info/reorg_log.txt

Issues with Database Reorg - Oracle 9i
http://sap.ittoolbox.com/groups/technical-functional/sap-basis/issues-with-database-reorg-oracle-9i-2158662

Introduction to the Reorg Wizard
http://download.oracle.com/docs/html/A86647_01/reorg.htm

Oracle reorganization
http://www.remote-dba.net/oracle_10g_tuning/t_oracle_reorganization.htm

Automated Space Cleanup in Oracle
http://www.dba-oracle.com/art_dbazine_hordilla_automated_space_cleanup_in_oracle.htm

Reclaiming Oracle disk space
http://www.dba-oracle.com/t_reclaiming_disk_space.htm

http://www.quest.com/space-manager-with-livereorg/
http://www.bgs-soft.com/Products_space.asp

SQL Server database fragmentation script
http://www.dba-oracle.com/t_sql_server_storage_fragmentation_script.htm

Oracle tablespace fragmentation
http://www.dba-oracle.com/bp/teaser_rs_ts_frag.htm


http://www.grid-tools.com/download/Oracle_E-Business_Database_Shrinking.pdf
http://nocoug.org/download/2004-11/Conquering_Ora_Latch_Conten_1d.pdf
http://www.ebook3000.com/Oracle-10g-RAC-Grid--Services---Clustering_147791.html
http://ebooksfreedownload.org/search/oracle-10g-pdf-free-download
http://ebooksfreedownload.org/2011/01/oracle-database-10g-performance-tuning-tipsamp-techniques.htm
http://www.dba-oracle.com/art_dba_interview.htm
http://www.orafaq.com/wiki/Interview_Questions#Oracle_DBA_Questions
http://downloadmela.com/interview-paper-download?id=1006
http://downloadmela.com/interview-paper?sno=30
http://qpaperkerala.blogspot.com/2011/12/oracle-dba-interview-questions.html
http://www.databasejournal.com/article.php/2205281
http://it.toolbox.com/wiki/index.php/Interview_Questions_with_Answers_for_Oracle,_DBA,_and_developer_candidates
http://marioalcaide.wordpress.com/2011/02/09/3years-interview-questions/
http://www.kendba.com/sample-chapters/oracle-backup-recovery-interview-questions/
http://www.kendba.com/sample-chapters/oracle-11g-rac-architecture-sample-video/
http://www.kendba.com/interview-questions/a-first-tricky-question-in-interview/
http://balajiabhi.blogspot.com/2008/12/custom-top-in-oracle-application.html
http://www.fadalti.com/oracle/database/10g_rac_administrator.htm
http://blogs.oracle.com/stevenChan/entry/which_is_better_forms_servlet_or_socket_mode

what is the purpose of appllsyspub/pub and guest/oracle

What is Forms Socket Mode?

DB Advanced by Nazim Shaikh

RAC Management Commands

Tuning performance on eBussiness suite [ID 744143.1]

MD120 Installation & configuration document

http://www.onlinedbasupport.com/oracledb3/211-rac-database-commands.html

Dharmendra

Tips - Data pump

Tips - Data pump

Export:

1. Use buffer parameter while using export and import by atleast 5000000( 5MB ) which will increase the performance of exp and imp by 3 folds. (conventional path)
2. Take care with NLS_LANG. It must match with V$NLS_PARAMETERS.NLS_CHARACTERSET.
3. For Speedy Exports set parameter db_file_multiblock_read_count =128. (OS Dependent)
4. The Export parameter BUFFER applies only to conventional path Exports. For direct path Export, use the RECORDLENGTH parameter to specify the size of the buffer that Export uses for writing to the export file.
5. Use direct mode export (direct=Y).
6. RECORDLENGTH recommended values: Multiples of the file system I/O block size, Multiples of DB_BLOCK_SIZE

Import:

1. Use indexes=n to ignore the index importing.
2. Using indexfile to create the index to file, create the indexes after the importing using script file.
3. Using rows=n indexes=y to import index in a separate import action.

Example:

exp username/username@pwd file=username.dmp log=username.log direct=y recordlength=640000 statistics=none

imp username/username@pwd file=username.dmp fromuser=username touser=username indexes=n

imp username/username@pwd file=username.dmp fromuser=username touser=username indexes=y rows=n


Dharmendra