Sunday, March 25, 2012

Attach Database

in the Enterprise Manager when one goes to attach a database it lets
you choose an MDF / LDF file. It then verifies the validity of the
database before attaching. (I also assume that it detects if the
database was spanning multiple files). I am wondering if there is a
sproc/sprocs that can be called to do this or is this done via
proprietary knowledge of the format that the mdf/ldf files are stored
in
The attaching or the check on spanning multiple files?
Attaching: sp_attach_db or sp_attach_single_file_db
Check for files: this is included in the header of the .mdf, primary data
file. When the database comes online, this information is populated into the
virtual sysfiles.
Sincerely,
Anthony Thomas
"johndoe@.driver.net" wrote:

> in the Enterprise Manager when one goes to attach a database it lets
> you choose an MDF / LDF file. It then verifies the validity of the
> database before attaching. (I also assume that it detects if the
> database was spanning multiple files). I am wondering if there is a
> sproc/sprocs that can be called to do this or is this done via
> proprietary knowledge of the format that the mdf/ldf files are stored
> in
>
|||So If i wanted to see all the files attached to a database I would need to
read the file myself and parse the header?
"AnthonyThomas" wrote:
[vbcol=seagreen]
> The attaching or the check on spanning multiple files?
> Attaching: sp_attach_db or sp_attach_single_file_db
> Check for files: this is included in the header of the .mdf, primary data
> file. When the database comes online, this information is populated into the
> virtual sysfiles.
> Sincerely,
>
> Anthony Thomas
>
> "johndoe@.driver.net" wrote:
|||Not too sure what the issue is.
If the database is online, then sp_helpdb <database name> will list out all
of the files used by the database.
If the database is detached and all you have is the primary data file, you
could try to use sp_attach_single_file_db and read the error messages as they
come up. This will tell you what the system is looking for.
However, if you or someone else has detached a database and you or someone
else didn't know what files belonged, shame on you. You should have checked
before you detached.
Sincerely,
Anthony Thomas
"johndoe@.community.nospam" wrote:
[vbcol=seagreen]
> So If i wanted to see all the files attached to a database I would need to
> read the file myself and parse the header?
> "AnthonyThomas" wrote:

No comments:

Post a Comment