Re: SQL connection problem

From: Uri Dimant (urid_at_iscar.co.il)
Date: 02/17/05


Date: Thu, 17 Feb 2005 15:04:45 +0200

John
You need to run
EXEC sp_defaultdb 'John', 'pubs'

Detach the database and delete the LOG file.

EXEC sp_detach_db @dbname = 'pubs'
EXEC sp_attach_single_file_db @dbname = 'pubs',
   @physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

"John Almeda" <jalmeda@northsouth.net> wrote in message
news:OgECTCPFFHA.2540@TK2MSFTNGP09.phx.gbl...
> I have sql 2000. Last night I had a backup problem where the Log would
> not restore becasue it was the wrong one. This left my DB greyed out. In
> my great wisdom I did a not so wise thing and detached the DB and tried
> to re-attach. No luck. Next thing I know I cannot connect to the server
> becasue "Cannot open user default db. Login failed" . I have tried
> everything short of moving a very large db and re-installing sql and
> then trying to attach or restore the data. IS there an easier/another
> way.
>
> John Almeda
> System Adm
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: HELP on How to move database files
    ... ChrisR wrote: ... > Detach. ... > Turn off SQL. ... > Delete log file. ...
    (microsoft.public.sqlserver.server)
  • Re: HELP on How to move database files
    ... Thank you Chris for the suggestion and John confirming the approach. ... What do you mean by turn off SQL? ... When I Detach a database, ... >> Delete log file. ...
    (microsoft.public.sqlserver.server)
  • Re: HELP on How to move database files
    ... Detach. ... Turn off SQL. ... Delete log file. ... >> physical location of the ...
    (microsoft.public.sqlserver.server)
  • Re: PerfMon recording to SQL 2005
    ... I've been out of the SQL world for a couple years so dusting ... A System DSN, specifying windows authentication, and change to an ... Configuring the log file, choose the tested DSN as the System DSN ... The user account I created in SQL is an owner of the ...
    (microsoft.public.sqlserver.server)
  • Re: PerfMon recording to SQL 2005
    ... I've been out of the SQL world for a couple years so dusting off ... A System DSN, specifying windows authentication, and change to an existing ... Configuring the log file, choose the tested DSN as the System DSN ... The user account I created in SQL is an owner of the ...
    (microsoft.public.sqlserver.server)