Quantcast
Channel: SQL Server Database Engine Forum
Viewing all 15872 articles
Browse latest View live

Error: An error occurred while preparing the query in openquery on ServiceNow ODBC Link Server

$
0
0

Hi Team,

Greetings of the Day!!!!!

I have a created a link server on SQL Server 2008 R2 databse of Service Now ODBC driver. And written a stored procedure using openquery to get the data from link server.

Now problem is that, when i have scheduled that stored procedure in sql jobs. When this job runs automatically then we are getting below error while when i start the job mannually then it's not giving error.

An error occurred while preparing the query "..........."

Please help me to resolve this issue.

Regards,

Brijendra Pandey


Unusual behaviour of SQL table

$
0
0

Good morning,

We're noticing some unusual behaviour on one of our very old SQL 2005 (sp3) database servers and was wondering if anybody had come across anything similar.

Below is the schema of a temporary table which is used to briefly hold scanned image data before it is "finalised" and put into the main database table.

There are quite a few inserts and subsequent deletes on this table each day.

/****** Object:  Table [dbo].[T_TempImages]    Script Date: 18/09/2014 09:45:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[T_TempImages](
	[ImageID] [uniqueidentifier] NOT NULL,
	[ImageFile] [image] NULL,
	[ScanBatchID] [uniqueidentifier] NULL,
	[InsertDate] [datetime] NULL,
	[KeepTogether] [bit] NULL,
 CONSTRAINT [PK_T_TempImages] PRIMARY KEY CLUSTERED 
(
	[ImageID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

ALTER TABLE [dbo].[T_TempImages] ADD  CONSTRAINT [DF_T_TempImages_InsertDate]  DEFAULT (getdate()) FOR [InsertDate]
GO

ALTER TABLE [dbo].[T_TempImages] ADD  CONSTRAINT [DF_T_TempImages_KeepTogether]  DEFAULT ((0)) FOR [KeepTogether]
GO

So, what we are seeing is that the table seems to constantly grow and grow... so much so in fact that yesterday when we checked, the table was taking up 42GB when the ACTUAL data being held was only around 25mb...

I tried doing an index rebuild using the below command :

ALTER INDEX [PK_T_TempImages] ON [dbo].[T_TempImages] REBUILD  WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO

But this did nothing (and the index fragmentation was only 40% in any case so I didnt expect this to have an effect).

The only way I was able to shrink the table was to drop it and rebuild it (i did this a little lazily by adding a new column as the first column using the table designer, saving, and then dropping it again).

Has anybody seen this before?  Is there a fix out there?  Can anybody think of a SQL command which will force a table rebuild that I can run regularly that doesnt require a lot of messing around?  I was going to try and dynamically script out all the defaults/columns/indexes etc, but this is quite a large task.

The rebuild I performed yesterday only took one or two seconds, so it isnt a slow process, and we have a regular maintenance window for this application.  

I have tried considering dropping the primary key and recreating it, however this does not actually drop/rebuild the table (which I hoped it might) so does not release the space.  

Regards,

Andy


Appears to be non-yielding on Scheduler 7

$
0
0

In the past week we have had several instances where an SQL instance becomes unresponsive and this error appears in the server log.

Process 0:0:0 (0x14c4) Worker 0x00000000D444A1A0 appears to be non-yielding on Scheduler 7. Thread creation time: 13055521392123. Approx Thread CPU Used: kernel 0 ms, user 0 ms. Process Utilization 0%. System Idle 95%. Interval: 70062 ms.

SELECT @@VERSION

Microsoft SQL Server 2008 R2 (SP2) - 10.50.4033.0 (X64)
 Jul  9 2014 16:04:25
 Copyright (c) Microsoft Corporation
 Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

Can anyone provide some insight on what may be causing this issue?

Thanks

Symentic Veritas Netbackup issue

$
0
0
I am facing backup issues in my environment. 
OS - Windows Server 2008 R2 
SQL - SQL Server 2008 R2
Netbackup Master Version - 7.5.0.7
Client Master Version - 7.5.0.1

Issue 1 : Database logs backups are runing fine but full database backups are not working. Full keeps runing fails.
Issue 2 : Backup failed at veritas end but SQL Job keeps runing in hung state. We need forcibly stopped the SQL Agent Backup job each time.

Things we tried :-
1)  Port are checked
2) Access for veritas netbackup account at OS & SQL Server
3) Antivirus exclusion for netbackup process

Please suggest.

Regards,
Rohit Garg
(My Blog)
This posting is provided with no warranties and confers no rights.
Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

CONCAT_NULL_YIELDS_NULL value different in UI than in query?

$
0
0

I look at the database properties through SSMS explorer, right-click on database - right-click on properties. I see the value concat_null_yields_null with the value of false.

When I run the queries in either SSMS or using sqlcmd

SELECT   SESSIONPROPERTY ('CONCAT_NULL_YIELDS_NULL') 

DECLARE @CONCAT_NULL_YIELDS_NULL VARCHAR(3) = 'OFF';
IF ( (4096 & @@OPTIONS) = 4096 ) SET @CONCAT_NULL_YIELDS_NULL = 'ON';
SELECT @CONCAT_NULL_YIELDS_NULL AS CONCAT_NULL_YIELDS_NULL;

I see the value 1 and ON, which means true. I can verify the property is indeed set to ON by running the query SELECT NULL + 'ABC'; which returns null.

Why do I see the value of false in the UI? Am I misunderstand something?

Thanks.

Slow import from a view

$
0
0

I am running into a weird issue. When I try to import data from a view from on database to another it's taking over an hour to copy roughly 300k rows. I am using import export wizard to do the import. However when I run a select * on the view, all 300k rows are returned in about 10 seconds. When I run Insert into dummytable select * from view ... this statement also populates the dummy in 10 seconds.

I am sort of at a loss here. Not sure what's going on. Wonder if someone can share their experience and thoughts on how to solve this issue.

thanks


SQL Pro

Jobs on passive side of mirror

$
0
0

Hello,

Have a problem I can't seem to find a definitive answer.  we have 2 SQL servers, 1 is the primary the other is a passive mirror.  Both have about 20 jobs running in agent, each which fire stored procedures.  I have about 10 of these deployments.  On 2 of the deployments, the jobs are executing on the passive side of the mirror to the principle database.  I have checked the target, which is set to "target Local server".

Does anybody know why it would act this way on 2 of 10 deployments?  All of them are SQL 2012.  Some are at SP1, some SP2.  I don't want to have the jobs disabled on the passive machine is case they failover to it.

many thanks in advance.

Restore MSDB Database

$
0
0

Hi - I have a corrupt MSDB database and I am not able to run dbcc checkdb with the fix parameter nor am I able to restore from backup - I get an error saying that the operating system returned error 23 in file... (the msdb DB file) - it adds that it is error 823.

I get this when I try to restore any of the databases and when I try to repair msdb.

I am running SQL Server 2008 R2

Any help will be appreciated.

 


A large table access suddenly got 2x slower

$
0
0

Access to one of our large tables suddenly got slow.
We have a table T1 which contains millions of rows. For each row in that table, call an sp which looks up rows in table T2 and 
then updates T1. T2 has billions of rows. The lookup in T2 is done via clustered index. Each individual lookup in T2 accesses only
small number of rows. There is a clustered index on T2 and the lookup is on the clustered index fields. 

Suddenly this procedure went from taking 1 hour to 2.5 hours. We didn't change the SQL code. There is no conceivable way SQL can be choosing wrong plans because there is a clustered index exactly on the fields that the query uses.

We are puzzled about how can the access get 2.5x slower. Any suggestions on what we should look?

OFFLINE Index rebuilds vs ONLINE Index rebuilds

$
0
0
Hi,

Can anyone please tell me the difference between OFFLINE Index rebuilds and ONLINE Index rebuilds? Which one is good over the other?

Thanks

mirroring error

$
0
0

hai ,

in mirroring configuration , i got an error as above .

please help me how to change a database from read only mode to read/write mode.

thanks.

How to get alerted or notified when db goes offline

$
0
0

Hi All,

I am basically looking for solution for the below problem.

Is there a nice way for a DBA to get alerted/notified as and when a database is not accessible for any reason(say offline,suspect,restoring...) DBA has to get alerted.  I am working on sql2k5 and sql2k8 environments.Also looking for a solution which work across all Edition and not just Enterprise Edition like Policy based managment or so..

So, Is there a nice way through which we can achieve this using native tsql programming and alerting system combined with database mail functionality? If have done it in your past, please do share views and ideas.

Again, I am not looking for any 3rd party solutions.


Thank you.



sp_addlinkedsrvlogin fails with @locallogin = 'NT AUTHORITY\NETWORKSERVICE'

$
0
0

If I run

EXECmaster.dbo.sp_addlinkedsrvlogin@rmtsrvname = @serverName,
                                    
@useself =N'False',
                                    @locallogin ='NT AUTHORITY\NETWORKSERVICE',
                                    
@rmtuser = @user,
                                    @rmtpassword = @password;

I get the following error:

Msg 15007, Level 16, State 1, Procedure sp_addlinkedsrvlogin, Line 76
'NT AUTHORITY\NETWORKSERVICE' is not a valid login or you do not have permission.

But, it will pass if I use @locallogin ='NT AUTHORITY\NETWORK SERVICE'.

So, why am I using 'NT AUTHORITY\NETWORKSERVICE'?  Because that’s what’s returned when I run SELECT service_accountFROMsys.dm_server_services.

What’s going on here?  Is this a bug, or am I missing some step to convert values returned by sys.dm_server_services into something that sp_addlinkedsrvlogin will accept?

connection pooling error and DB server not responding..

$
0
0

Hi Team,

one of my production server running good, but suddenly i am getting below error  even DBA also unable to access.

error:

Error: 18056, Severity: 20, State: 29.

The client was unable to reuse a session with SPID 900, which had been reset for connection pooling. The failure ID is 29. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.

how to fix those kind of issues.

 

How to CATCH when database not exists?


Mirrored backup on external HDD fails

$
0
0

Hi all,

We have attached a HSB drive to server. When we backup on local drive and USB drive at the same time (mirrored backup) the following error is returned:

Executed as user: NT AUTHORITY\SYSTEM. The mirror device "G:\New_Backups\Automation\Automation_2014-09-03.bak" and the mirror device "I:\New_Backups\Automation\Automation_2014-09-03.bak" have different device specifications. [SQLSTATE 42000] (Error 3212)  BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013).  The step failed.

What's wrong with my SQL Server?

Any help would be greatly appreciated.

Leila

Weird question on Job history

$
0
0

hi there:

 I've created a job and schedule it to run every 5 mins. This job contains 2 steps. This job has been running for a while and I want to check it out. I saw this log file which is very confusing.

at 9/17/2014 2:10pm, it ran for 3 steps as supposed to be 2 steps. How is that possible? 

Also there is no job running history at 2:05pm which is odd. I do know that this job was running very odd( extremely slow) 

at 2:05pm... 

 Anyone saw this before? please feel free to share your experience.

 Thanks

Hui


--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

Filegroup/Partitioning

$
0
0

Hi All,

I want to take advice from all of experts,My database is located at data center and System Admin is telling to me SAN disk is sharable it means San disk is shared with many server and provide to us particular amount of space(1 TB) from SAN   (i don't have too much knowledge about hardware) .If I am wrong then please correct to me

My second question is if its sharable then its doesn't improve any  performance if i adding filegroup  /adding file (ndf )/partitioning 

thanks

For really expert, size checking

$
0
0

Hi guys, it's been weeks that I'm struggling with the performance of my datawarehouse. Some insert (with calculatio, hundreds millions of rows) used to take y, two hours now take seven or eight hours. I passed from full to simple recover, I shrinked the log...nothing. I noticed that the problem could be in the insert with the calculation...maybe...now I ran a query to see how many space take each table and surprise I noticed that table with many rows can take less space that table with less rows ( and column). As below:

TableNameSchemaName RowCountsTotalSpaceKB UsedSpaceKBUnusedSpaceKB
xdbo0 0 00
xxdbo 000 0
xx0dbo 000 0
xx1dbo 000 0
xx2dbo 61616 0
xx3dbo 411616 0
xx4dbo 51616 0
xx5dbo 51616 0
xx6dbo 501616 0
xx6dbo 51616 0
xx7dbo 121616 0
xx8dbo 108032 320
xx9dbo 105656 560
xx10dbo 181572 720
xx11dbo 187216 56
xx12dbo 12672 2448
xx13dbo 288024 56
xx14dbo 638024 56
xx15dbo 758024 56
xx16dbo 12380 2456
xx17dbo 528024 56
xx18dbo 528024 56
xx19dbo 528832 56
xx20dbo 10088 3256
xx21dbo 759640 56
xx22dbo 4383128 8840
xx23dbo 1156144 9648
xx24dbo 1144144 9648
xx25dbo 1046144 11232
xx26dbo 7175144 1440
xx27dbo 3743152 1448
xx28dbo 3946200 16040
xx29dbo 4383200 16040
xx30dbo 1462208 15256
xx31dbo 2958272 2648
xx32dbo 2155280 24832
xx33dbo 3844344 28856
xx34dbo 6336392 3920
xx35dbo 4177456 40056
xx36dbo 6919464 4568
xx37dbo 6691520 48832
xx38dbo 7466600 54456
xx39dbo 9139728 67256
xx40dbo 9353976 89680
xx41dbo 7126976 93640
xx42dbo 145091048 10408
xx43dbo 75551112 105656
xx44dbo 458381816 1552264
xx45dbo 616301872 185616
xx46dbo 718561872 18720
xx47dbo 753122000 196040
xx48dbo 779042192 21848
xx49dbo 122482448 240048
xx50dbo 166632592 251280
xx51dbo 674423272 2832440
xx52dbo 674423272 2832440
xx53dbo 845403848 379256
xx54dbo 867793984 396816
xx55dbo 769134880 482456
xx56 dbo120020 5128 5120 8
xx57dbo 708025968 5768200
xx58dbo 308517176 71688
xx59dbo 722217760 7224536
xx60dbo 260259232 920824
xx61 dbo26763 9744 5728 4016
xx62dbo 2676310064 60883976
xx63dbo 2602512040 1201624
xx64dbo 8170612056 110081048
xx65dbo 17193012568 12384184
xx66dbo 28032013208 12696512
xx67dbo 13348716144 15952192
xx68dbo 27567430616 29848768
xx69dbo 18839748784 48608176
xx70dbo 126030458696 5863264
xx71 dbo1573792 70488 70384 104
xx72dbo 1435789105232 105176 56
xx73dbo 2608390229584 229544 40
xx74dbo 4912686497376 497320 56
xx75dbo 7489714501592 476512 25080
xx76dbo 9235276618520 587560 30960
xx77dbo 4912686685912 685800 112
xx78dbo 10820694698256 698128 128
xx79dbo 137053721104784 1077152 27632
xx80dbo 279613791872536 1778880 93656
xx81dbo 370076041910360 1910096 264
xx82dbo 493581311957848 1876256 81592
xx83dbo 301810282021208 1920096 101112
xx84dbo 370076042056272 2056000 272
xx85 dbo 37007604 2350368 2349728 640
xx86dbo 370076043312408 3311984 424
xx87dbo 867631264397272 4396704 568
xx88dbo 547194565796432 5795696 736
xx89dbo 360728486024296 6023536 760
xx90dbo 336703356372216 6371408 808
xx91dbo 336703356678680 6677824 856
xx92dbo 336703356985688 6984800 888
xx93dbo 336703597293272 7292336 936
xx94dbo 1646503777659616 7658192 1424
xx95dbo 1349619239037992 8586088 451904
xx96dbo 3041576439046760 9045624 1136
xx97dbo 33712937713372408 12815224 557184
xx98dbo 29483996815219544 15217640 1904
xx99dbo 29483996816382128 16380048 2080
xx100dbo 61071631818164912 18162616 2296
xx101dbo 29483996819024392 19022008 2384
xx102dbo 29483996824573112 24570056 3056
xx103dbo 14318631839921512 39916520 4992
xx104dbo 27144194840548584 40535552 13032
xx105dbo 19765755340632112 40631288 824
xx106dbo 27123924450886912 50880608 6304

Now I'm running the x105 and you know what? After one hour it went at 180000000 rows and after it slow down...now it took four hour so far...the xx106 took ten hours, instead the x88 took 20-30 minutes...

According your experience, do you notice something wrong in the number above?

Thanks



sql server connecting error

$
0
0

hi Team,

while i am tring to connecting sql server 2012 SSMS getting bleow error.

Note: all named pipes and port are enabled .

Viewing all 15872 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>