Showing posts with label size. Show all posts
Showing posts with label size. Show all posts

Thursday, March 29, 2012

Convert Access CROSSTAB query to SQL Table or View

TRANSFORM IIf(Sum(IIf([blockinyield]=True,[SIZE],0))>0,Sum([Y_TOTAL_ton])/Sum(IIf([blockinyield]=True,[SIZE],0)),0) AS Yield_THA
SELECT OILPALM.NAME, OILPALM.YEAR, formatyear([year]) AS yearDisplay, Count(OILPALM.BLOCK) AS CountOfBLOCK
FROM OILPALM
GROUP BY OILPALM.NAME, OILPALM.YEAR
PIVOT Year([D_PLANTED]);

how to convert the access query above to sql server 2000

In SQL Server 2000 you have't have predefined operator to get the PIVOT table..

Here you have to manually write the query to get the pivot result...

(Example)

Code Snippet

Create Table #BikeSales
(
Year int,
Product Varchar(100),
Sales Int
)

Insert Into #BikeSales Values ('2005', 'HONDA F1', 10000)
Insert Into #BikeSales Values ('2006', 'HONDA F1', 6000)
Insert Into #BikeSales Values ('2007', 'HONDA F1', 7000)

Insert Into #BikeSales Values ('2005', 'HONDA IRL', 100)
Insert Into #BikeSales Values ('2006', 'HONDA IRL', 99)
Insert Into #BikeSales Values ('2007', 'HONDA IRL', 1000)

Insert Into #BikeSales Values ('2005', 'HONDA MotoGP', 124)
Insert Into #BikeSales Values ('2006', 'HONDA MotoGP', 344)
Insert Into #BikeSales Values ('2007', 'HONDA MotoGP', 132)

Insert Into #BikeSales Values ('2005', 'HONDA Super GT', 234)
Insert Into #BikeSales Values ('2006', 'HONDA Super GT', 32344)
Insert Into #BikeSales Values ('2007', 'HONDA Super GT', 123232)

Select
[Main].Product
,Sum([2005].Sales) as [2005]
,Sum([2006].Sales) as [2006]
,Sum([2007].Sales) as [2007]
From (Select Distinct Product From #BikeSales) as [Main]
Left Outer Join (Select * From #BikeSales Where Year=2005) as [2005] On [2005].Product=[Main].Product
Left Outer Join (Select * From #BikeSales Where Year=2006) as [2006] On [2006].Product=[Main].Product
Left Outer Join (Select * From #BikeSales Where Year=2007) as [2007] On [2007].Product=[Main].Product
Group By [Main].Product

You can generate the above query dynamically using the following script..

Code Snippet

Declare @.JoinQuery as Varchar(1000);
Declare @.SelectQuery as Varchar(1000);
Declare @.PreparedJoinQuery as Varchar(1000);
Declare @.PreparedSelectQuery as Varchar(1000);
Select @.JoinQuery = '', @.SelectQuery = ''
Select @.PreparedJoinQuery = 'Left Outer Join (Select * From #BikeSales Where Year=?) as [?] On [?].Product=[Main].Product '
Select @.PreparedSelectQuery =',Sum([?].Sales) as [?]'
Select
@.JoinQuery = @.JoinQuery + Replace(@.PreparedJoinQuery,'?',Cast(year as Varchar))
,@.SelectQuery = @.SelectQuery + Replace(@.PreparedSelectQuery,'?',Cast(year as Varchar)) From #BikeSales Group By Year

Exec ('Select [Main].Product' + @.SelectQuery + ' From (Select Distinct Product From #BikeSales) as [Main]' + @.JoinQuery + ' Group By [Main].Product')

|||

Using Manivannan's data, this method of creating a 'pivot' table in SQL 2005 is quite a bit more efficient. (Single Pass, No JOINS, NO Sub-Queries, No Dynamic SQL.)

Code Snippet


DECLARE @.BikeSales table
( [Year] int,
Product varchar(25),
Sales int
)


Insert Into @.BikeSales Values ('2005', 'HONDA F1', 10000)
Insert Into @.BikeSales Values ('2006', 'HONDA F1', 6000)
Insert Into @.BikeSales Values ('2007', 'HONDA F1', 7000)
Insert Into @.BikeSales Values ('2005', 'HONDA IRL', 100)
Insert Into @.BikeSales Values ('2006', 'HONDA IRL', 99)
Insert Into @.BikeSales Values ('2007', 'HONDA IRL', 1000)
Insert Into @.BikeSales Values ('2005', 'HONDA MotoGP', 124)
Insert Into @.BikeSales Values ('2006', 'HONDA MotoGP', 344)
Insert Into @.BikeSales Values ('2007', 'HONDA MotoGP', 132)
Insert Into @.BikeSales Values ('2005', 'HONDA Super GT', 234)
Insert Into @.BikeSales Values ('2006', 'HONDA Super GT', 32344)
Insert Into @.BikeSales Values ('2007', 'HONDA Super GT', 123232)


Select
Product,
[2005] = sum( CASE [Year] WHEN 2005 THEN Sales END ),
[2006] = sum( CASE [Year] WHEN 2006 THEN Sales END ),
[2007] = sum( CASE [Year] WHEN 2007 THEN Sales END )
FROM @.BikeSales
GROUP BY Product
ORDER BY Product

Sunday, March 25, 2012

Conversion of Access application to SQL Server

Hi there,

I have written an application which uses MS Access for it's database engine.
Due to the large size which the database has become I have decided that it
would be sensible to use SQL Server with the application instead.

I am an extreme SQL Server newbie so I am not really sure what I'm doing
yet! I have successfully downloaded and installed the MS SQLDE 2000 and
service pack 3.

What do I need to do next? Ideally I would like to convert the existing
Access database to MS SQL Server format. Also I would like to know if it is
possible to create an SQL Server database from scratch using a gui
environment similar to Access and if so which software (preferably free) do
I need to achieve this?

Many thanks,
Clive.The easiest way to start is to create the tables in SQL and then point
the MS Access app to these tables. You will need to use the same table
design so it will be easy to follow. You can keep your existing
queries, forms, reports etc... so you keep the functionality of Access
with the back end of SQL which is far better IMO.

For the front end, you can't do this in SQL. You need something else
and seeing as you know Access, it's the best place for you to do this
and you don't need to re-do anything. All you need to do is make sure
you link to the SQL tables using ODBC and keep the naming convention
(for the links at least) the same. Everything else will either work,
or be as near as damn it.

I'd also recommend looking at www.mvps.org/access as this should have
plenty of helpful tips for you. Not sure what SQL stuff is there, but
it may help with a few other bits and bobs.

HTH

Ryan

"Clive Minnican" <clive@.mail.com> wrote in message news:<BeLUc.1603$CT4.510@.newsfe3-gui.ntli.net>...
> Hi there,
> I have written an application which uses MS Access for it's database engine.
> Due to the large size which the database has become I have decided that it
> would be sensible to use SQL Server with the application instead.
> I am an extreme SQL Server newbie so I am not really sure what I'm doing
> yet! I have successfully downloaded and installed the MS SQLDE 2000 and
> service pack 3.
> What do I need to do next? Ideally I would like to convert the existing
> Access database to MS SQL Server format. Also I would like to know if it is
> possible to create an SQL Server database from scratch using a gui
> environment similar to Access and if so which software (preferably free) do
> I need to achieve this?
> Many thanks,
> Clive.|||The easiest way to start is to create the tables in SQL and then point
the MS Access app to these tables. You will need to use the same table
design so it will be easy to follow. You can keep your existing
queries, forms, reports etc... so you keep the functionality of Access
with the back end of SQL which is far better IMO.

For the front end, you can't do this in SQL. You need something else
and seeing as you know Access, it's the best place for you to do this
and you don't need to re-do anything. All you need to do is make sure
you link to the SQL tables using ODBC and keep the naming convention
(for the links at least) the same. Everything else will either work,
or be as near as damn it.

I'd also recommend looking at www.mvps.org/access as this should have
plenty of helpful tips for you. Not sure what SQL stuff is there, but
it may help with a few other bits and bobs.

HTH

Ryan

"Clive Minnican" <clive@.mail.com> wrote in message news:<BeLUc.1603$CT4.510@.newsfe3-gui.ntli.net>...
> Hi there,
> I have written an application which uses MS Access for it's database engine.
> Due to the large size which the database has become I have decided that it
> would be sensible to use SQL Server with the application instead.
> I am an extreme SQL Server newbie so I am not really sure what I'm doing
> yet! I have successfully downloaded and installed the MS SQLDE 2000 and
> service pack 3.
> What do I need to do next? Ideally I would like to convert the existing
> Access database to MS SQL Server format. Also I would like to know if it is
> possible to create an SQL Server database from scratch using a gui
> environment similar to Access and if so which software (preferably free) do
> I need to achieve this?
> Many thanks,
> Clive.|||"Clive Minnican" <clive@.mail.com> wrote in message news:<BeLUc.1603$CT4.510@.newsfe3-gui.ntli.net>...
> Hi there,
> I have written an application which uses MS Access for it's database engine.
> Due to the large size which the database has become I have decided that it
> would be sensible to use SQL Server with the application instead.
> I am an extreme SQL Server newbie so I am not really sure what I'm doing
> yet! I have successfully downloaded and installed the MS SQLDE 2000 and
> service pack 3.
> What do I need to do next? Ideally I would like to convert the existing
> Access database to MS SQL Server format. Also I would like to know if it is
> possible to create an SQL Server database from scratch using a gui
> environment similar to Access and if so which software (preferably free) do
> I need to achieve this?
> Many thanks,
> Clive.

I believe that Access has an upsizing wizard which attempts to
automatically upgrade Access applications to MSSQL, although like all
platform migration tools it probably has a number of limitations. In
any case, you may get a better response to this in an Access newgroup.

http://www.aspfaq.com/show.asp?id=2182

As for GUIs for MSDE, see here:

http://www.aspfaq.com/show.asp?id=2442

Simon

Monday, March 19, 2012

Controlling the size of the Tempdb

Description:
Error: 9002, Severity: 17, State: 6
The log file for database 'tempdb' is full. Back up the
transaction log for the database to free up some log
space.
Rather than have to check the size of the tempdb.mdf every
day to make sure it's not consuming too much drive space,
we would like to find out if anyone has found an automated
way of backing up the tempdb to reduce the log size, or
maybe even schedule a restart of the SQL services in the
middle of the night to reset the log to its default size?
Any help would be greatly appreciated.
If it's growing too large, it's because your application requires it.
Either make more room on the disk for tempdb, move tempdb to a different
drive, or fix the application so it doesn't require so much space.
http://www.aspfaq.com/2446
Of course you can schedule a job to restart SQL Server, etc. But this is a
really bad hack at best.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Animatrix1" <anonymous@.discussions.microsoft.com> wrote in message
news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
> Description:
> Error: 9002, Severity: 17, State: 6
> The log file for database 'tempdb' is full. Back up the
> transaction log for the database to free up some log
> space.
> Rather than have to check the size of the tempdb.mdf every
> day to make sure it's not consuming too much drive space,
> we would like to find out if anyone has found an automated
> way of backing up the tempdb to reduce the log size, or
> maybe even schedule a restart of the SQL services in the
> middle of the night to reset the log to its default size?
> Any help would be greatly appreciated.
|||We've also had tempdb spiral out of control. We are
using PeopleSoft as the front end application, and I can
tell you with great assurance, that there is no possible
way the application requires a 20 gig tempdb, to support
a 5 gig database.
We find the tempdb slowly grows over time. Sometimes
quickly, normally slowly. The only solution we came up
with, was the limit the size of tempdb, to something
large, but not all consuming.
We have about 15 installations of PeopleSoft, of varying
version levels with SQLServer. I've only seen two of
them suffer from this problem. So it's certainly not the
norm.
Fred...

>--Original Message--
>If it's growing too large, it's because your application
requires it.
>Either make more room on the disk for tempdb, move
tempdb to a different
>drive, or fix the application so it doesn't require so
much space.
>http://www.aspfaq.com/2446
>Of course you can schedule a job to restart SQL Server,
etc. But this is a
>really bad hack at best.
>--
>Aaron Bertrand
>SQL Server MVP
>http://www.aspfaq.com/
>
>
>
>"Animatrix1" <anonymous@.discussions.microsoft.com> wrote
in message[vbcol=seagreen]
>news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
every[vbcol=seagreen]
space,[vbcol=seagreen]
automated[vbcol=seagreen]
the[vbcol=seagreen]
size?
>
>.
>

Controlling the size of the Tempdb

Description:
Error: 9002, Severity: 17, State: 6
The log file for database 'tempdb' is full. Back up the
transaction log for the database to free up some log
space.
Rather than have to check the size of the tempdb.mdf every
day to make sure it's not consuming too much drive space,
we would like to find out if anyone has found an automated
way of backing up the tempdb to reduce the log size, or
maybe even schedule a restart of the SQL services in the
middle of the night to reset the log to its default size?
Any help would be greatly appreciated.If it's growing too large, it's because your application requires it.
Either make more room on the disk for tempdb, move tempdb to a different
drive, or fix the application so it doesn't require so much space.
http://www.aspfaq.com/2446
Of course you can schedule a job to restart SQL Server, etc. But this is a
really bad hack at best.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Animatrix1" <anonymous@.discussions.microsoft.com> wrote in message
news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
> Description:
> Error: 9002, Severity: 17, State: 6
> The log file for database 'tempdb' is full. Back up the
> transaction log for the database to free up some log
> space.
> Rather than have to check the size of the tempdb.mdf every
> day to make sure it's not consuming too much drive space,
> we would like to find out if anyone has found an automated
> way of backing up the tempdb to reduce the log size, or
> maybe even schedule a restart of the SQL services in the
> middle of the night to reset the log to its default size?
> Any help would be greatly appreciated.|||We've also had tempdb spiral out of control. We are
using PeopleSoft as the front end application, and I can
tell you with great assurance, that there is no possible
way the application requires a 20 gig tempdb, to support
a 5 gig database.
We find the tempdb slowly grows over time. Sometimes
quickly, normally slowly. The only solution we came up
with, was the limit the size of tempdb, to something
large, but not all consuming.
We have about 15 installations of PeopleSoft, of varying
version levels with SQLServer. I've only seen two of
them suffer from this problem. So it's certainly not the
norm.
Fred...
>--Original Message--
>If it's growing too large, it's because your application
requires it.
>Either make more room on the disk for tempdb, move
tempdb to a different
>drive, or fix the application so it doesn't require so
much space.
>http://www.aspfaq.com/2446
>Of course you can schedule a job to restart SQL Server,
etc. But this is a
>really bad hack at best.
>--
>Aaron Bertrand
>SQL Server MVP
>http://www.aspfaq.com/
>
>
>
>"Animatrix1" <anonymous@.discussions.microsoft.com> wrote
in message
>news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
>> Description:
>> Error: 9002, Severity: 17, State: 6
>> The log file for database 'tempdb' is full. Back up the
>> transaction log for the database to free up some log
>> space.
>> Rather than have to check the size of the tempdb.mdf
every
>> day to make sure it's not consuming too much drive
space,
>> we would like to find out if anyone has found an
automated
>> way of backing up the tempdb to reduce the log size, or
>> maybe even schedule a restart of the SQL services in
the
>> middle of the night to reset the log to its default
size?
>> Any help would be greatly appreciated.
>
>.
>

Controlling the size of the Tempdb

Description:
Error: 9002, Severity: 17, State: 6
The log file for database 'tempdb' is full. Back up the
transaction log for the database to free up some log
space.
Rather than have to check the size of the tempdb.mdf every
day to make sure it's not consuming too much drive space,
we would like to find out if anyone has found an automated
way of backing up the tempdb to reduce the log size, or
maybe even schedule a restart of the SQL services in the
middle of the night to reset the log to its default size?
Any help would be greatly appreciated.If it's growing too large, it's because your application requires it.
Either make more room on the disk for tempdb, move tempdb to a different
drive, or fix the application so it doesn't require so much space.
http://www.aspfaq.com/2446
Of course you can schedule a job to restart SQL Server, etc. But this is a
really bad hack at best.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Animatrix1" <anonymous@.discussions.microsoft.com> wrote in message
news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
> Description:
> Error: 9002, Severity: 17, State: 6
> The log file for database 'tempdb' is full. Back up the
> transaction log for the database to free up some log
> space.
> Rather than have to check the size of the tempdb.mdf every
> day to make sure it's not consuming too much drive space,
> we would like to find out if anyone has found an automated
> way of backing up the tempdb to reduce the log size, or
> maybe even schedule a restart of the SQL services in the
> middle of the night to reset the log to its default size?
> Any help would be greatly appreciated.|||We've also had tempdb spiral out of control. We are
using PeopleSoft as the front end application, and I can
tell you with great assurance, that there is no possible
way the application requires a 20 gig tempdb, to support
a 5 gig database.
We find the tempdb slowly grows over time. Sometimes
quickly, normally slowly. The only solution we came up
with, was the limit the size of tempdb, to something
large, but not all consuming.
We have about 15 installations of PeopleSoft, of varying
version levels with SQLServer. I've only seen two of
them suffer from this problem. So it's certainly not the
norm.
Fred...

>--Original Message--
>If it's growing too large, it's because your application
requires it.
>Either make more room on the disk for tempdb, move
tempdb to a different
>drive, or fix the application so it doesn't require so
much space.
>http://www.aspfaq.com/2446
>Of course you can schedule a job to restart SQL Server,
etc. But this is a
>really bad hack at best.
>--
>Aaron Bertrand
>SQL Server MVP
>http://www.aspfaq.com/
>
>
>
>"Animatrix1" <anonymous@.discussions.microsoft.com> wrote
in message
>news:4d2601c42c6b$7e9f2be0$a601280a@.phx.gbl...
every[vbcol=seagreen]
space,[vbcol=seagreen]
automated[vbcol=seagreen]
the[vbcol=seagreen]
size?[vbcol=seagreen]
>
>.
>

Controlling the resultset size.

I'm using a report basically as a form. In this form I want the same number of lineitems no matter if I have 2 rows of data or 5 rows of data in my resultset. I basically want extra blank lines to roundout the resultset. The reason, is that with extra rows people printing the form can write additional data. Also, it will preseve the formatting. So I either need a way to tell a table in SSRS that it needs to have a minimum number of rows, OR, I need a way to add extra blank/null rows to a result set. Any ideas?

Hello,

I just developed a working solution to the same problem a few minutes ago. My problem was that the footer in the table was appearing in random places depending on the number of rows returned. I can fit 7 rows, so I needed to pad out additional rows to equal 7. So, I had to add additional data to the SQL resultset to do this. After my stored procedure produced a resultset, I immediately invoked this function to add more rows before returning to the report. Hope this helps. If anyone has an elegant solution, please post, I would like to implement it!

ALTER FUNCTION [dbo].[fCreateBlankTblRows]
(
@.nbrRows //my stored procedure figured out how many rows were returned and how many more were needed.
)

RETURNS
@.my_temp_tbl TABLE
(
id int,
id2 int,
xyx int
)
AS
BEGIN
Declare @.loopCount int;
set @.loopCount = 0;
WHILE (@.loopCount < @.nbrRows)
Begin
INSERT INTO @.my_temp_tbl
(id, id2, xyz)
VALUES (null,null,null);
set @.loopCount = @.loopCount + 1;
End;
RETURN
END

controlling temdb size

We have a create table query against 2 large tables (about 12 gig) that
balloons our tempdb to about 17 gigs. Is there a way to constrain the growt
h
of tempdb by turning off logging of some operations. The query is fairly
clean and the join and group by clauses are fully covered by indexes.There is no way to turn off logging. Is it the log file that is ballooning
or the data file? If it's the data file (which I suspect is most of it)
then logging has nothing to do with it anyway. You can pretty much expect a
lot of activity in TempDB when you have that much data that you are joining
and especially grouping by. It has to keep the intermediate results
somewhere while it groups them and that is tempdb. Maybe if you post the DDL
for the tables involved and the actual query someone can suggest something.
Andrew J. Kelly SQL MVP
"Consultant Mark" <Consultant Mark@.discussions.microsoft.com> wrote in
message news:85E3C12A-EB74-4489-916A-7E15FAB04AA4@.microsoft.com...
> We have a create table query against 2 large tables (about 12 gig) that
> balloons our tempdb to about 17 gigs. Is there a way to constrain the
> growth
> of tempdb by turning off logging of some operations. The query is fairly
> clean and the join and group by clauses are fully covered by indexes.|||Andrew,
Thanks for your reply. The problem is the tempdb file, not the data file.
Using table hints to force use of appropriate indexes and a 'merge' join hin
t
the query now has the same 1hr 50min time but only brought temdb to 9 gig
(rather than 17gig). Below is the DDL for the table and query. By the way
the accnt table is 1.1 million rows and the proft table is 25 million rows.
___
CREATE TABLE [dbo].[accnt] (
[FIRM_ID] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ACCT_NO] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[DATABASE_DATE] [smalldatetime] NULL ,
[REP] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[BRANCHLABEL] [char] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[REGIONLABEL] [char] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[BAL_OTHR] [money] NOT NULL ,
[CNT_OTHR] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[proft] (
[FIRM_ID] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ACCT_NO] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[DATABASE_DATE] [smalldatetime] NULL ,
[HOUSE_REVENUE] [money] NOT NULL ,
[TRADING_REVENUE] [money] NOT NULL ,
[TOTAL_EXPENSE] [money] NOT NULL ,
[CLIENT_PROFITABILITY] [money] NOT NULL ,
[HasParent] [bit] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[accnt] WITH NOCHECK ADD
CONSTRAINT [PK_firm_acct] PRIMARY KEY CLUSTERED
([FIRM_ID],[ACCT_NO]) ON [PRIMARY]
GO
CREATE INDEX [FIRM_ID_ind] ON [dbo].[accnt]([FIRM_ID]) ON [PRIMARY]
GO
CREATE INDEX [ACCT_NO_ind] ON [dbo].[accnt]([ACCT_NO]) ON [PRIMARY]
GO
CREATE INDEX [DATABASE_DATE_ind] ON [dbo].[accnt]([DATABASE_DATE]) ON
[PRIMARY]
GO
CREATE INDEX [REP_ind] ON [dbo].[accnt]([REP]) ON [PRIMARY]
GO
CREATE INDEX [BRANCHLABEL_ind] ON [dbo].[accnt]([BRANCHLABEL]) ON [PRIMARY]
GO
CREATE INDEX [REGIONLABEL_ind] ON [dbo].[accnt]([REGIONLABEL]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[proft] ADD
CONSTRAINT [HasParentDefault] DEFAULT (0) FOR [HasParent]
GO
CREATE INDEX [HasParent_ind] ON [dbo].[proft]([HasParent]) ON [PRIMARY]
GO
CREATE INDEX [FIRM_ID_ind] ON [dbo].[proft]([FIRM_ID]) ON [PRIMARY]
GO
CREATE INDEX [ACCT_NO_ind] ON [dbo].[proft]([ACCT_NO]) ON [PRIMARY]
GO
CREATE INDEX [FIRMACCT_ind] ON [dbo].[proft]([FIRM_ID], [ACCT_NO]) ON
[PRIMARY]
GO
ALTER TABLE [dbo].[proft] ADD
CONSTRAINT [FK_proft_accnt] FOREIGN KEY ([FIRM_ID],[ACCT_NO])
REFERENCES [dbo].[accnt] ([FIRM_ID],[ACCT_NO])
GO
SELECT
accnt.BRANCHLABEL,
accnt.REP,
proft.DATABASE_DATE,
accnt.REGIONLABEL,
COUNT(*) AS ACCOUNTS,
SUM(proft.HOUSE_REVENUE) AS HOUSE_REVENUE,
SUM(proft.TRADING_REVENUE) AS TRADING_REVENUE,
SUM(proft.TOTAL_EXPENSE) AS TOTAL_EXPENSE,
SUM(proft.CLIENT_PROFITABILITY) AS CLIENT_PROFITABILITY,
SUM(CAST(0 AS money)) AS OTHER_REVENUE
INTO RepMonth
FROM accnt WITH (INDEX (pk_firm_acct))
INNER MERGE JOIN proft WITH (INDEX (FIRMACCT_ind))
ON accnt.FIRM_ID = proft.FIRM_ID AND accnt.ACCT_NO = proft.ACCT_NO
GROUP BY accnt.REGIONLABEL, accnt.BRANCHLABEL, accnt.REP, proft.DATABASE_DAT
E
ORDER BY accnt.BRANCHLABEL, accnt.REP, proft.DATABASE_DATE, accnt.REGIONLABE
L
___
"Andrew J. Kelly" wrote:

> There is no way to turn off logging. Is it the log file that is balloonin
g
> or the data file? If it's the data file (which I suspect is most of it)
> then logging has nothing to do with it anyway. You can pretty much expect
a
> lot of activity in TempDB when you have that much data that you are joinin
g
> and especially grouping by. It has to keep the intermediate results
> somewhere while it groups them and that is tempdb. Maybe if you post the D
DL
> for the tables involved and the actual query someone can suggest something
.
> --
> Andrew J. Kelly SQL MVP
>
> "Consultant Mark" <Consultant Mark@.discussions.microsoft.com> wrote in
> message news:85E3C12A-EB74-4489-916A-7E15FAB04AA4@.microsoft.com...
>
>|||OK well each database including tempdb has at least one data file and one
log file. The data file normally has a .mdf extension and the log file has
a .ldf extension. Which one of these for TempDB is growing to 17GB? A
couple of comments from what I see here. You don't have a primary Key
defined on the Proft table and you don't have a clustered index on that
table either. Both of which are very important. I suggest you drop the
nonclustered index on Firm_ID, ACCT_NO and create a clustered index on
Firm_ID, ACCT_NO instead. That will allow the two tables to be joined in a
true merge fashion using the clustered indexes and should dramatically cut
down on the time to do this. You might even consider making the clustered
indexes on both these tables with ACCT_NO as the first column instead of
Firm_ID. The reason being that this is more selective but this depends a
lot on how you access these tables. Do you look for Acc_No or Firm_ID more?
In either case there is no need to have a non-clustered index on Firm_ID if
the clustered index already has Firm_ID as the first column in the index
expression. Also why does the Order By have the same columns as the group by
but in a different order? It may help to have them the same so the engine
does not potentially have to order twice.
Andrew J. Kelly SQL MVP
"Consultant Mark" <ConsultantMark@.discussions.microsoft.com> wrote in
message news:95D8D214-FFA2-4C49-A6D9-64AE8CDDF645@.microsoft.com...
> Andrew,
> Thanks for your reply. The problem is the tempdb file, not the data file.
> Using table hints to force use of appropriate indexes and a 'merge' join
> hint
> the query now has the same 1hr 50min time but only brought temdb to 9 gig
> (rather than 17gig). Below is the DDL for the table and query. By the
> way
> the accnt table is 1.1 million rows and the proft table is 25 million
> rows.
> ___
> CREATE TABLE [dbo].[accnt] (
> [FIRM_ID] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [ACCT_NO] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [DATABASE_DATE] [smalldatetime] NULL ,
> [REP] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [BRANCHLABEL] [char] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [REGIONLABEL] [char] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [BAL_OTHR] [money] NOT NULL ,
> [CNT_OTHR] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> CREATE TABLE [dbo].[proft] (
> [FIRM_ID] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [ACCT_NO] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [DATABASE_DATE] [smalldatetime] NULL ,
> [HOUSE_REVENUE] [money] NOT NULL ,
> [TRADING_REVENUE] [money] NOT NULL ,
> [TOTAL_EXPENSE] [money] NOT NULL ,
> [CLIENT_PROFITABILITY] [money] NOT NULL ,
> [HasParent] [bit] NOT NULL
> ) ON [PRIMARY]
> GO
>
> ALTER TABLE [dbo].[accnt] WITH NOCHECK ADD
> CONSTRAINT [PK_firm_acct] PRIMARY KEY CLUSTERED
> ([FIRM_ID],[ACCT_NO]) ON [PRIMARY]
> GO
> CREATE INDEX [FIRM_ID_ind] ON [dbo].[accnt]([FIRM_ID]) ON [PRIMARY]
> GO
> CREATE INDEX [ACCT_NO_ind] ON [dbo].[accnt]([ACCT_NO]) ON [PRIMARY]
> GO
> CREATE INDEX [DATABASE_DATE_ind] ON [dbo].[accnt]([DATABASE_DATE]) ON
> [PRIMARY]
> GO
> CREATE INDEX [REP_ind] ON [dbo].[accnt]([REP]) ON [PRIMARY]
> GO
> CREATE INDEX [BRANCHLABEL_ind] ON [dbo].[accnt]([BRANCHLABEL]) ON
> [PRIMARY]
> GO
> CREATE INDEX [REGIONLABEL_ind] ON [dbo].[accnt]([REGIONLABEL]) ON
> [PRIMARY]
> GO
> ALTER TABLE [dbo].[proft] ADD
> CONSTRAINT [HasParentDefault] DEFAULT (0) FOR [HasParent]
> GO
> CREATE INDEX [HasParent_ind] ON [dbo].[proft]([HasParent]) ON [PRIMARY]
> GO
> CREATE INDEX [FIRM_ID_ind] ON [dbo].[proft]([FIRM_ID]) ON [PRIMARY]
> GO
> CREATE INDEX [ACCT_NO_ind] ON [dbo].[proft]([ACCT_NO]) ON [PRIMARY]
> GO
> CREATE INDEX [FIRMACCT_ind] ON [dbo].[proft]([FIRM_ID], [ACCT_NO]) ON
> [PRIMARY]
> GO
> ALTER TABLE [dbo].[proft] ADD
> CONSTRAINT [FK_proft_accnt] FOREIGN KEY ([FIRM_ID],[ACCT_NO])
> REFERENCES [dbo].[accnt] ([FIRM_ID],[ACCT_NO])
> GO
> SELECT
> accnt.BRANCHLABEL,
> accnt.REP,
> proft.DATABASE_DATE,
> accnt.REGIONLABEL,
> COUNT(*) AS ACCOUNTS,
> SUM(proft.HOUSE_REVENUE) AS HOUSE_REVENUE,
> SUM(proft.TRADING_REVENUE) AS TRADING_REVENUE,
> SUM(proft.TOTAL_EXPENSE) AS TOTAL_EXPENSE,
> SUM(proft.CLIENT_PROFITABILITY) AS CLIENT_PROFITABILITY,
> SUM(CAST(0 AS money)) AS OTHER_REVENUE
> INTO RepMonth
> FROM accnt WITH (INDEX (pk_firm_acct))
> INNER MERGE JOIN proft WITH (INDEX (FIRMACCT_ind))
> ON accnt.FIRM_ID = proft.FIRM_ID AND accnt.ACCT_NO = proft.ACCT_NO
> GROUP BY accnt.REGIONLABEL, accnt.BRANCHLABEL, accnt.REP,
> proft.DATABASE_DATE
> ORDER BY accnt.BRANCHLABEL, accnt.REP, proft.DATABASE_DATE,
> accnt.REGIONLABEL
> ___
> "Andrew J. Kelly" wrote:
>|||Andrew,
Thanks. Not quite sure why the order and group by statements have different
field order, but that's easy to fix.
The mdf for tempdb is the one growing.
We will try variations of your good suggestions. Firm_id is baggage, part
of the account number and in this implementation of the database always
containing the same value, so we will flip that around.
Monthly we use DTS to add 1 million records to proft and drop and replace
all rows in the accnt table. Because the proft is so large I drop and
rebuild all indexes (loading the data in between), so if I have a primary ke
y
I have to deal with all the dependencies, constraints, etc. Proft by the wa
y
is unique on acct_no, firm_id, database_date, so its primary key would need
all three but this field order should be ok.
With the foreign key constraint connecting proft into accnt I assumed the db
engine would recognize what is supposed to be happening.
"Andrew J. Kelly" wrote:

> OK well each database including tempdb has at least one data file and one
> log file. The data file normally has a .mdf extension and the log file ha
s
> a .ldf extension. Which one of these for TempDB is growing to 17GB? A
> couple of comments from what I see here. You don't have a primary Key
> defined on the Proft table and you don't have a clustered index on that
> table either. Both of which are very important. I suggest you drop the
> nonclustered index on Firm_ID, ACCT_NO and create a clustered index on
> Firm_ID, ACCT_NO instead. That will allow the two tables to be joined in
a
> true merge fashion using the clustered indexes and should dramatically cu
t
> down on the time to do this. You might even consider making the clustered
> indexes on both these tables with ACCT_NO as the first column instead of
> Firm_ID. The reason being that this is more selective but this depends a
> lot on how you access these tables. Do you look for Acc_No or Firm_ID mor
e?
> In either case there is no need to have a non-clustered index on Firm_ID i
f
> the clustered index already has Firm_ID as the first column in the index
> expression. Also why does the Order By have the same columns as the group
by
> but in a different order? It may help to have them the same so the engine
> does not potentially have to order twice.
> --
> Andrew J. Kelly SQL MVP
>
> "Consultant Mark" <ConsultantMark@.discussions.microsoft.com> wrote in
> message news:95D8D214-FFA2-4C49-A6D9-64AE8CDDF645@.microsoft.com...
>
>|||If the data file keeps growing back to that size then you should leave it
there. Growing a data file is very expensive. There is no penalty for too
much free space but a big one for too little. If Firm_ID is always the same
value I would argue that you don't have it in the Clustered index at all.
The column(s) of the clustered index are appended to the end of all the
nonclustered indexes so you are propagating 4 bytes per row * every
nonclustered index. Let us know how it works out.
Andrew J. Kelly SQL MVP
"Consultant Mark" <ConsultantMark@.discussions.microsoft.com> wrote in
message news:36502EBA-6CFA-4F94-92B8-1402769CE178@.microsoft.com...
> Andrew,
> Thanks. Not quite sure why the order and group by statements have
> different
> field order, but that's easy to fix.
> The mdf for tempdb is the one growing.
> We will try variations of your good suggestions. Firm_id is baggage, part
> of the account number and in this implementation of the database always
> containing the same value, so we will flip that around.
> Monthly we use DTS to add 1 million records to proft and drop and replace
> all rows in the accnt table. Because the proft is so large I drop and
> rebuild all indexes (loading the data in between), so if I have a primary
> key
> I have to deal with all the dependencies, constraints, etc. Proft by the
> way
> is unique on acct_no, firm_id, database_date, so its primary key would
> need
> all three but this field order should be ok.
> With the foreign key constraint connecting proft into accnt I assumed the
> db
> engine would recognize what is supposed to be happening.
> "Andrew J. Kelly" wrote:
>

Controlling size of database log

Hi,
Our production database log size (9 GB) is 3 times greater than size of the
actual database itself (3GB)!
Is it normal? If not how can I bring the log size down? Can someone let me
know please.
Thanks in advance,
Harish Mohanbabuback it up.
BACKUP LOG databaseName
you can even back it up just to truncate it.
BACKUP LOG databaseName WITH TRUNCATE_ONLY
Greg Jackson
PDX, Oregon|||In addition to pdxjaxon,
you can run DBCC Shrinkfile, to reduce the physical log file size to the
desired target size.
Thanks
Yogish
"pdxJaxon" wrote:

> back it up.
> BACKUP LOG databaseName
>
> you can even back it up just to truncate it.
> BACKUP LOG databaseName WITH TRUNCATE_ONLY
>
> Greg Jackson
> PDX, Oregon
>
>|||And also check the recovery model for the database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yogish" <yogishkamathg@.icqmail.com> wrote in message
news:DDB0D749-6F74-4673-993E-A5767020BFD6@.microsoft.com...[vbcol=seagreen]
> In addition to pdxjaxon,
> you can run DBCC Shrinkfile, to reduce the physical log file size to the
> desired target size.
> --
> Thanks
> Yogish
> "pdxJaxon" wrote:
>

Controlling size of database log

Hi,
Our production database log size (9 GB) is 3 times greater than size of the
actual database itself (3GB)!
Is it normal? If not how can I bring the log size down? Can someone let me
know please.
Thanks in advance,
Harish Mohanbabu
back it up.
BACKUP LOG databaseName
you can even back it up just to truncate it.
BACKUP LOG databaseName WITH TRUNCATE_ONLY
Greg Jackson
PDX, Oregon
|||In addition to pdxjaxon,
you can run DBCC Shrinkfile, to reduce the physical log file size to the
desired target size.
Thanks
Yogish
"pdxJaxon" wrote:

> back it up.
> BACKUP LOG databaseName
>
> you can even back it up just to truncate it.
> BACKUP LOG databaseName WITH TRUNCATE_ONLY
>
> Greg Jackson
> PDX, Oregon
>
>
|||And also check the recovery model for the database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yogish" <yogishkamathg@.icqmail.com> wrote in message
news:DDB0D749-6F74-4673-993E-A5767020BFD6@.microsoft.com...[vbcol=seagreen]
> In addition to pdxjaxon,
> you can run DBCC Shrinkfile, to reduce the physical log file size to the
> desired target size.
> --
> Thanks
> Yogish
> "pdxJaxon" wrote:

Controlling size of database log

Hi,
Our production database log size (9 GB) is 3 times greater than size of the
actual database itself (3GB)!
Is it normal? If not how can I bring the log size down? Can someone let me
know please.
Thanks in advance,
Harish Mohanbabuback it up.
BACKUP LOG databaseName
you can even back it up just to truncate it.
BACKUP LOG databaseName WITH TRUNCATE_ONLY
Greg Jackson
PDX, Oregon|||In addition to pdxjaxon,
you can run DBCC Shrinkfile, to reduce the physical log file size to the
desired target size.
--
Thanks
Yogish
"pdxJaxon" wrote:
> back it up.
> BACKUP LOG databaseName
>
> you can even back it up just to truncate it.
> BACKUP LOG databaseName WITH TRUNCATE_ONLY
>
> Greg Jackson
> PDX, Oregon
>
>|||And also check the recovery model for the database.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yogish" <yogishkamathg@.icqmail.com> wrote in message
news:DDB0D749-6F74-4673-993E-A5767020BFD6@.microsoft.com...
> In addition to pdxjaxon,
> you can run DBCC Shrinkfile, to reduce the physical log file size to the
> desired target size.
> --
> Thanks
> Yogish
> "pdxJaxon" wrote:
>> back it up.
>> BACKUP LOG databaseName
>>
>> you can even back it up just to truncate it.
>> BACKUP LOG databaseName WITH TRUNCATE_ONLY
>>
>> Greg Jackson
>> PDX, Oregon
>>

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
Greg
What recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Sunday, March 11, 2012

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
GregWhat recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
--
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Controlling log file size

My log file size is 38 GB and database file is only 1.5
GB. Only 8 GB space is left to cover the entire disk
space. I backed up the log file and shrink the database
to 10% but it released only 3 GB disk space. What would
be the best way to further reduce the log file size and
control the growth at this point?
Thanks in advance...Hi Jessica,
It should work if u have done exactly as shown in the
below KB
INF: Shrinking the Transaction Log in SQL Server 2000 with
DBCC SHRINKFILE
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;272318
Also do a frequent transaction log backups to over come
this . You can also turn the Database from FULL recovery
to SIMPLE recovery if your data is not critical so that
the log is truncated immediately.
There are some other pointers on MS site which tell why a
Tran. log grows rapidly.
HTH
--
Regards
Thirumal
www.thirumal.com
>--Original Message--
>My log file size is 38 GB and database file is only 1.5
>GB. Only 8 GB space is left to cover the entire disk
>space. I backed up the log file and shrink the database
>to 10% but it released only 3 GB disk space. What would
>be the best way to further reduce the log file size and
>control the growth at this point?
>Thanks in advance...
>.
>

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
GregWhat recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Control the size of a text box via a report parameter

We have some note fields that are very large so reports take up too many
pages.
However we would like to either limit the field to lets say 4 lines or all
lines via some parameter.
Is there any way to do this?Did you look into using the Left() function to limit the field content to a
certain length based on a report parameter? You could use an expression
similar to this for the textbox value property:
=iif(Parameters!RestrictLength.Value = True,
Left(Fields!LongDescription.Value, 200), Fields!LongDescription.Value)
MSDN documentation for Left():
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctLeft.asp
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kyle Jedrusiak" <kjedrusiak@.princetoninformation.com> wrote in message
news:eMmW3XeFFHA.3272@.TK2MSFTNGP10.phx.gbl...
> We have some note fields that are very large so reports take up too many
> pages.
> However we would like to either limit the field to lets say 4 lines or all
> lines via some parameter.
> Is there any way to do this?
>

Tuesday, February 14, 2012

Constraints on Table Field

Hi,

I have a table which saves attachment files.

I need to create a constraint on table which will restrict the size of attachments in the table. How this can be done? I know we can create a check constraint on table but how to restrict the field size? Pls. advise. Thanks in advance.

Are you storing your files as text in the table? If so you might be able to do something checking the datalength like:

create table dbo.testor
( targetFile nvarchar(max)
check ( datalength(targetFile) <= 30000 )
)

|||

Thanks for your response.

I am using image as datatype to attach files. I need to restrict this column size to only accept 50 kb size.

Thanks,

Sunday, February 12, 2012

Constant table size?

Hi, thanks for taking a minute to help me out.

I've got a bunch of reports that have very specific formatting requirements (not mine, industry standards). Basically I need to have different headers and footers on each page, so I don't think I can use the report's headers and footers. Instead I'd like to use each table's (one for each page) set of headers and footers. This is fine for getting the data in there, but I'd like the table footer to be forced to be at the bottom of the page because having a footer halfway down just looks bad.

To summarize, is it possible to have a table footer be in the same place on a page (almost) regardless of how many rows there are returned.
pg1 pg2
header header
data data
data
footer footer

I'd prefer not to split each page into a different report and use those footers, so if there are any other hacks out there I'd really appreciate it

Thanks, JeffWell I do have an ugly way: add enough rows (of the data row's height) to the table footer to put the footer in the right position. Then add an expression to each one's visibility to toggle the first one off when 2 data rows are returned, and toggle the second when 3 data rows are returned, etc.

Any neater, less intensive ideas?
-Jeff

Friday, February 10, 2012

Consolidation question

I have to move a database from Server A to Server B. I have checked the space
and CPU utilization on both the servers. The database size is 5 GB and there
are 50 concurrent users.
Server A - source server
CPU utilization - <25 %
Available space - 80 Gb
Memory - 2 GB
Memory used by sqlserver.exe - 1800 MB
Memory configured for dynamic allocation by sql server upto 2GB
Server B - destination server
CPU utilization - <10 %
Available space - 80 Gb
Memory - 1795 MB
Memory used by sqlserver.exe - 1500 MB
Memory configured for dynamic allocation by sql server upto 1795 MB
How do I find out if the memory is going to be sufficient after the move? I
ma thinking of reducing the memory allocated to sql servers on both Server A
and Server B to just 1 GB and see the performance of both the servers. If
tehy perform OK at reduced memory then I will assume the memory on
destination Server B will be good enough for the new database. Any insight
will be highly appreciated. Thanks.sharman,
SQL Server uses as much space as it can in its address space unless it has
to give up memory to other processes. But this memory need is not doubled
when you bring another database and 50 users online. The impact on memory
is probably rather small. Certainly, I don't think that restricting memory
on the two servers will give you a meaningful measure for what will happen
when they are brought together on one server.
Of course, you are expecting CPU utilization to go up. Something else that
you should check on each server is the SQL Servers: Buffer Manager \ Page
Life Expectancy. If they are consistently under 300 seconds, that may
indicate that there is too little memory for the active buffer contents,
which will mean more I/O and CPU.
RLF
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:96430D73-D40A-4961-A95C-00C7E2F0CD89@.microsoft.com...
>I have to move a database from Server A to Server B. I have checked the
>space
> and CPU utilization on both the servers. The database size is 5 GB and
> there
> are 50 concurrent users.
> Server A - source server
> CPU utilization - <25 %
> Available space - 80 Gb
> Memory - 2 GB
> Memory used by sqlserver.exe - 1800 MB
> Memory configured for dynamic allocation by sql server upto 2GB
> Server B - destination server
> CPU utilization - <10 %
> Available space - 80 Gb
> Memory - 1795 MB
> Memory used by sqlserver.exe - 1500 MB
> Memory configured for dynamic allocation by sql server upto 1795 MB
> How do I find out if the memory is going to be sufficient after the move?
> I
> ma thinking of reducing the memory allocated to sql servers on both Server
> A
> and Server B to just 1 GB and see the performance of both the servers. If
> tehy perform OK at reduced memory then I will assume the memory on
> destination Server B will be good enough for the new database. Any insight
> will be highly appreciated. Thanks.|||Hi Russell,
Thanks for the info. I did a quick check of Page Life Expectancy on both the
servers. These are the typical values that I found.
Sever to which the db will be moved = 33270 (average)
Server on which the db currently resides = varies between 282 to 378
"Russell Fields" wrote:
> sharman,
> SQL Server uses as much space as it can in its address space unless it has
> to give up memory to other processes. But this memory need is not doubled
> when you bring another database and 50 users online. The impact on memory
> is probably rather small. Certainly, I don't think that restricting memory
> on the two servers will give you a meaningful measure for what will happen
> when they are brought together on one server.
> Of course, you are expecting CPU utilization to go up. Something else that
> you should check on each server is the SQL Servers: Buffer Manager \ Page
> Life Expectancy. If they are consistently under 300 seconds, that may
> indicate that there is too little memory for the active buffer contents,
> which will mean more I/O and CPU.
> RLF
> "sharman" <sharman@.discussions.microsoft.com> wrote in message
> news:96430D73-D40A-4961-A95C-00C7E2F0CD89@.microsoft.com...
> >I have to move a database from Server A to Server B. I have checked the
> >space
> > and CPU utilization on both the servers. The database size is 5 GB and
> > there
> > are 50 concurrent users.
> >
> > Server A - source server
> > CPU utilization - <25 %
> > Available space - 80 Gb
> > Memory - 2 GB
> > Memory used by sqlserver.exe - 1800 MB
> > Memory configured for dynamic allocation by sql server upto 2GB
> >
> > Server B - destination server
> > CPU utilization - <10 %
> > Available space - 80 Gb
> > Memory - 1795 MB
> > Memory used by sqlserver.exe - 1500 MB
> > Memory configured for dynamic allocation by sql server upto 1795 MB
> >
> > How do I find out if the memory is going to be sufficient after the move?
> > I
> > ma thinking of reducing the memory allocated to sql servers on both Server
> > A
> > and Server B to just 1 GB and see the performance of both the servers. If
> > tehy perform OK at reduced memory then I will assume the memory on
> > destination Server B will be good enough for the new database. Any insight
> > will be highly appreciated. Thanks.
>
>|||Sharman,
It looks like you are on the low, but acceptable side of Page Life
Expectancy. However, reviewing your notes says that you are moving to the
server with a couple hundred megabytes less memory. So you may find
yourself experiencing some memory pressure issues when the memory load moves
machines.
It looks like you are fine with your CPU for the time being, but it would be
good to bump up your memory a bit, if you can.
You did not mention which version of OS and SQL Server you are running, but
those will make a difference in your memory options.
RLF
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:A552585E-485D-4149-B797-A014B1E2BAAA@.microsoft.com...
> Hi Russell,
> Thanks for the info. I did a quick check of Page Life Expectancy on both
> the
> servers. These are the typical values that I found.
> Sever to which the db will be moved = 33270 (average)
> Server on which the db currently resides = varies between 282 to 378
> "Russell Fields" wrote:
>> sharman,
>> SQL Server uses as much space as it can in its address space unless it
>> has
>> to give up memory to other processes. But this memory need is not
>> doubled
>> when you bring another database and 50 users online. The impact on
>> memory
>> is probably rather small. Certainly, I don't think that restricting
>> memory
>> on the two servers will give you a meaningful measure for what will
>> happen
>> when they are brought together on one server.
>> Of course, you are expecting CPU utilization to go up. Something else
>> that
>> you should check on each server is the SQL Servers: Buffer Manager \ Page
>> Life Expectancy. If they are consistently under 300 seconds, that may
>> indicate that there is too little memory for the active buffer contents,
>> which will mean more I/O and CPU.
>> RLF
>> "sharman" <sharman@.discussions.microsoft.com> wrote in message
>> news:96430D73-D40A-4961-A95C-00C7E2F0CD89@.microsoft.com...
>> >I have to move a database from Server A to Server B. I have checked the
>> >space
>> > and CPU utilization on both the servers. The database size is 5 GB and
>> > there
>> > are 50 concurrent users.
>> >
>> > Server A - source server
>> > CPU utilization - <25 %
>> > Available space - 80 Gb
>> > Memory - 2 GB
>> > Memory used by sqlserver.exe - 1800 MB
>> > Memory configured for dynamic allocation by sql server upto 2GB
>> >
>> > Server B - destination server
>> > CPU utilization - <10 %
>> > Available space - 80 Gb
>> > Memory - 1795 MB
>> > Memory used by sqlserver.exe - 1500 MB
>> > Memory configured for dynamic allocation by sql server upto 1795 MB
>> >
>> > How do I find out if the memory is going to be sufficient after the
>> > move?
>> > I
>> > ma thinking of reducing the memory allocated to sql servers on both
>> > Server
>> > A
>> > and Server B to just 1 GB and see the performance of both the servers.
>> > If
>> > tehy perform OK at reduced memory then I will assume the memory on
>> > destination Server B will be good enough for the new database. Any
>> > insight
>> > will be highly appreciated. Thanks.
>>