suspected database but i can''t reset

  • hi there

    Three of my database is shown as suspect in my server. When i am resetting this one ,

    it tells the error "It can only be run on suspected database."  if i put this one to emergency mode i can access the data.

    any one can help me regarding this one

    thanx in advance

    by

    yasi

  • Try to re-start your server after resetting the status. If that doesn't work, you can bcp all the data out of the database and then create a new database and import it back.

  • Hi addict

    How i can bcp all the data

    thanx in advance.

    by

    yasi

  • You can use the procedure below. It will create different text files for each and every table. Create the procedure in master database and then just pass in the database name as a parameter. Please note that the default location is c:\

    create procedure sp_outputtables @database_name varchar(50)

    as

    declare @table_name varchar(100)

    declare @sql varchar(200)

    set @sql = 'declare cur_tables cursor for select name from ' + @database_name + '.dbo.sysobjects where xtype = ''U'''

    exec (@sql)

    open cur_tables

    fetch next from cur_tables into @table_name

    while @@fetch_status = 0

    begin

    set @sql = 'bcp ' + @database_name +'.dbo.' + @table_name + ' out C:\' + @table_name + '.txt -Sfcxdb19 -c -T '

    exec master.dbo.xp_cmdshell @sql

    fetch next from cur_tables into @table_name

    end

    close cur_tables

    deallocate cur_tables

Viewing 4 posts - 1 through 3 (of 3 total)

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