Linked server works locally but not remotely

January 1, 2013 1 comment

i was not able to use linked server remotely (from my desktop) or from SQL agent jobs on an instance INST1

English: M in blue square (similar to seen on )

English: M in blue square (similar to seen on ) (Photo credit: Wikipedia)

linked server point to INST2 .. i was able to view objects in linked server tab (in SSMS) and runs select from the server locally (INST1)

 

even below query worked fine

 

begin distributed tran
select * from [remoteservername].master.sys.sysprocesses
commit tran

 

but i was not able to view or make jobs (INST1) run fine … getting below error
Named Pipes Provider: Could not open a connection to SQL Server [5].
OLE DB provider “SQLNCLI10” for linked server “[remoteservername” returned message “Login timeout expired”.
OLE DB provider “SQLNCLI10” for linked server “[remoteservername” returned message “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.”. (Microsoft SQL Server, Error: 5)

 

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

 

SOLUTION

 

after checking everything .. from firewall to bouncing SQL browser service on destination server .. we figured out below ..

 

an alias using named pipes was created to the INST2 ..on INST1 as soon as that alias was dropped .. all jobs ran fine and linked server TAB

 

worked fine remotely fro

 

 

m SSMS .. it seems the alias was the default configuration used by linked server .. for remote requests VIA SSMS and

 

SQL agent jobs …

 

**** so just save the alias configurations and deleting it .. and rerun the jobs and remote queries *****

 

try the above solution .. if nothing works for you

 

Deleting a remote server deletes all remote logins defined for that server — how to delete linked server

November 7, 2012 1 comment

Problem:

while deleting a linked server in SQL server instance VIA SSMS or using command

exec sp_dropserver ‘TESTserver’

Msg 15190, Level 16, State 1, Procedure sp_dropserver, Line 44
There are still remote logins for the server ‘TESTserver”.

GUI
TITLE: Microsoft SQL Server Management Studio
——————————

Deleting a remote server deletes all remote logins defined for that server. Are you sure you want to delete this linked server and all remote logins defined for this server?

——————————
BUTTONS:

&Yes
&No
——————————

Solution ::

1> The message is a bit misleading

2> it refers  to the mapping between local and remote login .. that will be dropped (local to remote login mappings)

3> no remote logins are dropped when you drop a linked server ,,, basically the mapping at security levels are dropped

so NO worries .. whether any login will be dropped .. if you proceeded .. with YES .. on the prompt window

Enjoy 🙂

Categories: General

SQL server 2012 certification path for DBA ..

October 18, 2012 Leave a comment
Categories: INDEXES

Error executing sp_vupgrade_replication SQL server or Login failed for user ‘domain\username’. Reason: Server is in script upgrade mode

October 18, 2012 Leave a comment

if you happen to failover a SQL server cluster .. you may have to wait before the SQL comes online .. and you will get below messages

1> SQL error log or while connecting thro SSMS

Login failed for user ‘domain\username’. Reason: Server is in script upgrade mode. Only administrator can connect at this time. [CLIENT: ] 2012-10-18 05:20:16.370 Logon Error: 18401, Severity: 14, State: 1.

2> The SQL error log may also have below errors  (if the Database are involved in replication )

2012-10-18 05:20:29.800 spid9s Executing sp_vupgrade_replication.

2012-10-18 05:20:29.800 spid9s Executing sp_vupgrade_replication.
Database ‘master’ is upgrading script ‘repl_upgrade.sql’ from level 167776160 to level 167777660
Upgrading publication settings and system objects in database [DB1].
Upgrading publication settings and system objects in database [DB2].

Error executing sp_vupgrade_replication.

2012-10-18 05:21:05.090 spid9s Cannot perform this operation while SQLServerAgent is starting. Try again later.2012-10-18 2012-10-18 05:21:05.090 spid9s Saving upgrade script status to ‘SOFTWARE\Microsoft\MSSQLServer\Replication\Setup’

2012-10-18 05:21:05.090 spid9s Saving upgrade script status to ‘SOFTWARE\Microsoft\MSSQLServer\Replication\Setup’.

2012-10-18 05:21:05.090 spid9s Saved upgrade script status successfully.

Cause : This happens because the Databases have never been failed over this cluster node (the current active node) after the successful upgrade of service pack (e.g SQL 2008 SP2 or SP3 ) or are failed over for the First time after upgrade

**** some of the Database do not upgrade if the SQL agent is running **** so you need to let the upgrade run with SQL agent been STOPPED ..

To resolve this issue, follow these steps:

  1. In the cluster administrative tools, bring both SQL Server Agent and the SQL Server service offline. 
  2. Bring the SQL Server service back online while SQL Server Agent is still offline. 
  3. After the startup process has begun, review the error logs to see whether the following entries appear there:If you do not find these entries, the replication upgrade has completed successfully. To verify this, check whether the value of the Upgrade registry key at the following registry entry is updated to 1. (This indicates a successful upgrade.)
    • spid7s Upgrading publication settings and system objects in database [DBName].
    • spid7s Cannot perform this operation while SQLServerAgent is starting. Try again later.
    • spid7s Error executing sp_vupgrade_replication.
    • spid7s Saving upgrade script status to ‘SOFTWARE\Microsoft\MSSQLServer\Replication\Setup’.
    • spid7s Saved upgrade script status successfully.

  4. HKLM\SOFTWARE\Microsoft\MSSQLServer\Replication\Setup
     

  5. Run the following command, and then look for a transaction that is named “tran_sp_MScreate_peer_tables.” If you do not see an entry sthat has this name, you have additional verification that the replication upgrade completed on its own. use [DBName] 
    select * from sys.dm_tran_active_transactions where name = ‘tran_sp_MScreate_peer_tables’
  6. Stop the instance of SQL Server, bring both SQL Server Agent and the SQL Server service online on Node1, fail the instance of SQL Server over to the other node, and fail the instance back to the original node. 

If the instance of SQL Server is a stand-alone instance, you can resolve the issue by stopping both SQL Server and the SQL Server Agent service, disabling the SQL Server Agent service, and then restarting just the SQL Server service. This lets the upgrade process complete in the database. After this process is complete, you can restart the SQL Server Agent service.

Reference –> http://support.microsoft.com/kb/2509302

note the 6th point : you may have to failover cluster few times .. if you upgrade does not work clean initially ..

Thanks for reading 🙂

GS

Categories: Cluster

Great post on SQL azure by Anup .. SQLSailor

August 2, 2012 Leave a comment

hey everyone …

The new Windows Azure platform explained in detail by Anup .. THE SQLSailor

do check out

http://sqlsailor.com/2012/06/08/firstsqldatabase/

Categories: INDEXES

SQL Server 2008 tutorial — Mail setup

August 2, 2012 Leave a comment

Categories: INDEXES

Find out permissions of currently logged in USER or your permissions

August 2, 2012 Leave a comment

Find out permissions of currently logged in USER or your permissions

USE function fn_my_permissions in SQL Server 2005 or above .

Use AdventureWorks
Go
—————Return Callers permission on the current server
SELECT * FROM fn_my_permissions(NULL, ‘SERVER’);
Go

—————Return Callers permission on the current database
SELECT * FROM fn_my_permissions(NULL, ‘DATABASE’);
Go

————–Return Callers permission on the given object
SELECT * FROM fn_my_permissions(‘Sales.vIndividualCustomer’, ‘OBJECT’);
Go

 

for more info refer

http://msdn.microsoft.com/en-us/library/ms176097.aspx

 

Categories: INDEXES

great links about slipstream drop .. SQL 2008 R2

May 20, 2012 Leave a comment

Hey ..

           I justed happen to come cross some cool sites discussing about abt slipstream ..

          it helps you to do your original sql server installation and SP at ONCE — talking about SQL 2008 and highher ..

          below are the links …

        1>  http://www.littlekendra.com/2009/11/10/are-you-slipstreaming-the-very-best-way-to-install-sql-server/

        2> http://blogs.msdn.com/b/petersad/archive/2011/07/13/how-to-slipstream-sql-server-2008-r2-and-a-sql-server-2008-r2-service-pack-1-sp1.aspx

      3> http://blogs.msdn.com/b/petersad/archive/2009/02/25/sql-server-2008-creating-a-merged-slisptream-drop.aspx

        Thanks for reading ….

Categories: Installations

size of all non clustered indexes (NCI) in a database sql 2005

February 10, 2012 Leave a comment

use the below query to get the size of all NCI in a particular database .. works for 2005 and above

SELECT
CURRENT_TIMESTAMP as ‘DateTimeStamp’,
@@Servername     ServerName,
db_name() DBName,
OBJECT_NAME(partition_stats.object_id) ObjectName,
SUM(used_page_count) AS used_page_count,
(SUM(used_page_count) * 8) / 1024.0 / 1024.0 AS used_page_size_GB,
SUM(reserved_page_count) AS reserved_page_count,
(SUM(reserved_page_count) * 8) / 1024.0 / 1024.0 AS reserved_page_size_GB
FROM sys.dm_db_partition_stats AS partition_stats
INNER JOIN sys.indexes AS indexes ON partition_stats.object_id = indexes.object_id
and partition_stats.index_id = indexes.index_id
where indexes.type_desc = ‘NONCLUSTERED’
GROUP BY OBJECT_NAME(partition_stats.object_id)
ORDER BY OBJECT_NAME(partition_stats.object_id)

 

 

Categories: INDEXES Tags:

Hello world!

January 25, 2012 1 comment

Hi All !!! this blog is about my SQL DBA exp ..

Categories: INDEXES Tags:
Design a site like this with WordPress.com
Get started