I am using SQL Server 2014 and I need to access the database using a VPN. I have no issue logging on the SQL Server using my VPN but I can't expand the database or query it.
When I click the database to expand it, I get the following message:
The database XXXX is not accessible. (ObjectExplorer)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.DatabaseNavigableItem.get_CanGetChildren()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest request)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)
If I query a table from the database, I get the following message:
Msg 916, Level 14, State 1, Line 2
The server principal "Bi" is not able to access the database "HMS_ARL" under the current security context.
Any kind of help would be much appreciated.
Related
I've set up 2 local SQL server databases, one on a laptop and the other on my desktop, I simply want to transfer the data my laptop gathers onto my desktop PC.
I've already managed to connect the 2 machines, from my desktop's SSMS I can see and query the laptop database.
Now I only need to transfer the data from the laptpop Server to my desktop, I tried with a simple
SELECT *
INTO [DesktopDB].[dbo].[TargetTable]
FROM [LaptopIP].[LaptopDB].[dbo].[SourceTable]
But I get this error:
OLE DB provider "MSOLEDBSQL" for linked server "LaptopIP" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 0
SQL Server Network Interfaces: No credentials are available in the security package
Can you please help me address this issue?
Thank you very much!
For Windows auth to work between servers without a domain, your username and password must be the same on both servers.
You can connect remote sql server as Linked server, than insert data into local database table from linked server
Currently moving a database to Azure SQL. I've generated a script to import the database. In SQL management studio, I've connected to the cloud database as the server admin. I try to run the script - though I get multiple errors such as -
ODBC error: State: 28000: Error: 18456 Message:'[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user '##MS_InstanceCertificate##'.'.
Msg 5069, Level 16, State 3, Line 11
and
Looking around I found;
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-manage-logins
I went through the steps to create a user and add to the role dbmanager.
I'm still getting the same errors when running the database import script.
As a heads up, I've run this script logged in as the server admin and as the user created by the server admin.
Any help is greatly appreciated.
The error message is a bit misleading, it hasn't (necessarily) something to do with certificates. In general, this error message says that connecting to the database with a certain user failed. So check...
if the user exists
if the username is spelled correctly
if the database you connect to exists
if the database name is spelled correctly
I get the following error when trying to log in to a named SQL Server 2016 instance:
2017-03-31 09:25:19.12 Logon
Error: 18456, Severity: 14, State: 5.
2017-03-31 09:25:19.12 Logon
Login failed for user 'domain\user'. Reason: Could not find a login matching the name provided. [CLIENT: some-ip-address
SQL Server 2016 is a named instance on this box as it also has SQL Server 2012 instance and was installed using virtual accounts as outlined here
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions
This named instance is running under port 1500.
Any ideas on how to connect to this server using SQL Server Management Studio ?
A virtual account is used to run the SQL Server Service but you wouldn't be able to login using that account as there is no way to know the password. In addition it's a local account only so domain\user is not going to work.
You should have had to grant SOME user access to the server, I think by default it grants the user who is installing the SQL Server so if you know that account you could try logging in with that. Also if you know the sa password that should work too.
Past that you are probably looking at putting the server in single user mode and adding a login just to get in. See here
I want to query a supplier Azure SQL PDWH from our on-premises server (SQL 2014) to extract data from that Azure SQL PDWH and insert into a database that is located on the on-premises server. In the end this should automated via stored procedures that reside in the on-premises database and are scheduled.
To do so I have setup a linked server between the Azure SQL DWH and our on-premises server using the following scripts that I found here:
https://blogs.msdn.microsoft.com/sqlcat/2011/03/07/linked-servers-to-sql-azure/
/*
Create new linked server
*/
-- Make a link to the cloud
EXEC sp_addlinkedserver
#server=N'read_only_dwhs',
#srvproduct=N'Azure SQL Db',
#provider=N'SQLNCLI',
#datasrc=N'server.database.windows.net,1433',
#catalog='xxxxxx';
GO
--Set up login mapping
EXEC sp_addlinkedsrvlogin
#rmtsrvname = 'read_only_dwhs',
#useself = 'FALSE',
#locallogin=NULL,
#rmtuser = 'xxxxxx',
#rmtpassword = 'xxxxxx'
GO
These statements run without errors. However, when I execute the sp_testlinkedserver it returns a time-out error after about 10 seconds.
OLE DB provider "SQLNCLI11" for linked server "read_only_dwhs" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "read_only_dwhs" returned message "Unable to complete login process due to delay in prelogin response".
Msg 258, Level 16, State 1, Line 23
TCP Provider: Timeout error [258].
I checked with IT and they confirm that nothing is blocked by the firewall relating this and that TCP/IP is enabled. Our supplier also confirms that our IP is added to the Azure Firewall. I have no problem querying direct from the Azure SQL PDWH database via visual studio community 2015.
Also tools like these: http://sqlazuremw.codeplex.com/ give the same error on connecting.
I searched for hours, but whatever I do it keeps returning the same error message.
Any help is appreciated.
Update 2016 09 27:
After some more testing with IT it seems like this has to do with our firewall settings.
When I directly query via the database from the on-premises server (connected via remote desktop) to the Azure DWH I get no errors and everything works. I am than also able to query from my local machine, using the same on-premises database.
However, when another colleague logs on to the on-premises server I am not able anymore to query from my local machine (with the time-out errors above) until I login again to the (on-premises) server with my credentials.
I think that the firewall rule is too strict in only allowing information to be sent/received to the Azure DWH if my credentials are active on the on-premises server.
Update 2016 09 28:
The issue seems to be fixed for now. IT managed to apply the correct settings to the firewall. The server can now communicate with the Azure DWH even when colleagues are logged on to the server.
This might help some-one else.
With the Windows 2003 end-of-life data looming next month, I am migrating a legacy application to Windows 2008. This has all gone surprisingly smoothly with the exception of our connection to Indexing Services.
We have two servers, a DB server running SQL 2008 and a Web server. Our web application allows users to search a document store. Here's the process:
User types in query to web application
Web application sends a query to the database server
The query references the web application as a linked database server and loads the retrieved paths into a temporary table
The database server joins those paths against another table in the SQL server
The database server sends the results back to the web application
The web application shows the results to the user.
The web application logs in via SQL authentication to the DB server to perform the query, but it fails with this error:
An error occurred while preparing the query "SELECT PATH FROM "10.0.1.89".MyCatalog..SCOPE('DEEP TRAVERSAL OF "C:\Documents"') WHERE (FREETEXT(Contents, 'introduction')) OR (FREETEXT(FileName, 'introduction'))" for execution against OLE DB provider "MSIDXS" for linked server "Filesystem".
The same error is displayed when I attempt to execute the query when logged in as this user on the DB server through SSMS, but with some extra information:
OLE DB provider "MSIDXS" for linked server "Filesystem" returned message "Invalid catalog name 'MYCATALOG'. SQLSTATE=42000 ".
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "MSIDXS" for linked server "Filesystem" reported an error.
Access denied.
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT PATH FROM "10.0.1.89".MyCatalog..SCOPE('DEEP TRAVERSAL OF "C:\Documents"') WHERE (FREETEXT(Contents, 'introduction')) OR (FREETEXT(FileName, 'introduction'))" for execution against OLE DB provider "MSIDXS" for linked server "Filesystem".
However, when I log in to SSMS with my Windows Authentication account, I am able to perform the same query and it returns result. My username and password must be the same as an account on the web server - if I change my password on the web server, an error is thrown, but not the same one:
OLE DB provider "MSIDXS" for linked server "Filesystem" returned message "Unspecified error".
OLE DB provider "MSIDXS" for linked server "Filesystem" returned message "Invalid catalog name 'MYCATALOG'. SQLSTATE=42000 ".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT PATH FROM "10.0.1.89".MyCatalog..SCOPE('DEEP TRAVERSAL OF "C:\Documents"') WHERE (FREETEXT(Contents, 'introduction')) OR (FREETEXT(FileName, 'introduction'))" for execution against OLE DB provider "MSIDXS" for linked server "Filesystem".
I created the linked server with this query, which appears to match the configuration of the legacy system:
EXEC sp_addlinkedserver FileSystem, 'Index Server', 'MSIDXS', 'Web';
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname = N'FileSystem', #locallogin = NULL, #useself = N'False', #rmtuser = N'CatalogUser', #rmtpassword = N'xxx';
I created a user on the web server with the name CatalogUser, and I set its password to be the same as the query above.
When I connect with Windows authentication however, this information seems to be ignored and my Windows authentication data is used instead. If I change the password to anything, the query still succeeds.
I have tried enabling CatalogUser to log on as a service account, and this has had no effect.
The two machines are not on a domain, but neither are the two Windows 2003 machines, and that works totally fine.
I must have missed something from the set-up between the two. Unfortunately, these machines were set up long before people started keeping documentation for stuff like this, so I'm not sure what the missing step is.
There isn't very much information about this issue on the internet, presumably due to the age of the software, so at the very least we can start to build a knowledge base here. I wonder if more people are having issues with this software now the end of life is on the horizon.
I have now resolved this issue. I didn't know this, but when you run a program under NT AUTHORITY\LOCAL SYSTEM, it will authenticate over the network as an anonymous user.
To resolve this, I created a new SqlServer user on both the web server and the DB server with the same password. I then configured my SQL Server instance to run under this new user, and it started authenticating correctly.
It seems that any security information entered for the MSIDXS backend is just ignored, although perhaps it wouldn't be if you were joined to a domain. All other documentation I read suggested that was the only way to do this, but it wasn't the case in the original setup and it isn't the case here.