Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Add Data files dynamically based no of cpu's
Add Data files dynamically based no of cpu's
Rate Topic
Display Mode
Topic Options
Author
Message
@SQLFRNDZ
@SQLFRNDZ
Posted Wednesday, December 19, 2012 5:44 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 4:05 PM
Points: 412,
Visits: 857
Here is the scenario:
Step1: Verify number of CPU's
SELECT cpu_count FROM sys.dm_os_sys_info
Step2: Verify number of Datafiles
select COUNT(*)-1 from tempdb.sys.sysfiles
Step 3: If Count in steps and step2, we need add additional files using t-sql ?
Can I get help with script please ?
--
SQLFRNDZ
Post #1398721
SQLRNNR
SQLRNNR
Posted Wednesday, December 19, 2012 9:24 PM
SSCoach
Group: General Forum Members
Last Login: 2 days ago @ 1:46 PM
Points: 18,732,
Visits: 12,329
Are these the only considerations for this script? Or do you also want to adhere to BP recommendations as can be found
here
?
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1398759
@SQLFRNDZ
@SQLFRNDZ
Posted Thursday, December 20, 2012 11:07 AM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 4:05 PM
Points: 412,
Visits: 857
Yes, I need only the script..Appreciate your help!
--
SQLFRNDZ
Post #1399073
GilaMonster
GilaMonster
Posted Thursday, December 20, 2012 12:26 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 8:45 AM
Points: 37,637,
Visits: 29,891
Err...bad idea. Really bad idea.
One file per core is an old recommendation, it's not a good idea under all circumstances without consideration or investigation.
http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-%281230%29-tempdb-should-always-have-one-data-file-per-processor-core.aspx
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1399087
@SQLFRNDZ
@SQLFRNDZ
Posted Thursday, December 20, 2012 4:29 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 4:05 PM
Points: 412,
Visits: 857
I knew it is bad practise for tempdb but want to see how we can write a query to dynamically add files based on a condition.
--
SQLFRNDZ
Post #1399130
SQLRNNR
SQLRNNR
Posted Thursday, December 20, 2012 4:33 PM
SSCoach
Group: General Forum Members
Last Login: 2 days ago @ 1:46 PM
Points: 18,732,
Visits: 12,329
Well, what have you got for your script so far?
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1399131
@SQLFRNDZ
@SQLFRNDZ
Posted Thursday, December 20, 2012 5:42 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 4:05 PM
Points: 412,
Visits: 857
SQLRNNR (12/20/2012)
Well, what have you got for your script so far?
This is what I got so far and I need help with looping script to add files to number of times based on condition cpu_count.
Here is the script I'm able to write so far
DEclare @value1 int
DEclare @value2 int
DECLARE @OUTPUT Varchar(100)
select @value1=COUNT(*)-1 from sys.sysfiles
SELECT @value2=cpu_count FROM sys.dm_os_sys_info
select @OUTPUT =
Case when @value1 = @value2 THEN 'GoodToGo'
ELSE "-- Needs a Script Here --"
END
SELECT @OUTPUT [TEMPDB FILES]
GO
--
SQLFRNDZ
Post #1399139
SQLRNNR
SQLRNNR
Posted Thursday, December 20, 2012 9:30 PM
SSCoach
Group: General Forum Members
Last Login: 2 days ago @ 1:46 PM
Points: 18,732,
Visits: 12,329
@SQLFRNDZ (12/20/2012)
This is what I got so far and I need help with looping script to add files to number of times based on condition cpu_count.
Here is the script I'm able to write so far
DEclare @value1 int
DEclare @value2 int
DECLARE @OUTPUT Varchar(100)
select @value1=COUNT(*)-1 from sys.sysfiles
SELECT @value2=cpu_count FROM sys.dm_os_sys_info
select @OUTPUT =
Case when @value1 = @value2 THEN 'GoodToGo'
ELSE "-- Needs a Script Here --"
END
SELECT @OUTPUT [TEMPDB FILES]
GO
Ok, from there - what would you pseudo-code to achieve your goal?
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1399174
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.