Create User To Run SQL Migration Script Azure SQL - sql-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

Related

Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'sa'

Im installing the MDM of Informatica.
MDM 10.2 - Jboss 6.4 EAP - SQL Server 11 - Windows Server 2008 R2.
During the creation of the schema 'sip_ant.bat create_bpm' i got this error
Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'sa'.
(Same eeror with another user)
I already tried to use the Auth Mixed Mode and restarted the instance of the DB.
Error received is
D:\informatica\database\bin\common.xml:248: The following error occurred while executing this line:
D:\informatica\database\bin\mssql\database.xml:1214: Launched command return error code 1.
And that's the line of database.xml:1214 that refers:
collation_name="${activevos.collation}" param2=""${dbpath_short}"" param1="${activevos.password}">
Im able to login via SQLCMD on CMD with user 'sa' and other users.
MDM and SQL Server are on different Machine.
Any suggestion?
By default SQL Server will track failed logins and register it in the server log along with the reason. So check out your errorlog and look for errors 18456.
You can read the log by using SQL Server Management Studio by going to server, Management, SQL Server Logs, Current. Or any other way you prefer.
You'll find something like this:
2018-02-27 13:51:26.120 Logon Error: 18456, Severity: 14, State: 5.
2018-02-27 13:51:26.120 Logon Login failed for user 'fasd'. Reason: Could not find a login matching the name provided. [CLIENT: 10.80.62.89]
server=Yourservername,portnumber
You can put the above in your connection string
Problem was due to Customer configured another Default SQL port to use on SQL Management.

Receive the "Login failed for user 'sa' " when trying to connect Servoy 8 to SQL Server 2014

I am trying to connect a SQL Server 2014 database into Servoy 8 but I am receiving the following error:
The password for the user 'sa' is correct such as the links. I searched everywhere but I couldn't find a solution.
You should check SQL Server error log for this error. There will be two rows, one containing 18456 error with the state and the second decoding what the state means. It can be not only a bad password, the login can be disabled or the server can be configured to use windows authentication only

SSH tunnel doesn't work in DataGrip

I have an Oracle database that is located on server_c and are only accessible if you are on server_b. So in order to connect to this Oracle database, I have to first log in to server_b via SSH, and type in the following command to connect to it.
sqlplus username/password#server_c:1571/service
I would like to connect to the Oracle database in DataGrip, first I typed in my username and password in the SSH/SSL tab.
Then I typed in the general database information.
I thought it would be fine, but when I clicked on the Test Connection, I got an error.
Error: Connection to Oracle - #server_c failed. ORA-00604: error occurred at recursive SQL level 1 ORA-20001: Server is not in the List of Valid Application Servers ORA-06512: at line 28
This error occurs if I try to connect to the database directly without logging in to server_b beforehand. In other words, I think DataGrip doesn't connect to the SSH tunnel first before connecting the database.
I'm not sure if I'm using SSH/SSL tab correctly in this way. So if you have any idea why it doesn't work or any solution to it, please let me know.
The clue is in the error message:
Error: Connection to Oracle - #server_c failed. ORA-00604: error
occurred at recursive SQL level 1 ORA-20001: Server is not in the
List of Valid Application Servers ORA-06512: at line 28
Check with your DBA either of:
a sqlnet.ora valid node checking tcp.validnode_checking = ...
or more likely:
a login trigger that prevents "unknown servers" from logging in.

Error occurred while connecting to SQL Server 2012: Cannot open user database. Login failed. (Microsoft SQL Server, Error: 4064)

I unknowingly deleted SA user from the SQL Server 2012. Now i cannot be able to connect to the sever. It shows an error :
Cannot open user database. Login failed. Login failed for the user 'username'.(Microsoft SQL Server, Error: 4064)
Now i don't know what to do?
Help me please
Thanks
When ever get this error,we have to create a new user with server authentication to connect the data base
We can create login for data base under security tab-->create new login under it
If you have Windows administator permissions, you can restart SQL Server in single-user mode. Any administrator can then log in locally and fix things.
Give this a shot as a place to start:
Connect to SQL Server When System Administrators Are Locked Out (MSDN)

Unable to login to SQL Server + SQL Server Authentication + Error: 18456

I have created login account on my localhost\sql2008 Server (Eg. User123)
Mapped to Database (default)
Authentication Mode on SQL Server is set to both (Windows and SQL)
But login to SQL Server fails with following message (for User123)
Note: Have checked multiple time that UserName / Password are typed in correctly
Error Details:
Login failed for user 'User123'
(Net.SqlClient Data Provider)
Server Name : localhost\sql2008 Error
Number: 18456 Severity : 14 State : 1
Line Number : 65536
any help on this please.
You need to enable SQL Server Authentication:
In the Object Explorer, right click on the server and click on "Properties"
In the "Server Properties" window click on "Security" in the list of pages on the left. Under "Server Authentication" choose the "SQL Server and Windows Authentication mode" radio option.
Restart the SQLEXPRESS service.
By default login failed error message is nothing but a client user connection has been refused by the server due to mismatch of login credentials. First task you might check is to see whether that user has relevant privileges on that SQL Server instance and relevant database too, thats good. Obviously if the necessary prvileges are not been set then you need to fix that issue by granting relevant privileges for that user login.
Althought if that user has relevant grants on database & server if the Server encounters any credential issues for that login then it will prevent in granting the authentication back to SQL Server, the client will get the following error message:
Msg 18456, Level 14, State 1, Server <ServerName>, Line 1
Login failed for user '<Name>'
Ok now what, by looking at the error message you feel like this is non-descriptive to understand the Level & state. By default the Operating System error will show 'State' as 1 regardless of nature of the issues in authenticating the login. So to investigate further you need to look at relevant SQL Server instance error log too for more information on Severity & state of this error. You might look into a corresponding entry in log as:
2007-05-17 00:12:00.34 Logon Error: 18456, Severity: 14, State: 8.
or
2007-05-17 00:12:00.34 Logon Login failed for user '<user name>'.
As defined above the Severity & State columns on the error are key to find the accurate reflection for the source of the problem. On the above error number 8 for state indicates authentication failure due to password mismatch. Books online refers: By default, user-defined messages of severity lower than 19 are not sent to the Microsoft Windows application log when they occur. User-defined messages of severity lower than 19 therefore do not trigger SQL Server Agent alerts.
Sung Lee, Program Manager in SQL Server Protocols (Dev.team) has outlined further information on Error state description:The common error states and their descriptions are provided in the following table:
ERROR STATE ERROR DESCRIPTION
------------------------------------------------------------------------------
2 and 5 Invalid userid
6 Attempt to use a Windows login name with SQL Authentication
7 Login disabled and password mismatch
8 Password mismatch
9 Invalid password
11 and 12 Valid login but server access failure
13 SQL Server service paused
18 Change password required
Well I'm not finished yet, what would you do in case of error:
2007-05-17 00:12:00.34 Logon Login failed for user '<user name>'.
You can see there is no severity or state level defined from that SQL Server instance's error log. So the next troubleshooting option is to look at the Event Viewer's security log [edit because screen shot is missing but you get the
idea, look in the event log for interesting events].
I had this same problem, however mine was because I hadn't set the Server authentication to "SQL Server and Windows Authentication mode" (which you had) I just wanted to mention it here in case someone missed it in your question.
You can access this by
Right click on instance (IE SQLServer2008)
Select "Properties"
Select "Security" option
Change "Server authentication" to "SQL Server and Windows Authentication mode"
Restart the SQLServer service
Right click on instance
Click "Restart"
You can access this by
Right click on instance (IE SQLServer2008)
Select "Properties"
Select "Security" option
Change "Server authentication" to "SQL Server and Windows Authentication mode"
Restart the SQLServer service
Right click on instance
Click "Restart"
Just for anyone else reading this: This worked for me on 2012 SQL Server too.
Thanks
After enabling "SQL Server and Windows Authentication mode"(check above answers on how to), navigate to the following.
Computer Mangement(in Start Menu)
Services And Applications
SQL Server Configuration Manager
SQL Server Network Configuration
Protocols for MSSQLSERVER
Right click on TCP/IP and Enable it.
Finally restart the SQL Server.
None of the solutions will work for you if you do not restart the SQL Server.
Find the SQLServerManager13.msc
Then in SQL Server Services section select SQL Server and restart it.
Or
Select you server in the Object Explorer menu in MS SQL Server Management Studio.
Right click on it and restart
The correct solution to the problem is to make sure SQL server authentication is turned on for your SQL Server.
After spending a long time and trying every suggestion on every page, this solved my problem:
[server name] > Security > Logins >
[Login Name] >
Right Click >
Properties >
Status >
SQL Server authentication
There is a checkbox Login is locked out. It was checked and preventing me from login. I unchecked the checkbox and my problem was solved.
try using this connection string
Server=ServerName;Database=DbName;Trusted_Connection=SSPI;MultipleActiveResultSets=true;TrustServerCertificate=true

Resources