Run below Query. And once the query executes completely, go through the SQL Server Error log to see the results.
declare databases cursor for
select name from sys.databases
where name <> 'master' and name <> 'tempdb'
and name <> 'model' and name <> 'msdb'
declare @dbname varchar(100)
fetch next from databases into @dbname
print @dbname + ' - ';
DBCC CHECKDB (@dbname) with no_infomsgs;
fetch next from databases into @dbname
xp_readerrorlog parameter 1, parameter 2, parameter 3, parameter 4
Parameter 1: To specify the errorlog number. Starts from 0. 0 = current, 1 = Archive #1, 2 = Archive #2
Parameter 2: Log file type. 1 or NULL for Error log and 2 for SQL Agent Log
Parameter 3: Search string
Parameter 4: Second search string further refine your search. Continue reading “Read and filter SQL server error logs using TSQL”
Did you come across any situation where you wanted to make sure that the password you set for a SQL account is what you really wanted? Below is how you can validate the password for a particular account. With this methord, you can find out the forgotten password for a SQL account without causing any audit failures and by not changing any security settings.
SELECT name FROM sys.syslogins WHERE pwdcompare (
When you run the above query, you will get the list of accounts which has password set as SomePasswordWhichYouKnow.
This way, you can figure out what password was set while creating an account (SQL authentication account)
After connecting to SQL Server using SQL Server Management Studio, I am not able to see the green play arrow on the SQL Server DB icon before the instance name. It just shows white circle.
Make sure that the Windows account with which you opened SQL Server Management studio have got admin privilege on the operating system and can retrieve service running status.
In Windows 2008, Even if your account has admin privilege on the OS, you need to run SSMS (for SQL Server 2008) and sqlwb (SQL Server 2005) from command prompt opened with “Run as Administrator”.
If you wanna add a shared disk to the two nodes of a cluster to be built inside a VMware, Follow below steps.
- If your VMware is pretty Old, Then shutdown both the virtual machines to be configured as cluster.
- Then from inside VMware virtual center, right click one of the virtual machine and select ‘edit settings’.
- Create one SCSI control with sharing allowed among multiple virtual machines.
- Now click on Add and select Hard Disk.
- Select to create new virtual disk, provide required size, thin provisioning unchecked and to store with the virtual machine. And in advanced section, select the value for Virtual node (1:x, where 1:0 was selected as virtual node in step 3 and the x can have any value which is unoccupied. Since this SCSI control was newly created, all the nodes will be vacant. So here x can have any value between 0 and 15). Complete the wizard and now you have disk created and mapped to one virtual machine.
- Right click the same virtual machine once again and choose ‘edit settings’. And then click on the Hard Disk we just added. Now in a box at the right top corner, you will get the disk file location and name.
- Next use the tool putty (Let me know if you would like to know what putty is) and connect with the ESX host where the two virtual machines are located and also the disk we created in step 5 will be located.
- Using basic linux commands, navigate and find the Disk file and run below command to make the Disk file Zeroed (All bits on that disk are reset in this process).
- vmkfstools -w /filepath/filename.vmdk
, Continue reading…
At first I thought starting SQL Server in Single user mode is easy in Windows 2008 fail-over cluster. But I was wrong, If I just add ‘;-m’ in start-up parameter and starts it, the SQL server will start in single user mode via cluster. But we wont be able to log in. The cluster service logs in before us. And so we might see an error like below.
Login failed for user ‘Domain\user’. Reason: Server is in single user mode. Only one administrator can connect at this time. [CLIENT: xx.xx.xx.xx]
Now what do we do? Below is how I overcame this problem.
Why do we need this?
By default, you might be having the stock media package which will give you a SQL server without the latest service pack. You will have to install service pack separately after installing the instance (Double work and time consuming). So if you follow below method you can update your install media with the latest service pack so that you can directly install SQL server + latest service pack in one shot. This method is also called as slip stream.
Here lets take the example of adding Service Pack 2 to a SQL Server 2008 Enterprise Edition x64 install media.
- SQL Server 2008 Install Media.
- x86,ia64 and x64 versions of Executable for latest Service pack. They can be downloaded at http://www.microsoft.com/download/en/details.aspx?id=12548. Download all three files listed below.
- Create a new folder name D:\SQL2008EEPlusSP2 and extract/copy all the files of the install media to that folder. Now you will have below list of files and folders in that New Folder.
- ia64 (Folder)
- x64 (Folder)
- x86 (Folder)
Shows errors like below on your Joomla, Drupal or in any other php coded webpage.
Those functions got replaced with alternate ones. (Sorry that I don’t know the reason behind that. May be the new ones might have some new features). Also I experienced this problem after upgrading PHP engine on my server.
FTP the web server and open the file showing error, search for “ereg” and replace ereg(…) with mb_ereg(…). The syntax is same for both. (Try this and keep it if it works. It will work 90% sure.)
FTP the web server and open the file showing error, search for “split” and replace split(…) with explode(…). (Same as above.)
Replace the below line showing error
with below code
Note: More findings will be added to this post as and when I experience them. Please comment below if you had experienced and fixed any other deprecations.
Before we start we need to make mySQL database capable of supporting unicode characters. For that we need to change the database collation or the table collation to utf8_unicode_ci. This can be done with phpmyadmin portal.
- Click the table you need to change.
- select Structure tab.
- Check the required column and click change or edit.
- From the collation drop down select utf8_unicode_ci.
- Press Go.
Click here to read more
We had a requirement to change the SQL Server Fail over cluster group Virtual server name. We did that change through the cluster administrator. That SQL Server was 2008 Enterprise running on Windows 2008 Enterprise cluster. The change was successfully made from one node and the SQL server came online after that. But when we did fail over testing, we noticed that the SQL Server service is not coming online on the other node. The SQL Server error-log gave below errors while trying to start-up.
Click here to continue reading this post and resolution