Failing to connect to Database due to database in recovery - sql-server

I am using SQL Server 2008, developer edition. I connect to my database from my asp.net mvc application using Linq2SQL. I noticed that my database went into recovery mode about 4 times in a span of a month. I am running a few complext Linq2SQL queries. When database is in recovery mode, my asp.net mvc application is going off line as it could not connect to the database. I do not know how to prevent the database from getting into recovery mode. I have seen some of the questions on SO, but could not find a way how to solve it. I am hoping some one could help me out.

Some possibilities/things to check include:
Is this database part of a Log
Shipping configuration? If so, whilst
the Secondary server is being
restored you will be unable to
establish connections to the
database.
You are certain you are using the Developer
Edition of SQL Server and not the
Express Edition?
Is the Autoclose option set to TRUE?
If so the database will shutdown when
there are no active user connections.
To check if you have any databases set to Autoclose use the following T-SQL:
SELECT * FROM sys.databases WHERE DATABASEPROPERTYEX(name, 'IsAutoClose') = 1

Related

Login failed after moving sharded database from self-hosted to Azure Database

Is there a proper way to move a SQL Server 2016 sharded database from self-hosted to Azure Database?
I have a SQL Server 2016 sharded database that is part of the platform (Sitecore 10) I'm working with. It has a Shard Map Manager database and two Shard databases. I want to migrate the databases from self-hosted to Azure Database.
When the database is in a SQL Server Instance, it has one login mapped to the Shard Map Manger user and both Shard users. Everything works great. Since Azure Database does not use logins the same way and the databases are partially contained, I created separate users in each database in Azure with the same name and password.
Next, I migrated the schema with Azure Data Migration Services and then the data. There are some stored procedures that Sitecore provides to setup permissions and I ran those.
Finally, I updated the ServerName and DatabaseName fields in the [__ShardManagement].[ShardsGlobal] table for the ShardMapManager DB and the [__ShardManagement].[ShardsLocal] table in both Shard databases to match the new server and database names.
When I updated the app to use the new database, it spewed errors into the log, ultimately tracking to a failed login for the user. There are 13 other databases for the app which were also migrated and work fine, only the sharded database does not work in the app. I ran a PowerShell script that tests the connection string for all of the databases. All of the connection strings were successful. Backing out only the connection strings for the sharded database fixes the errors proving that the connection to the sharded databases is the problem.
What did I do wrong and what should I do to fix it?
If the requirement is only to migrate the databases from local to Azure, the best possible way is to use SQL Server Management Studio (SSMS).
The advantage is that you can mention the new database name on Azure while migrating itself and hence no need to change later. But just make sure same named database shouldn't available already in Azure SQL Server.
You can follow the migration steps from my this answer.
Also, my suggestion is to go through the official documents Assessment rules for SQL Server to Azure SQL Database migration, Troubleshoot connecting to the SQL Server Database Engine. I'm sure you will find the useful insights there which could help to make migrated database work properly with the apps.

What are my options for accessing an SQL Server database through MS Access front-end while offline

I'm currently working on a project proposal which would require moving multiple Access databases into a new MS SQL Server database. The idea is to keep the front end program as MS Access so that the users are familiar with the process of inputting data and creating reports.
However, things get complicated in that the internet in the areas where the survey will be collected has poor connectivity and will be out from time to time. I had thought of a few ways of solving this issue but all of them are cumbersome:
1) Having a PC with a router that stores the SQL Server database in offline mode and the data entry PCs connect to the PC with the offline database through the router. The PC with the SQL Server database can then backup the db on the server when it has an internet connection.
2) Adding the data to MS Access databases that can then be merged with the SQL Server at specified increments (this would probably cause some issues).
We've done option 1 before for similar projects but never for connecting to an SQL Server database in offline mode. However, it seems feasible.
My question is: Does anyone know of a way of using Access as a front end application for SQL Server and being able to update data during times without internet connectivity? The SQL Server database would automatically assign primary keys, so, duplicate unique values shouldn't be an issue while syncing the data.
Thanks for your help. I've been having a hard time finding an answer on Google and syncing to databases is complicated at the best of times. I'm really just looking for a starting point to see if there are easier ways of accomplishing this.
I would run a the free editon of SQL express on all laptops. So the Access database would be the front end to the local edition of SQL express. SQL express can be a subscriber to the "main" sql database. You thus use SQL replication to sync those local editions of SQL server to the master server. Of course the main SQL server can't be the free edition of SQL server. So to publish the database for replication, you can't use the free edition, but those free editions can certainly be used as subscribers.
This approach would eliminate the need to build or write special software for the Access application. You thus do a traditional migration of the access back end (data tables) to sql server, and then simply run the Access application local with sql express installed on each laptop. You then fire off a sync to the main edition of sql server when such laptops are back at the office.
The other possible would be to adopt and use the net sync framework. This would also allow sync, and would eliminate the need to run sql expess on each machine. I think the least amount of effort is to sync the local editions of sql express with the main editon of SQL server running at the office (but that office edition of SQL server can't be a free edition).

SQL Server to Oracle Migration Cannot Find User

I migrated a SQL Server database to Oracle 11 Express and have trouble to connect to the converted database in Oracle SQL Developer. I followed the instruction here: Oracle Migration the only difference is I am using an on-line migration.
I have successfully converted the database, but what I am struggling with is I cannot connect to the converted database because there is no user migrated (or created). Please see image below. I wonder if anyone has the same problem before or can give me directions how to solve this.
much appreciated for any suggestions/helps.
SQL Server to Oracle Migration - connect migrated user
If your migration is completed and your repository has recorded all migration transactions.
It is confirmed that before migration you created Oracle User. you are well aware about the password.
If you have lost after migration.
Just log in as System or Sysdba user and change the particular username password. That's it.
Now connect to migrated user.

Filter database names in SQL Management Studio 2008 R2

I'm trying to connect to my database that is located in a server with lots of other databases (that belongs to other people that are on the same hosting company).
Due to my low internet speed after I connect as I click on expanding databases most of the time I get no results waiting.
Is there a way that I can filter databases that only would load my databases ignoring the others?
Consider denying the server permission VIEW ANY DATABASE to yourself or ask the server's DBA to do it.

Getting client application data to enterprise database server

I'm looking to use sql server compact edition for an application where users will not always be connected to the internet. Once the users regain an internet connection, I want them to be able to send the data to the enterprise sql server.
I started thinking about this and I don't want to have to loop through a recordset to submit each record one-by-one.
Normally, I would just do something like the following:
insert into table2
select * from table1
Can someone tell me how to proceed or easily send the data from the compact edition to the enterprise edition?
The Sync Framework is designed to cover exactly these scenarios of mobile users connecting sporadically from smart devices, laptops and alike. See Introduction to Sync Framework Database Synchronization for a high level discussion. See Synchronizing Databases for a much more detailed discussion. Finally, see Database Sync - SQL Server and SQL Compact 2-Tier and
Database Sync - SQL Server and SQL Compact N-Tier with WCF for working code samples.
Try merge replication. The synchronization function is built in to the SQL Server and CE functions. You don't have to write code manually to sync rows.

Resources