Showing posts with label mdf. Show all posts
Showing posts with label mdf. Show all posts

Friday, March 23, 2012

how can I open a .mdf aspnetDB DataBase ?

Hello everybody,

I am working with SqlExpress and MSSQL Server Management Studio Express and do not manage to open the aspnetDB .mdf database in which I am storing all data about my users.

I woulds like to open it and to be able to request it in order to check some strange things.

Actually, I'm experiencing an isssue with that database since the request just below gives me two results for only one user:

SELECT Member.Password, Member.PasswordAnswerFROM aspnet_MemberShip Member, aspnet_Users UsersWHERE Member.UserId=Users.UserIdAND Users.UserName='Admin'

Using this request returns me a user whom password is clear and an identical user whom password is hashed whereas I set PasswordFormat="Clear" in my Web.Config

Could you explain me how I may proceed please?

Thanx for your help

If you still have your project open, it could be that the project has a lock on the database file. Close your project in order to use MS SSMS express.

Otherwise, you can right-click the ASPNET.MDF database file and choose 'Open'. This will allow you to navigate the database using the Server Explorer tab, much like you would with SSMS.

Your problem lies in your SQL, however. UserId is the only Unique column in the default Users table because it is the primary key. This means that the UserName is NOT unique, and could be duplicated.

Use System.Web.Security.Membership.Provider to get a reference to the app's default membership provider, and use that to do what you need. (See the System.Web.Security.MembershipProvider class for available functions.)

|||

Thanx for your answer ps2goat,

I finally used VisualStudio Servers's Explorer to do so and was able to see all the information stored in the .mdf file.

This raises some questions about the issue I was dealing about above, but at the time, it is a solution for that precise problem ;)

In fact, I had two identical usernames in the database, one with a password saved in clear and the other hashed and, as you tell it, with a different unique ID.

I believe this comes from the fact that I used this .mdf file in more than 3 versions of the current prooject, making of it some kind of mess where it becomes to difficult to find what you're looking for.

Thanks for your help.

|||

You can just use visual studio directly to navigate through it. Also you can get that into sql express or any other db and reconstruct all the db.

Wednesday, March 21, 2012

How can I move/import .MDF file to another machine ?

Our SQL Server machine just crashed, but I can get to the .MDF file (not a
backup file). If I have the .MDF file of a SQL Server database, can I import
this file to another SQL Server and look at it at the new machine ?
Thanks.
If the SQL Server crashed in a weird state, you MIGHT be able to recover the
file.
Copy the MDF and LDF files to the other machine, and try attaching them.
(Look at sp_attach_db in Books Online).
If that fails, you can try just the MDF file, using sp_attach_single_file_db
(also documented in books online).
If that also fails, then you might have just learned the value of backups.
Better late than never. :-)
http://www.aspfaq.com/
(Reverse address to reply.)
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> Our SQL Server machine just crashed, but I can get to the .MDF file (not a
> backup file). If I have the .MDF file of a SQL Server database, can I
import
> this file to another SQL Server and look at it at the new machine ?
> Thanks.
|||Thank you.
I do not have the LDF file, and when I tried sp_attach_single_file_db
I got an error saying something like the MDF file does not have the right
format, or something like that.
I already recommend them to backup next time.
Thank you for your help.
"Aaron [SQL Server MVP]" wrote:

> If the SQL Server crashed in a weird state, you MIGHT be able to recover the
> file.
> Copy the MDF and LDF files to the other machine, and try attaching them.
> (Look at sp_attach_db in Books Online).
> If that fails, you can try just the MDF file, using sp_attach_single_file_db
> (also documented in books online).
> If that also fails, then you might have just learned the value of backups.
> Better late than never. :-)
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
> news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> import
>
>
|||See if this helps:
http://www.sqlservercentral.com/scri...p?scriptid=599
Restoring a .mdf
This is why Backups are so important.
Andrew J. Kelly SQL MVP
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:7E0625EA-A06C-49B4-833A-232C4B11DAC5@.microsoft.com...[vbcol=seagreen]
> Thank you.
> I do not have the LDF file, and when I tried sp_attach_single_file_db
> I got an error saying something like the MDF file does not have the right
> format, or something like that.
> I already recommend them to backup next time.
> Thank you for your help.
> "Aaron [SQL Server MVP]" wrote:

How can I move/import .MDF file to another machine ?

Our SQL Server machine just crashed, but I can get to the .MDF file (not a
backup file). If I have the .MDF file of a SQL Server database, can I import
this file to another SQL Server and look at it at the new machine ?
Thanks.If the SQL Server crashed in a weird state, you MIGHT be able to recover the
file.
Copy the MDF and LDF files to the other machine, and try attaching them.
(Look at sp_attach_db in Books Online).
If that fails, you can try just the MDF file, using sp_attach_single_file_db
(also documented in books online).
If that also fails, then you might have just learned the value of backups.
Better late than never. :-)
http://www.aspfaq.com/
(Reverse address to reply.)
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> Our SQL Server machine just crashed, but I can get to the .MDF file (not a
> backup file). If I have the .MDF file of a SQL Server database, can I
import
> this file to another SQL Server and look at it at the new machine ?
> Thanks.|||Thank you.
I do not have the LDF file, and when I tried sp_attach_single_file_db
I got an error saying something like the MDF file does not have the right
format, or something like that.
I already recommend them to backup next time.
Thank you for your help.
"Aaron [SQL Server MVP]" wrote:

> If the SQL Server crashed in a weird state, you MIGHT be able to recover t
he
> file.
> Copy the MDF and LDF files to the other machine, and try attaching them.
> (Look at sp_attach_db in Books Online).
> If that fails, you can try just the MDF file, using sp_attach_single_file_
db
> (also documented in books online).
> If that also fails, then you might have just learned the value of backups.
> Better late than never. :-)
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
> news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> import
>
>|||See if this helps:
http://www.sqlservercentral.com/scr...sp?scriptid=599
Restoring a .mdf
This is why Backups are so important.
Andrew J. Kelly SQL MVP
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:7E0625EA-A06C-49B4-833A-232C4B11DAC5@.microsoft.com...[vbcol=seagreen]
> Thank you.
> I do not have the LDF file, and when I tried sp_attach_single_file_db
> I got an error saying something like the MDF file does not have the right
> format, or something like that.
> I already recommend them to backup next time.
> Thank you for your help.
> "Aaron [SQL Server MVP]" wrote:
>sql

How can I move/import .MDF file to another machine ?

Our SQL Server machine just crashed, but I can get to the .MDF file (not a
backup file). If I have the .MDF file of a SQL Server database, can I import
this file to another SQL Server and look at it at the new machine ?
Thanks.If the SQL Server crashed in a weird state, you MIGHT be able to recover the
file.
Copy the MDF and LDF files to the other machine, and try attaching them.
(Look at sp_attach_db in Books Online).
If that fails, you can try just the MDF file, using sp_attach_single_file_db
(also documented in books online).
If that also fails, then you might have just learned the value of backups.
Better late than never. :-)
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> Our SQL Server machine just crashed, but I can get to the .MDF file (not a
> backup file). If I have the .MDF file of a SQL Server database, can I
import
> this file to another SQL Server and look at it at the new machine ?
> Thanks.|||Thank you.
I do not have the LDF file, and when I tried sp_attach_single_file_db
I got an error saying something like the MDF file does not have the right
format, or something like that.
I already recommend them to backup next time.
Thank you for your help.
"Aaron [SQL Server MVP]" wrote:
> If the SQL Server crashed in a weird state, you MIGHT be able to recover the
> file.
> Copy the MDF and LDF files to the other machine, and try attaching them.
> (Look at sp_attach_db in Books Online).
> If that fails, you can try just the MDF file, using sp_attach_single_file_db
> (also documented in books online).
> If that also fails, then you might have just learned the value of backups.
> Better late than never. :-)
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
> news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> > Our SQL Server machine just crashed, but I can get to the .MDF file (not a
> > backup file). If I have the .MDF file of a SQL Server database, can I
> import
> > this file to another SQL Server and look at it at the new machine ?
> > Thanks.
>
>|||See if this helps:
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
This is why Backups are so important.
--
Andrew J. Kelly SQL MVP
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:7E0625EA-A06C-49B4-833A-232C4B11DAC5@.microsoft.com...
> Thank you.
> I do not have the LDF file, and when I tried sp_attach_single_file_db
> I got an error saying something like the MDF file does not have the right
> format, or something like that.
> I already recommend them to backup next time.
> Thank you for your help.
> "Aaron [SQL Server MVP]" wrote:
>> If the SQL Server crashed in a weird state, you MIGHT be able to recover
>> the
>> file.
>> Copy the MDF and LDF files to the other machine, and try attaching them.
>> (Look at sp_attach_db in Books Online).
>> If that fails, you can try just the MDF file, using
>> sp_attach_single_file_db
>> (also documented in books online).
>> If that also fails, then you might have just learned the value of
>> backups.
>> Better late than never. :-)
>> --
>> http://www.aspfaq.com/
>> (Reverse address to reply.)
>>
>>
>> "Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
>> news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
>> > Our SQL Server machine just crashed, but I can get to the .MDF file
>> > (not a
>> > backup file). If I have the .MDF file of a SQL Server database, can I
>> import
>> > this file to another SQL Server and look at it at the new machine ?
>> > Thanks.
>>

Monday, March 12, 2012

How can I know the data logical file name?

Hi, all
How can i know the the data file .mdf logical file name?
I want to use alter database to modify the file's size.
Thanks!Execute sp_helpfile in the database.
-Sue
On Tue, 19 Aug 2003 16:29:34 -0700, "Hawk"
<abchawk@.hotmail.com> wrote:
>Hi, all
>How can i know the the data file .mdf logical file name?
>I want to use alter database to modify the file's size.
>Thanks!
>|||or
select * from sysfiles
>--Original Message--
>Hi, all
>How can i know the the data file .mdf logical file name?
>I want to use alter database to modify the file's size.
>Thanks!
>
>.
>