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

Linked Server Connection Sharing Performance & Persistence

$
0
0


We have situation where we can't avoid having multiple databases that share data on two different database servers. We are aware that between the two servers we would only need one linked server on each server to reference the other server for the communication between them. We are also aware that the access to the databases via the linked server is determined by the user the linked servers are created with. We are wondering about the performance impact of having multiple linked server references essentially to the same server but different in name, only, for the specific database on the server.

What is the performance impact of sharing the same linked server reference by 10 databases to get to another server for a variety of different databases? So 1 linked server reference to get to another server, but shared by a variety of processes.

What is the performance impact of having 10 different linked server references on a server to another server where the references are different only in the name? So 10 database linked server references on one server where the linked server references are different in name only.

What is the persistence for a linked server connection?

Scenario 1

Scenario 2



Attention All SS DBE Gurus! Time to SPRING Into Action!

$
0
0

April fools out of the way, now let's find an April genius!

The name "April" is derived from the Latin verb "aperire", meaning "to open", as it is the season when trees, flowers AND MINDS start to open! And.. I can't wait to OPEN and read this month's community contributions! (groan, tenuous link!)

Things are indeed heating up around TechNet. The Wiki has become a shining example of what the community has to offer, and talent is SPRINGING FORTH from all corners of our garden of knowledge. 

If you can find the time to enrich us with your latest revelations, or some fascinating facts, then not only will you build up a profile and name for yourself within the gaze of Microsoft's very own glitterati, but you will be adding pages to the most respected source for Microsoft knowledge base articles. This could not only boost your career, but would benefit generations to come!

So don't be an April fool. Please realise the potential of this platform, realise where we are going, and join us in growing this community, learning more about you, and opening the minds of others!

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!

Backup SQL database by php mssql driver ERROR

$
0
0

SQL QUERY

backup database baza_programu to disk='d:\arh\baza_programu.bak'

---------------------------------

In SQL Server management studio it's OK.

Processed 2840 pages for database 'baza_programu', file 'baza_programu' on file 1.

Processed 2 pages for database 'baza_programu', file 'baza_programu_log' on file 1.

BACKUP DATABASE successfully processed 2842 pages in 3.932 seconds (5.644 MB/sec).

------------------------------------

BY PHP MSSQL DRIVER

Error in executing query.
Array (    [0] => Array        (            [0] => 01000            [SQLSTATE] => 01000            [1] => 4035            [code] => 4035            [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Processed 2840 pages for database 'baza_programu', file 'baza_programu' on file 2.            [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Processed 2840 pages for database 'baza_programu', file 'baza_programu' on file 2.        ) )

( notice. no include baza_programu.log file   )

 Pawel.

Communication Link Failure in SELECT statement | From Middleware Application to SQL Server 2008/R2

$
0
0

Hi

We are connecting to an SQL Server 2008/R2 on a windows 7 machine from a middle ware message broker application on RHEL. We are using FreeTDS 7.0 to establish this connection.

We have seperate Program modules connecting to the same database and same table in SQL. Sometimes , we start getting a "Communication Link Failure" error in the SELECT statement. In each program module , we are connecting to the databse and then doing a SELECT , the connection statement is executing successfully , and the SELECt throws this exception.

In odbc log file , we are getting the below entries : 

Please let know in case any other information is required.

We are trying to find out the rrot cause of this error.

Thanks in advance for the help

[ODBC][1197][SQLAllocHandle.c][345]
                Entry:
                        Handle Type = 2
                        Input Handle = 0x8c21a18
[ODBC][1197][SQLAllocHandle.c][463]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x137084e0
[ODBC][1197][SQLSetConnectOption.c][262]
                Entry:
                        Connection = 0x137084e0
                        Option = SQL_ATTR_QUIET_MODE
                        Value = 0
[ODBC][1197][SQLSetConnectOption.c][405]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLConnect.c][3549]
                Entry:
                        Connection = 0x137084e0
                        Server Name = [XIBSQLDSNR2][length = 11 (SQL_NTS)]
                        User Name = [user_r2][length = 7 (SQL_NTS)]
                        Authentication = [*************][length = 13 (SQL_NTS)]
                UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'

[ODBC][1197][SQLConnect.c][4123]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLSetConnectOption.c][262]
                Entry:
                        Connection = 0x137084e0
                        Option = SQL_ATTR_AUTOCOMMIT
                        Value = 0
[ODBC][1197][SQLSetConnectOption.c][525]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLGetInfo.c][214]
                Entry:
                        Connection = 0x137084e0
                        Info Type = SQL_CURSOR_COMMIT_BEHAVIOR (23)
                        Info Value = 0x136d56c4
                        Buffer Length = 2
                        StrLen = (nil)
[ODBC][1197][SQLGetInfo.c][528]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLGetInfo.c][214]
                Entry:
                        Connection = 0x137084e0
                        Info Type = SQL_CURSOR_ROLLBACK_BEHAVIOR (24)
                        Info Value = 0x136d56c6
                        Buffer Length = 2
                        StrLen = (nil)
[ODBC][1197][SQLGetInfo.c][528]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLAllocHandle.c][510]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x8c21fa8
[ODBC][1197][SQLAllocHandle.c][872]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x1371a130
[ODBC][1197][SQLPrepare.c][189]
                Entry:
                        Statement = 0x1371a130
                        SQL = [SELECT DISTINCT MSTID FROM MESSUTIL,RP_PIVSRTCLT01 WHERE MSTDATER IS NULL AND MSTETAT IS NULL AND MSTNOMTABLE LIKE ? AND MSTID =...][length = 174 (SQL_NTS)] [ODBC][1197][SQLPrepare.c][364]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLBindParameter.c][193]
                Entry:
                        Statement = 0x1371a130
                        Param Number = 1
                        Param Type = 1
                        C Type = 1 SQL_C_CHAR
                        SQL Type = 1 SQL_CHAR
                        Col Def = 14
                        Scale = 0
                        Rgb Value = 0xf336c910
                        Value Max = 14
                        StrLen Or Ind = 0x8c54088
[ODBC][1197][SQLBindParameter.c][339]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLBindParameter.c][193]
                Entry:
                        Statement = 0x1371a130
                        Param Number = 2
                        Param Type = 1
                        C Type = 1 SQL_C_CHAR
                        SQL Type = 1 SQL_CHAR
                        Col Def = 8
                        Scale = 0
                        Rgb Value = 0xf390d290
                        Value Max = 8
                        StrLen Or Ind = 0x8c5409c
[ODBC][1197][SQLBindParameter.c][339]
                Exit:[SQL_SUCCESS]
[ODBC][1197][SQLExecute.c][183]
                Entry:
                        Statement = 0x1371a130
[ODBC][1197][SQLExecute.c][344]
                Exit:[SQL_ERROR]
                DIAG [08S01] [FreeTDS][SQL Server]Communication link failure

[ODBC][1197][SQLError.c][342]
                Entry:
                        Statement = 0x1371a130
                        SQLState = 0xffa5bee0
                        Native = 0xffa5bed8
                        Message Text = 0x8c1f7b8
                        Buffer Length = 511
                        Text Len Ptr = 0xffa5bede
[ODBC][1197][SQLError.c][379]
                Exit:[SQL_SUCCESS]
                        SQLState = 08S01
                        Native = 0xffa5bed8 -> 0
                        Message Text = [[unixODBC][FreeTDS][SQL Server]Communication link failure] [ODBC][1197][SQLFreeStmt.c][140]
                Entry:
                        Statement = 0x1371a130
                        Option = 1
[ODBC][1197][SQLFreeHandle.c][365]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x1371a130
[ODBC][1197][SQLFreeHandle.c][462]
                Exit:[SQL_SUCCESS]

Why "Target Server Memory" = "Total Server Memory" (Permanently)?

$
0
0

Hello,

could you please help me to understand why values of next Performance counters are permanently equal?:

  • SQLServer:Memory Manager / Target Server Memory (KB)
  • SQLServer:Memory Manager / Total Server Memory (KB)
  • 22906680 = 22906680

even after we added 4 GB RAM to this server.

Technical details: ________________________________

  • Microsoft SQL Server: 2008-R2 (SP1) - 10.50.2500.0 (X64), Standard Edition,
  •   - MIN server memory (MB): 4 096 (run_value)
  •   - MAX server memory (MB): 2 147 483 647 (run_value)
  • Microsoft Windows:  2008-R2 NT 6.1 (Build 7601: Service Pack 1) (Hypervisor), Enterprise Edition,
  • HW: Virtual (VMWare),
  • CPU: 8 virtual (Intel Xeon X5550),
  • RAM: 24 GB.
  • This server is:
  •   - dedicated for Microsoft SQL Server only,
  •   - member of "Microsoft Active Directory".



__________________________________________________________ If isn't above described anything, the following applies: Technical details: * OS: Windows Server v2008-R2, English, Enterprise Edition, x64, SP1 ** My User-Account is member of 'Administrators' local security group. * MS-SQL-Server: v2008-R2, English, Enterprise Edition, x64, SP1 ** My User-Account is member of 'SysAdmin' db-role.

dbcc checkdb error state 6

$
0
0
I got an error message in SQL Logs, saying dbcc checkdb came back with an error state 6.  You guys ever seen that?  Can't seem to find any info on error state 6.

"Database Audit Specification" not available.

$
0
0

Hi all, 

Been asked by one of the developers to audit delete & insert for one night only so I thought to investigate built in auditing via "new Database Audit Specification".  I am in the sysadmin role but no  option to add a database audit, the server audit is however available.

This is SQL 2008R2 enterprise. 

Any ideas? 

Thanks

SSD Drive slow on Database Restore

$
0
0

Hi All,

My main VMWare hosted server has recently been "upgraded" to improve performance and now has a suite of 6 SSD Drives connected via VMWare SCSI Drivers.

However I am finding that whereas the old 2Tb HDD could restore a 300Gb Database in about 10 mins, writing at 225Mb/Sec, the same restore on the new drives (even splitting logs and db to separate partitions) now takes over an hour with an average speed of about 70Mb/Sec.

The compressed source .BAK file sits on one of the SSDs and it doesn't seem to matter whether that is on an SSD or the old HDD. What seems to matter is the destination.

Has anyone got any suggestions to troubleshoot the bottleneck? Tried playing with maxfiletransfer and buffer settings and managed to improve the speed on the old HDD but not significantly improve the speed on the SSD.

Thanks for any help!


Iain


Connectivity: Error 10054 An existing connection was forcibly closed by the remote host

$
0
0

This is a SQL 2008 R2 server.  I am attempting the connection from SSMS.  Neither windows nor sql authenication works.  However, i can connect using sqlcmd.  Also ODBC driver 'Test Connection' works.  My application (which is what i really want) doesn't work either.

There isn't anything in the ERRORLOG.  I have checked ring buffers and the ssat tool on codeplex.  I can't figure this out.

ideas/

thanks


-- dan http://dnhlmssql.blogspot.com/

ALTER DATABASE AUDIT SPECIFICATION

$
0
0

Hi, 

I've created a database audit in SQL2008R2 and now can't seem to disable/delete it.  I assumed it would be a case of

  1. disable database audit 
  2. delete database audit
  3. disable server audit 
  4. delete server audit

However I cannot even do steps 1 and 2. I scripted deletion of the database audit but when I run it from a query window it just runs and runs.  

USE [Admin]
GO
ALTER DATABASE AUDIT SPECIFICATION [DatabaseAuditSpecification-20150420-122643]
WITH (STATE = OFF)
GO
USE [Admin]
GO
DROP DATABASE AUDIT SPECIFICATION [DatabaseAuditSpecification-20150420-122643]
GO

Now I can't even open/refresh the "Audits" folder at the instance level, getting this error

"Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)" 

I have the option of restarting the instance tonight at 18:30, however I need to be able to audit a couple of databases for DELETE/INSERT before this time. 

Any ideas? 

Thanks in advance. 

SQL Server 2012 syspolicy_purge_history fails step 3 "Erase Phantom System Health Records."

$
0
0

I recently installed SQL Server 2012 Ent (x64). The install is a stand alone default instance.

The syspolicy_purge_history job fails on step three with the following error:

Executed as user: <DomainName>\sql_xxx_agt_svc. A job step received an error at line 1 in a PowerShell script. The corresponding line is 'set-executionpolicy RemoteSigned -scope process -Force'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Security error.  '.  Process Exit Code -1.  The step failed.

Here is the code that is in the step:

if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = '\DEFAULT'} ELSE {$a = ''};
(Get-Item SQLSERVER:\SQLPolicy\$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()

The domain user is the account that SQL Agent is running as.

What permissions need to be granted to this account?



Here is the link to the Connect post:

https://connect.microsoft.com/SQLServer/feedback/details/754063/sql-server-2012-syspolicy-purge-history-job-step-3-fails-with-security-error

Log File Rotation

$
0
0
I needed help with the log file rotation and cleanup script and how to remove the log file older then x days.

Redshift Linked server Performance behavior issues.

$
0
0

Hi bit of a shot in the dark here but open for offers.

We have a Redshift database 

version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.901 

which is hosted on the cloud now I  downloaded the recommend driver from

https://docs.aws.amazon.com/redshift/latest/mgmt/install-odbc-driver-windows.html

Installed the 64bit then gained connection.   I then setup a linked server within SQL 2012

EXEC master.dbo.sp_addlinkedserver @server = N'CONSOLE', @srvproduct=N'Redshift', @provider=N'MSDASQL', @datasrc=N'Console'
 /* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'CONSOLE',@useself=N'False',@locallogin=NULL,@rmtuser=N'test',@rmtpassword='########'

GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'collation compatible', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'data access', @optvalue=N'true'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'dist', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'pub', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'rpc', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'rpc out', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'sub', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'connect timeout', @optvalue=N'0'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'collation name', @optvalue=null
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'lazy schema validation', @optvalue=N'false'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'query timeout', @optvalue=N'0'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'use remote collation', @optvalue=N'true'
GO

EXEC master.dbo.sp_serveroption @server=N'CONSOLE', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO

Which is all fine however getting some very odd behavior where on certain tables if I select a 14k location table it never retuns but if i limit it to 5 returns instantly.

Also for another table which has 200 columns I can only select 1 row otherwise it comes back with 

OLE DB provider "MSDASQL" for linked server "console" returned message "[Amazon][RedShift ODBC] (30) Error occurred while trying to execute a query: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
".

Yet when I use a the aginioty workbench client which I'm guessing uses its own form of connection there are no issues with it.

Any help or advice on this would be great .

Many Thanks

Robert 

 

SET AUTO_SHRINK OFF with users connected?

$
0
0

hi, 

Is it possible/advisable to change this setting with users connected?  There are a number of web based users and an agent job running every 30 seconds. 

USE [master]
GO
ALTER DATABASE [Bla] SET AUTO_SHRINK OFF WITH NO_WAIT

Fail to add user 'sa' as a owner of a database for administration

$
0
0

Dear all,

I try to set permission of "sa" user to a database I created with an other Windows admin account. When trying to set mapping role to owner in order that "sa" account gets all permission on that database I get a failure creation and exception is as follow :

===================================

Create failed for User 'sa'.  (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+User&LinkId=20476

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
   at Microsoft.SqlServer.Management.Smo.User.Create()
   at Microsoft.SqlServer.Management.SqlManagerUI.CreateLoginData.LoginPrototype.ApplyDatabaseRoleChanges(Server server)
   at Microsoft.SqlServer.Management.SqlManagerUI.CreateLoginDatabaseAccess.OnRunNow(Object sender)

===================================

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
   at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImplFinish(StringCollection createQuery, ScriptingOptions so)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()

===================================

Cannot use the special principal 'sa'. (.Net SqlClient Data Provider)

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

------------------------------
Server Name: .\SQLEXPRESS
Error Number: 15405
Severity: 16
State: 1
Line Number: 1


------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)

Any idea how should I do ?

regards

serge


Your knowledge is enhanced by that of others.


Dropped FileGroup/Files still show up in Sys.Master_Files and MSDB.dbo.backupfile

$
0
0

 Hello all,

I am wondering why is that when a filegroup/file is removed from the DB, it still shows up in sys.master_files and msdb.dbo.backupfile.

To reproduce, just create a database and add a filegroup or file to an existing file and delete that filegroup\file.

Now,Query Sys.master_files and you can still see the deleted Filegroup/file for the database. Of course the State_desc shows as 'Offline' but I am wondering why it is not removed completely.

Also, if you take a backup and query the msdb.dbo.backupfile, it will show up there as well. Again, State_desc = 'Dropped' but why is it not removed completely.

Thank you and have a wonderful day.


Hope it Helps!!

SQL Query Performance downgrade rapidly after migrated to SQL2012 from SQL2000

$
0
0

Problem:

SQL statement                                                           SQL 2000 (cost)                              SQL2012

1 customer select  SQL Statement ( little long)           22 seconds                                     5 mins (after rebuild index)

Migration method:

1. Backup SQL2000 DB and restore to SQL2008;

2. Backup SQL2008 DB and restore to SQL2012.

Anybody can help on this case? Thanks!


Environment
-----------
SQL2000 and SQL2005 instances: 4CPU, 4GB RAM, Windows Server 2000 SP4
SQL2012 R2: 4 vitual CPU cores, 8GB RAM, Windows Server 2012R2

Sql services are not able to start in server

$
0
0

We have rebooted inactive the server due to rolling maintenance.

 

Sql is not running and sql services are not able to start. Getting the below error message while starting the services.

 

please suggest how to fix?

SQL Performance issue - exec sp_cursorfetch

$
0
0

Hello,

We have currently performance issue with a SQL 2K12SP1 Microsoft Orchestrator Database.
From our application (Orchestrator) we meet SQL latencies.
And when we check the SQL Profiler, there is a lot of "exec sp_cursorfetch" that  seems to generate SQL deadlocks !

How could we remove this ? It just appears overnight without modification and more curious, our pre production environment do not generate "sp_cursorfetch"

Thank's for help.

Jeremy

Receive a notification if xp_cmdshell is being enabled

$
0
0

Hi all,

I want to receive a notification if someone, member of the sysadmin role, enables the xp_cmdshell on a SQL Server. Is there a way to accomplish this task?

Viewing all 15889 articles
Browse latest View live


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