Monday, July 23, 2012

Database Mirroring - Common Errors


Database Mirroring Errors

The following errors are the commonly occuring in 
database mirroring and hence 
I thought of collecting them and providing solution 
as well so that it might 
benefit others
Error:
Login Failure connecting to new principal server after failover
Error: 18456 Severity: 14 State: 16
The problem is that after performing failover the
 original mirror database becomes 
the new principal. We can connect successfully to 
the mirror using Windows login.
But we are unable to connect to the new principal database with 
Sql login as we get the below,
Cannot open database "" requested by the login. The login failed.


Solution:
This problem occurs because the SIDs (security identifiers) 
for the SQL Server logins
 on each server do not match. Although the names 
for the logins are the same, the 
login is resolved via the SID. This is not a problem 
with Windows/Domain user/group
 logins because the SIDs for these logins are created 
based on the domain SID for
 the user/group, and hence will be the same for the 
same given user/group.


1. You can either run the procedure sp_change_users_login
 to map the user
 and login (or )
2. At the time of creating logins in the mirror server, you
 will need to create 
the SQL Server logins on the mirror server not only with 
the same name, but
 also with the same SID as on the principal server.


Execute the below command in Mirror server to create the 
same login as in 
original principal server with the same SID as in the original 
principal server


Create Login "login name" With Password = "Password" , 
SID = "Sid of the same
 login from original principal server"


You can obtain the SID of the same login from original
 principal server using,


select name,sid from sys.sql_logins where name ='Login name'
Error:When you configure mirroring you might receive
 the below errror,
One or more of the server network addresses lacks a 

fully qualified domain name 
(FQDN). Specify the FQDN for each server, and click start 
mirroring again

Solution:

Assume that your principal server is A and mirror server is
 B and you have configured 
mirroring for Adventure Works database. The fully qualified 
computer name of each
 server can be found running the following from the
 command prompt:

IPCONFIG /ALL

Concatenate the "Host Name" and "Primary DNS Suffix". 
If you see something like:
Host Name . . . . . . . . . . . . : A
Primary Dns Suffix . . . . . . . : corp.mycompany.com
Then the computer name is just A.corp.mycompany.com. Prefix 'TCP://' and append ':
and you then have the partner name.


-- Specify the partner from the mirror server
ALTER DATABASE [AdventureWorks] SET PARTNER =
 'TCP://A.corp.mycompany.com:5022';

-- Specify the partner from the principal server
ALTER DATABASE [AdventureWorks] SET PARTNER =

 'TCP://B.corp.mycompany.com:5022';

Pls replace your database name accordingly in the above command


Error:
Msg 1416, Level 16, State 31, Line 3. Database is not configured 
for database mirroring
Solution: 
You need to restore the Full backup from principal server 
using With NoRecovery 
option and also one transactional log backup from principal 
server using With
 NoRecovery 
option and then start configuring mirroring.

Monday, May 28, 2012

Relinquish the CPU BottleNeck on Win Server 2008 64-bit


CPU Performance Bottleneck

Server Specification
Dell PowerEdge T610
Processor Intel Quad Core Xeon COU, 2.8 GHz
Memory 16GB 4x4GB
Operating System: MS Windows Server 2008 Standard x64 Ed.
Database: MS Sql Server 2008 x64

Summary
Initially the Server T610 was running on single instance IDBSVR\INS_ICARE to manage ICARE database. The hardware setup  on CPU and Memory was based on default setting. We only reconfigure the current RAID setup from RAID 5 to RAID 10. The ICARE database was replicated continously to another Windows 2003 Server I.e DBSVR.

We used Spotlight on SQL Server Enterprise to monitor the database performance and track any significant errors.

Symptom
On April ~ May 2011, we started to install Boss.Net application and create another instance IDBSVR\BOSS_NET_DB. This database also was replicated to DBSVR on scheduled basis.

However, the Spotlight monitoring software started to view alarming indicator which shows bottleneck on CPU performance.

Benchmark
Processor Queue Length (CPUs x 2) = 32 (Logical CPU)
                                                            = 16 (Physical CPU)

            Preliminary Trial Setup = 16

Context Switches/Sec                         = 8000

Message Alarms
The IDBSVR started to broadcast Low level alarm indicating high number of Processor Queue Length which is exceeding 16 for more than 10 minutes and Context Switching level has started to reach 2 million counters.

The symptoms started to appear after 48 hours of restarting the server.

Solution and Action

1.      Set Maximum Worker Threads =  704 in Server Properties under Processors Tab on IDBSVR\INS_ICARE*
2.      Restart the server.
3.      After 48 hours, the problem still happened.
4.      Set Maximum Worker Threads =  704 in Server Properties under Processors Tab on IDBSVR\IBOSS_NET_DB*
5.      Restart the server.


*The default value 704 on Max Worker Thread is taken from MSDN blog.

Thursday, March 31, 2011

Set up Virtual Mail Server using Postfix in Ubuntu Hardy

These are few things which need to be taken care of cautiously:
1. In postfix's main.cf file - ensure 'mydestinations' parameter is set to blank. Otherwise the domain folder and user mail dir will not be created in the server (although it shows in the mysql tables). The IMAP server testing in test_config page of Roundcube will show error message "no file/directory is found/created".
2. If Posfixadmin is intended to be installed as mail manager for setup virtual domain/user, let the postfixadmin do the table creation. The database and super user account can be created earlier.
3. Roundcube web mail; if the user needs to login to his/her account at the first time, make sure '$rcmail_config['auto_create_user'] value is set to 'true'. Other wise it keep displaying the login page.


Thursday, February 17, 2011

Gloomy Day!

What a pathetic! I am so bored with my current job. Gonna start thinking 'bout job hunting. Preferably in server or database administration. Doesn't matter if the pay was unattractive. But I need to buckle up my life! Despair...

Wednesday, February 16, 2011

Active Directory/Domain Controller Recovery Plan

Recently the domain controller (PDC) in my workplace which holds authentication,security,global policy,FSMO roles and operates as DNS server was inevitably crash down. Hence, no replication service on AD objects between PDC and another DC was implemented and set up. The reason we never set up this is because our network was small with less than 200 clients (terrible thinking, what a mistake).

  1. Modification on Default Global policy in order to stop W32.Conficker-A from spreading and threatens company's domain (as a matter of fact, I did this registry mess up to curb with the virus).Network services I.e RPC,Net Logon Workstation,Server had failed to start normally after server reboot.

  2. Constant threat by Virus/malware I.e Conficker on timely basis.

    Impact on Affected Area

    -File and printer sharing across the domain were blocked.

    -Users can't log on into the domain as normal.

    -Temporarily halted the database backup and report viewing thru BI tools (except for SQL database users setting).

Symptoms

  1. Receieved error message: Domain Controller for this domain could not be contacted.

  2. Run dcdiag.exe produced below error message:

Warning: DcGetDcName(TIME_SERVER) call failed, error 1355
A Time Server could not be located.
The server holding the PDC role is down.
Warning: DcGetDcName(GOOD_TIME_SERVER_PREFERRED) call failed, error 1355
A Good Time Server could not be located.
Warning: DcGetDcName(KDC_REQUIRED) call failed, error 1355
A KDC could not be located - All the KDCs are down.
......................... hospitalmetro.com failed test FsmoCheck

  1. Error message when opening GPO,ADSAS, ADUC snap-in where no domain controller was found in the list.

  2. Network services e.g Net Logon,RPC,Workstation,Server etc could not be started.

  3. The NetLogon and SYSVOL share were missing (not shared).

  4. Clients could not use file and printing sharing services across domain.

    Applying Recovery Plan Solution

    Several methods have been identified to curb with Failed Domain Controller. These selected methods significantly relevant to particular symptoms only and do not suitable fo every recovery actions.

    Method 1

    1. Run dcdiag.exe /s:locahost.

    2. Received error message as above.

    3. Try restore the Group Policy Object using dcgpofix.exe /target:[both|domain|dc]

    4. Failed. Result produced error message “dcgpofix could not open AD object LDAP://rootDSE

    5. The cause of the error was caused by the network servcies I.e Net Logon, RPC etc could not being started using Services.msc snap-in or via command prompt.

    Method 2

    1. Restore AD objects using Non-Authoritative or Normal Restore method

    2. This method reinstates AD data to the state before the backup for single domain controller.

    3. Reboot the DC and press F8 to enter into Safe Mode environment.

    4. On the Boot Menu section, select Directory Services Restore Mode

    5. Open NTBackup.exe and perform restore to Original Location.

    6. Restart the server to the Normal Mode.

    7. The NTBackup utility will restore the System State data back to previous setting prior to server crash.

    8. To produce the System State backup, use NTBackup.exe utility and select System State checkbox as what to backup.

    Conclusion

    1. Schedule backup on DC's System State on timely fashion.

    2. Best practice stipulates that the Default Domain and Default DC Group Policy Object should not be modified. Instead, create new GPOs and link them to relevant containers I.e Computers,Users,DC,OU, MSH etc.

    3. Compulsory to have another DC (BDC) (replication services) or create another standby DC with DNS service.

Sunday, February 13, 2011

MYKAD .Net Software Development SDK Package

~ Unlimited used of Dynamic Link Library (DLL) file with source codes.
~Developed guna vb .net 2005 express edition (free download)
~Compiled using .Net Framework 2.0 atau ke atas.
~Sample program with source code juga diberi.
~ Tested on standard USB mykad reader.
~ Sesuai utk student dan novice coders understand COM/DLL development.

Aku bagi sekali dengan utiliti e.g package installer,Smartcard tools etc. Smaple code ni boleh retrieve basic info and photo dari mykad. Berminat? Aku jual dgn harga RM50. delivery akan dibuat guna Email. Sebarang pertanyaan, boleh komen di bawah. TQ

Thursday, February 10, 2011

Setting Mail Server in Ubuntu Server 8.04 using Postfix

~For three days, I have been doing in-depth testing on Ubuntu 8.04's Linux Server to deploy a Mail Server runs on Postfix as SMTP agent, integrates with Courier to provide POP3 and IMAP services, where these services are equipped with authentication packages. This mail service runs on MySQL backend with virtual domain and virtual users creation.
~ To conclude, I managed to deploy it for the client access using web-based email i.e Roundcube.
~ Initially, I have installed LAMP,Bind9 for DNS setup and phpMyAdmin.
~ Finally I managed to send email using Outlook Express which carried more than 20MB in size to other users. (This will also be explained in my next blog later).
~I will explain the installation later on my next writing. See ya!

Thursday, July 30, 2009

The Eagle Has Landed!!!

(...Meminjam petikan dr base crew Apollo II semasa Neil Armstrong jejak kaki ke bulan) Dah lama aku tak masuk blog. Sejak aku kawin dulu sampai la ni puteraku cecah usia 1thn 3bln. Macam2 ranjau idup aku dh lalui.. Byk cabaran yg aku dh tempuhi...Baru aku sedar betapa sia2nya idup aku dulu.. Lalai..
Hmmm..esok aku citer lain...Xda mood la bro!!!

Tuesday, December 19, 2006

First Impression On Earth

Syukur.....aku masih bernyawa.....hampir 2 bulan aku tak tulis dlm blog...Mcm2 yd dh berlaku. Tanggal 25 Dec ni genap sebulan usia perkahwinan aku dgn wife tercinta SIA...wpun aku masih lagi rasa cinta..tp aku berdoa satu hr nanti TUHAN akan buka hati aku utk terima cintanya...

For guys n gals out there especially yg cerewet sgt tuh..hahaahaaahhaaaa...hangpa rugi...tak rasa nikmat anugerah ALLAH utk hambaNya....


So...let strokes!!!!

Saturday, October 21, 2006

Fuhhh...hari ni cukup boring. Orang lain(Kaum muslimin) cuti..aku je ternganga2 kat sini. Lusa nak raya..tapi semangat raya tu takdak...sbb aku ponteng posa lebih dari sepuluh hari. Semuanya gara2 aku kena masuk wad minggu pertama posa sebab mandibel fracture. Jatuh masa main futsal tengah2 malam. Oh jahilnya aku..patutnya malam2 mcm tu aku cari fadilat..

Allah Maha Besar......aku terima dengan redha sebab aku rasakan inilah balasannya atas hambanya yang byk lakukan maksiat. Aku redah walaupun mukaku nampak kemek..mungkin cacat sampai bila2...

Mak aku nampak ceria mulai kelmarin. Mungkin sebab anak yg dia rindui dah balik. Lama jugak adik aku merajuk. Aku gembira sebab sebelum ni mak aku selalu teringat kat dia. Aku tak jeles tapi aku hepi sebab keluarga kami semuanya dpt berkumpul di hari raya ni....

Mak..mak...sementara dia masih hidup ni...aku berazam nak bahagiakan dia walaupun bukan dengan wang ringgit. Aku taknak berkira dengan mak aku..kalau dia tak cukup duit bagi jer..dia nak apa2 beli jer...

Aku tak nak mcm yg terjadi kat member aku..mak dia kena strok..dan masa tulah nak belikan macam2...tak guna sebab dia tak dpt nak menikmati pemberian anaknya tu...

Wahai..anak2 sekalian..ingatla hartamu itu yg tiada gantinya.....

2nd Chance.....

Hmmm..aku agak gelisah ari ni. Why aaa?(meminjam kata-kata sorang staff tempat keja aku). Yelaaaa...aku kan akad nikah 25 nov nie..tp haram seduit pun tarak..Kesian kat mak aku. Salah aku jugak sbb over confident yg loan aku akan approve tapi rupa2nya haraammm...

Dengar cerita bank ni suka tolong org yg nak kawin..islam pulak tu...tapi lain jadinya. Kesian mak aku..sampai merayu kat officer tu dan aku pun buatla surat rayuan..tp tak lulus jgk..alasannya aku byk berhutang walaupun gaji aku cukup syarat.

Ahhhh..aku mula terfikir pasal 2nd chance..mungkin ianya sedang menatiku.....