Showing posts with label copied. Show all posts
Showing posts with label copied. Show all posts

Wednesday, March 28, 2012

problem restoring backup of DB

Hello,
I copied a backup file of a production DB on a production server to another
location on a Development server. When I try to restore this backup on the
Dev server - from Enterprise Manager, I am getting an error message that
states I need to use "With Move" to identify a valid location for the restor
e
file.
On the Restore Database Dialog I enter the name of the mdf file (which is
not in the dropdown list) in the "Restore as database" textbox. Then I
select the device - "Restore from" Disk, click on Add - select the bak file
,
click OK from that dialog, goto the Options tab and enter the physical path
in the "Move to physical file name" window. Then click OK on the Restore
Database dialog and get the error message above - "use With Move..." How do
I use "With Move"?
I also copied the actual mdf file from the production server and moved it to
the Dev server and tried to attach it to the Dev serve. But the mdf is
trying to reference the old Log file. I thought (hoped) it would create its
own log file. Is there a way to get around this?
Thanks,
Rich> I also copied the actual mdf file from the production server and moved it tod">
> the Dev server and tried to attach it to the Dev serve. But the mdf is
> trying to reference the old Log file. I thought (hoped) it would create i
ts
> own log file. Is there a way to get around this?
>
Did you detach the database first, before copying the mdf file?
If not, try detaching the DB, then copying the file(s), then re-attaching to
the other server.|||The file is a replication DB and I did not want to fiddle with
sp_removereplication. Otherwise I would have used the Copy Database wizard.
But since it is in Replication mode, I can't detach it or use the Copy
Database wizard.
What I did was to stop the production server for a few minutes, copied the
file to the dev server - restart the prod server. I did not copy the ldf
because it was kind of large. I was hoping the copy DB would create its own
log file on the Dev server. Is there a way to force that to happen?
Or am I stuck with using sp_removeReplication and then doing the copy?
"Mark Williams" wrote:

> Did you detach the database first, before copying the mdf file?
> If not, try detaching the DB, then copying the file(s), then re-attaching
to
> the other server.|||You will need the ldf file along with your mdf file. What you did is the
same as detach method except you shut MS SQL server down for a few minutes.
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:625F97FE-6DC8-4DB3-95AE-392A7CCAB396@.microsoft.com...
> The file is a replication DB and I did not want to fiddle with
> sp_removereplication. Otherwise I would have used the Copy Database
> wizard.
> But since it is in Replication mode, I can't detach it or use the Copy
> Database wizard.
> What I did was to stop the production server for a few minutes, copied the
> file to the dev server - restart the prod server. I did not copy the ldf
> because it was kind of large. I was hoping the copy DB would create its
> own
> log file on the Dev server. Is there a way to force that to happen?
> Or am I stuck with using sp_removeReplication and then doing the copy?
> "Mark Williams" wrote:
>|||Yeah, I figured I would have to do that. the ldf is like 3 gigs +. So once
I get the DB attached, what is the best way to shrink down the ldf? Can I
delete it once the mdf is attached and it will create a new one?
"Grant" wrote:

> You will need the ldf file along with your mdf file. What you did is the
> same as detach method except you shut MS SQL server down for a few minutes
.
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:625F97FE-6DC8-4DB3-95AE-392A7CCAB396@.microsoft.com...
>
>|||> I get the DB attached, what is the best way to shrink down the ldf?
You shrink if *before* you detach. Or after you have attached. Use DBCC SHRI
NKFILE.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:D1264111-609E-4190-922C-A88BB233D0CB@.microsoft.com...
> Yeah, I figured I would have to do that. the ldf is like 3 gigs +. So on
ce
> I get the DB attached, what is the best way to shrink down the ldf? Can I
> delete it once the mdf is attached and it will create a new one?
> "Grant" wrote:
>|||Following or explaining GUI in text is incredibly hard. I suggest you invest
igate the file structure
of your backup using RESTORE FILELISTONLY. And based on that construct a RES
TORE command with the
proper commands. If restore from that doesn't work, you can post the output
from RESTORE
FILELISTONLY, your RESTORE command you tried and the error message.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
> Hello,
> I copied a backup file of a production DB on a production server to anothe
r
> location on a Development server. When I try to restore this backup on th
e
> Dev server - from Enterprise Manager, I am getting an error message that
> states I need to use "With Move" to identify a valid location for the rest
ore
> file.
> On the Restore Database Dialog I enter the name of the mdf file (which is
> not in the dropdown list) in the "Restore as database" textbox. Then I
> select the device - "Restore from" Disk, click on Add - select the bak fi
le,
> click OK from that dialog, goto the Options tab and enter the physical pa
th
> in the "Move to physical file name" window. Then click OK on the Restore
> Database dialog and get the error message above - "use With Move..." How
do
> I use "With Move"?
> I also copied the actual mdf file from the production server and moved it
to
> the Dev server and tried to attach it to the Dev serve. But the mdf is
> trying to reference the old Log file. I thought (hoped) it would create i
ts
> own log file. Is there a way to get around this?
> Thanks,
> Rich|||Thank you for your suggestion. Here is what Restore Filelist returned:
Subscriber_Data D:\MSSQLDATA\Subscriber_
Data.MDF D PRIMARY 654573568 3518437
2080640
Subscriber_Log E:\MSSQLLOGS\Subscriber_l
og.LDF L NULL 2818572288 35184372080
640
And here is what I tried with Restore Database - which is currently running
RESTORE DATABASE Subscriber
FROM DISK = 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber.bak'
WITH MOVE 'Subscriber' TO
'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Data.mdf',
MOVE 'Subscriber_log' TO
'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Log.ldf'
I will post the results of this restore effort - still running - probably
for an hour or so.
"Tibor Karaszi" wrote:

> Following or explaining GUI in text is incredibly hard. I suggest you inve
stigate the file structure
> of your backup using RESTORE FILELISTONLY. And based on that construct a R
ESTORE command with the
> proper commands. If restore from that doesn't work, you can post the outpu
t from RESTORE
> FILELISTONLY, your RESTORE command you tried and the error message.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
>|||Success!!! Thank you very much for your help. The restore DB works
perfectly!
"Tibor Karaszi" wrote:

> Following or explaining GUI in text is incredibly hard. I suggest you inve
stigate the file structure
> of your backup using RESTORE FILELISTONLY. And based on that construct a R
ESTORE command with the
> proper commands. If restore from that doesn't work, you can post the outpu
t from RESTORE
> FILELISTONLY, your RESTORE command you tried and the error message.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
>|||The restore command looks fine with one comment, and I also noticed the othe
r post where you said it
was successful.
The comment is that you specified the location for the database files to be
created by your restore
process to be in the Backup directory. Not that it is harmful, but perhaps a
little bit unusual.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:C2E59AEB-3FF8-4930-B0E6-DDACEE2B9104@.microsoft.com...
> Thank you for your suggestion. Here is what Restore Filelist returned:
> Subscriber_Data D:\MSSQLDATA\Subscriber_Data.MDF D PRIMARY 654573568 35184
372080640
> Subscriber_Log E:\MSSQLLOGS\Subscriber_log.LDF L NULL 2818572288 351843720
80640
>
> And here is what I tried with Restore Database - which is currently runnin
g
> RESTORE DATABASE Subscriber
> FROM DISK = 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber.bak'
> WITH MOVE 'Subscriber' TO
> 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Data.mdf',
> MOVE 'Subscriber_log' TO
> 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Log.ldf'
> I will post the results of this restore effort - still running - probably
> for an hour or so.
>
> "Tibor Karaszi" wrote:
>sql

Monday, March 26, 2012

problem recreating a report - 2nd dataset doesn't exist?

Hello,
I am just starting out with reporting services (I have a book which I have
not read yet). I have copied the basic part of a report to a new report for
learning purposes. This contains a parameter which I included in the query.
This works so far. But the original report also includes a table of fields
that are based on a separate dataset. I am getting an error now. How do I
add/imlement this secondary dataset? The error message says that this
dataset does not exist. I presume it means the dataset does not exist in the
report because the tables in sql server exist. How do I create this dataset?
Thanks,
Richopen report project by using visual studio
open report document (double click the report file - solution explorer)
go to Data tab (Data / Layout / Preview)
click dataset dropdown and choose <new dataset...>
have fun
"Rich" <Rich@.discussions.microsoft.com> escreveu na mensagem
news:D8EE2D83-6A8B-49AF-B875-DF9191DAD51A@.microsoft.com...
> Hello,
> I am just starting out with reporting services (I have a book which I have
> not read yet). I have copied the basic part of a report to a new report
> for
> learning purposes. This contains a parameter which I included in the
> query.
> This works so far. But the original report also includes a table of
> fields
> that are based on a separate dataset. I am getting an error now. How do
> I
> add/imlement this secondary dataset? The error message says that this
> dataset does not exist. I presume it means the dataset does not exist in
> the
> report because the tables in sql server exist. How do I create this
> dataset?
> Thanks,
> Rich|||Nevermind. I figured it out. Goto Data, New Dataset.
I didn't check the entire list of datasets in the original report.
"Rich" wrote:
> Hello,
> I am just starting out with reporting services (I have a book which I have
> not read yet). I have copied the basic part of a report to a new report for
> learning purposes. This contains a parameter which I included in the query.
> This works so far. But the original report also includes a table of fields
> that are based on a separate dataset. I am getting an error now. How do I
> add/imlement this secondary dataset? The error message says that this
> dataset does not exist. I presume it means the dataset does not exist in the
> report because the tables in sql server exist. How do I create this dataset?
> Thanks,
> Rich|||Thanks. I am sort of having fun. At least I can get my report to run.
Note: I am outputting this report in Excel format. The first set of fields
(about 3 of them) are based on the first dataset - the master data. Then I
have the 2nd dataset which is the detail data (about 6 fields). When I run
the report (outside of VS, like from an Access database app) the first
dataset displays on the first sheet of an Excel workbook, but the 2nd
dataset, the detail data, is displaying on a 2nd Excel sheet. How can I keep
the detail data on the same sheet as the master data? Is there something I
need to do in the Layout view in VS?
Thanks,
Rich
"Ricardo" wrote:
> open report project by using visual studio
> open report document (double click the report file - solution explorer)
> go to Data tab (Data / Layout / Preview)
> click dataset dropdown and choose <new dataset...>
> have fun
> "Rich" <Rich@.discussions.microsoft.com> escreveu na mensagem
> news:D8EE2D83-6A8B-49AF-B875-DF9191DAD51A@.microsoft.com...
> > Hello,
> >
> > I am just starting out with reporting services (I have a book which I have
> > not read yet). I have copied the basic part of a report to a new report
> > for
> > learning purposes. This contains a parameter which I included in the
> > query.
> > This works so far. But the original report also includes a table of
> > fields
> > that are based on a separate dataset. I am getting an error now. How do
> > I
> > add/imlement this secondary dataset? The error message says that this
> > dataset does not exist. I presume it means the dataset does not exist in
> > the
> > report because the tables in sql server exist. How do I create this
> > dataset?
> >
> > Thanks,
> > Rich
>
>

Monday, March 12, 2012

Problem of MS SQL -ntwdblib.lib NOT found

Dear all,

I want to use C program to connect MS SQL server.
I copied some sample file to install on my computer.
When I run the program, an error occurred, which is about ntwdblib.dll
not find in some paths.
But when I check the paths again, they have ntwdblib.dll.
When I run my C program in another computer, it works...

so , I feel very frustrated.

In my C program, I include the following libraries.
#defineDBNTWIN32
#include "windows.h"
#include <sqlfront.h>
#include <sqldb.h>
#include <stdio.h
Also, I don't know the meaning of "#defineDBNTWIN32".
I haven't installed SQL Client on my computer. Is it the main
problem??

Pls help!!

Cheers,
Alanalan (cheung_yuklun@.i-cable.com) writes:
> I want to use C program to connect MS SQL server.
> I copied some sample file to install on my computer.
> When I run the program, an error occurred, which is about ntwdblib.dll
> not find in some paths.
> But when I check the paths again, they have ntwdblib.dll.
> When I run my C program in another computer, it works...
> so , I feel very frustrated.
> In my C program, I include the following libraries.
> #define DBNTWIN32
> #include "windows.h"
> #include <sqlfront.h>
> #include <sqldb.h>
> #include <stdio.h>
> Also, I don't know the meaning of "#define DBNTWIN32".
> I haven't installed SQL Client on my computer. Is it the main
> problem??

Yes, that is the problem. NTWDBLIB.DLL is the DLL for DB-Library, which
is not part of MDAC, so SQL connectivity is about the only way to install
it.

DB-Library is a very good client library, but unfortunately Microsoft
does not agree, so they stopped developmet of DB-Lib many years ago.
As a consequence, you have restricted support for new features in
SQL Server with DB-Library.

Unless you have some legacy software you are working with, I'd recommend
you to use ODBC or OLE DB instead.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp