Thursday, March 29, 2012
Getting the physical directory that the log file is located
SQL Server.
I am using
SELECT Filename FROM master.dbo.sysdatabases
to get the data directory, now I need to find the log files.
Thanks,
RSHmaster..sysaltfiles or dbname..sysfiles
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"RSH" <way_beyond_oops@.yahoo.com> wrote in message news:eFWU7uc%23FHA.3064@.TK2MSFTNGP10.phx
.gbl...
>I am trying to programatically determine the directory of the log files in
> SQL Server.
> I am using
> SELECT Filename FROM master.dbo.sysdatabases
> to get the data directory, now I need to find the log files.
>
> Thanks,
> RSH
>|||There are some issues with this - like suppose you multiple data files
and/or multiple log files.
However, assuming one data file and one log file, then the file that is
not the data file is the log file...
SELECT filename
FROM sysfiles
WHERE filename NOT IN
(SELECT filename FROM master..sysdatabases WHERE name = db_name())
Payson
RSH wrote:
> I am trying to programatically determine the directory of the log files in
> SQL Server.
> I am using
> SELECT Filename FROM master.dbo.sysdatabases
> to get the data directory, now I need to find the log files.
>
> Thanks,
> RSH|||In SQL Server 2000, you can use master.dbo.sysaltfiles to return both the
data and log file directories.
In SQL Server 2005, you should use the sys.master_files catalog view
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"RSH" <way_beyond_oops@.yahoo.com> wrote in message
news:eFWU7uc%23FHA.3064@.TK2MSFTNGP10.phx.gbl...
>I am trying to programatically determine the directory of the log files in
>SQL Server.
> I am using
> SELECT Filename FROM master.dbo.sysdatabases
> to get the data directory, now I need to find the log files.
>
> Thanks,
> RSH
>|||Thanks...I just realized however that when our SA installed SQL Server he
set it up so the Log files were stored in the same directory as the
Datafiles. he then later changed his mind and set it up to store the
datafiles seperate from the logfiles. The problem is that in doing so the
Master database (which I was using to find the directories of the files to
use in several stored procs) still has both files in the same directory. Is
there a way to find out where the Log files and where the Datafiles are set
to be created in programatically? In other words can I query a sys table to
find where SQL Server will by default place the Log and the Data files when
a new database is being created?
Thanks,
RSH
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23gcUrzc%23FHA.3064@.TK2MSFTNGP10.phx.gbl...
> master..sysaltfiles or dbname..sysfiles
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "RSH" <way_beyond_oops@.yahoo.com> wrote in message
> news:eFWU7uc%23FHA.3064@.TK2MSFTNGP10.phx.gbl...|||I realize that but our SA has set it up so all of the log files are written
to directory A and the data files are written to direcory B.
I have the query below which indeed returns the location of the Log and Data
file for the Master DB which is not the problem. The problem is that the
Master database was created when we installed SQL Server. Since then we
went back and set it up so that the MDFs are written in one directory and
the LDFs are written to another. ALL of the databases that exist on the
server have both their LDF and MDF in the same directory. The problem is
that I have a conversion application that is about to convert thousands of
databases and I need to get the data files in the data directory and the log
files in the log directory but since all of the databases on that server
have both the logs and datafiles in the same directory i need a way to find
out the preference setting for SQL server to find out which directory to
correctly write the appropriate filetype.
Thanks,
Ron
"Payson" <payson_b@.hotmail.com> wrote in message
news:1133808837.723905.12280@.g44g2000cwa.googlegroups.com...
> There are some issues with this - like suppose you multiple data files
> and/or multiple log files.
> However, assuming one data file and one log file, then the file that is
> not the data file is the log file...
> SELECT filename
> FROM sysfiles
> WHERE filename NOT IN
> (SELECT filename FROM master..sysdatabases WHERE name = db_name())
> Payson
>
> RSH wrote:
>|||Not sure I understand your problem completely, but maybe this will
help.
The undocumented procedure sp_msforeachdb will loop through the
databases
sp_msforeachdb 'use ? SELECT ''?'' as dbname, filename FROM
sysfiles'
The status column in sysfiles will, when decoded, tell you whether the
file is a data file or a log file - see sysfiles in BOL.
Good luck.
Payson
RSH wrote:
> I realize that but our SA has set it up so all of the log files are writte
n
> to directory A and the data files are written to direcory B.
> I have the query below which indeed returns the location of the Log and Da
ta
> file for the Master DB which is not the problem. The problem is that the
> Master database was created when we installed SQL Server. Since then we
> went back and set it up so that the MDFs are written in one directory and
> the LDFs are written to another. ALL of the databases that exist on the
> server have both their LDF and MDF in the same directory. The problem is
> that I have a conversion application that is about to convert thousands of
> databases and I need to get the data files in the data directory and the l
og
> files in the log directory but since all of the databases on that server
> have both the logs and datafiles in the same directory i need a way to fin
d
> out the preference setting for SQL server to find out which directory to
> correctly write the appropriate filetype.
> Thanks,
> Ron
>
> "Payson" <payson_b@.hotmail.com> wrote in message
> news:1133808837.723905.12280@.g44g2000cwa.googlegroups.com...|||Let me word this a bit differently...Is there anyway to query the
preferences to find out where SQL Server is setup to write the Log files,
and datafiles.
I can't simply query the tables because the system databases were setup when
SQL Server was setup to write both filetypes to the same directory. Now he
has changed the directories so that each is in its own directory but since
all of the databases on the server already exist, querying the table brings
back the same data directory.
EXAMPLE:
Preferences:
Physical Directories When SQL Server was installed:
DATA: C:\Datafiles
LOGS: C:\Datafiles
The systable query returns this value when pointed at the master database:
datafile location: C:\Datafiles\master.mdf
log file location: C:\Datafiles\masterlog.ldf
NOW... The Sys Admin changed the SQL Server preferences to write datafiles
to a seperate directory than the log files:
Preferences:
DATA: L:\Datafiles
LOGS: M:\Logfiles
BUT... because SQL was installed initially with the datafiles and log files
written to the same directory, all of the databases still have their files
in the original locations which is a problem...my data conversion
application queries the systables to find the directories where the log and
data files are so I can pass that information in the create database query
when setting up the database.
The systable query returns this value when pointed at the master
database: --
datafile location: C:\Datafiles\master.mdf
log file location: C:\Datafiles\masterlog.ldf
Since none of the databases reflect the preferences setting in SQL Server
they are being written to the C:\Datafiles directory instead of being split
to the L:\Datafiles, and M:\Logfiles respectively.
"Payson" <payson_b@.hotmail.com> wrote in message
news:1133812823.499247.50450@.g43g2000cwa.googlegroups.com...
> Not sure I understand your problem completely, but maybe this will
> help.
> The undocumented procedure sp_msforeachdb will loop through the
> databases
> sp_msforeachdb 'use ? SELECT ''?'' as dbname, filename FROM
> sysfiles'
> The status column in sysfiles will, when decoded, tell you whether the
> file is a data file or a log file - see sysfiles in BOL.
> Good luck.
> Payson
> RSH wrote:
>|||Gonna try once more. I am using sysfiles in my query, which is local
to each database - hence the USE. I think sysfiles (the one in a given
database, not the one in master) will tell you the actual files for
that database. And I think the status column, when anded with 64, will
tell you whether or not this particular file is a log file.
I think.
If not, I don't have a clue.
Best of luck.
Payson
RSH wrote:
> Let me word this a bit differently...Is there anyway to query the
> preferences to find out where SQL Server is setup to write the Log files,
> and datafiles.
> I can't simply query the tables because the system databases were setup wh
en
> SQL Server was setup to write both filetypes to the same directory. Now h
e
> has changed the directories so that each is in its own directory but since
> all of the databases on the server already exist, querying the table bring
s
> back the same data directory.
> EXAMPLE:
> Preferences:
> Physical Directories When SQL Server was installed:
> DATA: C:\Datafiles
> LOGS: C:\Datafiles
> The systable query returns this value when pointed at the master database:
> datafile location: C:\Datafiles\master.mdf
> log file location: C:\Datafiles\masterlog.ldf
>
> NOW... The Sys Admin changed the SQL Server preferences to write datafiles
> to a seperate directory than the log files:
> Preferences:
> DATA: L:\Datafiles
> LOGS: M:\Logfiles
>
> BUT... because SQL was installed initially with the datafiles and log file
s
> written to the same directory, all of the databases still have their files
> in the original locations which is a problem...my data conversion
> application queries the systables to find the directories where the log an
d
> data files are so I can pass that information in the create database query
> when setting up the database.
> The systable query returns this value when pointed at the master
> database: --
> datafile location: C:\Datafiles\master.mdf
> log file location: C:\Datafiles\masterlog.ldf
> Since none of the databases reflect the preferences setting in SQL Server
> they are being written to the C:\Datafiles directory instead of being spli
t
> to the L:\Datafiles, and M:\Logfiles respectively.
>
>
> "Payson" <payson_b@.hotmail.com> wrote in message
> news:1133812823.499247.50450@.g43g2000cwa.googlegroups.com...|||> In other words can I query a sys table to find where SQL Server will by default place the
Log and
> the Data files when a new database is being created?
It is a bit more involved than that. You can define in EM default path for d
ata and log files. This
is stored in the registry at (for a default instance):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MS
SQLServer\MSSQLServer
In the entries "DefaultData" and "DefaultLog".
However, if you didn't set these, I believe that the path where the master d
atabase is will act as
the default path (you need to do some testing on this).
You can read the registry with TSQL using xp_instance_regread. I don't think
it is documented so use
at own risk, Google for usage.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"RSH" <way_beyond_oops@.yahoo.com> wrote in message news:%23LzIp3c%23FHA.600@.tk2msftngp13.ph
x.gbl...
> Thanks...I just realized however that when our SA installed SQL Server he
set it up so the Log
> files were stored in the same directory as the Datafiles. he then later c
hanged his mind and set
> it up to store the datafiles seperate from the logfiles. The problem is t
hat in doing so the
> Master database (which I was using to find the directories of the files to
use in several stored
> procs) still has both files in the same directory. Is there a way to find
out where the Log files
> and where the Datafiles are set to be created in programatically? In othe
r words can I query a
> sys table to find where SQL Server will by default place the Log and the D
ata files when a new
> database is being created?
> Thanks,
> RSH
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:%23gcUrzc%23FHA.3064@.TK2MSFTNGP10.phx.gbl...
>
Getting the OUT parameter of stored proc in .cmd file.
Iam new to BCP and .cmd commands in sqlserver. I want to know how to access
the output parameter of stored proc in .cmd command. Based on the value i
need to terminate the program. Below are the details.
In the .cmd file we use the below syntax for truncating a table.
isql -E -S%1 -d%2 -Q"truncate table tb_mast"
Right now this needs to be replaced by calling a stored procedure by passing
the table name and get the return value to check sucess/failure through the
output parameter. If any error the program (.cmd) should terminate.
Store procedure is ready and it is working fine. Procedure will be like
sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
parameter2 will be set as 0, else 1.
How do I call the procedure in the .cmd file and check the success/failure b
y
getting the output parameter?
Please help me in this regard. Hope my explanation is clear.
Thanks in advance.
Vivek.
rHi,
May not be possible directly. Why do you want to have a command file to do
this?
You could truncate table inside the stored procedure by implementing a
condition right.If there is any technical difficulty please write back.
Thanks
Hari
SQL Server MVP
"rvivek2000" wrote:
> Hi,
> Iam new to BCP and .cmd commands in sqlserver. I want to know how to acces
s
> the output parameter of stored proc in .cmd command. Based on the value i
> need to terminate the program. Below are the details.
> In the .cmd file we use the below syntax for truncating a table.
> isql -E -S%1 -d%2 -Q"truncate table tb_mast"
> Right now this needs to be replaced by calling a stored procedure by passi
ng
> the table name and get the return value to check sucess/failure through th
e
> output parameter. If any error the program (.cmd) should terminate.
> Store procedure is ready and it is working fine. Procedure will be like
> sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
> parameter2 will be set as 0, else 1.
> How do I call the procedure in the .cmd file and check the success/failure
by
> getting the output parameter?
> Please help me in this regard. Hope my explanation is clear.
> Thanks in advance.
> Vivek.
> --
> r
>|||rvivek2000 wrote:
> Hi,
> Iam new to BCP and .cmd commands in sqlserver. I want to know how to acces
s
> the output parameter of stored proc in .cmd command. Based on the value i
> need to terminate the program. Below are the details.
> In the .cmd file we use the below syntax for truncating a table.
> isql -E -S%1 -d%2 -Q"truncate table tb_mast"
> Right now this needs to be replaced by calling a stored procedure by passi
ng
> the table name and get the return value to check sucess/failure through th
e
> output parameter. If any error the program (.cmd) should terminate.
> Store procedure is ready and it is working fine. Procedure will be like
> sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
> parameter2 will be set as 0, else 1.
> How do I call the procedure in the .cmd file and check the success/failure
by
> getting the output parameter?
> Please help me in this regard. Hope my explanation is clear.
> Thanks in advance.
> Vivek.
>
Have a look at the EXIT command that can be used with isql. You can use
it to set the ERRORLEVEL based the results of a query.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Getting the OUT parameter of stored proc in .cmd file.
Iam new to BCP and .cmd commands in sqlserver. I want to know how to access
the output parameter of stored proc in .cmd command. Based on the value i
need to terminate the program. Below are the details.
In the .cmd file we use the below syntax for truncating a table.
isql -E -S%1 -d%2 -Q"truncate table tb_mast"
Right now this needs to be replaced by calling a stored procedure by passing
the table name and get the return value to check sucess/failure through the
output parameter. If any error the program (.cmd) should terminate.
Store procedure is ready and it is working fine. Procedure will be like
sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
parameter2 will be set as 0, else 1.
How do I call the procedure in the .cmd file and check the success/failure by
getting the output parameter?
Please help me in this regard. Hope my explanation is clear.
Thanks in advance.
Vivek.
--
rHi,
May not be possible directly. Why do you want to have a command file to do
this?
You could truncate table inside the stored procedure by implementing a
condition right.If there is any technical difficulty please write back.
Thanks
Hari
SQL Server MVP
"rvivek2000" wrote:
> Hi,
> Iam new to BCP and .cmd commands in sqlserver. I want to know how to access
> the output parameter of stored proc in .cmd command. Based on the value i
> need to terminate the program. Below are the details.
> In the .cmd file we use the below syntax for truncating a table.
> isql -E -S%1 -d%2 -Q"truncate table tb_mast"
> Right now this needs to be replaced by calling a stored procedure by passing
> the table name and get the return value to check sucess/failure through the
> output parameter. If any error the program (.cmd) should terminate.
> Store procedure is ready and it is working fine. Procedure will be like
> sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
> parameter2 will be set as 0, else 1.
> How do I call the procedure in the .cmd file and check the success/failure by
> getting the output parameter?
> Please help me in this regard. Hope my explanation is clear.
> Thanks in advance.
> Vivek.
> --
> r
>|||rvivek2000 wrote:
> Hi,
> Iam new to BCP and .cmd commands in sqlserver. I want to know how to access
> the output parameter of stored proc in .cmd command. Based on the value i
> need to terminate the program. Below are the details.
> In the .cmd file we use the below syntax for truncating a table.
> isql -E -S%1 -d%2 -Q"truncate table tb_mast"
> Right now this needs to be replaced by calling a stored procedure by passing
> the table name and get the return value to check sucess/failure through the
> output parameter. If any error the program (.cmd) should terminate.
> Store procedure is ready and it is working fine. Procedure will be like
> sp_truncate_table (paramerer1 IN, parameter2 OUTPUT). If successful
> parameter2 will be set as 0, else 1.
> How do I call the procedure in the .cmd file and check the success/failure by
> getting the output parameter?
> Please help me in this regard. Hope my explanation is clear.
> Thanks in advance.
> Vivek.
>
Have a look at the EXIT command that can be used with isql. You can use
it to set the ERRORLEVEL based the results of a query.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
getting the most out of sql server 2005 express
I know there is a 4GB file size limit and a 1GB RAM limit build into
sql server 2005 express.
1. Does this 4Gb file size include the LDF file?
2. If i place multiple databases on one server, does the total file
size of all databases combined have to be less then 4gb or do i get
4gb space per database?
3. If the server has 2 GB of RAM and i want to place 2 databases, can
i assign 1GB to each database or will those 2 databases have to share
1 GB?
4. If the server has 2 CPU's, can i assign one CPU to one database and
the other CPU to the other?
5. Does a duo core or quad core processor count as one CPU?
6. What would be currently the best CPU to use for SQL server?
7. Can Sql server 2005 express edition work with an external raid
cabinet? If yes, what would be the best raid configuration if I want
both performance and stability and if about 60 % of the data access
are select statements and the other 40 % are add/delete/update
statements?
8. When running a select query, does the CPU load come down a lot when
using an external SCSI controler or is most of the CPU load not
related to HDD actions?
8. My idea is to sell a windows C# application to clients. Each client
will require its own database on my hosted server. All databases will
be less then 4GB in size and each will require less then 1 GB RAM to
function normally. I want to put about 30 of such databases on one
server. Each database would serve an average of 2 users. I estimate
that there will be maximum 40 simultanious users (devided over 30
databases) who will require about 2 or 3 simple select/add/update
statements to be executed per minute. Would sql server 2005 express be
sufficient in this case?
Thanks
Hugo
1. No
2. Per database
3. Per instance. You would have to install several instances to utilize > 2GB memory.
4. Yes, using sp_configure and affinity mask.
5. Yes, we count sockets, not cores or logical CPUs.
6. ?
7.
a: Yes, RAID is transparent to SQL Server.
b. As always, it depends. A basic thing is to separate transaction log on a separate physical disk
(RAID). You have to weigh budget into this.
8. It depends on how well you serve your queries with indexes and the complexity of your queries.
9. Possibly. Hard to say without testing.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176286179.388516.214500@.b75g2000hsg.googlegr oups.com...
> Hi Everyone,
> I know there is a 4GB file size limit and a 1GB RAM limit build into
> sql server 2005 express.
> 1. Does this 4Gb file size include the LDF file?
> 2. If i place multiple databases on one server, does the total file
> size of all databases combined have to be less then 4gb or do i get
> 4gb space per database?
> 3. If the server has 2 GB of RAM and i want to place 2 databases, can
> i assign 1GB to each database or will those 2 databases have to share
> 1 GB?
> 4. If the server has 2 CPU's, can i assign one CPU to one database and
> the other CPU to the other?
> 5. Does a duo core or quad core processor count as one CPU?
> 6. What would be currently the best CPU to use for SQL server?
> 7. Can Sql server 2005 express edition work with an external raid
> cabinet? If yes, what would be the best raid configuration if I want
> both performance and stability and if about 60 % of the data access
> are select statements and the other 40 % are add/delete/update
> statements?
> 8. When running a select query, does the CPU load come down a lot when
> using an external SCSI controler or is most of the CPU load not
> related to HDD actions?
> 8. My idea is to sell a windows C# application to clients. Each client
> will require its own database on my hosted server. All databases will
> be less then 4GB in size and each will require less then 1 GB RAM to
> function normally. I want to put about 30 of such databases on one
> server. Each database would serve an average of 2 users. I estimate
> that there will be maximum 40 simultanious users (devided over 30
> databases) who will require about 2 or 3 simple select/add/update
> statements to be executed per minute. Would sql server 2005 express be
> sufficient in this case?
> Thanks
> Hugo
>
|||"3. Per instance. You would have to install several instances to
utilize > 2GB memory. "
So it is possible to install an instance of sql server for each
database so databases can each get 1GB of memory?
And would this not require a lot more resources then 1 instance of a
standard version of sql server?
|||> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
Yes. Thanks for catching my typo, btw.
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
Yes perhaps not "a lot" but "more", but it will allow you to tune things like memory allocation and
processor usage per instance.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176292970.398149.166320@.w1g2000hsg.googlegro ups.com...
> "3. Per instance. You would have to install several instances to
> utilize > 2GB memory. "
> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
>
getting the most out of sql server 2005 express
I know there is a 4GB file size limit and a 1GB RAM limit build into
sql server 2005 express.
1. Does this 4Gb file size include the LDF file?
2. If i place multiple databases on one server, does the total file
size of all databases combined have to be less then 4gb or do i get
4gb space per database?
3. If the server has 2 GB of RAM and i want to place 2 databases, can
i assign 1GB to each database or will those 2 databases have to share
1 GB?
4. If the server has 2 CPU's, can i assign one CPU to one database and
the other CPU to the other?
5. Does a duo core or quad core processor count as one CPU?
6. What would be currently the best CPU to use for SQL server?
7. Can Sql server 2005 express edition work with an external raid
cabinet? If yes, what would be the best raid configuration if I want
both performance and stability and if about 60 % of the data access
are select statements and the other 40 % are add/delete/update
statements?
8. When running a select query, does the CPU load come down a lot when
using an external SCSI controler or is most of the CPU load not
related to HDD actions?
8. My idea is to sell a windows C# application to clients. Each client
will require its own database on my hosted server. All databases will
be less then 4GB in size and each will require less then 1 GB RAM to
function normally. I want to put about 30 of such databases on one
server. Each database would serve an average of 2 users. I estimate
that there will be maximum 40 simultanious users (devided over 30
databases) who will require about 2 or 3 simple select/add/update
statements to be executed per minute. Would sql server 2005 express be
sufficient in this case?
Thanks
Hugo1. No
2. Per database
3. Per instance. You would have to install several instances to utilize > 2G
B memory.
4. Yes, using sp_configure and affinity mask.
5. Yes, we count sockets, not cores or logical CPUs.
6. ?
7.
a: Yes, RAID is transparent to SQL Server.
b. As always, it depends. A basic thing is to separate transaction log on a
separate physical disk
(RAID). You have to weigh budget into this.
8. It depends on how well you serve your queries with indexes and the comple
xity of your queries.
9. Possibly. Hard to say without testing.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176286179.388516.214500@.b75g2000hsg.googlegroup
s.com...
> Hi Everyone,
> I know there is a 4GB file size limit and a 1GB RAM limit build into
> sql server 2005 express.
> 1. Does this 4Gb file size include the LDF file?
> 2. If i place multiple databases on one server, does the total file
> size of all databases combined have to be less then 4gb or do i get
> 4gb space per database?
> 3. If the server has 2 GB of RAM and i want to place 2 databases, can
> i assign 1GB to each database or will those 2 databases have to share
> 1 GB?
> 4. If the server has 2 CPU's, can i assign one CPU to one database and
> the other CPU to the other?
> 5. Does a duo core or quad core processor count as one CPU?
> 6. What would be currently the best CPU to use for SQL server?
> 7. Can Sql server 2005 express edition work with an external raid
> cabinet? If yes, what would be the best raid configuration if I want
> both performance and stability and if about 60 % of the data access
> are select statements and the other 40 % are add/delete/update
> statements?
> 8. When running a select query, does the CPU load come down a lot when
> using an external SCSI controler or is most of the CPU load not
> related to HDD actions?
> 8. My idea is to sell a windows C# application to clients. Each client
> will require its own database on my hosted server. All databases will
> be less then 4GB in size and each will require less then 1 GB RAM to
> function normally. I want to put about 30 of such databases on one
> server. Each database would serve an average of 2 users. I estimate
> that there will be maximum 40 simultanious users (devided over 30
> databases) who will require about 2 or 3 simple select/add/update
> statements to be executed per minute. Would sql server 2005 express be
> sufficient in this case?
> Thanks
> Hugo
>|||"3. Per instance. You would have to install several instances to
utilize > 2GB memory. "
So it is possible to install an instance of sql server for each
database so databases can each get 1GB of memory?
And would this not require a lot more resources then 1 instance of a
standard version of sql server?|||> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
Yes. Thanks for catching my typo, btw.
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
Yes perhaps not "a lot" but "more", but it will allow you to tune things lik
e memory allocation and
processor usage per instance.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176292970.398149.166320@.w1g2000hsg.googlegroups
.com...
> "3. Per instance. You would have to install several instances to
> utilize > 2GB memory. "
> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
>
getting the most out of sql server 2005 express
I know there is a 4GB file size limit and a 1GB RAM limit build into
sql server 2005 express.
1. Does this 4Gb file size include the LDF file?
2. If i place multiple databases on one server, does the total file
size of all databases combined have to be less then 4gb or do i get
4gb space per database?
3. If the server has 2 GB of RAM and i want to place 2 databases, can
i assign 1GB to each database or will those 2 databases have to share
1 GB?
4. If the server has 2 CPU's, can i assign one CPU to one database and
the other CPU to the other?
5. Does a duo core or quad core processor count as one CPU?
6. What would be currently the best CPU to use for SQL server?
7. Can Sql server 2005 express edition work with an external raid
cabinet? If yes, what would be the best raid configuration if I want
both performance and stability and if about 60 % of the data access
are select statements and the other 40 % are add/delete/update
statements?
8. When running a select query, does the CPU load come down a lot when
using an external SCSI controler or is most of the CPU load not
related to HDD actions?
8. My idea is to sell a windows C# application to clients. Each client
will require its own database on my hosted server. All databases will
be less then 4GB in size and each will require less then 1 GB RAM to
function normally. I want to put about 30 of such databases on one
server. Each database would serve an average of 2 users. I estimate
that there will be maximum 40 simultanious users (devided over 30
databases) who will require about 2 or 3 simple select/add/update
statements to be executed per minute. Would sql server 2005 express be
sufficient in this case?
Thanks
Hugo1. No
2. Per database
3. Per instance. You would have to install several instances to utilize > 2GB memory.
4. Yes, using sp_configure and affinity mask.
5. Yes, we count sockets, not cores or logical CPUs.
6. ?
7.
a: Yes, RAID is transparent to SQL Server.
b. As always, it depends. A basic thing is to separate transaction log on a separate physical disk
(RAID). You have to weigh budget into this.
8. It depends on how well you serve your queries with indexes and the complexity of your queries.
9. Possibly. Hard to say without testing.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176286179.388516.214500@.b75g2000hsg.googlegroups.com...
> Hi Everyone,
> I know there is a 4GB file size limit and a 1GB RAM limit build into
> sql server 2005 express.
> 1. Does this 4Gb file size include the LDF file?
> 2. If i place multiple databases on one server, does the total file
> size of all databases combined have to be less then 4gb or do i get
> 4gb space per database?
> 3. If the server has 2 GB of RAM and i want to place 2 databases, can
> i assign 1GB to each database or will those 2 databases have to share
> 1 GB?
> 4. If the server has 2 CPU's, can i assign one CPU to one database and
> the other CPU to the other?
> 5. Does a duo core or quad core processor count as one CPU?
> 6. What would be currently the best CPU to use for SQL server?
> 7. Can Sql server 2005 express edition work with an external raid
> cabinet? If yes, what would be the best raid configuration if I want
> both performance and stability and if about 60 % of the data access
> are select statements and the other 40 % are add/delete/update
> statements?
> 8. When running a select query, does the CPU load come down a lot when
> using an external SCSI controler or is most of the CPU load not
> related to HDD actions?
> 8. My idea is to sell a windows C# application to clients. Each client
> will require its own database on my hosted server. All databases will
> be less then 4GB in size and each will require less then 1 GB RAM to
> function normally. I want to put about 30 of such databases on one
> server. Each database would serve an average of 2 users. I estimate
> that there will be maximum 40 simultanious users (devided over 30
> databases) who will require about 2 or 3 simple select/add/update
> statements to be executed per minute. Would sql server 2005 express be
> sufficient in this case?
> Thanks
> Hugo
>|||"3. Per instance. You would have to install several instances to
utilize > 2GB memory. "
So it is possible to install an instance of sql server for each
database so databases can each get 1GB of memory?
And would this not require a lot more resources then 1 instance of a
standard version of sql server?|||> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
Yes. Thanks for catching my typo, btw.
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
Yes perhaps not "a lot" but "more", but it will allow you to tune things like memory allocation and
processor usage per instance.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<hlossie@.hotmail.com> wrote in message news:1176292970.398149.166320@.w1g2000hsg.googlegroups.com...
> "3. Per instance. You would have to install several instances to
> utilize > 2GB memory. "
> So it is possible to install an instance of sql server for each
> database so databases can each get 1GB of memory?
> And would this not require a lot more resources then 1 instance of a
> standard version of sql server?
>
Wednesday, March 21, 2012
Getting row order in Input File when Handling Errors
Hi All,
Well, tha case here is simply that i have a (Suppliers.csv) as an Input.
When taking that file, I do some validation on it's rows (Data type validations, Mandatory Fielda validations..etc).
When some rows to do not meet the requirments i put in these validations , it is supposed to be directed to an (Errors) Table in my SQL DB.
I want to include the order of the invalid row in the input File (The row which did not pass from the pre-mentioned validations) within the (Errors) Table when i direct the invalid rows to it.
Any ideas ?
See the script in my post on surrogate keys.http://www.ssistalk.com/2007/02/20/generating-surrogate-keys/
Place that at the beginning of your data flow to number all rows passing through it. Then in the error flow, you'll have the correct row number.
Friday, March 9, 2012
getting native error 18456 Error = login failed for user(username) when using BCP
can any one help in exporting data to a flat file by using BCP,
iam trying to use BCP but iam getting following error
Error : native error 18456 Error = login failed for user when using
BCP
thanks well in advanceexec master..xp_cmdshell 'BCP northwind..orders OUT
c:\test1.txt -c -C850 -SServer -Usa -Ppwd'
"RPK" <praveen.rampally@.gmail.com> wrote in message
news:1143093192.808073.125810@.u72g2000cwu.googlegroups.com...
> Hi ,
> can any one help in exporting data to a flat file by using BCP,
> iam trying to use BCP but iam getting following error
> Error : native error 18456 Error = login failed for user when using
> BCP
> thanks well in advance
>
Wednesday, March 7, 2012
getting more information while using audit trace files .trc files
I am trying to create a trace for user error messages using audit user error messages event class.I could create .trc file. But , unfortunately I am unable to get sql query which caused the error . I cannot use profiler to create and see the trace files as it is against our requirement.
This is how I created the trace file
1) DECLARE @.TraceIdOut int
Exec sp_trace_create @.traceid= @.TraceIdOut OUTPUT
,@.options = 2 ,@.tracefile =N'c:\Parseerrors'
PRINT @.TraceIdOut
2) Set the trace event to monitor Parse error messages
Exec sp_trace_setevent @.traceid = 2,@.eventid = 162,@.columnid =1, @.on = @.On
3) Set the trace event status to start.
EXEC sp_trace_setstatus @.traceid = 2, @.status = 1
I am getting only one column ..that is column which shows the user error..
for example "incorrect syntax near 'abcd' ".
I also want the sql query which caused the error. I could give only one columnid number while setting the trace event.
Please help me in getting the sql query which caused this error.
Each execution of 'sp_trace_setevent' will set a single column capture for the given event. If you want to capture different columns for the same event, include multiple back-to-back executions of 'sp_trace_setevent' with the same @.traceid and @.eventid values, but different @.columnid values.
Might find it easier if you opened profiler and configured the trace graphically with the events and columns you'd like to capture then start it and stop it immediately, then choose to script it from the 'File...Export...Script Trace Definition' menu option(s)...that will create a script file with the commands you would want to use to capture via a server-side trace.
HTH
Getting mdb file path at runtime for Dts package
I am creating a Dts package for transferring data from an Access mdb file to SQL server 2000 database.
The package itself is being invoked from a .Net program using dtsrun.
What i want to know is that I need to get the mdb files' path at runtime and accordingly run the Dts package for that mdb file path..
So how do i do that?
Thanks
try to include the mdb files in the same path as the .NET program is. then make an iterators or any trick to find the files at run time.
Sunday, February 26, 2012
Getting Flatfile col data into a variable
I have a flat file with several columns and maybe half a dozen rows
I want the value of the first column of the last row captured in a package variable for other processing.
In the old DTS I ran the data through a transformation from the flat file to a dummy table in tempdb and captured the value for that field via the Active X code inside the transform:
DTSGlobalVariables("DistrictVersion").Value = DTSSource("Col001")
by the time the transform was done I had the last value of 'DTSSource("Col001")' stored in my package variable.
I am stumbling round trying to find an equivalant in SSIS
Vanna Can I Buy a Clue?
Paul,The best way I can think of doing this is to read the file into a variable of type "Object" using a data-flow with a recordset destination.
Once the recordset is in a variable you can shred it using a Foreach loop using a technique similar to what is described here: http://www.sqljunkies.com/WebLog/knight_reign/archive/2005/03/27/9722.aspx
Or you could shred it using a script task as described here: http://blogs.conchango.com/jamiethomson/archive/2005/02/08/960.aspx
Regards
Jamie|||Thanks Jamie,
the FOR Each shredder was just what I needed. And many thanks to Kirk for all the direct and indirect input he has had on this solution.
Friday, February 24, 2012
Getting file names from path?
Need some help here.
Is there a way to get a list of file names from the file system using T-SQL?
Or is there some other method (DTS or Setting up a linked server) which will
accomplish this? I need to provide a list of file names from a folder where
I will provide the path statement and SQL will return the file names that
exist within that particular folder. From there I can concatonate the path
with the file names then store the full path statements with file name into
a table.
Thanks in advance.
CurtYou can use sp_OA* methods to do this. Another option is to use xp_cmdshell
with a dir command like:
EXEC master..xp_cmdshell 'DIR C:\ /B'
Anith|||Hi
To add to Anith's suggestions you could write an ActiveX script in a similar
way to using the sp_OA* commands see http://www.sqldts.com/default.aspx?292
John
"Fishman" wrote:
> Hi,
> Need some help here.
> Is there a way to get a list of file names from the file system using T-SQ
L?
> Or is there some other method (DTS or Setting up a linked server) which wi
ll
> accomplish this? I need to provide a list of file names from a folder wher
e
> I will provide the path statement and SQL will return the file names that
> exist within that particular folder. From there I can concatonate the path
> with the file names then store the full path statements with file name int
o
> a table.
> Thanks in advance.
>
> Curt
>
>|||You could use a CLR TVF like so:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.IO;
using System.Collections;
public partial class UserDefinedFunctions
{
/// <summary>
/// Returns a table with one column (Name) representing all files within
the path that match the criteria.
/// </summary>
/// <param name="path">The path to search. Can be relative</param>
/// <param name="searchPattern">The wildcard search pattern. Use "*" or
null for all.</param>
/// <param name="allDirectories">Search all directories under
path.</param>
/// <param name="includeFullPath">Include the full path in the
results.</param>
/// <returns>Table</returns>
[SqlFunction(FillRowMethodName = "FillFileNameRow", TableDefinition =
"Name nvarchar(300)")]
public static IEnumerable GetFileNames(string path, string
searchPattern, bool allDirectories, bool includeFullPath)
{
if (searchPattern == null)
searchPattern = "*";
string[] files = Directory.GetFiles(path, searchPattern,
allDirectories ? SearchOption.AllDirectories :
SearchOption.TopDirectoryOnly);
if (includeFullPath == false)
{
for (int i = 0; i < files.Length; i++)
{
files[i] = Path.GetFileName(files[i]);
}
}
return files;
}
/// <summary>
/// Break the row into columns for sql.
/// </summary>
public static void FillFileNameRow(object obj, out string Name)
{
string fn = (string)obj;
Name = fn;
}
};
Usage
--
select * from dbo.GetFileNames('c:', null, 0, 1)
Name
c:\AUTOEXEC.BAT
c:\boot.ini
c:\cmds.txt
c:\CONFIG.SYS
c:\dc100a.doc
c:\desktop.ini
...
William Stacey [MVP]
"Fishman" <qwpit@.kcnet.com> wrote in message
news:OWdCp5aJGHA.1676@.TK2MSFTNGP09.phx.gbl...
| Hi,
|
| Need some help here.
| Is there a way to get a list of file names from the file system using
T-SQL?
| Or is there some other method (DTS or Setting up a linked server) which
will
| accomplish this? I need to provide a list of file names from a folder
where
| I will provide the path statement and SQL will return the file names that
| exist within that particular folder. From there I can concatonate the path
| with the file names then store the full path statements with file name
into
| a table.
|
| Thanks in advance.
|
|
| Curt
|
||||You can use the FileSystemObject to enumerate a list of files. This example
is within the context of Office VBA scripting, but the syxtax for using it
with a DTS package / VBScript Task would be very similar if not the same.
http://msdn.microsoft.com/library/d...mfilesystem.asp
"Fishman" <qwpit@.kcnet.com> wrote in message
news:OWdCp5aJGHA.1676@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Need some help here.
> Is there a way to get a list of file names from the file system using
> T-SQL?
> Or is there some other method (DTS or Setting up a linked server) which
> will
> accomplish this? I need to provide a list of file names from a folder
> where
> I will provide the path statement and SQL will return the file names that
> exist within that particular folder. From there I can concatonate the path
> with the file names then store the full path statements with file name
> into
> a table.
> Thanks in advance.
>
> Curt
>
Sunday, February 19, 2012
getting error on Mail Task while attaching file of size > 2MB
Hi,
can any one help me , i am facing an issue on SSIS mail task, i want to attach a file of size 2 MB. it's getting error :
[Send Mail Task] Error: An error occurred with the following error message: "The operation has timed out.".
thanks,
sun.
Double check things like virus scan, the SMTP server, network issues, etc... First, try a smaller file and see if that works (if you haven't already).|||i already try for smaller file it's working fine. and there is no issue like virus scan, SMTP Server and networks..|||
I know that 2MB limits have been placed on attachments frequently (a setting somewhere) as a way to help prevent bandwidth consumption and malicious activity. Check with your SMTP server administrator.
I'm, of course, just trying to help you troubleshoot. I can't test this at the moment and it will have to wait till the morning here in the central US for me to be able to do so.
|||thank u so much for ur helping..Normally, i mean through my outlook i can send the same file.Getting error message saying "xpstar.dll is missing....." When I attach the MDF file w
When I attach the MDF file with SQL Server 2005 Express, I am getting a long error message saying "xpstar.dll is missing....." and the wizard closes. Please tell me what should i do to resolve it?
I have SQL Server 2005 Express Management Studio Express installed ....
Regards,
Fuzon
This seems to be related to Management Studio Express so I'm going to move to the tools forum.
Mike
|||This sounds like a defect to me. Please report this issue at the Microsoft Connect site (http://connect.microsoft.com/SqlServer/feedback). Connect feedback goes right into the defect tracking system used by the development team. Feedback from customers is an important criterion for determining which defects to fix next, so your feedback on Connect will help give this this problem attention sooner.
Thanks,
Steve
Getting error message saying "xpstar.dll is missing....." When I attach the MDF fi
When I attach the MDF file with SQL Server 2005 Express, I am getting a long error message saying "xpstar.dll is missing....." and the wizard closes. Please tell me what should i do to resolve it?
I have SQL Server 2005 Express Management Studio Express installed ....
Regards,
Fuzon
This seems to be related to Management Studio Express so I'm going to move to the tools forum.
Mike
|||This sounds like a defect to me. Please report this issue at the Microsoft Connect site (http://connect.microsoft.com/SqlServer/feedback). Connect feedback goes right into the defect tracking system used by the development team. Feedback from customers is an important criterion for determining which defects to fix next, so your feedback on Connect will help give this this problem attention sooner.
Thanks,
Steve