Quantcast
Channel: SQL Server Database Engine forum
Viewing all 15930 articles
Browse latest View live

table changes

$
0
0

Hi,

We have program that is inserting records in a table. In middle it is giving Duplicate key error.

How can I know which record is getting duplicated?

We are using SQL Server 2012

Regards





SQL 2014 Linked Servers with Availability Groups

$
0
0

Good afternoon All. Hope your well. We have SQL 2014 Availability group setup over multiple Subnets.

So basically Instance A(In Primary DC), and Instance B (Secondary Replica, in secondary DC), with AG1 (Availability Group) 

When I connect to the instance Directly (using SQL management Studio), and attempt to create a linked Server to another SQL 2014 instance (Instance D, Both use the same Service Account), I am able to successfully connect, and run query on the Linked Server. However when I connect to the Availability group, I attempt to open the linked server (to Instance D) and receive the following error:

Login Failed for User 'NT Authority\Anonymous Logon'

This above only happens when I connect to the AG1, and not the instances directly. I have given the Service account permissions to Read and Write its own SPNs (Using ADSI Edit). Researching this people have stated to add the Availability Group Name as an SPN to the Service account;

Setspn -A MSSQLSVC\AG1.mydomain:1433 mydomain\ServiceAccount

However, Im a little unsure at this stage, should the port in the above command reflect what the AG1 endpoint ports are? As I have done that (as well as trying port 1433), and unfortunately the error still happens. Your assistance would be appreciated,

kind regards,

login failed for user

$
0
0

hello I have error when I start the program I get login faild for user. I installed correctly SQL snd the software but I get the error I tried on many laptops. can you vist my laptop by team wiever and show me whats going wrong please because I don't understand a lot of SQL? pleaseinform me on my email and I will wait for an answer please and thank you for your time

Maintenance of clustered indexes

$
0
0

Hi, 

There has been an overnight job running here for a number of years which rebuilds the non clustered indexes in a large database. I changed it yesterday to either rebuild, reorganize or ignore based on the fragmentation in  sys.dm_db_index_physical_stats. 

This job specifically ignores clustered indexes which puzzles me.  Non of the original authors are here any more and I wondered why this decision would have been taken. Any ideas why they would ignore clustered indexes? 

Another question, there are a lot of heaps in the database which are also quite big (200,000+ rows).  I've looked at a number of these and there does not appear to be any natural key I could use as the PK.  Should I just add an identity column and make it the PK? 

Thanks 

tempdb + delete query

$
0
0
Hi everybody,

I work for a new customer. in his SSIS package he launches several SQL delete commands on huge tables.
Sometimes he gets such an error message Could not allocate space for object 'dbo.SORT temporary run storage...
Does the DELETE queries use tempdb and how?

Thanks

Pete

SQL 2005 database to open SQL 2008 database

$
0
0

hi

Need help. I have this question.

I have this database created in SQL Server 2008. But my developers only have SQL 2005. They are able to open this database in SQL 2005 using SP4(not with any other SP's). Is this method is correct and can they write all INSERT/DELETE/UPDATE/SELCT& create SP. Will it make an issue to SQL Server 2008 database as it is created in SQL 2008.

And if it is correct, is it mentioned in any of the MS documents. Thanks.

Regards

Sajith

Where is Adventureworks or Northwind for SQL 2008 Express?

$
0
0

Hi, I have a server with SQL Server 2008 Express installed. I downloaded AdventureWorks2008R2-Full Database Backup.bak (I know it's not R2, but that's what I found on CodePlex), and got:

Restore failed for Server 'server\instance'.  (Microsoft.SqlServer.SmoExtended)

...

ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.2500. That version is incompatible with this server, which is running version 10.00.2531. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)

Thanks,

Scott


Calling all SS DBE fans! Your chance to win love and glory! Be our November TechNet Guru!

$
0
0

November has been designated National Novel Writing Month and National Blog Posting Month.

But we don't want that! We want a professional wiki article!

TechNet Wiki provides anyone the chance to contribute Microsoft technology related content to the community!

And we'll love it, and tweak it, and show the world!

Everyone has an equal chance of becoming our TechNet technology Guru, every month.

Separate teams of judges (6-8 per category) read every article submitted.

Some of the most influential members of Microsoft in your favourite technologies contribute their judging time to this competition.

TechNet Guru awards also help to promote your progress within the community... and its inner circles.

These competitions also help towards real awards, even MVP recognition!

 

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over toTechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

Have you got what it takes o become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!


Cannot start SQL Server Agent (Version 2014 enterprise core)?

$
0
0

The SQL Server Agent log file has the following information. I already set the firewall for inbound 1433.

2014-11-04 11:59:43 - ? [100] Microsoft SQLServerAgent version 12.0.2000.8 (X64 unicode retail build) : Process ID 6108

2014-11-04 11:59:43 - ? [495] The SQL Server Agent startup service account is ......

2014-11-04 11:59:43 - ! [150] SQL Server does not accept the connection (error: 0). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.

2014-11-04 11:59:43 - ! [000] Unable to connect to server '(local)'; SQLServerAgent cannot start

2014-11-04 11:59:43 - ! [298] SQLServer Error: 27, Registry information is corrupt or missing. Make sure the provider is installed and registered correctly. [SQLSTATE 08001]

2014-11-04 11:59:43 - ! [298] SQLServer Error: 27, Client unable to establish connection [SQLSTATE 08001]

2014-11-04 11:59:43 - ! [165] ODBC Error: 0, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]

2014-11-04 11:59:43 - ! [382] Logon to server '(local)' failed (DisableAgentXPs)

2014-11-04 11:59:43 - ? [098] SQLServerAgent terminated (normally

Index Deadlocks

$
0
0

I am seeing a lot of deadlocks on a single table. There are two update statements that run frequently causing the problems. The table has a unique, clustered index on ID and a non-unique, non-clustered index on StatusDetailsID.

The winning statement is:

Update Messages set StatusDetailsID = @1 where ID = @2

The losing statement looks like:

Update Messages set StatusDetailsID = @2 Where StatusDetailsID <> @1 and DirectionID = @3

The winner has an X lock on the PK index on ID and wants an X lock on the StatusDetailsID index.

The loser has an U lock on the StatusDetailsID index and wants an U lock on the PK index.

I understand why this is happening, but am not sure how to avoid it. Most deadlock information deals with selects. The best I could come up with so far is to change the losing statement to load the IDs into a temp table and join the temp table to update based on IDs. I'm hoping for something better.

All ideas and suggestions appreciated.

My Local Database

$
0
0

Hello,

I have started working for a company, I have SQL Server on a share drive. They created a local database in SQL Server. I can't find my local database. Where I need to look for it?

I don't want to ask our IT

Thanks,

GGGGGNNNNN


GGGGGNNNNN

Unable to connect to SQL Server: 'SQL Server does not exist or access denied.'

$
0
0

Hi All,

I have windows service application created in C++. From windows service I am connecting to SQL server and database. When I create new process from windows service
and try to connect to same SQL Server/Database, I am getting following error:
SQL Server does not exist or access denied.

I am confused as from service I am able to connect but from process created by service is unable to connect to same SQL server.

Any help would be highly appreciated.


Raman

Rename SA account

$
0
0

Hi All,

I am sure many would have needed to do this (DISABLE/RENAME SA as per some audit requirement)

By default, all system DBs are owned by SA. I am going to rename the SA account. After this, I know the owner of the system DBs does change to the new "renamed" user. 

Is there any risk seen in doing this? I will be changing job owners from SA to SQL agent service account before renaming SA login.


note: I am aware of this known issue in upgrading sql server (http://support.microsoft.com/kb/968829/en-us)


thanks in advance...


Modellog.log file being moved with inapproprite name. Startup is now failing.

$
0
0

I ran an alter database command to move to model database to a new location.  This was a DISA STIG security requirement.  It is something I have done dozens or times successfully, but yesterday I went brain dead.

ALTER DATABASE Model MODIFY FILE ( NAME = modellog , FILENAME = 'C:\dir\modellog. log')

I should have proofed better, but I  just plain missed it.

Notice the embedded space between '.' and log.  Even though the file has been copied to the correct database it is still called modellog.log not modellog. log as expected by the startup process.

Is there any way to change the name the statup process is searching for? or is there a way to rename the file so it does contain an embedded space after the '.' ? I tried using and rename command without luck.

Thoughts?


Just my thoughts tomh

Error occurred while reading the input stream from the network

$
0
0

Hi,

I am facing this error in SQL server error logs on my active\passive Cluster set around 10-20 times per day, can anyone guide me according to the versions and service pack that is been used

Edition : SQLserver2008R2 Enterprise edition

SQL SP: SP1

Windows : 2008R2 Enterprise windows

  2012-07-30 04:44:15.560 A fatal error occurred while reading the input stream from the network. The session will be terminated (input error: 10054, output error: 0).


Connection attempts to an 'offline' database

$
0
0

Is there a way to determine whether anyone is trying to connect to an "offline" database in SQL Server 2008 R2 Standard Edition? We had to take some of the old databases to offline mode because of space issues, they are mostly not in use and I just want to run a process for an week or so just to confirm. Thanks!


spp

mixed authentication mode

$
0
0
does mixed mode mean that user has to enter two passwords - one at the level of windows and another to login to sqlserver - for the same user?

deadlock information

$
0
0

how do we find deadlock related information on a sqlserver?

the traceflags 1201 and 1222, can only produce information for the session right? using dbcc traceon and then executing sql?

i am more talking about existing deadlocks happening on the sqlserver and how we can track the related information?

appreciate the feedback.

Performance Monitoring

$
0
0
Performance Check through DMV's We don't have any tool and working on 2012 server with max 3 TB database size. 

Unable to access the linked Server data within the Trigger and Stored Procedure

$
0
0

I am unable to access the data from the linked Server within a Trigger and Stored Procedure. but it is accessible within the SQL Server Query Editor Directly.

Database API specific error Your database has returned the following error code and description to Alpha Five. Consult your database documentation for further information. 7391 - '[Microsoft][SQL Server Native Client 11.0][SQL Server]The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "RMS" was unable to begin a distributed transaction. SQL State is: 42000 [Microsoft][SQL Server Native Client 11.0][SQL Server]Mail (Id: 5) queued. SQL State is: 01000 [Microsoft][SQL Server Native Client 11.0][SQL Server]OLE DB provider "SQLNCLI11" for linked server "RMS" returned message "The partner transaction manager has disabled its support for remote/network transactions.". SQL State is: 01000'

 

RehaanKhan. M

Viewing all 15930 articles
Browse latest View live


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