Showing posts with label drives. Show all posts
Showing posts with label drives. Show all posts

Friday, March 9, 2012

How to get Physical Drives associated with SQL Instance

I need to get a list of physical drives (ie: drive
letters) of all the drives associated with an instance of
SQL 2000 running on a cluster.
The ideal solution would be a stored procedure that given
the instance name you would get back the drives.
Can anyone make a useful suggestion? Is this possible with
a stored procedure?
Thanks,
kenKen,
You can use master..xp_fixeddrives to get the fixed drives name as well as
free space in MB.Since its a undocumented call, please refrain from using it
in production code.An alternative would be to use master..xp_cmdshell
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Ken McClain" <ken@.softbreeze.net> wrote in message
news:0b8e01c35062$4e3466e0$a501280a@.phx.gbl...
> I need to get a list of physical drives (ie: drive
> letters) of all the drives associated with an instance of
> SQL 2000 running on a cluster.
> The ideal solution would be a stored procedure that given
> the instance name you would get back the drives.
> Can anyone make a useful suggestion? Is this possible with
> a stored procedure?
> Thanks,
> ken|||In addition to Dinesh's suggestion which I can't recall if it works on a
cluster there is also the system function fn_servershareddrives() that will
give you the shared cluster drives, possibly combining them will give you
the answer, I haven't got a cluster to test on at the moment. See BOL for
details of this function
SELECT *
FROM ::fn_servershareddrives()
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Ken McClain" <ken@.softbreeze.net> wrote in message
news:0b8e01c35062$4e3466e0$a501280a@.phx.gbl...
I need to get a list of physical drives (ie: drive
letters) of all the drives associated with an instance of
SQL 2000 running on a cluster.
The ideal solution would be a stored procedure that given
the instance name you would get back the drives.
Can anyone make a useful suggestion? Is this possible with
a stored procedure?
Thanks,
ken

Sunday, February 19, 2012

how to get file list from sysfiles table of .mdf

hi,
i have a strange requirement.
I have all the .mdf/.ndf/.ldf files for a given
database on different drives of same server.
I do not know which files put together make up the
database.
so in order to exec sp_attachdb or "create database
wit attach" syntax (files >16)
from where do i get the list of files pertaining to 1
db.
Can i access/read sysfiles system table in the .mdf
before attaching it.
any suggestion wud be welcome
Thanks
RahulIt's a reasonable requirement, but...
You'll have to keep track of the list of db files yourself.
You can't query a database file before it's attached.
However, if you haven't moved the files since they were detached, all you
need do is attach the primary datafile and it will find the other files (it
internally scans "sysfiles" during the attach to perform this).
"rahulnagarmath" <rahulnagarmath@.hotmail.com> wrote in message
news:2891001c39148$292d18c0$a601280a@.phx.gbl...
> hi,
> i have a strange requirement.
> I have all the .mdf/.ndf/.ldf files for a given
> database on different drives of same server.
> I do not know which files put together make up the
> database.
> so in order to exec sp_attachdb or "create database
> wit attach" syntax (files >16)
> from where do i get the list of files pertaining to 1
> db.
> Can i access/read sysfiles system table in the .mdf
> before attaching it.
> any suggestion wud be welcome
> Thanks
> Rahul
>