Database performence tuning
iam not able to get perfect tuning in database connectivity.
iam creating connection object at login page i wanted to use the same connection object in different page. is this the correct way please give some efficient way of usage of connection object.thanks for any regards
Hi,
Buddy no need to open diff. connection. Just one connection will do(provided ur app is small and ur server is pooling).
fundamentally u must have different DAO's for different components(coz diff. components requir different resultsets).
if ur not using Locator pattern to locate objects... then open connection in static block on servlet., put the opbect in context and share the same .
Its a good practice to close and nullify all ur resultset/statement objects immediate after processing.And connection object is closed when no more required thru out the application or when application is shuting down.
@mit
Similar Messages
-
Database Performence tuning Interview question
Hello All,
I had a bad interview yesterday for Oracle Database Administration job and was a developer who ask me a question about performance tuning that I couldn't answer him; the question was like
A developer come to you with a query that he issue to a database and he complain that it is too slow and the system is hang how can you solve the problem?
describe the steps that you have to follow to take care of this issue
Can some one give me an Idea on how to solve these type of problem, the steps
I assume it has to do with AWR, ASM, ADDM, AMM
I am a very new oracle DBA just certify with no experience that is why i found it difficult
Need help
Thanks
Nounouuser9362044 wrote:
Hello All,
I had a bad interview yesterday for Oracle Database Administration job and was a developer who ask me a question about performance tuning that I couldn't answer him; the question was likeThat's OK, I probably couldn't answer to his liking either.
>
A developer come to you with a query that he issue to a database and he complain that it is too slow and the system is hang how can you solve the problem?
describe the steps that you have to follow to take care of this issue
Can some one give me an Idea on how to solve these type of problem, the steps
I assume it has to do with AWR, ASM, ADDM, AMM
I am a very new oracle DBA just certify with no experience that is why i found it difficultWell, of course you would. As the "what to do when your query is slow" thread shows, there are a number of tools you would be expected to know, and yet, does that really answer the question? Someone depending on certification to get a job may be sorely disappointed, as the expectations of people offering the jobs don't often match up with the certification process. In this case, it sounds like they were expecting someone to have been a developer with experience in these issues moving up to a performance analyst.
Look at the performance tuning manual - it has quite a different process than the "what to do thread." That's because the system hang may not be due to the developers query at all, it may just be the trigger for another problem, or even be entirely coincidental. It might not even be a "system hang," it could be just some stupid app locking goof (or design feature), that makes users think the system is hung. I had one of those yesterday, looked just like http://download.oracle.com/docs/cd/E11882_01/server.112/e10822/tdppt_sqlid.htm#BABFJJCJ But the thing is, that is extremely misleading. What actually happened was another user walked away from her terminal with a row locked for update, causing everything else that needed to get to that row to go nuts trying to get to it. So, every methodology was wrong, it was not a performance problem at all, all I needed to do was look at the "all instance locks" screen and tell the complaining user (and have my boss tell the other users complaining to him) to drag the user away from her lunch and castigate her, as everyone is trained not to leave in the middle of an update screen.
So I probably wouldn't pass the interview either, as my view is a DBA is expected to know his system, know the apps, and know the tools available to solve problems, and a company shouldn't expect someone new to know much of that. The developer probably had a very different answer in mind, and who knows if it was the "what to do" thread, the Oracle party line, some other methodology like Method-R, ODM, Performance Firefighting, Silver Bullet, ratio tuning, the idea that he can know how you work from divining your thought processes or some strange ideas that make less sense. Or maybe none of those, he was just evaluating how you would fit in with the group.
An example of the range of expectations: http://www.freelists.org/post/oracle-l/Questions-for-a-Jr-DBA -
Oracle 11 G database performance tuning
How to indexing the oracle 11G database?
Thanks in advance.Your question is like if you ask "Tell me how to fix a car". As you know people spend years learning how to fix different problems with cars; the same applies to database performance tuning. There is no way to answer this question in one post. Please ask a more specific question in an apropriate (database related) forum.
cheers -
I have SSRS reports with each 5 parameters. Parameter datasets includes statements like WHERE @CategoryKey
I have 20 tables in SQL Server. We don't have OLAP cube.
I have created SQL Server Profiler trace. I have clicked all reports during process.
I have opened Database Engine Tuning Advisor.
I have selected all tables to Tune.
Tuning options are Indexes/No Partitioning/Keep all existing PDS
Result is following:
14% improvement
10 recommendations (8 statistic for Calender table and 2 index for Calender)
Tuning logs:
S008 exec sp_executesql N' LongSQLStatment including IN (@CategoryKey) Event does not reference any tables
S007 Replaced event exec sp_executesql
My question is that why I did not get any recommendations for other tables that Calender?
Could it be because of SSRS parameters like @CategoryKey?
Is it possible at all to use SQL Server profile for creating workload in case of SSRS reports with parameters?
I have tables and reports like ProductSales, which I suppose should be get indexedbecause of WHERE statements.
I have where statement like Month and Category and Color.Yes it is possible to capture a trace using profiler, but please provide the t-sql behind your dataset before I can answer your question about the DTA recommandations.
Regards
Rasmus Glibstrup
http://blog.sqlguy.dk -
Hello,
This is the first time I am using this forum. I am stuck and need some help. I received this error message both on SQL 2005 and 2008. I am currently using SQL 2008 DEV for testing purposes and I am experiencing this error message when trying to connect to Database Engine Tuning Advisor. I am using the SA account so I should not have any security issues. Also this is a fresh install of SQL 2008 DEV on a fresh install of Windows XP Pro with all SP. Can some please help.
Error:
"Failed to initialize MSDB database for tuning (exit code: -1073741819). (DTAClient)"
===================================
Failed to open a new connection.
===================================
Failed to initialize MSDB database for tuning (exit code: -1073741819). (DTAClient)
Program Location:
at Microsoft.SqlServer.Management.DTA.Client.TuningServer.InitializeTuningParametersDatabase()
at Microsoft.SqlServer.Management.DTA.Client.TuningServer.InitializeConnection()
at Microsoft.SqlServer.Management.DTA.Client.TuningServer.Connect()
at Microsoft.SqlServer.Management.DTA.Shell.SessionMonitor.AddServerInternal(SqlConnectionInfo connectionInfo, SqlConnection connection)
at Microsoft.SqlServer.Management.DTA.Shell.SessionMonitor.AddServer(SqlConnectionInfo connectionInfo, SqlConnection connection)
at Microsoft.SqlServer.Management.DTA.Shell.SessionMonitor.OnConnect(Object sender, EventArgs e)I created the below MSDB SP and Tables. Now the issue is resolved.
http://www.devnewsgroups.net/sqlservertools/t67379-database-engine-tuning-advisor.aspx
USE [msdb]
GO
/****** Object: StoredProcedure [dbo].[sp_DTA_start_xmlprefix] Script
Date: 12/31/2008 10:56:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[sp_DTA_start_xmlprefix]
as
begin
declare @startTags nvarchar(128)
set @startTags = N'<DTAXML><DTAOutput><AnalysisReport>'
select @startTags
end
GO
/****** Object: Table [dbo].[DTA_input] Script Date: 12/31/2008 10:56:59
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_input](
[SessionName] [sysname] NOT NULL,
[SessionID] [int] IDENTITY(1,1) NOT NULL,
[TuningOptions] [ntext] NOT NULL,
[CreationTime] [datetime] NOT NULL DEFAULT (getdate()),
[ScheduledStartTime] [datetime] NOT NULL DEFAULT (getdate()),
[ScheduledJobName] [sysname] NOT NULL DEFAULT (''),
[InteractiveStatus] [tinyint] NOT NULL DEFAULT ((0)),
[LogTableName] [nvarchar](1280) NOT NULL DEFAULT (''),
[GlobalSessionID] [uniqueidentifier] NULL DEFAULT (newid()),
PRIMARY KEY CLUSTERED
[SessionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_progress] Script Date: 12/31/2008
10:57:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_progress](
[ProgressEventID] [int] IDENTITY(1,1) NOT NULL,
[SessionID] [int] NULL,
[TuningStage] [tinyint] NOT NULL DEFAULT ((0)),
[WorkloadConsumption] [tinyint] NOT NULL,
[EstImprovement] [int] NOT NULL DEFAULT ((0)),
[ProgressEventTime] [datetime] NOT NULL DEFAULT (getdate()),
[ConsumingWorkLoadMessage] [nvarchar](256) NULL,
[PerformingAnalysisMessage] [nvarchar](256) NULL,
[GeneratingReportsMessage] [nvarchar](256) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_output] Script Date: 12/31/2008
10:57:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_output](
[SessionID] [int] NOT NULL,
[TuningResults] [ntext] NOT NULL,
[StopTime] [datetime] NOT NULL DEFAULT (getdate()),
[FinishStatus] [tinyint] NOT NULL DEFAULT ((0)),
PRIMARY KEY CLUSTERED
[SessionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_tuninglog] Script Date: 12/31/2008
11:01:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_tuninglog](
[SessionID] [int] NOT NULL,
[RowID] [int] NOT NULL,
[CategoryID] [nvarchar](4) NOT NULL,
[Event] [ntext] NULL,
[Statement] [ntext] NULL,
[Frequency] [int] NOT NULL,
[Reason] [ntext] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_database] Script Date:
12/31/2008 10:57:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_database](
[DatabaseID] [int] IDENTITY(1,1) NOT NULL,
[SessionID] [int] NOT NULL,
[DatabaseName] [sysname] NOT NULL,
[IsDatabaseSelectedToTune] [int] NULL,
PRIMARY KEY CLUSTERED
[DatabaseID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_query] Script Date: 12/31/2008
10:59:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_query](
[QueryID] [int] NOT NULL,
[SessionID] [int] NOT NULL,
[StatementType] [smallint] NOT NULL,
[StatementString] [ntext] NOT NULL,
[CurrentCost] [float] NOT NULL,
[RecommendedCost] [float] NOT NULL,
[Weight] [float] NOT NULL,
[EventString] [ntext] NULL,
[EventWeight] [float] NOT NULL,
CONSTRAINT [DTA_reports_query_pk] PRIMARY KEY CLUSTERED
[SessionID] ASC,
[QueryID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_querydatabase] Script Date:
12/31/2008 11:00:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_querydatabase](
[QueryID] [int] NOT NULL,
[SessionID] [int] NOT NULL,
[DatabaseID] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_table] Script Date: 12/31/2008
11:00:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_table](
[TableID] [int] IDENTITY(1,1) NOT NULL,
[DatabaseID] [int] NOT NULL,
[SchemaName] [sysname] NOT NULL,
[TableName] [sysname] NOT NULL,
[IsView] [bit] NOT NULL DEFAULT ((0)),
PRIMARY KEY CLUSTERED
[TableID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_partitionfunction] Script Date:
12/31/2008 10:58:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_partitionfunction](
[PartitionFunctionID] [int] IDENTITY(1,1) NOT NULL,
[DatabaseID] [int] NOT NULL,
[PartitionFunctionName] [sysname] NOT NULL,
[PartitionFunctionDefinition] [ntext] NOT NULL,
PRIMARY KEY CLUSTERED
[PartitionFunctionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_partitionscheme] Script Date:
12/31/2008 10:59:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_partitionscheme](
[PartitionSchemeID] [int] IDENTITY(1,1) NOT NULL,
[PartitionFunctionID] [int] NOT NULL,
[PartitionSchemeName] [sysname] NOT NULL,
[PartitionSchemeDefinition] [ntext] NOT NULL,
PRIMARY KEY CLUSTERED
[PartitionSchemeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_tableview] Script Date:
12/31/2008 11:01:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_tableview](
[TableID] [int] NOT NULL,
[ViewID] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_querytable] Script Date:
12/31/2008 11:00:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_querytable](
[QueryID] [int] NOT NULL,
[SessionID] [int] NOT NULL,
[TableID] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_index] Script Date: 12/31/2008
10:58:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_index](
[IndexID] [int] IDENTITY(1,1) NOT NULL,
[TableID] [int] NOT NULL,
[IndexName] [sysname] NOT NULL,
[IsClustered] [bit] NOT NULL DEFAULT ((0)),
[IsUnique] [bit] NOT NULL DEFAULT ((0)),
[IsHeap] [bit] NOT NULL DEFAULT ((1)),
[IsExisting] [bit] NOT NULL DEFAULT ((1)),
[Storage] [float] NOT NULL,
[NumRows] [int] NOT NULL,
[IsRecommended] [bit] NOT NULL DEFAULT ((0)),
[RecommendedStorage] [float] NOT NULL,
[PartitionSchemeID] [int] NULL,
[SessionUniquefier] [int] NULL,
PRIMARY KEY CLUSTERED
[IndexID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_column] Script Date: 12/31/2008
10:57:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_column](
[ColumnID] [int] IDENTITY(1,1) NOT NULL,
[TableID] [int] NOT NULL,
[ColumnName] [sysname] NOT NULL,
PRIMARY KEY CLUSTERED
[ColumnID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_queryindex] Script Date:
12/31/2008 11:00:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_queryindex](
[QueryID] [int] NOT NULL,
[SessionID] [int] NOT NULL,
[IndexID] [int] NOT NULL,
[IsRecommendedConfiguration] [bit] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_querycolumn] Script Date:
12/31/2008 10:59:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_querycolumn](
[QueryID] [int] NOT NULL,
[SessionID] [int] NOT NULL,
[ColumnID] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DTA_reports_indexcolumn] Script Date:
12/31/2008 10:58:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DTA_reports_indexcolumn](
[IndexID] [int] NOT NULL,
[ColumnID] [int] NOT NULL,
[ColumnOrder] [int] NULL,
[PartitionColumnOrder] [int] NOT NULL DEFAULT ((0)),
[IsKeyColumn] [bit] NOT NULL DEFAULT ((1)),
[IsDescendingColumn] [bit] NOT NULL DEFAULT ((1))
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[sp_DTA_check_permission] Script
Date: 12/31/2008 10:53:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[sp_DTA_check_permission]
@SessionID int
as
begin
declare @retcode int
declare @dbname nvarchar(128)
declare @sql nvarchar(256)
declare @dbid int
set nocount on
-- Check if SA
if (isnull(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 1)
begin
return(0)
end
-- if not yukon return
if (patindex('%9.00.%',@@version) = 0)
begin
return (1)
end
-- declare and open a cursor and get all the databases specified in the input
declare db_cursor cursor for
select DatabaseName from DTA_reports_database
where SessionID = @SessionID and IsDatabaseSelectedToTune = 1
-- open
open db_cursor
-- fetch first db name
fetch next from db_cursor
into @dbname
-- loop and get all the databases selected to tune
while @@fetch_status = 0
begin
-- build use db string
select @dbid = DB_ID(@dbname)
-- In Yukon this masks the error messages
set @sql = N'begin try
dbcc autopilot(5,@dbid) WITH NO_INFOMSGS
end try
begin catch
set @retcode = 1
end catch'
execute sp_executesql @sql
, N'@dbid int output, @retcode int OUTPUT'
, @dbid output
, @retcode output
-- if caller is not member of dbo
if (@retcode = 1)
begin
-- close and reset cursor,switch context to current
-- database and return 1
close db_cursor
deallocate db_cursor
return(1)
end
fetch from db_cursor into @dbname
end
-- close and reset cursor,switch context to current
-- database and return 1
close db_cursor
deallocate db_cursor
return(0)
end
GO
/****** Object: StoredProcedure [dbo].[sp_DTA_index_usage_helper_xml]
Script Date: 12/31/2008 10:54:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[sp_DTA_index_usage_helper_xml]
@SessionID int,
@IsRecommended int
as
begin
select 1 as Tag,
NULL as Parent,
'' as [IndexUsageReport!1!!ELEMENT],
case when @IsRecommended = 1 then 'false'
else 'true' end as [IndexUsageReport!1!Current],
NULL as [Database!2!DatabaseID!hide],
NULL as [Database!2!Name!ELEMENT] ,
NULL as [Schema!3!Name!ELEMENT] ,
NULL as [Table!4!TableID!hide],
NULL as [Table!4!Name!ELEMENT],
NULL as [Index!5!IndexID!hide],
NULL as [Index!5!Name!ELEMENT],
NULL as [Index!5!NumberOfReferences!ELEMENT],
NULL as [Index!5!PercentUsage!ELEMENT]
union all
select 2 as Tag,
1 as Parent,
NULL as [IndexUsageReport!1!!ELEMENT],
NULL as [IndexUsageReport!1!Current],
D.DatabaseID as [Database!2!DatabaseID!hide],
D.DatabaseName as [Database!2!Name!ELEMENT] ,
NULL as [Schema!3!Name!ELEMENT] ,
NULL as [Table!4!TableID!hide],
NULL as [Table!4!Name!ELEMENT],
NULL as [Index!5!IndexID!hide],
NULL as [Index!5!Name!ELEMENT],
NULL as [Index!5!NumberOfReferences!ELEMENT],
NULL as [Index!5!PercentUsage!ELEMENT]
from [msdb].[dbo].[DTA_reports_database] as D
where
D.SessionID = @SessionID and
D.DatabaseID in
(select D.DatabaseID from
[msdb].[dbo].[DTA_reports_queryindex] as QI,
[msdb].[dbo].[DTA_reports_index] as I,
[msdb].[dbo].[DTA_reports_table] as T,
[msdb].[dbo].[DTA_reports_database] as D
where
QI.IndexID = I.IndexID and
I.TableID = T.TableID and
T.DatabaseID = D.DatabaseID and
D.SessionID = @SessionID and
QI.IsRecommendedConfiguration = @IsRecommended
GROUP BY D.DatabaseID)
union all
select 3 as Tag,
2 as Parent,
NULL as [IndexUsageReport!1!!ELEMENT],
NULL as [IndexUsageReport!1!Current],
D.DatabaseID as [Database!2!DatabaseID!hide],
D.DatabaseName as [Database!2!Name!ELEMENT] ,
R.SchemaName as [Schema!3!Name!ELEMENT] ,
NULL as [Table!4!TableID!hide],
NULL as [Table!4!Name!ELEMENT],
NULL as [Index!5!IndexID!hide],
NULL as [Index!5!Name!ELEMENT],
NULL as [Index!5!NumberOfReferences!ELEMENT],
NULL as [Index!5!PercentUsage!ELEMENT]
from [msdb].[dbo].[DTA_reports_database] as D,
select D.DatabaseID,T.SchemaName from
[msdb].[dbo].[DTA_reports_queryindex] as QI,
[msdb].[dbo].[DTA_reports_index] as I,
[msdb].[dbo].[DTA_reports_table] as T,
[msdb].[dbo].[DTA_reports_database] as D
where
QI.IndexID = I.IndexID and
I.TableID = T.TableID and
T.DatabaseID = D.DatabaseID and
QI.IsRecommendedConfiguration = @IsRecommended and
D.SessionID = @SessionID
GROUP BY D.DatabaseID,T.SchemaName
) R
where
D.SessionID = @SessionID and
D.DatabaseID = R.DatabaseID
union all
select 4 as Tag,
3 as Parent,
NULL as [IndexUsageReport!1!!ELEMENT],
NULL as [IndexUsageReport!1!Current],
D.DatabaseID as [Database!2!DatabaseID!hide],
D.DatabaseName as [Database!2!Name!ELEMENT] ,
R.SchemaName as [Schema!3!Name!ELEMENT] ,
R.TableID as [Table!4!TableID!hide],
T.TableName as [Table!4!Name!ELEMENT],
NULL as [Index!5!IndexID!hide],
NULL as [Index!5!Name!ELEMENT],
NULL as [Index!5!NumberOfReferences!ELEMENT],
NULL as [Index!5!PercentUsage!ELEMENT]
from [msdb].[dbo].[DTA_reports_database] as D,
[msdb].[dbo].[DTA_reports_table] as T,
select D.DatabaseID,T.SchemaName,T.TableID from
[msdb].[dbo].[DTA_reports_queryindex] as QI,
[msdb].[dbo].[DTA_reports_index] as I,
[msdb].[dbo].[DTA_reports_table] as T,
[msdb].[dbo].[DTA_reports_database] as D
where
QI.IndexID = I.IndexID and
I.TableID = T.TableID and
T.DatabaseID = D.DatabaseID and
D.SessionID = @SessionID and
QI.IsRecommendedConfiguration = @IsRecommended
GROUP BY D.DatabaseID,T.SchemaName, T.TableID
) R
where
D.SessionID = @SessionID and
D.DatabaseID = R.DatabaseID and
R.TableID = T.TableID and
T.DatabaseID = D.DatabaseID
union all
select 5 as Tag,
4 as Parent,
NULL as [IndexUsageReport!1!!ELEMENT],
NULL as [IndexUsageReport!1!Current],
D1.DatabaseID as [Database!2!DatabaseID!hide],
D1.DatabaseName as [Database!2!Name!ELEMENT] ,
T1.SchemaName as [Schema!3!Name!ELEMENT] ,
T1.TableID as [Table!4!TableID!hide],
T1.TableName as [Table!4!Name!ELEMENT],
I1.IndexID as [Index!5!IndexID!hide],
I1.IndexName as [Index!5!Name!ELEMENT],
R.Count as [Index!5!NumberOfReferences!ELEMENT],
CAST(R.Usage as decimal(38,2)) as [Index!5!PercentUsage!ELEMENT]
from
[msdb].[dbo].[DTA_reports_database] as D1 ,
[msdb].[dbo].[DTA_reports_index] as I1,
[msdb].[dbo].[DTA_reports_table] as T1,
select D.DatabaseID,T.TableID ,
I.IndexID ,SUM(Q.Weight) as Count,
100.0 * SUM(Q.Weight) /
( 1.0 * ( select CASE WHEN SUM(Q.Weight) > 0 THEN SUM(Q.Weight)
else 1
end
from [msdb].[dbo].[DTA_reports_query] as Q
where Q.SessionID = @SessionID ))
as Usage
from
[msdb].[dbo].[DTA_reports_index] as I
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_queryindex] as QI ON QI.IndexID = I.IndexID
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_query] as Q ON QI.QueryID = Q.QueryID
JOIN
[msdb].[dbo].[DTA_reports_table] as T ON I.TableID = T.TableID
JOIN
[msdb].[dbo].[DTA_reports_database] as D ON T.DatabaseID = D.DatabaseID
and Q.SessionID = QI.SessionID and
QI.IsRecommendedConfiguration = @IsRecommended and
Q.SessionID = @SessionID
GROUP BY I.IndexID,T.TableID,D.DatabaseID) as R
where R.DatabaseID = D1.DatabaseID and
R.TableID = T1.TableID and
R.IndexID = I1.IndexID and
D1.SessionID = @SessionID and
R.Count > 0
order by
[Database!2!DatabaseID!hide],[Schema!3!Name!ELEMENT],[Table!4!TableID!hide],
[Index!5!NumberOfReferences!ELEMENT] , [Index!5!IndexID!hide]
FOR XML EXPLICIT
end
GO
/****** Object: StoredProcedure
[dbo].[sp_DTA_index_usage_helper_relational] Script Date: 12/31/2008
10:54:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[sp_DTA_index_usage_helper_relational]
@SessionID int,
@IsRecommended int
as begin select D1.DatabaseName as 'Database Name' ,T1.SchemaName as
'Schema Name' ,T1.TableName as 'Table/View Name' ,I1.IndexName as 'Index
Name' ,R.Count as 'Number of references' ,CAST(R.Usage as decimal(38,2)) as
'Percent Usage' from
DTA_reports_database as D1 ,
DTA_reports_index as I1,
DTA_reports_table as T1,
select D.DatabaseID,T.TableID ,
I.IndexID ,SUM(Q.Weight) as Count,
100.0 * SUM(Q.Weight) /
( 1.0 * ( select CASE WHEN SUM(Q.Weight) > 0 THEN SUM(Q.Weight)
else 1
end
from [msdb].[dbo].[DTA_reports_query] as Q
where Q.SessionID = @SessionID ))
as Usage
from
[msdb].[dbo].[DTA_reports_index] as I
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_queryindex] as QI ON QI.IndexID = I.IndexID
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_query] as Q ON QI.QueryID = Q.QueryID
JOIN
[msdb].[dbo].[DTA_reports_table] as T ON I.TableID = T.TableID
JOIN
[msdb].[dbo].[DTA_reports_database] as D ON T.DatabaseID = D.DatabaseID
and Q.SessionID = QI.SessionID and
QI.IsRecommendedConfiguration = @IsRecommended and
Q.SessionID = @SessionID
GROUP BY I.IndexID,T.TableID,D.DatabaseID) as R
where R.DatabaseID = D1.DatabaseID and
R.TableID = T1.TableID and
R.IndexID = I1.IndexID and
D1.SessionID = @SessionID and
R.Count > 0
order by R.Count desc end
GO
/****** Object: StoredProcedure [dbo].[sp_DTA_database_access_helper_xml]
Script Date: 12/31/2008 10:53:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[sp_DTA_database_access_helper_xml]
@SessionID int
as
begin
select 1 as Tag,
NULL as Parent,
'' as [DatabaseAccessReport!1!!ELEMENT],
NULL as [Database!2!Name!ELEMENT] ,
NULL as [Database!2!NumberOfReferences!ELEMENT],
NULL as [Database!2!PercentUsage!ELEMENT]
union all
select 2 as Tag, 1 as Parent,NULL,D1.DatabaseName ,
R.Count ,
CAST(R.Usage as decimal(38,2)) from
[msdb].[dbo].[DTA_reports_database] as D1 ,
select D.DatabaseID,SUM(Q.Weight) as Count,
100.0 * SUM(Q.Weight) /
( 1.0 * ( select CASE WHEN SUM(Q.Weight) > 0 THEN SUM(Q.Weight)
else 1
end
from [msdb].[dbo].[DTA_reports_query] as Q
where Q.SessionID = @SessionID ))
as Usage
from
[msdb].[dbo].[DTA_reports_database] as D
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_querydatabase] as QD ON QD.DatabaseID =
D.DatabaseID
LEFT OUTER JOIN
[msdb].[dbo].[DTA_reports_query] as Q ON QD.QueryID = Q.QueryID
and Q.SessionID = QD.SessionID and
Q.SessionID = @SessionID
GROUP BY D.DatabaseID
) as R
where R.DatabaseID = D1.DatabaseID and
D1.SessionID = @SessionID and
R.Count > 0
order by Tag,[Database!2!NumberOfReferences!ELEMENT] desc
FOR XML EXPLICIT
end
GO -
Hi gurur's how we do the PERFORMENCE TUNING OF THE REPORT
hi gurur's how we do the PERFORMENCE TUNING OF THE REPORT .plz help me
Hi,
Use tcode SE30 and ST05
Regards,
Prashant -
i have a very large database consisting of around 300,000,000 records with 38 columns in each record.
i need help in tuning the database so that query results don't take more than a few seconds.
the data is the log of events occuring in the SMSC server.
there are about 10,000,000 events daily.
Search criteria is usually time range and the mobile numbers.
Please advise on the sql and table structure to be used for best performance.presently using composite partitioning with range partitioning based on time( one partition for each day). query with 1 day range takes about 70-80 seconds.
i'm using java servlets and jdbc for accessing the database.
there's no problem in inserting data.Hi
Thanks for your replies.
The table structure is as follows :
LOGGING_TIME DATE
LOG_TYPE NUMBER
SUC_INDICATOR NUMBER
ORIG_IW_TYPE NUMBER
ORIG_TYPE NUMBER
ORIG_ADDR VARCHAR2(21)
ORIG_ADDR_LEN NUMBER
DEST_IW_TYPE NUMBER
DEST_TYPE NUMBER
DEST_ADDR VARCHAR2(21)
DEST_ADDR_LEN NUMBER
SMS_CENTRE VARCHAR2(21)
INCOMING_TIME DATE
TIME DATE
ERROR_CAUSE NUMBER
ERROR_ORIGINATOR NUMBER
NO_OF_ATTEMPTS NUMBER
TARIFF_CLASS NUMBER
MSG_LEN NUMBER
PID NUMBER
SR_REQUEST NUMBER
DEFERRED_DEL NUMBER
SERV_DESC NUMBER
REF_NR NUMBER
MAX_NR NUMBER
SEQ_NR NUMBER
SP_MSG_IND NUMBER
DCS NUMBER
ACCESS_METHOD NUMBER
PRIORITY NUMBER
SENDER_CHG_TYPE NUMBER
RECIPIENT_CHG_TYPE NUMBER
SENDER_PREPAID_STATUS NUMBER
RECIPIENT_PREPAID_STATUS NUMBER
CHARGED_PARTY NUMBER
VMSC VARCHAR2(21)
ORIG_IMSI VARCHAR2(21)
CONSO_MSG VARCHAR2(10)
I have used composite partitioning with range partition based on logging_time and one day for each partition.there are 32 subpartitions.
I have created a local partitioned index on columns logging_time,orig_addr and dest_addr respectively as they are the most commonly used in queries.
query : select /*+ parallel_index(event_logs, event_logs_ind2)*/ * from event_logs where (logging_time>=?) and (logging_time<?) and (orig_addr like ?) and (log_type like ?) and (dest_addr like ?) order by logging_time
execution plan is as follows:
select statement
partition range(iterator)
sort(order by)
partition hash(all)
table access(by local index rowid) of "smsevent.event_logs"
index(range scan) of "smsevent.event_logs_ind"(non-unique)
I tried to make this more readable but the white spaces are getting removed from the posted message.
looking forward to a quick response -
Dears,,
If i have running database and i need to make check health for it for performance , tuning , . . . , etc
Is there any steps or advisors or documentations to go ahead with them enable me to check the database health.
Thanks & Regards,,Eng.Mohammed wrote:
Dears,,
If i have running database and i need to make check health for it for performance , tuning , . . . , etc
Is there any steps or advisors or documentations to go ahead with them enable me to check the database health.
Thanks & Regards,,
One way to check for performance issues is to see if your telephone is ringing. If no one is calling to complain, then you don't have any problems.
I'm only half joking. Which means I am half serious. While you shouldn't take a completely cavalier attitude toward performance, neither do you want to fall victim to Compulsive Tuning Disorder.
Start with the 2-Day DBA manual. Follow up with the tuning guide. Both at tahiti.oracle.com
And remember, no matter how much effort you put into tuning, there will always be a "Top Five" wait events. Is it worth 40 man hours of effort to get a 75% reduction in average response time? Really? Even if the average response time is already 0.5 seconds? Is the user going to be able to perceive that 0.38 seconds improvement? -
Database performance tuning Question
Please,
The top wait event having all the time when tuning, oracle database is the following.
enq: TX - row lock contention
What could be the best way to pinpoint the cause of this?.
I'm on Oracle 10g, windows server 2003.
ThanksThe first thing to do is check the underlying reason. If you query v$session_wait_history or v$lock when you spot a lock appearing, you can check if the request is for mode 4 or mode 6.
Mode 6 means you are colliding on an attempt to update the data in a heap table. Mode 4 can mean many things - including a few "internal" problems, which is probably why the comment about initrans appeared - but often means you have a collision on indexes, (e.g. pending duplicates in unique indexes, conflicts in parent/child referential integrity) or colliding updates to the non-key part of IOTs.
If you are allowed to use v$active_session_history, you can query that to find the sql_id of a session that was waiting for a lock and then be able to see the SQL that the waiting session was trying to operate - otherwise you may have to catch it waiting and check v$session for the sql_id.
Once you have the SQL, you may have a better idea of why the lock was happening.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http:/www.jlcomp.demon.co.uk -
I am fetching records from Database using DB Adapter in BPEL. It takes more than 3 seconds. If i execute the same query from toad the time taken is less than a second. In my BPEL process i have used translation.
Can any one help me in guiding how can i improve the performance.
I suspect that i need to tune the DB Adapter, Is there any tuning guidelines for tuning DB Adapter.
Regards
VikasHi! i think all of you are very busy... can someone post the tunning guide, i can put it in some webpage to download it, in this way everyone who read this thread will download the guide without posting a message! :-)
Best Regards and blesses! -
hi
can any body tell me how it will work for all entries statement in select stmntHi,
You can only use FOR ALL ENTRIES IN ...WHERE ...in a SELECT statement.
SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).
For example:
SELECT * FROM sflight INTO wa_sflight
FOR ALL ENTRIES IN ftab
WHERE CARRID = ftab-carrid AND
CONNID = ftab-connid AND
fldate = '20010228'.
This condition, return all entries of the sflight.
When using FOR ALL ENTRIES the number of matching records is restricted to the number of records in the internal table. If the number of records in the database tables is too large then join would cause overheads in performance. Additionally a JOIN bypasses the table buffering.
follow these links for knowing the difference between For all entries and joins.
http://www.erpgenie.com/abap/performance.htm#For%20all%20entries
http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912
Regards,
Priyanka. -
Book for 1Z0-033 Oracle9i Database: Performance Tuning
Hi
are there are any recommended books for 1Z0-033 exam
regards
kedarMoreover, You can refer the Instructor Led Training (ILT) Materials which provided by Oracle Authorized Institutions i.e. SQL * International, and also, practice the Oracle's self test software questions.
Best of luck.
Sabdar Syed. -
I have two table SDTM_EG,SDTM_SP both have same table structure and indexes.toatl count from both table is SDTM_EG=560066,SDTM_SP=821651.
While i run query select count(*) from each table then it will take time As SDTM_EG=9 Sec and SDTM_SP=5esc.
when i saw table size from dba_segments means i run query
select sum(bytes/1024/1024) from dba_segments where OWNER='SDTMREPOSITORY' and SEGMENT_NAME='SDTM_EG';
'SDTM_EG'=1280;'SDTM_SP'=312.
wether this effect on my query for retriving data.Means whenever i run any script on SDTM_EG table it take more time as compare to SDTM_SP.
Please suggest solution for this .Hi:
Please do an explain plan on your query and see if it is using the right plan. If you are running on CBO please make sure relevant statistics are collected on the tables. There are so many factors that determing why query on that particular table is slow. Missing index , Wrong statistics and wrong join order just to name a few. Doing an explain plan in most cases will help you what might have gone wrong.
Regards,
BMP -
Hi,
I have 9i database, can anybody give me
1. Unix Important Command(like sar , top, vmstat, iostat, netstat), Please don't tell me how to use this command. Instead please tell me when is the bottleneck(generally how much oracle process should used and at what % we should consider cpu or memory or io usage is high).
2. Tunning database document quick quide.Hi,
I have 9i database, can anybody give me
1. Unix Important Command(like sar , top, vmstat,
iostat, netstat), Please don't tell me how to use
this command. Instead please tell me when is the
bottleneck(generally how much oracle process should
used and at what % we should consider cpu or memory
or io usage is high).
2. Tunning database document quick quide.hi,
Generally I look at the 'wait' class in top/vmstat to see if the system is waiting on disks.
database tuning is an iterative process. You would need to post back some parameters e.g.
show parameter sga
show parameter pga
etc etc.
By asking your question, do we assume that your database needs tuning?
Also as you are on UNIX, have you enable async servers?
rgds
alan -
SQL Result Cache vs In-Memory Database Cache
Hi,
can anyone help me to understand the relations and differences between the 11 g new features of SQL Result Cache vs In-Memory Database Cache ?
ThanksI highly recommend you read the 11g New Features Guide. Here is a sample from it:
h4. 1.11.2.9 Query Result Cache
A separate shared memory pool is now used for storing and retrieving
cached results. Query retrieval from the query result cache is faster
than rerunning the query. Frequently executed queries will see
performance improvements when using the query result cache.
The new query result cache enables explicit caching of results in
database memory. Subsequent queries using the cached results will
experience significant performance improvements.
See Also:
[Oracle Database Performance Tuning Guide|http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/memory.htm#PFGRF10121] for details
[Results Cache Concepts|http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/memory.htm#PFGRF10121|Results Cache Concepts]
HTH!
Maybe you are looking for
-
File sender adapter: convert binary to xml
Hello everyone, I am doing a File-to-RFC scenario, where I am reading a PDF-file and sending it via RFC for further processing. My problem is that I don't know how to create an XML-container for this PDF-file to transport it through XI. My target str
-
Spool recepient issue in ECC 6.0
We have a scheduled background job ZD510_FILL_RATE_REPORT_ECC6. This produces a reports and sends to a distribution group. When the group receives the report in their inbox they open it and it only shows 16 pages of the 33 pages. The user replied th
-
Storage location missing or incorrect Message no. L3432
Hi, Previously the item we want to zero-in is under warehouse number WH1 under let's say plant 1000-storage location 1010. However this plant 1000 storage location 1010 was later on assigned to a new warehouse number WH2. During the migration period,
-
Hi Everyone, I've been trying to capture an NTSC VHS tape into Final Cut Pro and it just isn't working. I'm using a Miglia Directors Cut Take 2 to capture via an S-Video cable. The Directors Cut box is on 'Capture' and is set to NTSC and the VCR is N
-
I am trying to configure tacacs on a WAAS device using 4.1.1c. I have configured the tacacs server to allow the user to login using privilege level 7 then the user is required to enable the device and login again to reach privilege level 15. When eve