sql server 2012 copy database failed between two instances on the same host - sql-server-2012

I am learning the sql server 2012 and got stuck when using the copy datase, trying to figure out why.
I created two instances on the same host, using administrator, windows authentication.
(the default instance:iZp0w14yqtvxcmZ, the second instance: iZp0w14yqtvxcmZ\instance2, try to copy database from the default one to the second one)
It failed at the last step: execute sql server agent job.
here is the error log from windows event viewer:
Message: Failed to connect to server iZp0w14yqtvxcmZ.
StackTrace: at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.OpenConnection(Server& server, ServerProperty serverProp)
InnerException-->Login failed for user 'NT Service\SQLAgent$INSTANCE2'.
Then I tried to add the login 'NT Service\SQLAgent$INSTANCE2' in the default instance. Then tried again and got another error:
Event Name: OnError
Message: An error occurred while transferring data. See the inner exception for details.
StackTrace: at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferExtraObjectsViaSmoTransfer()
InnerException-->Windows NT user or group 'iZp0wd5ebkvswaZ\Administrator' not found. Check the name again.
But the Adminitrator does exist in the computer management -> local user and groups -> group, so I don't know what to do now. NEED HELP !!!
Thanks a lot!

after two-day's struggling, I figured it out. The sql server agent service should use a domain-based account for a multi-server environment. Also that account should be able to log in and perform the job.

I solved the issue changing the login method to system local account.

Two instances must have the same password and open, then in this case:
insert into [EI7-PC\SQLEXPRESS2].[MYCOMPANY].[dbo].[inventory] SELECT *
FROM [EI7-PC\SQLEXPRESS1].[MYCOMPANY].[dbo].[inventory] where itemno='10-0001'
The reason for the same password is unknown, this is per my experience. With two different password you may get an error about 'sa' failed to login.

Related

Error: 18456, Severity: 14, State: 38 Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>]

I'm facing a situation which every 10 seconds an error log is recorded with the following msg:
2018-07-25 09:07:09.59 Logon Error: 18456, Severity: 14, State: 38.
2018-07-25 09:07:09.59 Logon Login failed for user 'svc_sql'. Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>]
In my instance I don't have a 'ReportServer' database. I know that in the past the server was migrated to a new machine and I reckon the 'ReportServer' database was created with a new name in the new server. I really don't know how the migration was done.
I've activated the SQL_Profiler with all audit options and I could see that this user also executes a procedure sometimes.
I've checked the default database for this user and it's Master.
Any ideas how can I fix this issue? My error log is flooding with this message.
Thanks a lot.
Rod
I've checked the default database for this user and it's Master.
The error doesn't tell you about default database but about explicitly specified database, that is different, it's the database that is mentioned in connection string under Initial Catalog or Database.
Do you see what application tries to open this database? The problem is in that application, it uses old connection string. If it's SSMS, it's simple, it's in the Options of connection dialog, but if it's another application, the connection string can be written in the ini file or hardcoded.
I don't know if I try to run DBCC CHECKDB master will solve this.
Of course it cannot solve this. This has nothing to do with database integrity. It's your client that uses wrong connection string.
Any ideas how can I fix this issue? My error log is flooding with this
message.
If you just want to save your errorlog from these messages just turn off failed logins audit:
Or you should find this application by its name or host or client address.
Or you can temporarily disable this login and see who will call you saying he cannot login anymore, or, if it's your local machine, some of your applications will fail, this way you'll find it.
I had the same error and doing the following resolved the error for me:
From within the SQL Server Management Studio
Security
Logins
Right Click the user ID that was failing login
Server Roles
Make sure all the checkboxes are checked. Right clicked Security and refresh.

Microsoft Azure: There was an error while creating data connection 'SQL data connection'. Deployment to resource group failed

I am trying to create an Android Mobile app via the Azure app service and while doing so, I am trying to create a database, but I am getting the error 'there was an error while creating data connection 'SQL data connection'. Deployment to resource group failed'. Please help as soon as possible.
$
This error is due to server limit exceeding the quote associated with your account. Under all resources, check if there's a new SQL server created with a random name- you will need to delete that. Attempt to create again.
(just done- it worked!)
I've faced the exact issue.
First time it failed giving the error - Data Connection Creation Error..!
When Configuring for the first time it didn't work for me.
i.e.,
Creating a Database
Creating a New Server
Entering Server Admin Login
Entering Server Admin Password
I've noted down all the above information.
Tried Second time setting up the Connection String with the above details IT WORKED.
Hope this information helps.

oracle sql developer- ora-12514 error

im using oracle sql developer to make my database, but now i stopped to work.
it wrote this:
An error was encountered performing the requested operation:
Listener refused the connection with the following error: ORA-12514,
TNS:listener does not currently know of service requested in connect
descriptor
Vendor code 12514
i also tried to make new connection but it didnt help
pls help me,i dont know what to do, i need this to do my homework
when i tried to change connection it wrote this:
An error was encountered performing the requested operation:
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label. Vendor code 1031
Please check the services are running:
OracleOraDb11g_home1TNSListener and OracleServiceORCL.
You're going to have to do some troubleshooting; Here are a couple of suggestions:
ORA-12514 Tips
ORA-12514 TNS:listener does not currently know of service requested in connect descriptor
How to resolve error: ORA-12514
The service name ,you are using should be in sid column and not in service name entry box.
For example, the service name provided for you is overflow,you have to mention it in
ex:10.171.1.24:1521:overflow
Sid : overflow
Service : leave blank
Test the connection
Go to Services
check whether the "ORACLEServiceORCL" is running or not.
if not running then right-click on it and click start.
Your problem may solve this.
Happy coding :D
This worked for me- Close your SQL Developer and launch again.
I had the same issue after restarting my PC and could not access my local database. This fixed it.
Go to Run > services.msc > Services (Local) > OracleService
Right-click on OracleService > Properties > Log On
Make sure Local System Account is checked then press OK.
Stop the OracleService and restart it. It should be working now.
Mine was working fine till last night but this morning I found the said problem. I checked OracleOraDb11g_home1TNSListener and OracleServiceORCL was running and in "Started" status but still issue was there.
Just restarting both the services solved my issue. I suggest just try this once to save your time before exploring other solutions.

Unable to execute query against a linked server inside a SQL Job

My server setup is a bit weird. One of my DB Admins added a Linked Server to my server. In the linked server properties, I see the following in the Security view:
Local server login to remote server login mappings:
Local Login Impersonate Remote User Remote Password
domain\myusername CHECKED
For a login not defined in the list above, connections will:
- Be made using the security context
Remote login: linkedserveruser
With password: **************
Therefore, when I created a stored procedure with the following:
SELECT *
INTO #TEMP
FROM LINKEDSERVERNAME.DBName.dbo.TableName
-- Update local table after processing #TEMP
And setup a SQL job, it was failing with the following message:
Message
Executed as user: NT AUTHORITY\NETWORK SERVICE. Login failed for user 'linkedserveruser'. [SQLSTATE 28000] (Error 18456). The step failed.
After, digging through documentation, I found a KB811031 article that explains this problem and suggested that I map the security context and run the job as osql.
I did not have to map the security context because (as you can see from the settings of the linked server above), it already was mapped. I changed the Type to Operating System Command as suggested. When I run the job now, I get the following message:
Executed as user: domain\MYMACHINENAME$. Msg 18456, Level 14, State 1, Server SOMEOTHERDATABASENAME, Line 1 Login failed for user 'linkedserveruser'. Process Exit Code 0. The step succeeded.
And the job quits reporting success when in fact it failed. Any suggestions on how I can get this type of stored procedure containing a query to a linked server to run as a SQL job?

Could not obtain information about Windows NT group user

I am creating a SQL Server Replication using a script. When I try to execute
The job failed. Unable to determine if the owner (STAR\moorer7) of job L3BPT2M-Atlas-14 has server access (reason: Could not obtain information about Windows NT group/user 'STAR\moorer7', error code 0x5. [SQLSTATE 42000] (Error 15404)).
This is a job created by a script that defines replication.
How do I debug this?
Active Directory is refusing access to your SQL Agent. The Agent should be running under an account that is recognized by STAR domain controller.
For me, the jobs were running under DOMAIN\Administrator and failing with the error message "The job failed. Unable to determine if the owner (DOMAIN\administrator) of job Agent history clean up: distribution has server access (reason: Could not obtain information about Windows NT group/user 'DOMAIN\administrator', error code 0x5. [SQLSTATE 42000] (Error 15404)). To fix this, I changed the owner of each failing job to sa. Worked flawlessly after that. The jobs were related to replication cleanup, but I'm unsure if they were manually added or were added as a part of the replication set-up - I wasn't involved with it, so I am not sure.
We encountered similar errors in a testing environment on a virtual machine. If the machine name changes due to VM cloning from a template, you can get this error.
If the computer name changed from OLD to NEW.
A job uses this stored procedure:
msdb.dbo.sp_sqlagent_has_server_access #login_name = 'OLD\Administrator'
Which uses this one:
EXECUTE master.dbo.xp_logininfo 'OLD\Administrator'
Which gives this SQL error 15404
select text from sys.messages where message_id = 15404;
Could not obtain information about Windows NT group/user '%ls', error code %#lx.
Which I guess is correct, under the circumstances. We added a script to the VM cloning/deployment process that re-creates the SQL login.
In my case I was getting this error trying to use the IS_ROLEMEMBER() function on SQL Server 2008 R2. This function isn't valid prior to SQL Server 2012.
Instead of this function I ended up using
select 1
from sys.database_principals u
inner join sys.database_role_members ur
on u.principal_id = ur.member_principal_id
inner join sys.database_principals r
on ur.role_principal_id = r.principal_id
where r.name = #role_name
and u.name = #username
Significantly more verbose, but it gets the job done.
Just solved this problem. In my case it was domain controller is not accessible, because both dns servers was google dns.
I just add to checklist for this problem:
check domain controller is accessible
I was having the same issue, which turned out to be caused by the Domain login that runs the SQL service being locked out in AD. The lockout was caused by an unrelated usage of the service account for another purpose with the wrong password.
The errors received from SQL Agent logs did not mention the service account's name, just the name of the user (job owner) that couldn't be authenticated (since it uses the service account to check with AD).
I had to connect to VPN for the publish script to successfully deploy to the DB.
In our case, the Windows service account that SQL Server and SQL Agent were running under were locked out in Active Directory.
I just got this error and it turns out my AD administrator deleted the service account used by EVERY SQL Server instance in the entire company. Thank goodness AD has its own recycle bin.
See if you can run the Active Directory Users and Computers utility (%SystemRoot%\system32\dsa.msc), and check to make sure the account you are relying on still exists.