Wednesday, May 1, 2013

Find the Index Fragmentation on SQL Server 2005 and 2008


sys.dm_db_index_physical_stats dynamic view which returns size and fragmentation information.but query returns lots of information.

SELECT OBJECT_NAME(idx.OBJECT_ID) AS TableName,
idx.name AS IndexName,idxst.avg_fragmentation_in_percent,
idxst.avg_fragment_size_in_pages,
idxst.avg_page_space_used_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') idxst
INNER JOIN sys.indexes idx ON idx.OBJECT_ID = idxst.OBJECT_ID
AND idx.index_id = idxst.index_id
WHERE idxst.avg_fragmentation_in_percent > 5

Decide to de-fragment an index we should determine how much affected it is. Fragmentation is measured as a percentage that indicates the number of pages that are not in the ideal order. A value below 5% indicates a very low fragmented index that requires no maintenance. A value of between 5% and 30% can be improved by reorganizing the idex. Greater than 30% fragmentation warrants an index rebuild.

Friday, April 26, 2013

Check Table Last Accessed by User. with TSQL Script

Select DB_Name(usts.[database_id]) AS [Database],
Object_Name(usts.[object_id]) AS [TableName],
MAX(usts.[last_user_lookup]AS [last_user_lookup],
MAX (usts.[last_user_scan]) AS [last_user_scan],
MAX(usts.[last_user_seek]) AS [last_user_seek]
FROM sys.dm_db_index_usage_stats AS usts
WHERE usts.[database_id] = DB_ID()
AND usts.[object_id] = Object_ID(‘Table_Name’)
GROUP BY usts.[database_id], usts.[object_id];

After Database Services/ Server restart View also reset.
Change your database context to your current database.
Change the Table Name for which you want to get last access details. 

Monday, April 22, 2013

Oracle V SQL Server Comparison of Core Schema and Data Structures



Oracle V SQL Server Comparison of Core Schema and Data Structures (Objects)

Oracle
SQL Server
Table
Table
Index
Index
View
View
Synonym
Synonym
Sequence
Identity Columns
Procedure
Stored Procedure
Function
Function
Package
N/A
Queue in Streams Advanced Queuing
Service Broker Queue
Object Type
Type
XML DB
XML Schema Collection
                                                                             
Data Blocks, Extents And Segments
                                                                                           
Structure
Oracle
SQL Server 2008
Smallest unit of logical storage
Block
Page
Block size
Variable
8 KB fixed
Storage allocation
Performed in multiple blocks; are ‘extents’
Performed in multiple pages; are ‘extents’
Extent size
Variable
64 KB fixed
Segment
Any logical structure that is allocated storage
No equivalent structure


Tuesday, April 16, 2013

Solution for Downtime in Oracle


v Unplanned Down time: - The result of computer failures or data failures
Ø  System failures
          Fast-start Fault Recovery: - Fast-Start Fault Recovery enables you to bound the database Crash recovery time. The database self-tunes checkpoint processing to safeguard the desired recovery time objective.
          RAC Data Guard Stream: - RAC provides optimal performance, scalability, and availability gains.
Ø  Data failures
          RMAN backup/recovery: - Recovery Manager (RMAN) automates database backup and recovery. Data Recovery Advisor (not supported for RAC) diagnoses data failures and presents repair options.
          ASM: - ASM provides a higher level of availability using online provisioning of database storage.
          Flashback: - Flashback provides a quick resolution to human errors.
          Oracle Hardware Assisted Resilient Data (HARD): - It’s a comprehensive program designed to prevent data corruptions before they happen.
          Data Guard & Streams: - Data Guard must be the foundation of any Oracle database disaster-recovery plan.

v  Planned down time: - Due to data changes or system changes:
Ø  System changes
          Rolling upgrades/Online patching: - The Oracle database supports the application of patches to the nodes of a RAC system, as well as database software upgrades, in a rolling fashion.

          Dynamic provisioning: - The Oracle database continues to broaden support for dynamic reconfiguration, enabling it to adapt to changes in demand and hardware with no disruption of service.

Ø  Data changes
          Online Redefinition: - With online redefinition, the Oracle database supports many maintenance operations without disrupting database operations or users updating or accessing data. 

Sunday, April 14, 2013

Microsoft SQL Server Virtual Labs


Microsoft SQL Server Virtual Labs

Try Microsoft SQL Server in a virtual lab and learn more about AlwaysOn, ColumnStore Index, PowerView, and other new features. Virtual labs are simple, with no complex setup or installation required.
You get a downloadable manual and a 90-minute block of time for each module. You can sign up for additional 90-minute blocks at any time.

http://msdn.microsoft.com/en-us/hh859579.aspx
http://technet.microsoft.com/en-us/virtuallabs/bb467605.aspx

Saturday, April 6, 2013

Causes of Database Down Time


Causes of Unplanned Down Time

Ø  Software failures
·         Operating system
·         Database
·         Application
·         Network
·         Middleware
Ø  Hardware failures
·         Memory
·         CPU
·         Power Supply
·         Disk
·         Tape
·         Bus
·         Controllers
·         Network
·         Power
Ø  Human errors
·         Operator Error
·         User Error
·         DB Admin Error
·         System Admin Error
·         Sabotage
Ø  Disasters
·         Earthquake
·         Flood
·         Fire
·         Power Failure
·         Bombing

Causes of Planned Down Time

Ø  Routine operations
·         Backups
·         Performance mgmt
·         Security mgmt
·         Batches operations
Ø  Periodic maintenance
·         Storage maintenance
·         Schema management
·         Operating system
·         Initialization parameters
·         Software patches
·         Middleware
·         Network
Ø  New deployments
·         DB upgrades
·         OS upgrades
·         HW upgrade
·         Middleware upgrades
·         App upgrades
·         Net upgrades

Tuesday, March 26, 2013

All Oracle Application server, Database books / study material / pdf / Documents

All Oracle  books / study material / pdf / Documents at one place.