
Category Archives: DB Articles
Troubleshoot Suspect Database Issue
Problem
How to troubleshoot suspect database problem? How to bring it back online? What are the do you need to perform once the database is online?
Solution
Step 1: Bring the database online using below script
USE Master
GO
— Determine the original database status
SELECT [Name], DBID, Status
FROM master.dbo.sysdatabases
GO
— Enable system changes
sp_configure ‘allow updates’,1
GO
RECONFIGURE WITH OVERRIDE
GO
— Update the database status
UPDATE master.dbo.sysdatabases
SET Status = 24
WHERE [Name] = ‘SuspectedDatabaseName’
GO
— Disable system changes
sp_configure ‘allow updates’,0
GO
RECONFIGURE WITH OVERRIDE
GO
— Determine the final database status
SELECT [Name], DBID, Status
FROM master.dbo.sysdatabases
GO
Step 2: Check for database corruption. This is very important step please execute it.
- DBCC CHECKDB – Validate the overall database integrity
- DBCC CHECKCATALOG – Validate the system catalog integrity
- DBCC CHECKTABLE – Validate the integrity for a single table
Step 3: To resolve the corruption issue, please execute below commands
- Drop and Recreate Index(es)
- Move the recoverable data from an existing table to a new table
- Update statistics
- DBCC UPDATEUSAGE
- sp_recompile
Step 4: Repeat Step 2 to validate all the corruption occurred
DRBD, Heartbeat and MySQL
The easiest solution to implement clustering in MySQL is DRBD and Heartbeat.
DRBD: The Distributed Replicated Block Device (DRBD) is a software-based, shared-nothing, replicated storage solution mirroring the content of block devices (hard disks, partitions, logical volumes etc.) between servers.
DRBD mirrors data
- In real time. Replication occurs continuously, while applications modify the data on the device.
- Transparently. The applications that store their data on the mirrored device are oblivious of the fact that the data is in fact stored on several computers.
- Synchronously or asynchronously. With synchronous mirroring, a writing application is notified of write completion only after the write has been carried out on both computer systems. Asynchronous mirroring means the writing application is notified of write completion when the write has completed locally, but before the write has propagated to the peer system
You can download DRDB from below site
Error 18456, Severity 14: Login Failed States
| Error 18456, Severity 14: Login Failed States | |
| Login Failed states summary | |
| State | Description |
| 1 | Only state returned in SQL 2000. Server is in Single-User Mode (2005). |
| 2 and 5 | Invalid User Id |
| 6 | Attempt to use a windows login name with SQL Authentication |
| 7 | Login disabled and password mismatch |
| 8 | Password mismatch |
| 9 | Invalid Password |
| 10 | Read Ref Link #2 |
| 11 and 12 | Valid login but server access failure; Default Database access failure. Or Initial database connection failure in connection string. |
| 13 | SQL Server service paused |
| 16 | User doesn’t have permission to target database |
| 18 | Change password required |
| 23 | Server in process of shutting down, and user attempted to login. |
| 27 | Initial database could not be determined for session |
| 38 | Initial database could not be determined for session (SQL 2008) |
| 40 | Default database could not be accessed (SQL 2008) |
Happy Republic Day
