I am incredibly frustrated!
I have been trying for months to migrate a MS Access database to SQL Server and nothing has worked. I need to be able to edit data on an Access front-end and the SQL Server back-end.
I've been able to copy a table, but edits on one end are not applied on the other. I'm severely limited in what applications I can download -- it takes at least a week for our IT department to install a new app. I've tried using SSMS 18 (just had it installed today) to create a linked service.
I use "Microsoft Office 12.0 Access ..." (16.0 is not available) as the Provider and leave Product Name and Provider String blank -- I get this error for either a .mdb or a .accdb file.
TITLE: Microsoft SQL Server Management Studio
The linked server has been created but failed a connection test. Do
you want to keep the linked server?
ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
Cannot create an instance of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "2022_08_24".
(Microsoft SQL Server, Error: 7302) For help, click:
https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-7302-database-engine-error
The generated script is
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver #server = N'2022_08_24', #srvproduct=N'', #provider=N'Microsoft.ACE.OLEDB.12.0', #datasrc=N'C:\Users\liptonj1\OneDrive - Southern California Edison\Documents\Word Test_be.accdb'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'collation compatible', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'data access', #optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'dist', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'pub', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'rpc', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'rpc out', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'sub', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'connect timeout', #optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'collation name', #optvalue=null
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'lazy schema validation', #optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'query timeout', #optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'use remote collation', #optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption #server=N'2022_08_24', #optname=N'remote proc transaction promotion', #optvalue=N'true'
GO
USE [master]
GO
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname = N'2022_08_24', #locallogin = NULL , #useself = N'False'
GO
The right process is the one implemented by SSMA for Access: https://www.microsoft.com/en-us/download/details.aspx?id=54255
After creating matching tables and migrating the data the last step is to replace the Access tables with ODBC linked tables to the SQL Server so your Access-based forms and reports work directly with the SQL Server data.
Having a linked server from SQL Server to Access is not needed.
Ok, there is ALSO a 3rd option.
Access 2010 was the LAST version of Access to have a built in SQL server migration tool.
So here we are in 2022 12 years later!!!
but, Access 2010, and in fact Access 2007? It has a BUILT IN migration tool!!!
This is on the 2007 menu:
So, AFTER 2010, you ARE strong suggested to use the SSMAA - a seperate download and install.
However, Access 2003, 2007, and 2010? They have a BUILT-IN migration tool to sql server.
I don't have a 15 year old version of Access kicking around anymore, but you may very well want to try and use that tool. Just make sure you DO NOT use or pick the "ADP" option.
This is more a comment than an answer but is too long for a comment.
Try the following steps:
Using SSMS create a database
With that database (right mouse click) use task/import data and connect to your Access database using the Access connection type
Select the table(s) to copy (and copy them)
In your Access front end, connect to the SQL Server database using an ODBC connection and link the source tables
You can then read/write to them directly
While often not the case, we assume that you have a split access database.
That means that you have so called front end (accdb, or mdb). (FE)
And then you have linked tables to a back end (accDB, or mdb). (BE)
And office 12? Ok, that is version 2007 - 15 years old, but should work just fine.
(what other software are you using that is 15 years old? Or are you for some strange reason singling out Access for such a old version???).
Regardless?
So, the basic idea here?
You migrate the tables from the BE to sql server.
You then delete your FE links that point to the Access back end, and now are to create links in your FE that point/link to SQL server (where you presumably) migrated the Access data tables.
Hence:
I've been able to copy a table, but edits on one end are not applied on the other.
Sounds like your FE is still pointing to the older database. I mean EVEN without SQL server, it was often VERY easy to have your FE point to the WRONG database BE. You start editing, and you don't see changes in the database!!!!
So, once you move data to SQL server, then in your FE, you are to delete links
(you are NOT deleting tables here, but ONLY the linked tables in the FE, right, since we DO NOT have tables in the FE, do we?).
why do I export/import the tables, just to delete them?
You are NOT deleting tables!!!! - you are to delete your "linked" tables, or the so called links in your Access FE. You are now not using the BE anymore, and editing of data in your access FE will be directly working against and editing the table(s) that reside on SQL server. There is no concpet of suffeling data between tables - you are using linked tables. The data does NOT exist in the FE, and it never did with linked tables. So, you are being told to delete the linked tables - not the physical tables that were in your BE.
I mean assuming your Access applcation was split, then you don't have the tables in your FE to delete anymore do you? So, no, we not deleting ANY tables here, you are to delete the LINKED tables in your FE that previous pointed to your accDB BE.
You will THEN create NEW table links that now point to the tables you migrated to SQL server.
So, if you not using SSMAA?
Then you use the sql studio tools to create a database in SQL server.
Once you created a database, you are THEN to move the Access table(s) into that database. So, it comes down to what tools you plan to use for this task.
As a result, there is no "shuffle" of data between tables. You have a linked table in your FE. You are directly editing data in that linked table. But, now the linked table is not a access one, but one that resides on SQL server.
Ok, so above quite much outlines the moving parts and how this works.
So, lets take ONE simple table in a Access database. And lets import that table to SQL server. (but as noted, since this is one table, then we can use a simple import. But, AGAIN, if you have a boatload of tables in that Access database, then a dedicated migration tool is MANY times a better choice then a simple import of a table).
So, the first step would be to create a database. This is much similar to Access. You create a new database, and THEN you are to migrate(or import) the Access tables (and data) into that SQL server database.
Once done, then step 2 is to create a linked table to that table sitting in/on sql server.
So, we fire up SSMS, and create a new table.
So, we right click on databases, and choose new database.
And then just type in a name for our database.
And now hit ok.
Now, we right click on this database, and choose import data.
eg:
Now, in this example, we will import just one table.
So, in the import options, we see/get somthing like this:
Note the number of choices. Well, if this is a mdb file, then from above choose the "JET" database engine.
But, if this is a accDB file? (access 2007 and later), then choose the Access data engine as I have.
(and you might have to change the file drop down from *.mdb to all files.
So, that selects the file.
Now next page, you have to select the sql server "driver".
You have TOO many choices here - and it can be VERY confusing.
So, by FAR the best choice here is to ALWAYS choose a SQL server NATIVE driver. (you don't have to - but it will be more pain and suffering if you don't).
So this one:
thus this:
And again, don't know if you using SQL server logons, or windows security here.
Ok, so now we get:
I'm ONLY selecting one table (because this is a CRAP AND BAD way to do a data migration by using a simple import - but we have to start somewhere!!!).
So, at this point, we should be able to expland our database, and see the ONE table.
this:
Ok, so now right click on this table and choose design.
The table designer in SSMS is VERY much like access, so it should be easy to do the next steps:
REMEMBER WHAT I stated above. The import option above we used is a POOR way to import data to SQL server WHEN the goal is to use our Access FE to link to this table.
The REASON WHY is becuase the import option is kind of like a dirty and quick import choice for Excel and flat files and is quick and dirty.
But, it does NOT set our primary key, and all the other settings we would typical have in the Access table (such as PK column, and autonumber).
So, now in design mode, we WILL set the PK column.
So click on the PK column (should be in most cases "ID" - the default for Access).
Then up in the SSMS menu, click on the primary key button.
this:
Ok, that gets the PK (primary key setting).
Now we ALSO need to set this PK as "auto number" (like it was in Access).
So this setting:
So, again, "ID" is selected, and in the property sheet, set the column to "is identify" "yes", and it will put in the 1 and 1 for Increment and seed.
You can now close this table.
So, as noted, for 1 or 2-3 tables, you have to do the above for each table.
As I stated, if you have 40 and ALSO related data and tables, then we want to use a automated tool (like the SQL migration assistant for Access - SSMAA).
But, for this ONE table test, then the above is just fine.
Ok, so now we go to our Access FE, and we can delete this one table that was linked to the back end. (again, we not deleting a table, but ONLY the old existing LINKED table).
Now we create a new linked table to the SQL server table.
In access, then this:
So that option allows us to import or link (we are going to link here).
and we get to this:
ALWAYS NO MATTER what, choose (leave the default to FILE) as per above, do NOT use Machine Data source).
Next we choose the ODBC sql server driver.
WHEN POSSBILE ALWAYS choose a native driver. However, this choice depends if you going to distribute your FE to many users. (the native 11, 12 and up to 18 drivers are NOT installed by default). If you don't see any native drivers, then choose "SQL Server", but the native drivers are a better choice (but the down side is these drivers will have to be installed on all computers. The "SQL Server" one can be a good choice, since it ALWAYS will exist on every computer).
In fact, for this lets go with SQL Server one.
So, this one:
So then this (choose a name) for the conneciton.
next, then finish, and we get this:
The drop down SHOULD show a list of SQL servers you have.
then choose your logon.
I don't know if you using windows authentication, or SQL server passwords.
Then:
SUPER SUPER IMPORTANT STEP!!!!!!!
MAKE SURE you choose your database with this drop down - don't skip this!!!!
Check the box Change the default database to box, and then choose your database we created.
This we can just hit next - nothing to change.
then this - you can (should) try the test data Source button.
Now we are all the way back to the near starting panel, and you can hit ok
And now we get/can select the table to link to:
find your table - select it, and ALSO check that save password button.
At this point, you should see a linked table in Access. If we open it, we get this:
I have tried to rename the DB name in a RDS with SSMS but its giving below error.
User does not have permission to alter database 'DB name', the
database does not exist, or the database is not in a state that allows
access checks. (Microsoft SQL Server, Error: 5011)
Can some one please help me on this?
I have went through many articles and aws docs but did not find straight away solution so I am writing this, hope it helps someone. After some amendments to the findings, I was able to fix this issue.
Run the below queries as master on new query terminal.
use master
ALTER DATABASE YourOldDBname
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
EXEC rdsadmin.dbo.rds_modify_db_name N'YourOldDBname', N'YourNewDBname'
GO
ALTER DATABASE YourNewDBname
SET MULTI_USER
GO
If you have any active connection, you might get below error. Mostly you will not get any error as you are running above queries, if you still seeing below error please shut down any server that might be trying to establish a connection to same RDS DB.
Msg 50000, Level 16, State 2, Procedure rds_modify_db_name, Line 95 https://forums.aws.amazon.com/
The database could not be exclusively locked to perform the operation.
Hope its helped you :)
I have a SQL Server 2016 on a Windows Server 2016.
The database is stuck in single user mode.
I try to do this :
ALTER DATABASE MyDatabase
SET MULTI_USER;
But it says that the database is in use.
I tried this to find the spID :
exec sp_who
And I found the spid 57 is using the database,
Tried this to kill the spID
KILL 57
But it says : Process ID 57 is not an active process ID.
I am really stuck!
I can't even rename or delete the database.
I tried all of these but, didn't work :
SQL Server 2008 R2 Stuck in Single User Mode
Any idea please ?
It means that the DB is in use, it's set to single user mode, and you're not that single user. A common cause of that is that Object Explorer in SSMS is connected to the DB. Close everything that's connected to the server (even restart the SQL Server service if you need to), and try again. At worst, don't use SSMS. Just connect with SQLCMD, so you know that nothing else is connected.
I found the solution,
I restarted the sql server service, re-execute the query exec sp_who and found another spID and could kill it this time.
Thanks
From the Official docs you can try changing it a little bit by removing the read-only part
ALTER DATABASE [database_name]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [database_name]
SET MULTI_USER;
GO
Docs : https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-set-options?view=sql-server-ver15#b-setting-the-database-to-read_only
I'm trying to enable Full-Text search on my Azure SQL Database. I upgraded my DB to V12 Standard instance. The upgrade has got completed successfully. I say that because the Status says "Online" on the portal. However, when I execute this command below,
CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT;
it throws an error saying,
Msg 9972, Level 16, State 100, Line 2
Database is not fully started up or it is not in an ONLINE state. Try the full-text DDL command again after database is started up and becomes ONLINE.
I am following this blog post
What could be wrong?
Executing the below two statements by connecting to the database as well fixes this if in case you want to avoid the round trip of communicating to MSFT.
Alter database [dbname] set read_committed_snapshot off with rollback immediate
Alter database [dbname] set read_committed_snapshot on with rollback immediate
Thank you for the question. The error you are experiencing is related to an internal issue that we are aware of and currently in the process of fixing. To mitigate your issue, could you please email me at joseidz at microsoft dot com with server and database name and we will get this fixed for you.
I`ve got a problem with my mirroring. I have already uses this feature to make 2 db work.
But it was on test bases.
Now when I use my scripts on work DB it throws an error:
Msg 1499, Level 16, State 1, Line 1
Database mirroring error: status 1488, severity 16, state 1, string db_name.
Any suggestions?
you database may be in single user mode
right click the database -> options and select MULTI USER under restrict access
try to check the principal and mirror server names, dtabase name etc. It is possible that there is misprints.
This happened to us recently. We found that SQL set the restored database to single user mode during the restore process.
After some research, we simply restarted SQL server services on the mirror. When SQL started back up, the restored database was in multi-user mode and we were able to initialize mirroring without any issues.
There are other sites out there with answers as well, but they involve taking down the principle database. That was not really an option for us at the time. Here is one example in case restarting the mirror does not help the next person who runs into this.
http://blog.armgasys.com/?p=259
I had some what similar issue this is how I solved it. When I ran wizard for mirroring it created endpoints(first part) successfully but when i tried to turn on mirroring it gave me error.
So I solved it by running below command on both server
USE [master]
alter database [yourdatabase] set partner off;
go
--Secondary already had partner but primary did not
--- then i ran below commands on each server.
USE [master]
ALTER DATABASE [yourdatabase]
SET PARTNER = 'TCP://OtherMachineSQLname.domain.LOCAL:5022';
GO
-- then mirroring started to work.