Showing posts with label machine. Show all posts
Showing posts with label machine. Show all posts

Wednesday, March 21, 2012

Dumping Data from a XML file to DB Tables

Hi All ,

I have an XML file saved in my machine at c:\MyXML.xml . I have two tables in my DB as Table1 ( [col1],[col2]) & Table2()[col1],[col2] . I have to dump the data from this xml file to these two tables in one shot .The format of the XML file MyXML.xml is something like this :

<?xml version = "1.0">

-<Report xmlns = " MyReport".......... >

- <table1>

- <Data>

<Record col1 = "A" col2 = "B" / >

<Record col1 = "C" col2 = "D" / >

<Record col1 = "E" col2 = "F" / >

</Data>

</table1>

- <table2>

- <Data>

<Record col1 = "A" col2 = "B" / >

<Record col1 = "C" col2 = "D" / >

<Record col1 = "E" col2 = "F" / >

</Data>

</table2>

</Report>

Plz suggest me some possible ways to get this done . I m using sql 2005.

Thanks in advance for the help.

Here is a complete example, you can use the OPENXML statement after the stored procedure sp_xml_preparedocument has parsed the XML:

Code Snippet

CREATE TABLE table1 (

col1 nvarchar(10),

col2 nvarchar(10)

);

CREATE TABLE table2 (

col1 nvarchar(10),

col2 nvarchar(10)

);

DECLARE @.xmlDocument xml;

SET @.xmlDocument = '<Report xmlns="MyReport">

<table1>

<Data>

<Record col1 = "A" col2 = "B" />

<Record col1 = "C" col2 = "D" />

<Record col1 = "E" col2 = "F" />

</Data>

</table1>

<table2>

<Data>

<Record col1 = "A" col2 = "B" />

<Record col1 = "C" col2 = "D" />

<Record col1 = "E" col2 = "F" />

</Data>

</table2>

</Report>';

DECLARE @.docHandle int;

EXEC sp_xml_preparedocument @.docHandle OUTPUT, @.xmlDocument, N'<Report xmlns:ns1="MyReport"/>';

INSERT INTO table1

SELECT *

FROM OPENXML (@.docHandle, N'/ns1:Report/ns1:table1/ns1:Data/ns1:Record', 0)

WITH table1;

INSERT INTO table2

SELECT *

FROM OPENXML (@.docHandle, N'/ns1:Report/ns1:table2/ns1:Data/ns1:Record', 0)

WITH table2;

EXEC sp_xml_removedocument @.docHandle;

SELECT col1, col2 FROM table1;

SELECT col1, col2 FROM table2

Monday, March 19, 2012

Dump of databasse

I have a sql 2000 database on my local machine that I need to get to a far
away server so he can make one like it on his server. The admin tells me I
need to make a dump of it and send it to him. I just don't know how to do
that. Can someone help me out?

Thanks,
JerryI would just backup the database so the far-away can restore it on his
side.|||Jerry (notmyspam@.houston.rr.com) writes:
> I have a sql 2000 database on my local machine that I need to get to a far
> away server so he can make one like it on his server. The admin tells me I
> need to make a dump of it and send it to him. I just don't know how to do
> that. Can someone help me out?

BACKUP DATABASE db TO DISK = 'C:\temp\db.bak'

--
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

Friday, March 9, 2012

dual NIC cards SQL Server does not exist

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied
I have two NIC cards on my client machine.
NIC #1 is the corporate network where my SQLServer resides.
NIC #2 is for a local device accessed via TCP/IP.
When I try to open a connection to the corporate database I sometimes get
the error above.
If the other device on NIC #2 is powered off I always find the server.
I know the database is always on NIC card #1.
How can I force DBNETLIB to always connect to try a specific NIC card?
Does using named pipes affect this?
Eggle
Try connecting using the IP address for NIC 1.
-Sue
On Wed, 7 Mar 2007 07:22:03 -0800, RedBear
<RedBear@.discussions.microsoft.com> wrote:

>[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
>denied
>I have two NIC cards on my client machine.
>NIC #1 is the corporate network where my SQLServer resides.
>NIC #2 is for a local device accessed via TCP/IP.
>When I try to open a connection to the corporate database I sometimes get
>the error above.
>If the other device on NIC #2 is powered off I always find the server.
>I know the database is always on NIC card #1.
>How can I force DBNETLIB to always connect to try a specific NIC card?
>Does using named pipes affect this?
|||I have tried IP Address and WINDS name.
The problem is intermittent - connect #1 works, #2 fails, more work more fail.
It seems like the connect is getting routed to NIC #2 where it fails as
expected but never tried on NIC #1 where it would have succeeded.
Can I force a connect onto a specifc NIC card?
The low level connect code should try all NIC cards and declare failure only
after all NIC cards have replied negative or timeed out.
Eggle
"Sue Hoegemeier" wrote:

> Try connecting using the IP address for NIC 1.
> -Sue
> On Wed, 7 Mar 2007 07:22:03 -0800, RedBear
> <RedBear@.discussions.microsoft.com> wrote:
>
>
|||The only way I know of to force it to a specific card is to use that
cards IP address.
Being that it's intermittent, it will be very difficult to
troubleshoot although it's more likely something on the hardware side
of the configuration - maybe something with how the dual NICs are set
up, if you have something like teaming enabled, etc.
And it could be that it's not related to the dual NICs - you could
possible have the intermittent connectivity errors with just one NIC.
The following article has a lot of troubleshooting steps:
http://support.microsoft.com/kb/328306
-Sue
On Mon, 12 Mar 2007 05:18:03 -0700, RedBear
<RedBear@.discussions.microsoft.com> wrote:

>I have tried IP Address and WINDS name.
>The problem is intermittent - connect #1 works, #2 fails, more work more fail.
>It seems like the connect is getting routed to NIC #2 where it fails as
>expected but never tried on NIC #1 where it would have succeeded.
>Can I force a connect onto a specifc NIC card?
>The low level connect code should try all NIC cards and declare failure only
>after all NIC cards have replied negative or timeed out.

Dual Instances In onSQL Server 2000 Enterprise Manager

I am working on a site's SQL Server 2000 database on a W2k3 machine . I went into Enterprise Manager and saw that their database resides on a named instance. I did not see the default instance listed so I registered that using windows authentication. I noticed that the default instance had a user database that had the same name as the user database on the named instance that I was to work on. I looked at the properties of the databases and saw that on both the default and named instances of SQL Server that the Data Files and Log Files for the user database point to the same location.

Is this a problem? Can anyone see any issues with this? Does this mean that someone can simply connect to the named or the default instance of the SQL Server and connect to the same database?

Kirk

That is the not possible if one instance is already using those database files, then the other instance will not be able to use or even attach the database. Try to refresh the Databases pane of Enterprise Manager on the both the instances

Dual CPU Machine and SQL 7.0

We have a complex query that runs in 3-5 seconds on a single CPU machine. When we install the query on a Dual CPU machine, Optimizer selects a totally different execution plan that causes table scans and takes about 45 - 360 seconds to execute.
Any ideas on what to do?
ThanksWhen was the last time you updated statistics, re-built indexes and re-compiled your sps on the dual box?|||We have performed several analyses and traces on the system. We tore apart the Stored Procedure (and ended up re-assembling it the same way).

We dropped and rebuilt all indexes. Update Stats and recompile runs daily on all DBs.

We determined that on dual cpu machines, SQL Optimizer decides to use a bad Execution Path that includes Table Scans (thus the 30-40 minutes).

The data is the same across all the machines, as are the indexes, primary keys, security permissions etc.

We've eliminated flags/settings differences within SQL itself.

We eliminated the raid configuration as on single-cpu machines it runs on any raid config and won't run on dual-cpu any raid or non raid config.

When we pop out one of the CPUs, then the stored procedure runs in 3-5 seconds.|||I'm not quit sure that it's a because of a dual processor. Our development machine and UAT machine are single processors. Our Production and Reporting servers are dual processors and they created the same query plan as those on development and UAT. There is this one instance, about a month ago where a production stored procedure created a different query plan from development, UAT and the Reporting server. But there was one thing different and that was the Production server's indexes where created as CONTRAINTS, whereas on the other machines they where created with CREATE INDEX. The reason Production had to change was because transactional replication requires keys to be defined via PRIMARY KEY constraints. So to rectify the problem I coded tables in the FROM statement in the order of query optimization and adding the FORCE ORDER option.
This cleared up the problem. I never use HINTS or any of those FORCE options before, this is my first time. I'm not one to tamper with query plans, however in this one instance it helped.|||Thanks for the idea, but we have already tried the FORCE and hints options and Optimizer still overrides them. The data is the same across all the machines, as are the indexes, primary keys, security permissions etc.|||Dumb question here but is your hardware and os configured for one or two cpus?

I talked to one of our surver guys and he said you can't just reomve a cpu, reboot and expect NT to run properly.

In fact based on what you said I am wondering if NT was installed for one processor while the hardware is configured for 2 cpus!|||Thanks for the suggestion. We tried 2 different dual-cpu machines.

When configuring the machines both were wiped and WIN 2K SP2+ and SQL 7.0 SP3 were re-installed for a 2-cpu environment.

One machine (Dev) is AN HP LH4R w/Dual Pentium II Xeon 400 mhz CPUs. 2Ghz mem w/HP Netraid controller running a Raid 5 array.

The other machine (Production) is a IX Systems Tyan Motherboard Thunder model LES2510 with 2 Pentium III 1Ghz CPUs. Symbios SCSI Controller hooked to Infotran Raid Controller Model 3102 running Raid 5 array.

When the machines were taken back to 1 CPU, WIN 2K and SQL were again wiped and re-installed.|||Another "Is it Plugged in?" Question...

Are the settings correct for Paralellism in the 'Properties'
under your server in EM... Minimum query plan threshold setting...
defaults at 5 seconds (cost estimate)... for multi-CPU machines|||Hi all,

If the machine can be restarted - then boot to a single processor mode and run the tests...

just a shot...

take care
tony|||We have an sql application that runs perfecly on single processor machines. we recently installed on a dual processor capable server with only one Xeon 1.8 Ghz processor, windows2000 server. Suprisingly we find the sql performance has degraded dramatically( when compared to running it on 1 Ghz, single processpor)
I went through a number of message postings and detrmined that a number of other people have seen performace degradation or at least no increase in performance. Here are the links, the common thread is all of them have xeon processors

Wondering if this is a setup issue on the server or ....

http://216.239.33.100/search?q=cache:GokRMOJ5XtQC:dbforums.com/t363432.html+CONFIGURING+DUAL+PROCESSOR+SQL&hl=en&ie=UTF-8

http://webforums.sybase.com/nntp/nd000049.nsf/85255e6f0052055e85255d7f005ed8bc/dac80f4be40abe7352192d6d624343b1?OpenDocument

http://www.sqlmag.com/Forums/messageview.cfm?catid=5&threadid=4383

http://www.sqlmag.com/Forums/messageview.cfm?catid=5&threadid=5970

http://www.sqlmag.com/Forums/messageview.cfm?catid=5&threadid=4466

http://www.sqlmag.com/Forums/messageview.cfm?catid=22&threadid=3358

http://www.winnetmag.com/Forums/Application/Thread.cfm?CFID=19669352&CFTOKEN=65475496&CFApp=70&Thread_ID=88250|||We still haven't fixed the problem. We're currently trying different tests with setting the parallelism. I'll investigate the latest suggestions and incorporate them into our tests.

Thanks for all your help.

Wednesday, March 7, 2012

DTSSQLIMPORT error

We are rec'ving the following error when we try to run a pkg from a remote machine and the pkg has been created while logged onto the Server machine.

any ideas? thanks in advance.

-dinzana
[Dest tblBSIXData [506]] Error: An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Could not bulk load because SSIS file mapping object 'Global\DTSQLIMPORT ' could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.".Remember that a package runs on the machine from which you launch it.

The best way to execute a package on the server (ie the machine on which it is stored) is to create an unscheduled SQL Agent job for the package, and to run sp_startjob from the client.

-Doug
|||

I am recieving same message, when I am trying to import data from Excel file & exporting it to a Sql Server database on Sql serve database located on different IP (location) .

Can you help me.

|||

Are you using the SQL Server Destination component? This destination is only for use on the local server.

-Doug

DTSSQLIMPORT error

We are rec'ving the following error when we try to run a pkg from a remote machine and the pkg has been created while logged onto the Server machine.

any ideas? thanks in advance.

-dinzana
[Dest tblBSIXData [506]] Error: An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Could not bulk load because SSIS file mapping object 'Global\DTSQLIMPORT ' could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.".Remember that a package runs on the machine from which you launch it.

The best way to execute a package on the server (ie the machine on which it is stored) is to create an unscheduled SQL Agent job for the package, and to run sp_startjob from the client.

-Doug|||

I am recieving same message, when I am trying to import data from Excel file & exporting it to a Sql Server database on Sql serve database located on different IP (location) .

Can you help me.

|||

Are you using the SQL Server Destination component? This destination is only for use on the local server.

-Doug

Sunday, February 26, 2012

DTSRun remote execution

Hi,

I am trying to figure out a way for a machine other than the SQL Server 2000 machine hosting my DTS jobs to fire off a DTS job on request. The jobs are scheduled, but I want to be able to fire them off remotely if the schedule fails. I don't have access Enterprise Manager on the second machine I want to start the jobs from.

An added restriction I have is that I can only execute command line shell scripts on the second machine. This could be a batch file, an executable or any other function available from the command line.

In an initial attempt I made the SQL Server Binn directory available via a restricted network share so the second machine could access the DTSRun.exe file. I then created the DTSRun commands and set them up to run. This worked fine, except I ran into another complication. The DTS Jobs I am running make use of an ActiveX DLL and an ActiveX Control (OCX). These files are registered on the server, but since using DTSRun forces execution to take place on the machine issuing the DTSRun command, the jobs fail because the components are not installed on the second machine.

I would like to try and aviod installing these components on the second machine and was hoping someone could suggest an alternative method for remotely fireing off these DTSJobs.

Any help would be greatly appreciated!

Thanks!
- BradMy first suggestion would be to use a VBScript that uses ADO to manually force execution of the remote job that runs the DTS package.

Just about anything else (SP, CmdExec, etc) is going to run the DTS in the context of your client which may not be desirable for reasons other than the registered ActiveX controls you mention.

Another option might be to create a job or DTS package that checks the original and makes sure that it has run (and executes it if it has not). Or you could simply add this as an additional error check into the original DTS package (set a retry counter and a Global Variable with the maximum number of retries). You would need to examine the business requirements and design a strategy that suits your environment.

Regards,

Hugh Scott

Originally posted by BradC
Hi,

I am trying to figure out a way for a machine other than the SQL Server 2000 machine hosting my DTS jobs to fire off a DTS job on request. The jobs are scheduled, but I want to be able to fire them off remotely if the schedule fails. I don't have access Enterprise Manager on the second machine I want to start the jobs from.

An added restriction I have is that I can only execute command line shell scripts on the second machine. This could be a batch file, an executable or any other function available from the command line.

In an initial attempt I made the SQL Server Binn directory available via a restricted network share so the second machine could access the DTSRun.exe file. I then created the DTSRun commands and set them up to run. This worked fine, except I ran into another complication. The DTS Jobs I am running make use of an ActiveX DLL and an ActiveX Control (OCX). These files are registered on the server, but since using DTSRun forces execution to take place on the machine issuing the DTSRun command, the jobs fail because the components are not installed on the second machine.

I would like to try and aviod installing these components on the second machine and was hoping someone could suggest an alternative method for remotely fireing off these DTSJobs.

Any help would be greatly appreciated!

Thanks!
- Brad|||Hi Hugh, thanks for the reply.

The VBScript option sounds like it may be the way to go. Using a number of retries approach may not work in this case because we need to be able to manually fire off the jobs on request. Catch is, the people who will be firing off these jobs don't have access (or skills) to go into enterprise manager to run them.

If a VBScript file is used to fire off a job using ADO, would the job be executed on the server or on the local client machine? From your comments on context I gather it will be run on the server (which is a good thing in this case as it avoids the ActiveX components needing to be installed on client machines).

Thanks again for the help!

- Brad

[SIZE=1]Originally posted by hmscott
My first suggestion would be to use a VBScript that uses ADO to manually force execution of the remote job that runs the DTS package.|||Im using a stored procedure to run my DTS from the outside whenever I want.

CREATE PROCEDURE ProcImportFile AS
EXEC msdb.dbo.sp_start_job @.job_name = 'Import_file'
GO

I scheduled the DTS package to get a job to call from the procedure.

Haven't tried this solution fully yet beacuse there is some problems regarding the permissions on my database. If i execute the package manually it works fine. But the scheduled job fails averytime...
Helpdesk hasn't fixed it yet.