Hi, All!
I'am trying to recover a database using sp_attach_db. I just have the .MDF
file. I tried this command, and receive this result:
EXEC sp_attach_db 'Contax', 'C:\Arquivos de programas\Microsoft SQL
Server\MSSQL\Data\Contax.mdf'
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'contax'. CREATE DATABASE is aborted.
Device activation error. The physical file name
'D:\Bancos\Logs\\contax_log.LDF' may be incorrect.
I don't have the LDF file, but I suppose that SQL Server would create a new
one. Besides, the physical path in the error message has two slashes (after
"Logs" directory), and I found it weird...
Could somebody help me?
Thanks a lot.
MarcosTry using sp_attach_single_file_db ... for the syntax look at BOL
Thanks
GYK
"Marcos Federicce" wrote:
> Hi, All!
> I'am trying to recover a database using sp_attach_db. I just have the .MDF
> file. I tried this command, and receive this result:
> EXEC sp_attach_db 'Contax', 'C:\Arquivos de programas\Microsoft SQL
> Server\MSSQL\Data\Contax.mdf'
> Server: Msg 1813, Level 16, State 2, Line 1
> Could not open new database 'contax'. CREATE DATABASE is aborted.
> Device activation error. The physical file name
> 'D:\Bancos\Logs\\contax_log.LDF' may be incorrect.
> I don't have the LDF file, but I suppose that SQL Server would create a ne
w
> one. Besides, the physical path in the error message has two slashes (afte
r
> "Logs" directory), and I found it weird...
> Could somebody help me?
> Thanks a lot.
> Marcos|||GYK,
I already tried sp_attach_single_file_db, but I got the same error message :
)
Thanks anyway
Marcos
"GYK" wrote:
[vbcol=seagreen]
> Try using sp_attach_single_file_db ... for the syntax look at BOL
> Thanks
> GYK
> "Marcos Federicce" wrote:
>|||> I don't have the LDF file, but I suppose that SQL Server would create a new">
> one.
It can, but only under certain circumstances, like db being detached first,
only having one log file
etc. If those are not met, you need luck to get it to work. Apparently, it d
oesn't for you so I
recommend using your most recent backup(s) to get the database back.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Marcos Federicce" <MarcosFedericce@.discussions.microsoft.com> wrote in mess
age
news:EB863B21-0C15-4684-B985-CB0ABDD3DC93@.microsoft.com...
> Hi, All!
> I'am trying to recover a database using sp_attach_db. I just have the .MDF
> file. I tried this command, and receive this result:
> EXEC sp_attach_db 'Contax', 'C:\Arquivos de programas\Microsoft SQL
> Server\MSSQL\Data\Contax.mdf'
> Server: Msg 1813, Level 16, State 2, Line 1
> Could not open new database 'contax'. CREATE DATABASE is aborted.
> Device activation error. The physical file name
> 'D:\Bancos\Logs\\contax_log.LDF' may be incorrect.
> I don't have the LDF file, but I suppose that SQL Server would create a ne
w
> one. Besides, the physical path in the error message has two slashes (afte
r
> "Logs" directory), and I found it weird...
> Could somebody help me?
> Thanks a lot.
> Marcos
Showing posts with label alli. Show all posts
Showing posts with label alli. Show all posts
Wednesday, March 21, 2012
Recovering a DB using sp_attach_db
Labels:
alli,
command,
database,
mdffile,
microsoft,
mysql,
oracle,
receive,
recover,
recovering,
resultexec,
server,
sp_attach_db,
sql
Friday, March 9, 2012
Recover data from corrupt DB
Hi all:
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
John
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>
|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
John
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>
|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>
Recover data from corrupt DB
Hi all:
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/John
http://www.karaszi.com/SQLServer/in..._suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/in..._suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>
I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
VHD files, I never backed up the DBs themselves. Now for some reason all of
the images have an error in the MSCRM Metabase database, and I cannot
recover it. I tried this:
1. alter database Adventure_Works_Cycle_METABASE set emergency
2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
Which got the DB back online, but it dumped a bunch of necessary data and
broke MSCRM.
Can anyone make any suggestions as to how I can save the data? The metabase
tracks customizations to MSCRM, so if I lose it I'll lose all of my work.
Thanks in advance for any and all help.
John.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/John
http://www.karaszi.com/SQLServer/in..._suspect_db.asp
"John" <jstraumann@.nospam.hotmail.com> wrote in message
news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
> Hi all:
> I have MSCRM running in a VPC setup, so since I had 4 backup copies of the
> VHD files, I never backed up the DBs themselves. Now for some reason all
> of the images have an error in the MSCRM Metabase database, and I cannot
> recover it. I tried this:
> 1. alter database Adventure_Works_Cycle_METABASE set emergency
> 2. sp_dboption Adventure_Works_Cycle_METABASE, single, true
> 3. dbcc checkdb (Adventure_Works_Cycle_METABASE, repair_allow_data_loss)
> 4. sp_dboption Adventure_Works_Cycle_METABASE, single, false
> Which got the DB back online, but it dumped a bunch of necessary data and
> broke MSCRM.
> Can anyone make any suggestions as to how I can save the data? The
> metabase tracks customizations to MSCRM, so if I lose it I'll lose all of
> my work.
> Thanks in advance for any and all help.
> John.
> --
> This message sent from Windows Vista Ultimate
> http://mscrmguy.blogspot.com/
>|||Thanks but those steps only work if the DB is backed up.
This message sent from Windows Vista Ultimate
http://mscrmguy.blogspot.com/
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23039dpcGHHA.1188@.TK2MSFTNGP06.phx.gbl...
> John
> http://www.karaszi.com/SQLServer/in..._suspect_db.asp
>
> "John" <jstraumann@.nospam.hotmail.com> wrote in message
> news:929ACB25-076E-4714-AC77-144F44FD319B@.microsoft.com...
>
Monday, February 20, 2012
Record set to text with separator
Hi all!
I have a bunch of stored procedures that all return record sets. Now I want
the results of these record sets to a file, with a special character to
separate the columns. How can I accomplish that?
Example:
Col1 Col2
-- --
Hi all
Be nice
...should become...
1#Hi#all
2#Be#nice
- Kristoffer -
The easiest way is to run them in Query Analyzer. Go to
Tools/Options/Results and pick Results to File and Custom Delimiter. Then
execute your proc.
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:OefzTQqMEHA.2532@.TK2MSFTNGP10.phx.gbl...
> Hi all!
> I have a bunch of stored procedures that all return record sets. Now I
want
> the results of these record sets to a file, with a special character to
> separate the columns. How can I accomplish that?
> Example:
> Col1 Col2
> -- --
> Hi all
> Be nice
> ...should become...
> 1#Hi#all
> 2#Be#nice
> - Kristoffer -
>
>
|||"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:uRjuJUqMEHA.3292@.TK2MSFTNGP11.phx.gbl...
> The easiest way is to run them in Query Analyzer. Go to
> Tools/Options/Results and pick Results to File and Custom Delimiter. Then
> execute your proc.
Yes, I am doing that for testing. Now I want to automate it.
Does anyone know of a good way?
- Kristoffer -
|||You can also do all of the above mentioned by doing a simple export data
using the DTS Wizard. You can select your source to be your DB and the
Destination to be a text file. Use a SQL query at the source and just have
it execute your stored proc. you can set your custom delimiters you need
for the output file. You can save that as a DTS package and rerun it any
time.
OR
you could create another proc that just selects the # in between and use BCP
to pump out the data to text
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:OVQ4%23hqMEHA.268@.TK2MSFTNGP11.phx.gbl...[vbcol=seagreen]
> "Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
> news:uRjuJUqMEHA.3292@.TK2MSFTNGP11.phx.gbl...
Then
> Yes, I am doing that for testing. Now I want to automate it.
> Does anyone know of a good way?
> - Kristoffer -
>
|||I was thinking BCP would work, but it seems very complicated to use.
The DTS approach seems even better, if it works with MSDE. Does it?
That leaves only one question on the topic: How do I remove the empty rows
that appear between the returned recordsets?
Thank you!
- Kristoffer -
"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:eoPs4tqMEHA.4036@.TK2MSFTNGP12.phx.gbl...
> You can also do all of the above mentioned by doing a simple export data
> using the DTS Wizard.
> OR
> you could create another proc that just selects the # in between and use
BCP
> to pump out the data to text
>
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
|||DTS Comes with SQL Server and not MSDE. However if you have a SQL Server
you can create a DTS package there and easily have your source be the MSDE
DB on the other box.
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:uxwoXzqMEHA.740@.TK2MSFTNGP12.phx.gbl...
> I was thinking BCP would work, but it seems very complicated to use.
> The DTS approach seems even better, if it works with MSDE. Does it?
> That leaves only one question on the topic: How do I remove the empty rows
> that appear between the returned recordsets?
> Thank you!
> - Kristoffer -
> "Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
> news:eoPs4tqMEHA.4036@.TK2MSFTNGP12.phx.gbl...
> BCP
>
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
>
I have a bunch of stored procedures that all return record sets. Now I want
the results of these record sets to a file, with a special character to
separate the columns. How can I accomplish that?
Example:
Col1 Col2
-- --
Hi all
Be nice
...should become...
1#Hi#all
2#Be#nice
- Kristoffer -
The easiest way is to run them in Query Analyzer. Go to
Tools/Options/Results and pick Results to File and Custom Delimiter. Then
execute your proc.
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:OefzTQqMEHA.2532@.TK2MSFTNGP10.phx.gbl...
> Hi all!
> I have a bunch of stored procedures that all return record sets. Now I
want
> the results of these record sets to a file, with a special character to
> separate the columns. How can I accomplish that?
> Example:
> Col1 Col2
> -- --
> Hi all
> Be nice
> ...should become...
> 1#Hi#all
> 2#Be#nice
> - Kristoffer -
>
>
|||"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:uRjuJUqMEHA.3292@.TK2MSFTNGP11.phx.gbl...
> The easiest way is to run them in Query Analyzer. Go to
> Tools/Options/Results and pick Results to File and Custom Delimiter. Then
> execute your proc.
Yes, I am doing that for testing. Now I want to automate it.
Does anyone know of a good way?
- Kristoffer -
|||You can also do all of the above mentioned by doing a simple export data
using the DTS Wizard. You can select your source to be your DB and the
Destination to be a text file. Use a SQL query at the source and just have
it execute your stored proc. you can set your custom delimiters you need
for the output file. You can save that as a DTS package and rerun it any
time.
OR
you could create another proc that just selects the # in between and use BCP
to pump out the data to text
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:OVQ4%23hqMEHA.268@.TK2MSFTNGP11.phx.gbl...[vbcol=seagreen]
> "Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
> news:uRjuJUqMEHA.3292@.TK2MSFTNGP11.phx.gbl...
Then
> Yes, I am doing that for testing. Now I want to automate it.
> Does anyone know of a good way?
> - Kristoffer -
>
|||I was thinking BCP would work, but it seems very complicated to use.
The DTS approach seems even better, if it works with MSDE. Does it?
That leaves only one question on the topic: How do I remove the empty rows
that appear between the returned recordsets?
Thank you!
- Kristoffer -
"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:eoPs4tqMEHA.4036@.TK2MSFTNGP12.phx.gbl...
> You can also do all of the above mentioned by doing a simple export data
> using the DTS Wizard.
> OR
> you could create another proc that just selects the # in between and use
BCP
> to pump out the data to text
>
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
|||DTS Comes with SQL Server and not MSDE. However if you have a SQL Server
you can create a DTS package there and easily have your source be the MSDE
DB on the other box.
Jeff Duncan
MCDBA, MCSE+I
"Kristoffer Persson" <hidden> wrote in message
news:uxwoXzqMEHA.740@.TK2MSFTNGP12.phx.gbl...
> I was thinking BCP would work, but it seems very complicated to use.
> The DTS approach seems even better, if it works with MSDE. Does it?
> That leaves only one question on the topic: How do I remove the empty rows
> that appear between the returned recordsets?
> Thank you!
> - Kristoffer -
> "Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
> news:eoPs4tqMEHA.4036@.TK2MSFTNGP12.phx.gbl...
> BCP
>
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
>
Subscribe to:
Posts (Atom)