Linked server works locally but not remotely
i was not able to use linked server remotely (from my desktop) or from SQL agent jobs on an instance INST1
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
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 🙂
Error executing sp_vupgrade_replication SQL server or Login failed for user ‘domain\username’. Reason: Server is in script upgrade mode
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:
- In the cluster administrative tools, bring both SQL Server Agent and the SQL Server service offline.
- Bring the SQL Server service back online while SQL Server Agent is still offline.
- 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.
-
-
HKLM\SOFTWARE\Microsoft\MSSQLServer\Replication\Setup - 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’ - 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
Great post on SQL azure by Anup .. SQLSailor
hey everyone …
The new Windows Azure platform explained in detail by Anup .. THE SQLSailor
do check out
Find out permissions of currently logged in USER or your permissions
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
great links about slipstream drop .. SQL 2008 R2
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 …
Thanks for reading ….
size of all non clustered indexes (NCI) in a database sql 2005
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)