Impossible to attach Adventureworks

  • I just installed SQL 2005 and I tried (repeatedly) to attach Adventureworks; it fails displaying the Message Box below.

    I run DBCC Checktable and I got the following reply, with no errors:

    DBCC results for 'sysindexes'.

    There are 100 rows in 4 pages for object 'sysindexes'.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    The two links mentioned in the Message Box are helpless.

    Many thanks for your help,

    Dinu

    Message Box

    ==============================================================

    TITLE: Microsoft SQL Server Management Studio

    ------------------------------

    Attach database failed for Server xxxx.  (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

    ------------------------------

    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    Could not find row in sysindexes for database ID 5, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

    Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476

     

  • Dear ,

    Can u pls paste the code here.

     

    from

    Killer

  • Sorry, which code do you mean?

    Thanks,

    Dinu

  • THe attach code.

  • I used the SQL Server Management Studio Attach function not code.

  • Edit and run this:

    CREATE DATABASE AdventureWorks

    ON (FILENAME = 'c:\whateveryourpathishere\AdventureWorks.mdf')

    FOR ATTACH

  • Veteran: I have tried it \,this same error:

    Msg 1813, Level 16, State 2, Line 1

    Can not open 'AdventureWorks'?CREATE DATABASE ????

    Msg 602, Level 21, State 50, Line 1

    ??? sysindexes ?????? ID 12 ??? ID 1 ??? ID 1 ??????? sysindexes ?? DBCC CHECKTABLE?

    Msg 602, Level 21, State 50, Line 1

    Could not find row in sysindexes for database ID 12, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes

  • I get the same error:

    Msg 1813, Level 16, State 2, Line 1

    Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted.

    Msg 602, Level 21, State 50, Line 1

    Could not find row in sysindexes for database ID 8, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

    I've run DBCC CHECKTABLE and everything looks good.

    DBCC results for 'sysindexes'.

    There are 102 rows in 4 pages for object 'sysindexes'.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    I'm comparing Crystal Reports to MS Report Services, and I'd like to walk throught the tutorials, but the AdventureWorks DB is required.

  • Hi Experts!!!

    I am also facing the same problem. I tried to attach "AdventureWorks" db using many alternate ways but unfortunatelly all failed.

    It would be really great to get solution from someone in this group.

    If anyone have prooved solution, please post it here.

    Appreciate your help.

    Regards,

    Fakruddin Mansuri

  • Have you tried by executing the install script (instawdb.sql)...

    Script for AdventureWorks OLTP should be located in C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks OLTP

    --Ramesh


  • Codeplex now maintains the AdventureWorks sample databases. Are you using the latest rev (for SP2a)? i.e. http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004

  • You only need add a sentence for attach_rebuild_log

    With this script you can attach AdventureWorks in the same folder where master exists.

    DECLARE @data_path nvarchar(256);

    DECLARE @db nvarchar(50);

    DECLARE @filename nvarchar(100);

    SET @data_path = (SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)

    FROM master.sys.master_files

    WHERE database_id = 1 AND file_id = 1);

    set @db='AdventureWorks'

    set @filename= @db+ '_data.mdf'

    exec ('CREATE DATABASE ' + @db + '

    ON (FILENAME = '''+ @data_path + @filename + ')

    FOR ATTACH_REBUILD_LOG');

    GO

    Francisco Racionero
    twitter: @fracionero

  • Hi Ramesh,

    Thanks for your quick response.

    No, I haven't tried with install script (instawdb.sql). Infact this script is not available on my system. Can you please suggest me how should I proceed further? Where can I get the script file.

    Thanks for your time.

    --Fakruddin

  • You can use the link what Tommy has provided...

    --Ramesh


  • Thanks Ramesh, Francisco Racionero and Tommy for your time.

    I tried all your suggested option but still I am not able to have adverntureWorks db on my system.

    As Francisco suggested, I tried running the scrip but it says "Invalid object name 'master.sys.master_files". I used master database.

    Then I tried running the script like this

    "CREATE DATABASE AdventureWorks

    ON (FILENAME = 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf')

    FOR ATTACH_REBUILD_LOG"

    But it still gives error.

    As Ramesh and Tommy suggeted, I downloaded the latest msi file from the location "http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004" and ran the setup. It gave me .mdf and .ldf files. Then I tried to attach the same using Enterprise Manager. but it failed with the error message as below

    Msg 1813, Level 16, State 2, Line 1

    Could not open new database 'AdventureWorks_Data'. CREATE DATABASE is aborted.

    Msg 602, Level 21, State 50, Line 1

    Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

    Please advise.

    Once again thanks a lot for your time.

    Regards,

    Fakruddin

Viewing 15 posts - 1 through 15 (of 33 total)

You must be logged in to reply to this topic. Login to reply