Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

1 votes
1 answers
839 views
Bringing an Availability Group online after taking it offline
Answer in the following thread says: https://dba.stackexchange.com/questions/278528/activate-service-broker-on-a-database-in-an-availability-group/324386#324386 "You need to set RegisterAllProvidersIP to 0 Thereafter take the availability group offline and bring online again." Is it easy to bring an...
Answer in the following thread says: https://dba.stackexchange.com/questions/278528/activate-service-broker-on-a-database-in-an-availability-group/324386#324386 "You need to set RegisterAllProvidersIP to 0 Thereafter take the availability group offline and bring online again." Is it easy to bring an AG online after taking it offline. Documentation says: After an availability group goes offline, its databases become unavailable to clients and you cannot bring the availability group back online. Therefore, take an availability group offline only to migrate the availability group resources from one WSFC cluster to another.
Warer (11 rep)
Mar 5, 2023, 03:58 PM • Last activity: May 16, 2025, 12:05 PM
0 votes
0 answers
2071 views
User does not have permission to alter database '', the database does not exist, or the database is not in a state that allows access checks
Our log file was full, so I made a mistake in trying to shrink it. My original thought was to move the log file to a different drive, shrink the log, then move it back. However, I did it incorrectly. What I did was the following: 1. Set the database in Single User Mode 2. Took the database offline 3...
Our log file was full, so I made a mistake in trying to shrink it. My original thought was to move the log file to a different drive, shrink the log, then move it back. However, I did it incorrectly. What I did was the following: 1. Set the database in Single User Mode 2. Took the database offline 3. Moved the log file to a different drive Tried to bring the database back online, and now getting the following errors: >Msg 5011, Level 14, State 7, Line 10\ User does not have permission to alter database '', the database does not exist, or the database is not in a state that allows access checks I tried to move the log file back without shrinking it and still get that error. I am not sure how to bring the database back online at this point and unfortunately have not found a solution via various Google articles. I tried to find SPIDs that were blocking
SELECT request_session_id FROM sys.dm_tran_locks WHERE resource_database_id = DB_ID('DB') 
Select * from master.sys.sysprocesses Where spid > 50 And dbid=DB_ID ('DB')
These brought back no results. Log is configured with maximum size. Recovery mode is FULL. Unfortunately, do not take regular backups. Tried to run ALTER DATABASE OffLineDB SET ONLINE but get the error: > User does not have permission to alter database 'OfflineDB', the database does not exist, or the database is not in a state that allows access checks.\ Msg 5069, Level 16, State 1, Line 5\ ALTER DATABASE statement failed. We cannot do anything to bring the database online or put it into MULTI_USER mode. Any "ALTER" command executed gives that error message. The database is "OFFLINE" in "SINGLE_USER". I can use the ALTER command on any other DB, but just not this one to bring it back online. The physical log files are in the same place as the database shows. We do not have DAC enabled. The log just keeps showing: >"Logon failed for user [user]. Reason: Failed to open the explicitly specified database '[Database]'. [CLIENT: ". Error: 18456 Severity 14. State 38 The database being offline is causing those errors. Just cannot seem to be able to bring it back online and into MULTI_USER mode. I believe that the issue is due to file permissions when I moved the log file and moved it back, but just cannot seem to figure out how to get them back.
A M C (9 rep)
Oct 26, 2023, 09:22 PM • Last activity: Oct 27, 2023, 12:39 PM
5 votes
1 answers
1376 views
How does offline-first database design work?
I would like to make an offline-first To-do app which works on both the mobile app (SQLite) and the web app (PostgreSQL). The app will have these business models: User: - id - name - created_datetime Todo: - id - user_id - title - done - created_datetime - updated_datetime Creating new users: - Only...
I would like to make an offline-first To-do app which works on both the mobile app (SQLite) and the web app (PostgreSQL). The app will have these business models: User: - id - name - created_datetime Todo: - id - user_id - title - done - created_datetime - updated_datetime Creating new users: - Only can create a new user with the web app. Creating new to-dos: - Can create to-do with the web app. - If the mobile app is online, post the to-do on the web app. If the post was successful, create the to-do with the same successful to-do's id in the mobile app as well. - If the mobile app is offline, still create the new to-do, and update/post the new to-do to the web app, whenever it is online again. I am unsure how to create a new to-do if the mobile is offline and if I don't have any id, to begin with. If I create a dummy ID for the mobile app, it may clash with other to-do ids. Or should I use UUID for all my to-do's id in the mobile app, and then post it to the web app? How does other offline-first app database design work?
Robin (151 rep)
Dec 27, 2022, 07:19 AM • Last activity: Jan 27, 2023, 05:30 AM
0 votes
1 answers
102 views
Start mysqld.exe but as offline at the begining
How can I start my mysql server as usual using "./bin/mysqld.exe" on windows, but it has to be offline at the very begining? Right now when I start mysqld.exe, I always need to start Mysql Workbench and push the button "bring it offline" at "instance / startup/shutdown" first. It is annoying. I need...
How can I start my mysql server as usual using "./bin/mysqld.exe" on windows, but it has to be offline at the very begining? Right now when I start mysqld.exe, I always need to start Mysql Workbench and push the button "bring it offline" at "instance / startup/shutdown" first. It is annoying. I need mysql server only for localhost purposes, there is no need to be it online for the Internet. Tried to googling and duckducking it but suprisingly there is zero talk about it.
ElSajko (101 rep)
Apr 5, 2022, 05:12 PM • Last activity: Apr 5, 2022, 05:51 PM
2 votes
2 answers
1479 views
Should an OFFLINE database be SET EMERGENCY before dropping?
As a rule before dropping a database I, SET OFFLINE, for 30 days before dropping it. If there is anything that was missed and the database is still needed, I can SET ONLINE quickly for a full restore. USE master GO ALTER DATABASE database_name SET OFFLINE WITH ROLLBACK IMMEDIATE GO If you drop a dat...
As a rule before dropping a database I, SET OFFLINE, for 30 days before dropping it. If there is anything that was missed and the database is still needed, I can SET ONLINE quickly for a full restore. USE master GO ALTER DATABASE database_name SET OFFLINE WITH ROLLBACK IMMEDIATE GO If you drop a database while it is offline, the files stay on the server forever unless you purposely go clean them up. Assuming the you have taken whatever backups you want and are sure you want to completely drop the database on the server, you put it back online then drop it. USE [master] GO ALTER DATABASE database_name SET ONLINE DROP DATABASE database_name GO The database comes fully back online then gets dropped. Might it be a better practice to SET EMERGENCY before dropping? Depending on many variables, in theory when you go online a missed OLTP connection could access the database between ONLINE and DROP. Using SET EMERGENCY, grants ["READ_ONLY to members of sysadmin](https://msdn.microsoft.com/en-us/library/bb522682.aspx) and brings the database far enough online so that files on the server are deleted. At least with my limited testing on SQL2014 USE [master] GO ALTER DATABASE database_name SET EMERGENCY DROP DATABASE database_name GO If a missed OLTP (or anything) manages to connect to the database between ONLINE and DROP you would have deleted any record of it with the drop. Might it be a better practice with an OFFLINE database to SET EMERGENCY before dropping? If you are using T-SQL is it to quick for any possible connection to occur? If you are using the Delete Option on SSMS, even best case between online and delete, is going to measurable in seconds. Should this always be avoided?
James Jenkins (6318 rep)
Mar 28, 2016, 01:28 PM • Last activity: Dec 11, 2020, 09:51 AM
11 votes
3 answers
31097 views
When was a Database taken Offline
I am trying to find a way to figure out when was couple of my sql databases were taken offline. I checked the the logs but could not find any such info and moreover there is no default trace enabled. I just have a info that earlier there was a DBA who took that offline, but no emails or a written co...
I am trying to find a way to figure out when was couple of my sql databases were taken offline. I checked the the logs but could not find any such info and moreover there is no default trace enabled. I just have a info that earlier there was a DBA who took that offline, but no emails or a written communication as such.. Can we find an info on this? please suggest, thanks!
KASQLDBA (7203 rep)
Jan 21, 2015, 03:32 PM • Last activity: Oct 13, 2020, 12:07 PM
3 votes
2 answers
2037 views
Can a offline database be in use?
I have a SQL Server 2014 DB where the log file filled up the disk. Since it was a test db, we decided to just delete the whole database. We took it offline, but when we try to drop it, we get a message that it cannot be dropped since it is in use. How can it be in use when it is offline? How can I g...
I have a SQL Server 2014 DB where the log file filled up the disk. Since it was a test db, we decided to just delete the whole database. We took it offline, but when we try to drop it, we get a message that it cannot be dropped since it is in use. How can it be in use when it is offline? How can I get it dropped? (Preferable without taking it online.)
GHauan (615 rep)
Jun 13, 2017, 08:15 PM • Last activity: Aug 27, 2020, 07:31 PM
0 votes
2 answers
579 views
Does an OFFLINE Database use space?
I took my SQL Server Database `OFFLINE`. Is it still occupying the same space as when it was `ONLINE`? Should I keep it `OFFLINE` or is it better to `BACKUP` the database and `DROP` it?
I took my SQL Server Database OFFLINE. Is it still occupying the same space as when it was ONLINE? Should I keep it OFFLINE or is it better to BACKUP the database and DROP it?
pds (11 rep)
Jan 20, 2019, 06:31 PM • Last activity: Jan 20, 2019, 10:06 PM
0 votes
2 answers
3174 views
How to display User Mapping for offline databases?
When I use the GUI (SSMS) to review the User Mapping, where the Login has mapping to a database that is offline (*or otherwise not available*) I get the message below and it only displays Mapping for databases that are online. > One or more databases are inaccessible and will not be displayed in lis...
When I use the GUI (SSMS) to review the User Mapping, where the Login has mapping to a database that is offline (*or otherwise not available*) I get the message below and it only displays Mapping for databases that are online. > One or more databases are inaccessible and will not be displayed in list All the details should actually be in the Master DB, there should be something I can run that will show me what the full User Mapping is. How can I display User Mapping for offline databases?
James Jenkins (6318 rep)
Jun 1, 2016, 03:11 PM • Last activity: Oct 11, 2018, 05:44 PM
2 votes
0 answers
232 views
Distributing MS Access Database
I develop an application that saves records in MS Access DB. Each user has it own DB copy on his local machine, and there is a central DB that reflects all the copies from everyone. The central DB is located in a URL that everybody can access. I therefore distribute the central DB by creating local...
I develop an application that saves records in MS Access DB. Each user has it own DB copy on his local machine, and there is a central DB that reflects all the copies from everyone. The central DB is located in a URL that everybody can access. I therefore distribute the central DB by creating local copies that are links to the central tables. This means that the local DBs are synchronized with the central since they are links to it. However, this solution disable the option to work offline- if a user is not connected to the URL, he cannot save anything on the local DB which is a link to the central . I therefore have another option: to distribute the central DB by copying deep copy, and locate a copy (not link) on each machine. This enables to work offline since each user has a full copy of DB on hos machine. However, no synchronization among the copies and the central DB. Is there any solution that enables both offline work and full synchronization? Any Ideas?
user3165438 (131 rep)
May 16, 2016, 07:01 AM
1 votes
2 answers
496 views
Can't change _log database physical location in SQL Server
I just installed Microsoft ServiceBus and it created 5 databases. Now I want to move them to some specific location so I can join them to SQL Server AlwaysOn Availability group. I stopped service bus farm and tried to execute the following queries one by one: ALTER DATABASE [SbManagementDB] SET OFFL...
I just installed Microsoft ServiceBus and it created 5 databases. Now I want to move them to some specific location so I can join them to SQL Server AlwaysOn Availability group. I stopped service bus farm and tried to execute the following queries one by one: ALTER DATABASE [SbManagementDB] SET OFFLINE; ALTER DATABASE [SbManagementDB_log] SET OFFLINE; ALTER DATABASE [SbManagementDB] MODIFY FILE ( NAME = [SbManagementDB], FILENAME = 'C:\Program Files\Microsoft SQL Server\MyLocation\SbManagementDB.mdf' ); ALTER DATABASE [SbManagementDB_log] MODIFY FILE ( NAME = [SbManagementDB_log], FILENAME = 'C:\Program Files\Microsoft SQL Server\MyLocation\SbManagementDB_log.ldf' ); ALTER DATABASE [SbManagementDB] SET ONLINE; I brought SbManagementDB offline successfully, but when I tried to do that to SbManagementDB_log I've got the following error: Msg 5011, Level 14, State 5, Line 2 User does not have permission to alter database 'SbManagementDB_log', the database does not exist, or the database is not in a state that allows access checks. Msg 5069, Level 16, State 1, Line 2 ALTER DATABASE statement failed. I executed the following query SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files and made sure that this DB exists and I tried sa login, but got the same error. Any ideas what am I doing wrong?
Andrew (153 rep)
Apr 6, 2016, 04:04 PM • Last activity: Apr 6, 2016, 05:20 PM
Showing page 1 of 11 total questions