Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Thursday, March 29, 2012

Auto export to Excel

Is there a way to export directly to an excel .csv file when the report is run without having to preview the report first and then click the export icon?

I want to be able to schedule a report to run and have it go directly to an excel .csv file.

You can use the file delivery subscription. This allows you to automaticly create a csv file at a UNC path.

See http://msdn2.microsoft.com/en-us/library/ms157386.aspx for more information.

|||You can specify the export format using the URL access syntax. Have a look in the BOL, there are some samples for that listed.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

I cannot get to the property tab. It's greyed out. Only the location shows.

|||Alright I found it. It's all done on the server side. I was on the client side.

Auto export to Excel

Is there a way to export directly to an excel .csv file when the report is run without having to preview the report first and then click the export icon?

I want to be able to schedule a report to run and have it go directly to an excel .csv file.

You can use the file delivery subscription. This allows you to automaticly create a csv file at a UNC path.

See http://msdn2.microsoft.com/en-us/library/ms157386.aspx for more information.

|||You can specify the export format using the URL access syntax. Have a look in the BOL, there are some samples for that listed.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

I cannot get to the property tab. It's greyed out. Only the location shows.

|||Alright I found it. It's all done on the server side. I was on the client side.

Thursday, March 8, 2012

Auditing

From my reading of the online book it appears SQL can log all changes made
to each database, how do you switch this on and where is the file. What I am
trying to achieve is to build a monitoring process to identify what changes
a user performed for each session.
Thanks in advance.SQL Server does not have this ability. The log is to ensure database
integrity and not for auditing purposes. You have several choices to audit
user actions. One is to create triggers on each table that you wish to
monitor and write code to store the information into audit tables of your
design. Or you can use a 3rd party product such as Entegra from
www.lumigent.com.
Andrew J. Kelly
SQL Server MVP
"Con" <conaus@.hotmail.com> wrote in message
news:Ow409b56DHA.2568@.TK2MSFTNGP10.phx.gbl...
quote:

> From my reading of the online book it appears SQL can log all changes made
> to each database, how do you switch this on and where is the file. What I

am
quote:

> trying to achieve is to build a monitoring process to identify what

changes
quote:

> a user performed for each session.
> Thanks in advance.
>

Audit Transformation error

Hello all,

I am getting an error that I am stuck on. I dragged the Audit Transformation for error handling (Flat File Source); however, the Audit Transformation is returning an error for one of the standard column "User name". I tried to change the length or take out this column, but the error does not go away. Below is the error message. Your help is much appreciated!

-Lawrence

"The length for "output column "User name" (195)" is not valid for the specified lineage item."

"component "Audit" (180)" failed validation and returned validation status "VS_ISBROKEN".

Do you get the error immediately after dragging the Audit component on or after you have made some changes?

Is [User name] a column from the Flat File Source? If so, what is the length of it?

Regards

Jamie

|||

Jamie, "User Name" is one of the 8 items we allow users to monitor thru an Audit transform, in other words it is an output column (type dt_wstr) from Audit if customer chooses to add this.

Lawrence, the default length on this col is 64, you must have changed it somehow. If you use the advanced editor and change the length on the exact output column to >=13, you should be fine.

thanks

wenyang

|||

Wenyang Hu wrote:

Jamie, "User Name" is one of the 8 items we allow users to monitor thru an Audit transform, in other words it is an output column (type dt_wstr) from Audit if customer chooses to add this.

Yeah I know. I was just checking there wasn't a column of that name on the source!

-Jamie

|||

Hello Wenyang,

I am NOT finding the Advanced editor that you mentioned. From Books Online, I cannot find "Show Advanced Editor". Can you tell me why I am not getting that screen to modify User Name length?

Below is the Data Flow Path coming out of the Audit Transformation. As you can see, User Name has length 14 (not seeing the default length of 64 for this col).

'Name''Data Type''Precision''Scale''Length''Code Page''Sort Key Position''Comparison Flags''Source Component'
'Flat File Source Error Output Column''DT_TEXT''0''0''0''1252''0''''Flat File Source'
'ErrorCode''DT_I4''0''0''0''0''0''''Flat File Source'
'ErrorColumn''DT_I4''0''0''0''0''0''''Flat File Source'
'Execution instance GUID''DT_GUID''0''0''0''0''0''''Audit'
'Package ID''DT_GUID''0''0''0''0''0''''Audit'
'Package name''DT_WSTR''0''0''17''0''0''''Audit'
'Version ID''DT_GUID''0''0''0''0''0''''Audit'
'Execution start time''DT_DATE''0''0''0''0''0''''Audit'
'Machine name''DT_WSTR''0''0''15''0''0''''Audit'
'User name''DT_WSTR''0''0''14''0''0''''Audit'
'Task name''DT_WSTR''0''0''26''0''0''''Audit'
'Task ID''DT_GUID''0''0''0''0''0''''Audit'

|||

You access the advanced editor by right-clicking on the component and selecting "Show Advanced Editor".

-Jamie

Audit Trace Files

I am using server side traces to enable SQL Server 2000 and 2005 auditing.
Every time I start the server, I define a new trace file for auditing. So
till now I have configured around 100 trace files.
Now I want to get the list of all the trace files (which are at different
location in my PC), using some mechanism. Please let me know if there is a
function or procedure which will give me all the trace files that have been
configured for auditing in SQL 2000 and 2005.
I found a function fn_trace_getinfo, which returns information about a
specified trace or all existing traces, but I want all the trace files, whic
h
have been created till now, irrespective of whether they are active or not.
Is there a function in SQL which would help me in this?Munish Narula (munish.narula@.wipro.com) writes:
> I am using server side traces to enable SQL Server 2000 and 2005 auditing.
> Every time I start the server, I define a new trace file for auditing. So
> till now I have configured around 100 trace files.
> Now I want to get the list of all the trace files (which are at
> different location in my PC), using some mechanism. Please let me know
> if there is a function or procedure which will give me all the trace
> files that have been configured for auditing in SQL 2000 and 2005.
> I found a function fn_trace_getinfo, which returns information about a
> specified trace or all existing traces, but I want all the trace files,
> which have been created till now, irrespective of whether they are
> active or not.
> Is there a function in SQL which would help me in this?
I don't think so. As I understand it, once a trace is done, SQL Server
forgets all about it.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi
In SQL Server 2005 take a look at sys.traces system table
"Munish Narula" <munish.narula@.wipro.com> wrote in message
news:4412799B-EE0B-431B-92E2-F51988471166@.microsoft.com...
>I am using server side traces to enable SQL Server 2000 and 2005 auditing.
> Every time I start the server, I define a new trace file for auditing. So
> till now I have configured around 100 trace files.
> Now I want to get the list of all the trace files (which are at different
> location in my PC), using some mechanism. Please let me know if there is a
> function or procedure which will give me all the trace files that have
> been
> configured for auditing in SQL 2000 and 2005.
> I found a function fn_trace_getinfo, which returns information about a
> specified trace or all existing traces, but I want all the trace files,
> which
> have been created till now, irrespective of whether they are active or
> not.
> Is there a function in SQL which would help me in this?|||Hi,
Thanks for the response.
But this again does not solve my problem. The sys.traces catalog view
contains the current running traces on the system. This view is intended as
a
replacement for the fn_trace_getinfo function.
I want to get all the trace files that have been created so far.
"Uri Dimant" wrote:

> Hi
> In SQL Server 2005 take a look at sys.traces system table
>
>
> "Munish Narula" <munish.narula@.wipro.com> wrote in message
> news:4412799B-EE0B-431B-92E2-F51988471166@.microsoft.com...
>
>|||Munish
I'm affraid you cannot. Once trace is stopped SQL Server does not keep any
info about it
"Munish Narula" <munish.narula@.wipro.com> wrote in message
news:07439C49-276C-4677-B975-0341882D2C0F@.microsoft.com...[vbcol=seagreen]
> Hi,
> Thanks for the response.
> But this again does not solve my problem. The sys.traces catalog view
> contains the current running traces on the system. This view is intended
> as a
> replacement for the fn_trace_getinfo function.
> I want to get all the trace files that have been created so far.
>
>
> "Uri Dimant" wrote:
>|||You can get the file path only for active and stopped traces. As Erland and
Uri mentioned, no record is kept after the trace is deleted.
It's not hard to develop a process to manage trace files, though. For
example, I have a daily SSIS package that restarts a trace and copies the
files to an archive folder.
Hope this helps.
Dan Guzman
SQL Server MVP
"Munish Narula" <munish.narula@.wipro.com> wrote in message
news:4412799B-EE0B-431B-92E2-F51988471166@.microsoft.com...
>I am using server side traces to enable SQL Server 2000 and 2005 auditing.
> Every time I start the server, I define a new trace file for auditing. So
> till now I have configured around 100 trace files.
> Now I want to get the list of all the trace files (which are at different
> location in my PC), using some mechanism. Please let me know if there is a
> function or procedure which will give me all the trace files that have
> been
> configured for auditing in SQL 2000 and 2005.
> I found a function fn_trace_getinfo, which returns information about a
> specified trace or all existing traces, but I want all the trace files,
> which
> have been created till now, irrespective of whether they are active or
> not.
> Is there a function in SQL which would help me in this?

Audit Table - Design Question

I am looking for feedback on how to best design an auditing database for
tracking the progress of a file through various applications and vendors.
We need to be able to track delays in processing, as well as lost or missing
files.
We have a process where we send voice files out to a third party vendor to
have them transcribed, then returned to us as text files. I need to audit
the following events:
1. When was the voice file sent to the vendor
2. When was the voice file received by the vendor
3. When did the vendor return the transcribed text file to us
Each of these events could be tracked in a separate table, and if we apply
strict rules of normalization they probably should. For auditing reports I
would probably create a view with full outer joins on all three tables, or
many views with various joins for various purposes. It is expected that
these tables would contain up to one million rows each, with one and only
one row in each table corresponding to a row in each other table. In
theory, there could be errors at any stage of the process that results in
one event never occurring, effectively creating orphan records.
However, since this is strictly for auditing the progress of a particular
file through the systems, it seems to me that I could use a single table,
and update an existing row for each event, or create a new row if one does
not exist. This leaves me with questions regarding how to apply a primary
key and unique constraints. It also, however, would greatly speed up our
ability to run reports.
Here is a description of the events and data we will be tracking:
EVENT 1
On our end the voice data file names are unique, and we have the following
information available:
1.1. file name (strSentFileName)
1.2. IP address of the PC that submitted the file (strPC_ID)
1.3. ID of the person who dictated the voice file (strProviderID)
1.4. Date and time the file was submitted to the vendor (datSent)
EVENT 2
When the vendor receives the file, they send back to us a confirmation and w
e enter the following data:
2.1. Original File Name (strSentFileName)
2.2. New file name if applicable (strReturnFileName)
2.3. Unique identifier from their system (strJobID)
2.4. Date and time the confirmation was received (datConfirmed)
EVENT 3
When we receive the transcribed text file back from the vendor, we enter the
following data:
3.1. Unique identifier from their system (strJobID)
3.2. Date and time the final text file was received (datReturned)
Below is the DDL that I have thus far, but I am still mulling over how best
to design this. I originally thought of a rather denormalized approach to
this design, then rethought it and came up with a more normalized design.
Because we are auditing a process and could have errors that need to be
tracked, we expect orphans (or nulls) that complicate each approach. Any
advice as to how best design this would be much appreciated, as would
criticism of each of the approaches below.
Please excuse the camel case naming convention. I don't care for it myself,
but it is a standard within our environment.
--********************************
--Script to create a single, denormalized table for auditing
--********************************
-- No keys are defined, since any of the 3 events described above could fail
to occur
-- strSentFileName and strJobID should be either unique, or NULL
CREATE TABLE [dbo].[tblTranscriptionAudit] (
[strSentFileName] [varchar] (50) NULL ,
[strJobID] [varchar] (10) NULL ,
[strReturnFileName] [varchar] (50) NULL ,
[datSent] [smalldatetime] NULL ,
[datConfirmed] [smalldatetime] NULL ,
[datReturned] [smalldatetime] NULL ,
[strPC_IP] [varchar] (15) NULL ,
[strProviderID] [varchar] (10) NULL
) ON [PRIMARY]
GO
--********************************
--Script to create 3 normalized tables for auditing
--********************************
CREATE TABLE [dbo].[tblVoiceFilesSent] (
[strSentFileName] [varchar] (50) NOT NULL ,
[datSent] [smalldatetime] NOT NULL ,
[strPC_IP] [varchar] (15) NOT NULL ,
[strProviderID] [varchar] (50) NOT NULL
CONSTRAINT [PK_tblVoiceFilesSent] PRIMARY KEY CLUSTERED
([strSentFileName])
) ON [PRIMARY]
GO
-- note that the FK constraint here may have to be removed.
-- We could (due to errors) get a confirmation on a file that was never
submitted
CREATE TABLE [dbo].[tblReceiptConfirmed] (
[strSentFileName] [varchar] (50) NOT NULL ,
[strJobID] [varchar] (10) NOT NULL ,
[strReturnFileName] [varchar] (50) NOT NULL ,
[datConfirmed] [smalldatetime] NOT NULL
CONSTRAINT [PK_tblReceiptConfirmed] PRIMARY KEY CLUSTERED
([strJobID]),
CONSTRAINT [FK_tblReceiptConfirmed_tblVoiceFilesSen
t] FOREIGN KEY
([strSentFileName])
REFERENCES [tblVoiceFilesSent] ([strSentFileName])
ON DELETE CASCADE ON UPDATE CASCADE
) ON [PRIMARY]
GO
-- note that the FK constraint here may have to be removed.
-- We could (due to errors) get a returned text file that was never
submitted, or never confirmed
CREATE TABLE [dbo].[tblTextFileReturned] (
[strJobID] [varchar] (10) NOT NULL ,
[datReturned] [smalldatetime] NOT NULL
CONSTRAINT [PK_tblTextFileReturned] PRIMARY KEY CLUSTERED
([strJobID]),
CONSTRAINT [FK_tblTextFileReturned_tblReceiptConfir
med] FOREIGN KEY
([strJobID])
REFERENCES [tblReceiptConfirmed] ([strJobID])
ON DELETE CASCADE ON UPDATE CASCADE
) ON [PRIMARY]
GOOn Thu, 16 Mar 2006 14:36:28 -0500, Jim Underwood wrote:

>I am looking for feedback on how to best design an auditing database for
>tracking the progress of a file through various applications and vendors.
>We need to be able to track delays in processing, as well as lost or missin
g
>files.
(snip description)
>Here is a description of the events and data we will be tracking:
>EVENT 1
>On our end the voice data file names are unique, and we have the following
>information available:
>1.1. file name (strSentFileName)
>1.2. IP address of the PC that submitted the file (strPC_ID)
>1.3. ID of the person who dictated the voice file (strProviderID)
>1.4. Date and time the file was submitted to the vendor (datSent)
>EVENT 2
>When the vendor receives the file, they send back to us a confirmation and
w
>e enter the following data:
>2.1. Original File Name (strSentFileName)
>2.2. New file name if applicable (strReturnFileName)
>2.3. Unique identifier from their system (strJobID)
>2.4. Date and time the confirmation was received (datConfirmed)
>EVENT 3
>When we receive the transcribed text file back from the vendor, we enter th
e
>following data:
>3.1. Unique identifier from their system (strJobID)
>3.2. Date and time the final text file was received (datReturned)
Hi Jim,
Is it also possible that any of the above attributes are changed later
(other than for the obvious reason of correcting an input error)? And if
they are ever changed, do you need to keep a history of the previously
entered data, and when and by who the data was changed?
If the answer is no, then I don't think you need a seperate audit table.
In fact, I wouldn't use the term auditing at all, since people associate
that term with a full logging of who changed what data when.
All the above are, in my eyes, attributes of your voice files. Some of
those attributes are related to events (e.g. DateSent, DateConfirmed,
DateReturned), some are not directly related to events (though you
happen to receive that bit of information exactly when an event
happens).
I think you can add all these attrbitues to your existing VoiceFiles
table (assuming that you have any).
Here's how I would design the table (I took the liberty of losing the
silly str-, dat-, and tbl-prefixes, adding primary key constraints and
NOT NULL constraints and improving some column names. I also added some
check constraints to ensure the sanity of the column contents).
Note: If the ID of the person who dictated the file is already known
when the VoiceFiule is entered in the DB (which I can imagine), then
change the DEFAULT NULL to NOT NULL for the relevant column.
CREATE TABLE VoiceFiles
(VoiceFileName varchar(50) NOT NULL,
-- NOTE: Replaces "strSentFileName" column
-- Columns not mentioned in this message but already present
-- in your current VoiceFiles table.
Sender_PC_IPAddr varchar(15) DEFAULT NULL,
Provider_ID varchar(10) DEFAULT NULL,
-- NOTE: I dislike the name, but the obvious
-- alternative ("dictator") is no good either
DateSentToVendor smalldatetime DEFAULT NULL,
FileNameFromVendor varchar(50) DEFAULT NULL,
VendorJobID varchar(10) DEFAULT NULL,
DateConfirmedByVendor smalldatetime DEFAULT NULL,
DateReturnedFromVendor smalldatetime DEFAULT NULL,
PRIMARY KEY (VoiceFileName),
FOREIGN KEY (Sender_PC_IPAddr) REFERENCES PCs,
FOREIGN KEY (Provider_D) REFERENCES Persons,
CHECK (CASE WHEN DateSentToVendor IS NULL
THEN CASE WHEN Sender_PC_IPAddr IS NULL
AND ProviderID IS NULL
AND DateConfirmedByVendor IS NOT NULL
THEN 'Good'
ELSE 'Bad'
END
ELSE CASE WHEN Sender_PC_IPAddr IS NOT NULL
AND ProviderID IS NOT NULL
THEN 'Good'
ELSE 'Bad'
END
END = 'Good')
CHECK (CASE WHEN DateConfirmedByVendor IS NULL
THEN CASE WHEN FileNameFromVendor IS NULL
AND VendorJobID IS NULL
AND DateReturnedFromVendor IS NOT NULL
THEN 'Good'
ELSE 'Bad'
END
ELSE CASE WHEN FileNameFromVendor IS NOT NULL
AND DateReturnedFromVendor IS NOT NULL
THEN 'Good'
ELSE 'Bad'
END
END = 'Good')
CHECK (DateConfirmedByVendor <= DateSentToVendor)
CHECK (DateReturnedFromVendor <= DateSentToVendor)
CHECK (DateReturnedFromVendor <= DateConfirmedByVendor)
)
I didn't add a UNIQUE constraint for VendorJobID, since SQL Server
insists on ignoring the standard and rejecting a second NULL entry in a
nullable column with UNIQUE constraint. There are workaround taht allow
you to create a constraint to mimic the way UNIQUE should behave; google
for them or ask in a follow-up message.
(snip)
>-- note that the FK constraint here may have to be removed.
>-- We could (due to errors) get a confirmation on a file that was never
>submitted
(snip)
>-- note that the FK constraint here may have to be removed.
>-- We could (due to errors) get a returned text file that was never
>submitted, or never confirmed
I recommend putting those confirmations and those returned text files in
a seperate table. After all, I expect (and hope!) that your company
won't handle these confirmations and returned text files the same way
that other confirmations and returned text files are handled.
Hugo Kornelis, SQL Server MVP|||Hugo,
Thanks for all your feedback. I think I will go with a separate table
(probably two) for any later transactions that occur without the presence of
an originating transaction. You are absolutely correct that these will not
be handled in the same way as the other (non-orphaned) transactions. Doing
this also alleviates my concerns about defining a primary key on
VoiceFileName, which was my main stumbling block with this setup.
I know what you are saying about the unique constraint with nulls. I
bookmarked a page or two regarding "nullbusters" when I first saw it, and I
think I may use a similar approach here.
The silly prefixes I am stuck with, unfortunately (internal development
standards) but I do find your column names to be more intuitive than what I
had scribbled down.
All in all your feedback has been a big help.
Thank you!
"Hugo Kornelis" <hugo@.perFact.REMOVETHIS.info.INVALID> wrote in message
news:i3nr12hbps3nj374sof83ab758q0pc07be@.
4ax.com...
> On Thu, 16 Mar 2006 14:36:28 -0500, Jim Underwood wrote:
> Hi Jim,
> Is it also possible that any of the above attributes are changed later
> (other than for the obvious reason of correcting an input error)? And if
> they are ever changed, do you need to keep a history of the previously
> entered data, and when and by who the data was changed?
> If the answer is no, then I don't think you need a seperate audit table.
> In fact, I wouldn't use the term auditing at all, since people associate
> that term with a full logging of who changed what data when.
> All the above are, in my eyes, attributes of your voice files. Some of
> those attributes are related to events (e.g. DateSent, DateConfirmed,
> DateReturned), some are not directly related to events (though you
> happen to receive that bit of information exactly when an event
> happens).
> I think you can add all these attrbitues to your existing VoiceFiles
> table (assuming that you have any).
> Here's how I would design the table (I took the liberty of losing the
> silly str-, dat-, and tbl-prefixes, adding primary key constraints and
> NOT NULL constraints and improving some column names. I also added some
> check constraints to ensure the sanity of the column contents).
> Note: If the ID of the person who dictated the file is already known
> when the VoiceFiule is entered in the DB (which I can imagine), then
> change the DEFAULT NULL to NOT NULL for the relevant column.
> CREATE TABLE VoiceFiles
> (VoiceFileName varchar(50) NOT NULL,
> -- NOTE: Replaces "strSentFileName" column
> -- Columns not mentioned in this message but already present
> -- in your current VoiceFiles table.
> Sender_PC_IPAddr varchar(15) DEFAULT NULL,
> Provider_ID varchar(10) DEFAULT NULL,
> -- NOTE: I dislike the name, but the obvious
> -- alternative ("dictator") is no good either
> DateSentToVendor smalldatetime DEFAULT NULL,
> FileNameFromVendor varchar(50) DEFAULT NULL,
> VendorJobID varchar(10) DEFAULT NULL,
> DateConfirmedByVendor smalldatetime DEFAULT NULL,
> DateReturnedFromVendor smalldatetime DEFAULT NULL,
> PRIMARY KEY (VoiceFileName),
> FOREIGN KEY (Sender_PC_IPAddr) REFERENCES PCs,
> FOREIGN KEY (Provider_D) REFERENCES Persons,
> CHECK (CASE WHEN DateSentToVendor IS NULL
> THEN CASE WHEN Sender_PC_IPAddr IS NULL
> AND ProviderID IS NULL
> AND DateConfirmedByVendor IS NOT NULL
> THEN 'Good'
> ELSE 'Bad'
> END
> ELSE CASE WHEN Sender_PC_IPAddr IS NOT NULL
> AND ProviderID IS NOT NULL
> THEN 'Good'
> ELSE 'Bad'
> END
> END = 'Good')
> CHECK (CASE WHEN DateConfirmedByVendor IS NULL
> THEN CASE WHEN FileNameFromVendor IS NULL
> AND VendorJobID IS NULL
> AND DateReturnedFromVendor IS NOT NULL
> THEN 'Good'
> ELSE 'Bad'
> END
> ELSE CASE WHEN FileNameFromVendor IS NOT NULL
> AND DateReturnedFromVendor IS NOT NULL
> THEN 'Good'
> ELSE 'Bad'
> END
> END = 'Good')
> CHECK (DateConfirmedByVendor <= DateSentToVendor)
> CHECK (DateReturnedFromVendor <= DateSentToVendor)
> CHECK (DateReturnedFromVendor <= DateConfirmedByVendor)
> )
> I didn't add a UNIQUE constraint for VendorJobID, since SQL Server
> insists on ignoring the standard and rejecting a second NULL entry in a
> nullable column with UNIQUE constraint. There are workaround taht allow
> you to create a constraint to mimic the way UNIQUE should behave; google
> for them or ask in a follow-up message.
> (snip)
> (snip)
> I recommend putting those confirmations and those returned text files in
> a seperate table. After all, I expect (and hope!) that your company
> won't handle these confirmations and returned text files the same way
> that other confirmations and returned text files are handled.
> --
> Hugo Kornelis, SQL Server MVP

Friday, February 24, 2012

Attempting to restore a db from a network drive and use the 'with move' statement

Attempting to restore a db from a network drive and need to move the
log file to a new location. CAN SOMEONE PLEAS REVIEW THE STATEMENTS
AND ERROR MESSAGES AND LET ME KNOW WHAT I AM DOING WRONG.
Here is the script that I am using for this procedure
===================================== USE MASTER
GO
RESTORE FILELISTONLY
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
RESTORE LOG Indii
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
WITH MOVE 'Indii_Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL$INDII_NY2_PROD\Data\Indii_Log.LDF'
-- WITH NORECOVERY
RESTORE DATABASE Indii
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
WITH NORECOVERY
=====================================
Here are the error(s) that I am receiving
===================================== Server: Msg 913, Level 16, State 8, Line 3
Could not find database ID 65535. Database may not be activated yet or
may be in transition.
Server: Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Server: Msg 5105, Level 16, State 2, Line 7
Device activation error. The physical file name 'C:\Program
Files\Microsoft SQL Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF' may be
incorrect.
Server: Msg 3156, Level 16, State 1, Line 7
File 'Indii_Log' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF'. Use WITH MOVE to identify
a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 7
RESTORE DATABASE is terminating abnormally.war_wheelan@.yahoo.com wrote:
> Attempting to restore a db from a network drive and need to move the
> log file to a new location. CAN SOMEONE PLEAS REVIEW THE STATEMENTS
> AND ERROR MESSAGES AND LET ME KNOW WHAT I AM DOING WRONG.
> Here is the script that I am using for this procedure
> =====================================> USE MASTER
> GO
> RESTORE FILELISTONLY
> FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> Backup\Indii DB'
> RESTORE LOG Indii
> FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> Backup\Indii DB'
> WITH MOVE 'Indii_Log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL$INDII_NY2_PROD\Data\Indii_Log.LDF'
> -- WITH NORECOVERY
> RESTORE DATABASE Indii
> FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> Backup\Indii DB'
> WITH NORECOVERY
> =====================================> Here are the error(s) that I am receiving
> =====================================> Server: Msg 913, Level 16, State 8, Line 3
> Could not find database ID 65535. Database may not be activated yet or
> may be in transition.
> Server: Msg 3013, Level 16, State 1, Line 3
> RESTORE LOG is terminating abnormally.
> Server: Msg 5105, Level 16, State 2, Line 7
> Device activation error. The physical file name 'C:\Program
> Files\Microsoft SQL Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF' may be
> incorrect.
> Server: Msg 3156, Level 16, State 1, Line 7
> File 'Indii_Log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF'. Use WITH MOVE to identify
> a valid location for the file.
> Server: Msg 3013, Level 16, State 1, Line 7
> RESTORE DATABASE is terminating abnormally.
>
It looks like you're trying to restore the log before the database has
been restored. Restore the database first, THEN the log.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy,
The reason that I attempted to restore the log file first is because I
receive the same error either way.
Tracy McKibben wrote:
> war_wheelan@.yahoo.com wrote:
> > Attempting to restore a db from a network drive and need to move the
> > log file to a new location. CAN SOMEONE PLEAS REVIEW THE STATEMENTS
> > AND ERROR MESSAGES AND LET ME KNOW WHAT I AM DOING WRONG.
> >
> > Here is the script that I am using for this procedure
> > =====================================> > USE MASTER
> > GO
> > RESTORE FILELISTONLY
> > FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> > Backup\Indii DB'
> > RESTORE LOG Indii
> > FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> > Backup\Indii DB'
> > WITH MOVE 'Indii_Log' TO 'C:\Program Files\Microsoft SQL
> > Server\MSSQL$INDII_NY2_PROD\Data\Indii_Log.LDF'
> > -- WITH NORECOVERY
> > RESTORE DATABASE Indii
> > FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
> > Backup\Indii DB'
> > WITH NORECOVERY
> > =====================================> >
> > Here are the error(s) that I am receiving
> > =====================================> > Server: Msg 913, Level 16, State 8, Line 3
> > Could not find database ID 65535. Database may not be activated yet or
> > may be in transition.
> > Server: Msg 3013, Level 16, State 1, Line 3
> > RESTORE LOG is terminating abnormally.
> > Server: Msg 5105, Level 16, State 2, Line 7
> > Device activation error. The physical file name 'C:\Program
> > Files\Microsoft SQL Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF' may be
> > incorrect.
> > Server: Msg 3156, Level 16, State 1, Line 7
> > File 'Indii_Log' cannot be restored to 'C:\Program Files\Microsoft SQL
> > Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF'. Use WITH MOVE to identify
> > a valid location for the file.
> > Server: Msg 3013, Level 16, State 1, Line 7
> > RESTORE DATABASE is terminating abnormally.
> >
> It looks like you're trying to restore the log before the database has
> been restored. Restore the database first, THEN the log.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Attempting to restore a db from a network drive and use the 'with move' statement

Attempting to restore a db from a network drive and need to move the
log file to a new location. CAN SOMEONE PLEAS REVIEW THE STATEMENTS
AND ERROR MESSAGES AND LET ME KNOW WHAT I AM DOING WRONG.
Here is the script that I am using for this procedure
=====================================
USE MASTER
GO
RESTORE FILELISTONLY
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
RESTORE LOG Indii
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
WITH MOVE 'Indii_Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL$INDII_NY2_PROD\Data\Indii_L
og.LDF'
-- WITH NORECOVERY
RESTORE DATABASE Indii
FROM DISK = '\\NAS1\NASDisk\SQL Server\SQL Server Production
Backup\Indii DB'
WITH NORECOVERY
=====================================
Here are the error(s) that I am receiving
=====================================
Server: Msg 913, Level 16, State 8, Line 3
Could not find database ID 65535. Database may not be activated yet or
may be in transition.
Server: Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Server: Msg 5105, Level 16, State 2, Line 7
Device activation error. The physical file name 'C:\Program
Files\Microsoft SQL Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF' may be
incorrect.
Server: Msg 3156, Level 16, State 1, Line 7
File 'Indii_Log' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$PRODUCTION\Data\\Indii_log.LDF'. Use WITH MOVE to identify
a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 7
RESTORE DATABASE is terminating abnormally.Tracy,
The reason that I attempted to restore the log file first is because I
receive the same error either way.
Tracy McKibben wrote:
> war_wheelan@.yahoo.com wrote:
> It looks like you're trying to restore the log before the database has
> been restored. Restore the database first, THEN the log.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Sunday, February 19, 2012

Attachment file is invalid.

Hello,

I have a stored procedure with this syntax

declare @.filename varchar(100)

set @.filename='c:/A.pdf'

EXEC msdb.dbo.sp_send_dbmail

@.profile_name =@.p_profile

@.recipients = @.p_address,

@.body = @.p_body,

@.subject = @.p_subject,

@.file_attachments = @.filename

but when I execute it i have an error

Attachment file c:/A.pdf is invalid.

What's happen? Thanks in advance

hi,

It seems you are trying to load the file from invalid path. Change to

@.filename='C:\A.pdf' instead of 'c:/A.pdf'

Also make sure that A.pdf file is availed in C Drive.

|||Moving to the Transact-SQL forum.

Attaching without ldf file

I tried to attach mdf file without ldf file. However:
"Error 1813: Could not open new database 'GJIRB'. CREATE DATABASE is aborted
.
Device activation error. The physical file name 'C:\ ...\db_name.LDF' may be
incorrect."
Then:
"Attaching database has failed."
If one has not have ldf file is it possible to use mdf file?Hi
sp_attach_single_file_db may help! Make sure that the LDF does not exist
already and the location that is being used is correct.
John
"Alur" wrote:

> I tried to attach mdf file without ldf file. However:
> "Error 1813: Could not open new database 'GJIRB'. CREATE DATABASE is abort
ed.
> Device activation error. The physical file name 'C:\ ...\db_name.LDF' may
be
> incorrect."
> Then:
> "Attaching database has failed."
> If one has not have ldf file is it possible to use mdf file?|||After sp_attach_single_file_db
the message:
"Server: Msg 911, Level 16, State 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not locate entry in
sysdatabses for database 'db_name'.
No entry fount with that name. Make sure that the name is entered correctly.
"
appeared.
"John Bell" wrote:
> Hi
> sp_attach_single_file_db may help! Make sure that the LDF does not exist
> already and the location that is being used is correct.
> John
>
> "Alur" wrote:
>|||You can use exec sp_attach_db and only specify the database name and teh MDB
file path - and leave the remaining parameters blank (i.e., do not specify a
path to the non existant .LDF file).
Your database will get attached and a NEW log file (.ldf) will be created.
-HTH
"Alur" <Alur@.discussions.microsoft.com> wrote in message
news:115A77E2-4DDF-4A4E-8582-7B11A77CF90D@.microsoft.com...
>I tried to attach mdf file without ldf file. However:
> "Error 1813: Could not open new database 'GJIRB'. CREATE DATABASE is
> aborted.
> Device activation error. The physical file name 'C:\ ...\db_name.LDF' may
> be
> incorrect."
> Then:
> "Attaching database has failed."
> If one has not have ldf file is it possible to use mdf file?|||Excuse me
After
sp_attach_single_file_db
@.dbname = 'db_name',
@.physname = 'c:\db_name_Data.MDF'
the message
"Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'db_name'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL\Data\db_name_Log.LDF' may be incorrect."
appeared.
"John Bell" wrote:
> Hi
> sp_attach_single_file_db may help! Make sure that the LDF does not exist
> already and the location that is being used is correct.
> John
>
> "Alur" wrote:
>|||Thank you.
"Jeffrey Todd" wrote:

> You can use exec sp_attach_db and only specify the database name and teh M
DB
> file path - and leave the remaining parameters blank (i.e., do not specify
a
> path to the non existant .LDF file).
> Your database will get attached and a NEW log file (.ldf) will be created.
> -HTH
>
> "Alur" <Alur@.discussions.microsoft.com> wrote in message
> news:115A77E2-4DDF-4A4E-8582-7B11A77CF90D@.microsoft.com...
>
>|||I ran into this very same issue this w although I was trying to
attach the db via vbscript from an msi. Also got the same error when
trying to attach the db from Query Analyser.
Turned out that the mdf had been set to read only because someone had
not checked the shippable copy out of SourceSafe before building the
msi.
As soon as I set the file back to read\write... the problem dissappeared
instantly.
Seems that SQLDMO tries to update the mdf with the new file name and
instead of reporting an access error just continues and uses the ldf
location that is already in the mdf.
Maybe this will provide usefull for others.
Best wishes
Lee Cottrell
Chief Technical Officer
Paymentshield Limited
*** Sent via Developersdex http://www.examnotes.net ***|||Thank you.
"Lee Cottrell" wrote:

> I ran into this very same issue this w although I was trying to
> attach the db via vbscript from an msi. Also got the same error when
> trying to attach the db from Query Analyser.
> Turned out that the mdf had been set to read only because someone had
> not checked the shippable copy out of SourceSafe before building the
> msi.
> As soon as I set the file back to read\write... the problem dissappeared
> instantly.
> Seems that SQLDMO tries to update the mdf with the new file name and
> instead of reporting an access error just continues and uses the ldf
> location that is already in the mdf.
> Maybe this will provide usefull for others.
> Best wishes
> Lee Cottrell
> Chief Technical Officer
> Paymentshield Limited
> *** Sent via Developersdex http://www.examnotes.net ***
>|||And could you tell me is it possible to solve this in SQL Server versions,
which newer than 2000 ?
"Alur" wrote:
> Thank you.
> "Lee Cottrell" wrote:
>|||Hi
I don't think attaching a mdf file that has not been detached properly is
going to work in any version as your database will be in an inconsistent
state. But you may want to post to try posting to the beta news group
http://communities.microsoft.com/ne...lcid=us

to see if anyone has tried this.
John
"Alur" <Alur@.discussions.microsoft.com> wrote in message
news:B22347AC-D039-4842-9595-AF4CBF9D1E57@.microsoft.com...
> And could you tell me is it possible to solve this in SQL Server versions,
> which newer than 2000 ?
> "Alur" wrote:
>

Thursday, February 16, 2012

Attaching the log file and the mdf files of the database.

When I try to attach both the log file and mdf files

I got the following error message.

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server 'FCIT-GFOX082'. (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)

The header for file 'C:\Documents and Settings\Administrator\My Documents\Microsoft Press\AS2005SBS\Setup\Query\log_attach_databases.txt' is not a valid database file header. The FILE SIZE property is incorrect. (Microsoft SQL Server, Error: 5172)

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


BUTTONS:

OK

Could someone help me on how to go about this.

Regards,

Ronald

Maybe you need to take a step back and tell us what you were trying to accomplish. SSAS does not use mdf and log files. And the file in the error message you posted is a .txt file.

SSAS either uses a .abf format for back up and restore, or an xmla script to create an empty database.

|||

I am trying to attach the SSAS Step by Step database that comes with the book Microsoft SQL SERVER 2005 Analysis SErvices Step by Step.

When I try it out, I get error messages.

Regards,

Ronaldl

Attaching SQL 2000 database (.mdf) with missing (.ldf) file

Hello

Please can anyone help me

I've been given a .mdf file from sql server 2000 which i need to attach but we do not have the .ldf file

I am unable to recover the old .ldf file

I have tried the attach single file command but obvioulsy this still looks for the old .ldf file path which no longer exists

any help would be mostly appriciated

many thanks

Martin

sp_attach_single_file_db only works if the database was appropiatly closed and concistent. If the procedure does not work, you will either need to have the ldf file or a valid backup.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Unfortunatly we do not have the ldf file or a valid backup

we only have the mdf file

is there no way of getting round this or recreating a log so i can access the data of the mdf

regards

Martin

|||Hi, I'm in exactly the same situation where a server failure has lost us the LDF but we still have an MDF..

Weve tried the various attach etc but still no luck so if anyone has any advice I'd sure appreciate it as well please...........

regards
PeterSm
|||Unfortunately, the tools mentioned are the only ones.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Attaching SQL 2000 database (.mdf) with missing (.ldf) file

Hello

Please can anyone help me

I've been given a .mdf file from sql server 2000 which i need to attach but we do not have the .ldf file

I am unable to recover the old .ldf file

I have tried the attach single file command but obvioulsy this still looks for the old .ldf file path which no longer exists

any help would be mostly appriciated

many thanks

Martin

sp_attach_single_file_db only works if the database was appropiatly closed and concistent. If the procedure does not work, you will either need to have the ldf file or a valid backup.

Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Unfortunatly we do not have the ldf file or a valid backup

we only have the mdf file

is there no way of getting round this or recreating a log so i can access the data of the mdf

regards

Martin

|||Hi, I'm in exactly the same situation where a server failure has lost us the LDF but we still have an MDF..

Weve tried the various attach etc but still no luck so if anyone has any advice I'd sure appreciate it as well please...........

regards
PeterSm|||Unfortunately, the tools mentioned are the only ones.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Attaching SQL 2000 database (.mdf) with missing (.ldf) file

Hello

Please can anyone help me

I've been given a .mdf file from sql server 2000 which i need to attach but we do not have the .ldf file

I am unable to recover the old .ldf file

I have tried the attach single file command but obvioulsy this still looks for the old .ldf file path which no longer exists

any help would be mostly appriciated

many thanks

Martin

sp_attach_single_file_db only works if the database was appropiatly closed and concistent. If the procedure does not work, you will either need to have the ldf file or a valid backup.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Unfortunatly we do not have the ldf file or a valid backup

we only have the mdf file

is there no way of getting round this or recreating a log so i can access the data of the mdf

regards

Martin

|||Hi, I'm in exactly the same situation where a server failure has lost us the LDF but we still have an MDF..

Weve tried the various attach etc but still no luck so if anyone has any advice I'd sure appreciate it as well please...........

regards
PeterSm
|||Unfortunately, the tools mentioned are the only ones.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Attaching MDF without LDF

Hi Guys

I'm recovering from a hard disk crash, trying to reattach recovered
files.

The MDF file seems fine, but I get:

"Server: Msg 9004, Level 23, State 1, Line 1
An error occurred while processing the log for database
'NetCoverAdmin'."

when I try to include the LDF file. My command was:

EXEC sp_attach_db @.dbname = N'NetCoverAdmin',
@.filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NetcoverAdmin_Data.MDF',
@.filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NetcoverAdmin_Log.LDF'

Is there any way I can restore the database without the LDF file?

My backups where on another disk that mysteriously failed at the same
time, so I have to work what I got...

Any help appreciated!!

Thanks(Taqyon@.gmail.com) writes:
> Is there any way I can restore the database without the LDF file?

Maybe.

If there were no uncommitted transactions in the database at the time of
the crash, all data pages had been flushed to disk etc, the odds are
good.

But if there uncommitted transactions, or pages that had been written
to the log, but not to the data file, you will get a database that is
in poor shape. DBCC may report corruption. It may also come out clean,
but you may still have corruption on application level

If there is any value of that data to you, I stronly recommend you to
open a case with Microsoft, as a support engineer will guide you throuh
all the steps, and can also help you to devise procedures to check the
validity of your data.

If the cost of losing the data does not warrant a support call, but you
still want to give it a shot, I know of method that I will post here.
Simply because if it's applied without understanding, it can cause
even greater mess. Drop me a mail, if you want it.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Erland you Beaut!!!

Worked like a charm, data seems for the most part intact. Saved my
bacon.

Thanks a million!
Hein

Attaching MDF and LDF Files Error

i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database on
customer site installed on C Partition ...MDF file is 300 MB but LDF file
became 12 GB which took all of the C Partition Space.. Our Tech Supp Person
have moved these Physical Files From C to D partition and Deleted the files
and database from C partition and he created new database and tried to Attach
from D partion but that gives an error(Error 9003: The
LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is invalid)
another problem is that latest backup is not available only old backup
available.
we restored old backup and tried to attach those files (300 MB and 12 GB)
but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
DIFFERENT DATABASES.
please can any one help in this case ...my email is raza_noor@.hotmail.comHi
Was the file detached correctly?
Try renaming the log file and using sp_attach_single_file_db to create a new
log, and then detaching/move/attaching the log or in SQL 2005 you can use
CREATE DATABASE with the ATTACH_REBUILD_LOG option instead of
sp_attach_single_file_db.
John
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com|||Hi
Does he try top attach with single file option (for more details please see
BOL) i.e without specifying .LDF file?
Don't you have proper BACKUP?
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com|||If the Tech Supp Person did no detach database file before move it, he is
not qualified to manage a server/computer with production SQL Server.
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com

Attaching MDF and LDF Files Error

i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database on
customer site installed on C Partition ...MDF file is 300 MB but LDF file
became 12 GB which took all of the C Partition Space.. Our Tech Supp Person
have moved these Physical Files From C to D partition and Deleted the files
and database from C partition and he created new database and tried to Attach
from D partion but that gives an error(Error 9003: The
LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is invalid)
another problem is that latest backup is not available only old backup
available.
we restored old backup and tried to attach those files (300 MB and 12 GB)
but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
DIFFERENT DATABASES.
please can any one help in this case ...my email is raza_noor@.hotmail.com
Hi
Was the file detached correctly?
Try renaming the log file and using sp_attach_single_file_db to create a new
log, and then detaching/move/attaching the log or in SQL 2005 you can use
CREATE DATABASE with the ATTACH_REBUILD_LOG option instead of
sp_attach_single_file_db.
John
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com
|||Hi
Does he try top attach with single file option (for more details please see
BOL) i.e without specifying .LDF file?
Don't you have proper BACKUP?
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com
|||If the Tech Supp Person did no detach database file before move it, he is
not qualified to manage a server/computer with production SQL Server.
"razanoor" <razanoor@.discussions.microsoft.com> wrote in message
news:4D14A1C6-EE37-463B-A4E3-9B4F79BBA684@.microsoft.com...
> i am facing a problem for SQL 2000 Database .. We have SQL 2000 Database
> on
> customer site installed on C Partition ...MDF file is 300 MB but LDF file
> became 12 GB which took all of the C Partition Space.. Our Tech Supp
> Person
> have moved these Physical Files From C to D partition and Deleted the
> files
> and database from C partition and he created new database and tried to
> Attach
> from D partion but that gives an error(Error 9003: The
> LSN(12560:120211:1) Passed to log scan in database 'DatabaseName' is
> invalid)
> another problem is that latest backup is not available only old backup
> available.
> we restored old backup and tried to attach those files (300 MB and 12 GB)
> but didnt work.. another error comes that CAN NOT ATTACH FILES FROM
> DIFFERENT DATABASES.
> please can any one help in this case ...my email is raza_noor@.hotmail.com

attaching mdf & ldf files

Hi,
Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
database, formatted that server with the help of a sys admin.
I am aware that attach wont work 90% times without a detach. Now the dev.
guys say that they have some sp codes in that db and expecting me to make DB
available.
I am sure that chances are less but I am giving a try and this is the
present situation.
step1:
EXEC sp_attach_db @.dbname = N'MyDB',
@.filename1 = N'd:\backup\MyDB_Data.mdf',
@.filename2 = N'd:\backup\MyDB_log.ldf'
output:
Server: Msg 5173, Level 16, State 2, Line 1
Cannot associate files with different databases.
step2:
EXEC sp_attach_single_file_db @.dbname = 'MyDB',
@.physname = 'd:\bkup\MyDB_Data.mdf'
output:
Server: Msg 823, Level 24, State 2, Line 1
I/O error (bad page ID) detected during read at offset 0x00000028840000 in
file 'd:\backup\MyDB_Data.mdf'.
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
New log file 'd:\backup\MyDB_log.LDF' was created.
Connection Broken
Whats happening & what else i can try.
Thanks
reddi
Reddi,
Have you recreated the exact same paths that were on the original build?
Have you got a backup you can restore from?
My hopes are not high that you will be able to recover this database. If
you are really desperate you should give MS PSS a call.
http://www.mssqlserver.com/faq/general-pss.asp
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Reddi wrote:
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>
|||Hi Mark,
Have you recreated the exact same paths that were on the original build?
--These are just mdf and ldf files which were moved onto other server by
stopping the SQL Server. Do you mean to say that I need to create a similar
directory path as in source server and try to attach?
Have you got a backup you can restore from?
--yes but a old one..
Thanks
Reedi
"Mark Allison" wrote:

> Reddi,
> Have you recreated the exact same paths that were on the original build?
> Have you got a backup you can restore from?
> My hopes are not high that you will be able to recover this database. If
> you are really desperate you should give MS PSS a call.
> http://www.mssqlserver.com/faq/general-pss.asp
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> Reddi wrote:
>
|||On the second step, did you check if your database was restored?
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message
news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make
DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>
|||Hi Peter,
Thanks for the input.. i havent check that.. request u to keep this thread
on watch
will be back soon
reedi
"Peter Yeoh" wrote:

> On the second step, did you check if your database was restored?
> --
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Reddi" <Reddi@.discussions.microsoft.com> wrote in message
> news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> a
> DB
> Files\Microsoft
>
>
|||Hi Peter,
Extremely sorry for the delay.. after executing step 2, I dont see that
database created in EM.
Thanks
Reedi.
"Reddi" wrote:
[vbcol=seagreen]
> Hi Peter,
> Thanks for the input.. i havent check that.. request u to keep this thread
> on watch
> will be back soon
> reedi
>
> "Peter Yeoh" wrote:
|||Hi Reddi,
This might of help to you
http://www.spaceprogram.com/knowledg...leted_log.html
http://www.spaceprogram.com/knowledg..._received.html
http://forums1.itrc.hp.com/service/f...hreadId=653793
Regards
Ravi
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message news:<A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com>...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi

attaching mdf & ldf files

Hi,
Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
database, formatted that server with the help of a sys admin.
I am aware that attach wont work 90% times without a detach. Now the dev.
guys say that they have some sp codes in that db and expecting me to make D
B
available.
I am sure that chances are less but I am giving a try and this is the
present situation.
step1:
EXEC sp_attach_db @.dbname = N'MyDB',
@.filename1 = N'd:\backup\MyDB_Data.mdf',
@.filename2 = N'd:\backup\MyDB_log.ldf'
output:
Server: Msg 5173, Level 16, State 2, Line 1
Cannot associate files with different databases.
step2:
EXEC sp_attach_single_file_db @.dbname = 'MyDB',
@.physname = 'd:\bkup\MyDB_Data.mdf'
output:
Server: Msg 823, Level 24, State 2, Line 1
I/O error (bad page ID) detected during read at offset 0x00000028840000 in
file 'd:\backup\MyDB_Data.mdf'.
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
New log file 'd:\backup\MyDB_log.LDF' was created.
Connection Broken
Whats happening & what else i can try.
Thanks
reddiReddi,
Have you recreated the exact same paths that were on the original build?
Have you got a backup you can restore from?
My hopes are not high that you will be able to recover this database. If
you are really desperate you should give MS PSS a call.
http://www.mssqlserver.com/faq/general-pss.asp
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Reddi wrote:
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make
DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsof
t
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>|||Hi Mark,
Have you recreated the exact same paths that were on the original build?
--These are just mdf and ldf files which were moved onto other server by
stopping the SQL Server. Do you mean to say that I need to create a similar
directory path as in source server and try to attach?
Have you got a backup you can restore from?
--yes but a old one..
Thanks
Reedi
"Mark Allison" wrote:

> Reddi,
> Have you recreated the exact same paths that were on the original build?
> Have you got a backup you can restore from?
> My hopes are not high that you will be able to recover this database. If
> you are really desperate you should give MS PSS a call.
> http://www.mssqlserver.com/faq/general-pss.asp
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> Reddi wrote:
>|||On the second step, did you check if your database was restored?
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message
news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make
DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>|||Hi Peter,
Thanks for the input.. i havent check that.. request u to keep this thread
on watch
will be back soon
reedi
"Peter Yeoh" wrote:

> On the second step, did you check if your database was restored?
> --
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Reddi" <Reddi@.discussions.microsoft.com> wrote in message
> news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> a
> DB
> Files\Microsoft
>
>|||Hi Peter,
Extremely sorry for the delay.. after executing step 2, I dont see that
database created in EM.
Thanks
Reedi.
"Reddi" wrote:
[vbcol=seagreen]
> Hi Peter,
> Thanks for the input.. i havent check that.. request u to keep this thread
> on watch
> will be back soon
> reedi
>
> "Peter Yeoh" wrote:
>|||Hi Reddi,
This might of help to you
http://www.spaceprogram.com/knowled...s_received.html
http://forums1.itrc.hp.com/service/...threadId=653793
Regards
Ravi
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message news:<A0C79772-6A2F-471D-B842-ECD
98AC9F244@.microsoft.com>...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make
DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsof
t
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi

attaching mdf & ldf files

Hi,
Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
database, formatted that server with the help of a sys admin.
I am aware that attach wont work 90% times without a detach. Now the dev.
guys say that they have some sp codes in that db and expecting me to make DB
available.
I am sure that chances are less but I am giving a try and this is the
present situation.
step1:
EXEC sp_attach_db @.dbname = N'MyDB',
@.filename1 = N'd:\backup\MyDB_Data.mdf',
@.filename2 = N'd:\backup\MyDB_log.ldf'
output:
Server: Msg 5173, Level 16, State 2, Line 1
Cannot associate files with different databases.
step2:
EXEC sp_attach_single_file_db @.dbname = 'MyDB',
@.physname = 'd:\bkup\MyDB_Data.mdf'
output:
Server: Msg 823, Level 24, State 2, Line 1
I/O error (bad page ID) detected during read at offset 0x00000028840000 in
file 'd:\backup\MyDB_Data.mdf'.
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
New log file 'd:\backup\MyDB_log.LDF' was created.
Connection Broken
Whats happening & what else i can try.
Thanks
reddiReddi,
Have you recreated the exact same paths that were on the original build?
Have you got a backup you can restore from?
My hopes are not high that you will be able to recover this database. If
you are really desperate you should give MS PSS a call.
http://www.mssqlserver.com/faq/general-pss.asp
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Reddi wrote:
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>|||Hi Mark,
Have you recreated the exact same paths that were on the original build?
--These are just mdf and ldf files which were moved onto other server by
stopping the SQL Server. Do you mean to say that I need to create a similar
directory path as in source server and try to attach?
Have you got a backup you can restore from?
--yes but a old one..
Thanks
Reedi
"Mark Allison" wrote:
> Reddi,
> Have you recreated the exact same paths that were on the original build?
> Have you got a backup you can restore from?
> My hopes are not high that you will be able to recover this database. If
> you are really desperate you should give MS PSS a call.
> http://www.mssqlserver.com/faq/general-pss.asp
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> Reddi wrote:
> > Hi,
> >
> > Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
> > database, formatted that server with the help of a sys admin.
> >
> > I am aware that attach wont work 90% times without a detach. Now the dev.
> > guys say that they have some sp codes in that db and expecting me to make DB
> > available.
> >
> > I am sure that chances are less but I am giving a try and this is the
> > present situation.
> >
> > step1:
> >
> > EXEC sp_attach_db @.dbname = N'MyDB',
> > @.filename1 = N'd:\backup\MyDB_Data.mdf',
> > @.filename2 = N'd:\backup\MyDB_log.ldf'
> >
> >
> > output:
> >
> > Server: Msg 5173, Level 16, State 2, Line 1
> > Cannot associate files with different databases.
> >
> >
> > step2:
> >
> > EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> > @.physname = 'd:\bkup\MyDB_Data.mdf'
> >
> > output:
> > Server: Msg 823, Level 24, State 2, Line 1
> > I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> > file 'd:\backup\MyDB_Data.mdf'.
> > Device activation error. The physical file name 'C:\Program Files\Microsoft
> > SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> > New log file 'd:\backup\MyDB_log.LDF' was created.
> >
> > Connection Broken
> >
> > Whats happening & what else i can try.
> >
> > Thanks
> >
> > reddi
> >
>|||On the second step, did you check if your database was restored?
--
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message
news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make
DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi
>|||Hi Peter,
Thanks for the input.. i havent check that.. request u to keep this thread
on watch
will be back soon
reedi
"Peter Yeoh" wrote:
> On the second step, did you check if your database was restored?
> --
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Reddi" <Reddi@.discussions.microsoft.com> wrote in message
> news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> > Hi,
> >
> > Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
> a
> > database, formatted that server with the help of a sys admin.
> >
> > I am aware that attach wont work 90% times without a detach. Now the dev.
> > guys say that they have some sp codes in that db and expecting me to make
> DB
> > available.
> >
> > I am sure that chances are less but I am giving a try and this is the
> > present situation.
> >
> > step1:
> >
> > EXEC sp_attach_db @.dbname = N'MyDB',
> > @.filename1 = N'd:\backup\MyDB_Data.mdf',
> > @.filename2 = N'd:\backup\MyDB_log.ldf'
> >
> >
> > output:
> >
> > Server: Msg 5173, Level 16, State 2, Line 1
> > Cannot associate files with different databases.
> >
> >
> > step2:
> >
> > EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> > @.physname = 'd:\bkup\MyDB_Data.mdf'
> >
> > output:
> > Server: Msg 823, Level 24, State 2, Line 1
> > I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> > file 'd:\backup\MyDB_Data.mdf'.
> > Device activation error. The physical file name 'C:\Program
> Files\Microsoft
> > SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> > New log file 'd:\backup\MyDB_log.LDF' was created.
> >
> > Connection Broken
> >
> > Whats happening & what else i can try.
> >
> > Thanks
> >
> > reddi
> >
>
>|||Hi Peter,
Extremely sorry for the delay.. after executing step 2, I dont see that
database created in EM.
Thanks
Reedi.
"Reddi" wrote:
> Hi Peter,
> Thanks for the input.. i havent check that.. request u to keep this thread
> on watch
> will be back soon
> reedi
>
> "Peter Yeoh" wrote:
> > On the second step, did you check if your database was restored?
> >
> > --
> > Peter Yeoh
> > http://www.yohz.com
> > Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
> >
> >
> > "Reddi" <Reddi@.discussions.microsoft.com> wrote in message
> > news:A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com...
> > > Hi,
> > >
> > > Our dev. guys have stopped sequel & took the backup of mdf and ldf file of
> > a
> > > database, formatted that server with the help of a sys admin.
> > >
> > > I am aware that attach wont work 90% times without a detach. Now the dev.
> > > guys say that they have some sp codes in that db and expecting me to make
> > DB
> > > available.
> > >
> > > I am sure that chances are less but I am giving a try and this is the
> > > present situation.
> > >
> > > step1:
> > >
> > > EXEC sp_attach_db @.dbname = N'MyDB',
> > > @.filename1 = N'd:\backup\MyDB_Data.mdf',
> > > @.filename2 = N'd:\backup\MyDB_log.ldf'
> > >
> > >
> > > output:
> > >
> > > Server: Msg 5173, Level 16, State 2, Line 1
> > > Cannot associate files with different databases.
> > >
> > >
> > > step2:
> > >
> > > EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> > > @.physname = 'd:\bkup\MyDB_Data.mdf'
> > >
> > > output:
> > > Server: Msg 823, Level 24, State 2, Line 1
> > > I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> > > file 'd:\backup\MyDB_Data.mdf'.
> > > Device activation error. The physical file name 'C:\Program
> > Files\Microsoft
> > > SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> > > New log file 'd:\backup\MyDB_log.LDF' was created.
> > >
> > > Connection Broken
> > >
> > > Whats happening & what else i can try.
> > >
> > > Thanks
> > >
> > > reddi
> > >
> >
> >
> >|||Hi Reddi,
This might of help to you
http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html
http://www.spaceprogram.com/knowledge/sqlserver_recover_emails_received.html
http://forums1.itrc.hp.com/service/forums/questionanswer.do?admit=716493758+1098084882912+28353475&threadId=653793
Regards
Ravi
"Reddi" <Reddi@.discussions.microsoft.com> wrote in message news:<A0C79772-6A2F-471D-B842-ECD98AC9F244@.microsoft.com>...
> Hi,
> Our dev. guys have stopped sequel & took the backup of mdf and ldf file of a
> database, formatted that server with the help of a sys admin.
> I am aware that attach wont work 90% times without a detach. Now the dev.
> guys say that they have some sp codes in that db and expecting me to make DB
> available.
> I am sure that chances are less but I am giving a try and this is the
> present situation.
> step1:
> EXEC sp_attach_db @.dbname = N'MyDB',
> @.filename1 = N'd:\backup\MyDB_Data.mdf',
> @.filename2 = N'd:\backup\MyDB_log.ldf'
>
> output:
> Server: Msg 5173, Level 16, State 2, Line 1
> Cannot associate files with different databases.
>
> step2:
> EXEC sp_attach_single_file_db @.dbname = 'MyDB',
> @.physname = 'd:\bkup\MyDB_Data.mdf'
> output:
> Server: Msg 823, Level 24, State 2, Line 1
> I/O error (bad page ID) detected during read at offset 0x00000028840000 in
> file 'd:\backup\MyDB_Data.mdf'.
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL\data\MyDB_Log.LDF' may be incorrect.
> New log file 'd:\backup\MyDB_log.LDF' was created.
> Connection Broken
> Whats happening & what else i can try.
> Thanks
> reddi