SQL Server error cannot open database - sql-server

Helo fellow, sorry for being annoying u again =P.
Today a got a mission in the job... ¬¬'
Our system works integrated to SQL Server. There were two databases. The main one, and another "responsible" for doing some data integration stuffs...
One day, the boss decided not to use the second database anymore, and ordered the team to create a fix application that unlinked these databases. But in one of our clients the SQL Server is givin' an error message:
-[Microsoft][ODBC SQL Server Driver][SQL Server] Database 'XXX' cannot be onpened due to inaccessible files or insufficient memory or disk space.
I've checked the disk space and it's fine. The memory amount is ok too. And the database files, doesn't exist anymore in the SQL data folder (like we expected and the boss desired).
This error could be expected if the were references in the sql server, but the database is not atached anymore, the table 'sysdatabases' in the master database doesn't references the database...
Someone can give a clue? I'm previously thankful for any help. =)

Sounds to me like the client is running an old version of the code which is still trying to connect to the database that's been unlinked.

Related

Excel connection to database, problem when shared in One Drive

Not sure if this is the correct forum but here goes. Very new to databases so apologies ahead of time if I don't provide enough info.
I have a Microsoft SQL Server Database created with Microsoft SQL Server Management Studio 18, I connected Excel to it to analyse the data and saved that workbook in a shared One Drive folder. Works fine on my computer but the other users cannot refresh the data from the database. I've exhausted all my online search options to figure out how to fix this. I don't know if the database is on a cloud server or if that matters.
Error message is; [Datasource.Error] Microsoft SQL: A network related or instance specific error occurred while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider; SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
The database does allow for remote connections, I checked that.
I'm comfortable with Excel but I'm new to databases, only worked with Access in the past. Anyone know of the "best" way to have a database we can all (4 users currently) connect to while also connecting Excel to it.
I don't understand the pricing plans for Azure, AWS etc. plus they seem to be way more than what I need.
Doesn't have to be a free option but a set monthly fee with no surprises would work if a server is the issue. It's a relatively small amount of data, currently maybe 100 rows, 24 columns.
The option I last came across was Godaddy web hosting had a database option, don't if this is a good option or not. I signed up for Elephantsql but I haven't figured out how to use that to host the database, creating one in elephant itself seems to use only code rather than the way I created the database in Microsoft.
Thanks in advance for any help, going to go close my 25 google search tabs now.....
Kevin
do you realy need an SQL-Server for dataset auf 100 rows and 24 columns?
I would try do store the date in a shared Excel-File in Onedrive an connect to this.
Best regards
Chris
EDIT
If you want to connect to Private-OneDrive File you should use a WEB-Connector instead of a "File"-Connector.
Your Source should be like this:
=Excel.Workbook(Web.Contents("https://onedrive.live.com/download?resid=AAAXXXXAAA&authkey=BBBXXXXBBB&em=CCCXXXXCCC&app=Excel"), null, true)
You have to replace the AAAXXXXAAAA; BBBXXXXBBB and CCCXXXXCCC with informations from the embedded-link of your XLSX-File:
1) open OneDrive in WEB
2) Select you file and right-click
3) click "embedded"
4) in the right pane you find the embedded-link
5) find there the resid; authkey and em
OneDrive GetEmbeddedLink

SQL Anywhere error: error occurred during sharedmemory connection attempt

I have been writing queries for an SQL anywhere 12 database. I was able to connect to the database using Aqua Data Studio. However, my free trial is up and I don't want to pay $500 just to write some queries. Every other software I have tried (Sybase Central, ODBC, Altova DatabaseSpy, SQL anywhere Client) all give me the same error: an error occured during the sharedmemory connection attempt. I have no idea why this is happening, and I have even tried turning off the "use shared memory connection" on my DB but to no avail.
Does anyone know why Aqua Data studio was able to connect but no other software can? Is there a way to fix the SharedMemory issue?
Is there another software that would be able to connect to the database?
I figured out the problem. There were two servers running with the same name, so the "shared memory" couldn't figure out which one to connect to, I had to start up one server, then the second, then shut down the first.
I can't say for sure in this case, but SQL Anywhere does support the concept of an "authenticated" database, which means that only client applications recognized by the server as being allowed can connect. That is likely the case here.
Note: I work for SAP in SQL Anywhere Engineering.

SQL Server linked server error 7303 to Access database

I've performed multiple searches and read numerous pages and tried loads of different configurations and nothing seems to solve a nuisance problem we have. We have a SQL server (2008 R2 v10.50.4000) that has several linked servers to several different access databases on a different server. They are all set up using UNC paths and they work...for a time.
At some point, something happens and then we can no longer access the databases and the only way I have found to solve this is to restart the SQL server service, which obviously isn't ideal in a production environment. This is the exact error message we get when we try to access it:
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "HIDDEN" returned message "The Microsoft Access database engine cannot open or write to the file '\servername\path01\path02\path03\databasename.mdb'. It is already opened exclusively by another user, or you need permission to view and write its data.".
Yet it works absolutely fine again if I restart the SQL Server service, so I know the settings are correct. I strongly suspect it has something to do with the Microsoft ACE driver because they all (the Access database linked servers) stop working at the same time - even though they all look at different files.
At this point I'm willing to try anything.

Why is it such a mission to backup a SQL Server 2008 Express database?

I wouldn't describe myself as afraid of change - but afraid of new technologies? YES INDEED! Technologies from operating systems, to database servers just seem to become bugged, inefficient and backward the further they "progress"
MSDE 2000 (what they might call "SQL 2000 Express" in today's world)
BACKUP [MyDatabase] TO FILE 'c:\backups\mybackup.backup'
SQL 2008 EXPRESS
Wait up! Its a 'user instance' - to back it up we need to attach it to a server instance
Wait up! To attach it we need SQL Management Studio Express (78MB download)
Wait up! When we login to our .\SQLEXPRESS server instance and try to attach our database it gives us an error that literally looks like a bug in our homebrew dev project:
TITLE: Microsoft SQL Server Management Studio
Cannot show requested dialog.
------------------------------ ADDITIONAL INFORMATION:
Parameter name: nColIndex Actual value
was -1.
(Microsoft.SqlServer.GridControl)
Can someone explain how to backup a user instance of a SQL Server 2008 Express database in T-SQL code?
(sorry if this comes across like a flame at ummmm, Microsoft - I'm actually a huge fan of theirs. Just really angry about things like this! please don't vote me down...)
Um, if it's a user instance, then the simplest backup strategy is to copy the file. (whilst it's not connected to SQL Server).
If you need a more comprehensive backup strategy (e.g. transactional backups), then you really should be looking at a more comprehensive database (e.g. a "normal" one attached to a full SQL Server instance)
SOME KEY TIPS TO NOTE WHEN TRYING TO ACHIEVE USER INSTANCE BACKUP
a.) Connecting
Your connection string should look like this:
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True;User Instance=True;Database=MyDatabaseAlias
It is essential that your connection string gives the connection an alias Database=MyDatabaseAlias - this alias cannot be duplicated concurrently on the same machine or your connection may fail.
b.) Backing Up
As pointed out above, the Transact SQL to backup a database is the same on SQL MSDE/2000/2005/2008/R2 - once you have your database attached and aliased!
BACKUP DATABASE MyDatabaseAlias TO DISK = 'c:\backups\mydatabase_20101117.backup'
Whats truly amazing is the bull$h!t errors you can get because your connection string doesnt have the alias Database=MyDatabaseAlias part.
e.g. Unable to open the physical file 'c:\Code\MyProject\App_Data\MyDatabase.mdf' Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".BACKUP DATABASE is terminating abnormally.
c.) Restoring
USE [master]; RESTORE DATABASE MyDatabaseAlias FROM DISK = 'c:\backups\mydatabase_20101117.backup' WITH REPLACE
Do not forget the all essential USE [master]; at the beginning of this statement (and note that its all on one line for those executing the command from a DataContext or similar) If you do, it wont be able to overwrite the existing database because you'll still be connected to it.
Once again, the assortment of totally misleading errors you might receive here, due to an invalid connection string, is endless.

SQL Agent Job - Connection may not be configured correctly or you may not have the right permissions on this connection?

I'm getting this error when running an SSIS package through SQL Agent
Failed to acquire connection "ORACLE ADO.NET". Connection may not be configured correctly or you may not have the right permissions on this connection.
When I log on as the SQL Agent User and run the ssis package directly it is fine. When I then execute it through the SQL agent job, it fails.
I've read around extensively on this topic, and it seems a lot of the advise concerns how you are logged in, configuring of proxy accounts, etc, etc, etc, none of which has been helpful.
I am logging onto an Oracle database with an ADO.NET conncetion. The connection string is as follows (datasource, userid and password have been changed):
Data Source=DATASOURCE;User ID=userid;Password=password;Persist Security Info=True;Unicode=True;
I'm loading this from a registry setting using package configuration. To check that I am getting the correct string, I am writing it into a temporary log table. I am definately getting the string I need from the correct registry setting.
I've tested the oracle login credentials though PL/SQL developer, and it lets me login just fine.
As far as I can tell, as I'm using an explicit user name and password for the Oracle connection it just shouldn't matter who the SSIs pacakge is run as. The only point of failure that Ican see would be the reading of the information from the registry, but that seems fine.
I'm really quite baffled, I must confess, and would appreciate any help some of the splendid experts here can offer.
Many thanks,
James
Ok, tracked this one down after quite a lot of pain.
It was working fine on one environment, but not another, so I fired up Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) and ran a package through the SQL Agent job, comparing which system entities were hit on each enviroment.
On the failing environment, at the point of the bulk transfer operation, the package attempted to get the Oracle 11 client DLL, and then hung.
I knew that this was installed, and, moreoever, the DLL path was a system environment setting. After further investigation it was revealed that the server had not been rebooted since the Oracle Client install and the SQL Server Agent process had not bee recycled.
Yes, can you believe it, the old helpdesk fix "Can you reboot your computer?" worked.
Sigh!
We had issues at a client with running packages connecting to Oracle before stored on our sql server instance. The work around we found was to change the package property, protection level, to "Dont save Sensitive Data" and for security purposes, we encrypted the username and password in the package configuration that was decrypted by a udf in sql server. Of course, before you try the whole encryption part, I would recommend putting the username and password in the package configuration without encrypting the values to see if changing the protection level setting is the solution to your specific problem. I hope this helps.
I was getting this error when tnsnames.ora file did not have a valid entry for the environment

Resources