Description:
We all expect that RAISERROR raises error, but not like this one:
Script:
RAISERROR ('Error', 16, 255 );
Output:
Invalid value 255 for state. Valid range is from 0 to 127
Value for state can be from 0 to 255, according to BOL:
"state
Is an integer from 0 through 255. Negative values or values larger than 255 generate an error.
If the same user-defined error is raised at multiple locations, using a unique state number for each location can help find which section of code is raising the errors."
Solution:
- check SQL Server version (@@VERSION) and if it's 9.0.1399 (Microsoft Sql Server 2005 RTM) it's really time to apply some service pack. SQL 2005 RTM was released on November 7, 2005! ;)
Links:
- http://sqlserverbuilds.blogspot.com/ (list of SQL Server builds)
- http://www.microsoft.com/download/en/details.aspx?id=7218 (Download Microsoft SQL Server 2005 Service Pack 4 RTM)
- http://support.microsoft.com/kb/2507769/ (Cumulative update package 3 for SQL Server 2005 Service Pack 4)
Appendix:
- error in German language version:"Der Wert 255 für den Status ist ungültig. Der gültige Bereich liegt zwischen 1 und 127."
Tuesday 18 October 2011
RAISERROR raises error - not expected behavior on SQL 2005
Tuesday 4 October 2011
Kids don't delete LDF files!
If you have, and no backup etc, read following articles:
try with "CREATE DATABASE name ON fileMDB FOR ATTACH_REBUILD_LOG"
http://social.msdn.microsoft.com/forums/en-US/sqldisasterrecovery/thread/d48bb79b-0403-46d8-abb9-11fff40e7e72/
in case of opened transactions (error:" The protocol can not be rebuilt because there were open on shutdown of database transactions / users that no probe was used for the database or the database was write protected. This error can occur if the transaction log file was manually deleted or lost due to hardware failure or external failure.")
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114812
http://stackoverflow.com/questions/773059/how-to-recover-database-from-mdf-in-sql-server-2005
Uncommited transacions will appear in recovered databases.
try with "CREATE DATABASE name ON fileMDB FOR ATTACH_REBUILD_LOG"
http://social.msdn.microsoft.com/forums/en-US/sqldisasterrecovery/thread/d48bb79b-0403-46d8-abb9-11fff40e7e72/
in case of opened transactions (error:" The protocol can not be rebuilt because there were open on shutdown of database transactions / users that no probe was used for the database or the database was write protected. This error can occur if the transaction log file was manually deleted or lost due to hardware failure or external failure.")
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114812
http://stackoverflow.com/questions/773059/how-to-recover-database-from-mdf-in-sql-server-2005
Uncommited transacions will appear in recovered databases.
Monday 26 September 2011
Running ASP.NET MVC on hosted server without MVC support
1.) Configure "\bin Deployment", more at http://drew-prog.blogspot.com/2011/01/how-to-deploy-aspnet-mvc-3-app-to-web.html
2.) Re-build, publish, browse
3.) When using old IIS 6.0, read following article (404 etc...)
http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/
note-to-my-self :)
2.) Re-build, publish, browse
3.) When using old IIS 6.0, read following article (404 etc...)
http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/
note-to-my-self :)
Thursday 22 September 2011
SQL @@SERVERNAME can return NULL, but it should not
Probably we are all using "@@SERVERNAME" variable for geting SQL Server name and usually it does what we expect.
Today some custom maintenance procedures stoped working. After investigation I've noticed that SELECT @@SERVERNAME returns "NULL".
Background: @@SERVERNAME gets value (at SQL Server boot) from table sys.servers where server_id is equal to 0.
SELECT [name] FROM sys.servers WHERE server_id = 0
in this system table there are also linked servers and "my server" was there with server_id different than zero.
Solution:
EXEC master.dbo.sp_dropserver @server=N'serverName', @droplogins='droplogins'
EXEC sp_addserver 'serverName', LOCAL
and restart server.
Good workaround (probably best practice) is to use function ServerProperty('serverName').
More info at: http://randyjean.blogspot.com/2005/11/sql-servername-can-sometimes-return.html
PS Server is SQL Server 2005 Standard
Today some custom maintenance procedures stoped working. After investigation I've noticed that SELECT @@SERVERNAME returns "NULL".
Background: @@SERVERNAME gets value (at SQL Server boot) from table sys.servers where server_id is equal to 0.
SELECT [name] FROM sys.servers WHERE server_id = 0
in this system table there are also linked servers and "my server" was there with server_id different than zero.
Solution:
EXEC master.dbo.sp_dropserver @server=N'serverName', @droplogins='droplogins'
EXEC sp_addserver 'serverName', LOCAL
and restart server.
Good workaround (probably best practice) is to use function ServerProperty('serverName').
More info at: http://randyjean.blogspot.com/2005/11/sql-servername-can-sometimes-return.html
PS Server is SQL Server 2005 Standard
Sunday 18 September 2011
ASP.NET: Request for the permission of type 'System.Security.Permissions.FileIOPermission
Pri selitvi stare asp.net 2.0 aplikacije, k novemu gostitelju se mi je pojavila naslednja napaka:
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Directory.GetCurrentDirectory()
at System.Security.Cryptography.Xml.Reference.CalculateHashValue(XmlDocument document, CanonicalXmlNodeList refList)
at System.Security.Cryptography.Xml.SignedXml.BuildDigestedReferences()
at System.Security.Cryptography.Xml.SignedXml.ComputeSignature()
at xPortTools.xPortTools3.GenerateLicense(String lcHash, String ProductId, String lcToken, String lcKey, String lcHeader, String lcSupport, String lcWeb, String lcManufacturer, String lcManufacturerEmail, String lcCopyright, String lcDescription, Boolean Demo, DateTime ldActivationDate, String CdKey)
"
Rešitev:
Namesto "System.Web.Configuration.WebConfigurationManager" uporabi "System.Configuration.ConfigurationManager". Strežnik je nastavljen na "medium trust" in preprečuje uporaba "WebConfigurationManger".
Vir:
http://support.jodohost.com/showthread.php?t=11131
Vir:
http://support.jodohost.com/showthread.php?t=11131
Sunday 24 July 2011
VirtualBox 4 - sprememba velikosti diska VDU
Problem:
- zmanjkuje prostora v virtualnem disku
Rešitev:
- VirtualBox verzija 4 podpira razširjanje (resize) VDI datotek, uporabimo ukaz VBoxManage, parametri so naslednji:
- novavelikostvMB (npr. 40000 za slabih 40GB)
- pot do "VBoxMange.exe" se lahko razlikuje
- v trenutni verziji je podprto samo razširjanje diska (expand), zmanjševanje (compact) še ne
- ostane še razširitev diska v operacijskem sistemu
- zmanjkuje prostora v virtualnem disku
Rešitev:
- VirtualBox verzija 4 podpira razširjanje (resize) VDI datotek, uporabimo ukaz VBoxManage, parametri so naslednji:
C:\Program Files\Oracle\VirtualBox VBoxManage modifyhd "polna pot do\ime.vdi" --resize novavelikostvMB
- novavelikostvMB (npr. 40000 za slabih 40GB)
- pot do "VBoxMange.exe" se lahko razlikuje
- v trenutni verziji je podprto samo razširjanje diska (expand), zmanjševanje (compact) še ne
- ostane še razširitev diska v operacijskem sistemu
Thursday 21 July 2011
Zelo počasno odpiranje Excel datotek iz omrežja (mrežnega diska)
Simptomi:
Vzrok:
Rešitev:
- skušamo odpreti Excel (2003) datoteko iz mrežnega diska (npr. F:), dolgo časa se ne zgodi nič, kaže, da je Excel že zamrznil, nato pa se le končno odpre, pred nekaj dnevi je vse delovalo OK
- datoteko iz mrežnega diska skopiramo na lokalni disk (npr. c:), tam se odpre brez zakasnitve
Vzrok:
- pred kratkim je bil naložen popravek "Office File Validation Add-in"
Rešitev:
- izklop preko navodil članka 2570623, klik na mojstra "FixIT"
- v tem članku se nahaja tudi registerski ključ za izklop (primerzno namestitev, preko skripte, na več računalnikov)
Friday 1 July 2011
DELL MD3000 in MD3000i - dodajanje novega diska v logični nosilec (extend volume)
V obstoječem diskovnem polju tipa DELL MD3000 (3000i) želimo povečati kapaciteto, postopek je naslednji:
- dodamo fizični disk v polje, ko polje zazna nov disk, se le ta pojavi med "Physical Disks"
- preko programa "Dell Modular Disk Storage Manager", izberemo "Modify", "Add Free Capacity (Physical Disks), postopek je časovno potraten (navadno nekaj ur)
V Dell Storage Managmentu ni opcije za razširitev virtualnega diska, "Expand Logical Disk", zato uporabimo program v ukazni vrstici "smcli.exe"
Navadno se nahaja v mapi:
\Program Files\Dell\MD Storage Manager\Cli ali
\Program Files (x86)\Dell\MD Storage Manager\client (64bit okolje)
Sintaksa je naslednja:
smcli ArrayName -c "set virtualDisk ["virtualdiskname"] addCapacity=virtualdiskcapacityinbytes;"
Ostane samo še razširitev logičnega diska na nivoju OSa (extend volume).
Celotni postopek je načeloma neboleč (obstoječi podatki ostanejo nedotaknjeni), ampak varnostna opija pred prvim korakom je nujna.
- dodamo fizični disk v polje, ko polje zazna nov disk, se le ta pojavi med "Physical Disks"
- preko programa "Dell Modular Disk Storage Manager", izberemo "Modify", "Add Free Capacity (Physical Disks), postopek je časovno potraten (navadno nekaj ur)
V Dell Storage Managmentu ni opcije za razširitev virtualnega diska, "Expand Logical Disk", zato uporabimo program v ukazni vrstici "smcli.exe"
Navadno se nahaja v mapi:
\Program Files\Dell\MD Storage Manager\Cli ali
\Program Files (x86)\Dell\MD Storage Manager\client (64bit okolje)
Sintaksa je naslednja:
smcli ArrayName -c "set virtualDisk ["virtualdiskname"] addCapacity=virtualdiskcapacityinbytes;"
Ostane samo še razširitev logičnega diska na nivoju OSa (extend volume).
Celotni postopek je načeloma neboleč (obstoječi podatki ostanejo nedotaknjeni), ampak varnostna opija pred prvim korakom je nujna.
Thursday 30 June 2011
SharePoint 2010 - Error 403
Tehnika:
- SharePoint 2010 Foundation (velja tudi za ostale edicije)
Opis:
- uporabnik (doman user) skuša dostopati do neke vsebine npr: http://intranet/SitePages/nekastran.aspx
- Brskalnik javi napako "Error 403"
- administrator stran odpre brez težav (status 200), za tem tudi navadni uporabnik lahko odpre omenjeno stran (status 200)
- po zaustavitvi aplikacije (iisreset, recycle, ponovni zagon strežnika...) se težava zopet ponovi
Možna rešitev:
- uporabnik (npr. domain users skupina) nima pravic na \bin mapi, dodamo pravice in težave izgine :)
Kaj smo se še naučili?
- nikoli ne pusti razvijalcev na strežnik :)
Tuesday 14 June 2011
The object SPBackupRestoreConfigurationSetting
Izvajanje backupa javi naslednjo napako:
Napako reši naslednji poseg:
- zaustavitev "Windows SharePoint Services Timer"
- brisanje vseh datoek v mapi %ALLUSERSPROFILE%\Application Data\Microsoft\SharePoint\Config\
An update conflict has occurred, and you must re-try this action.
The object SPBackupRestoreConfigurationSettings Parent=SPFarm Name=SharePoint_Config is being
updated by Domain\User, in the STSADM process, on machine SERVER.
View the tracing log for more information about the conflict.
Napako reši naslednji poseg:
- zaustavitev "Windows SharePoint Services Timer"
- brisanje vseh datoek v mapi %ALLUSERSPROFILE%\Application Data\Microsoft\SharePoint\Config\
- ponovni zagon "Windows SharePoint Services Timer"
- in zagon backup
Tuesday 8 March 2011
Gmail - ne dostavi pošte na vse računalnike preko POP3 vmesnika
V primeru, da gmail (velja za navadni gmail in google apps) pošto prebirate z bralnikom pošte (npr. Outlook) na več napravah in vključite opcijo "pusti na strežniku" (leave on server) opazite, da se pošta prikazuje po sistemu "prvi pride, prvi bere". Skratka vseh sporočil ni na vseh računalnikih.
Potrebno je vklučiti t.i. "recent mode". Kako? Pred uporabniško ime dodaš "recent:", tako, da zadeva izgleda "recent:username@gmail.com".
Za več informacij preberi Using POP on multiple clients or mobile devices.
PS Morda je smiselno uporabljati IMAP protokol in še, kdo hudiča ne uporablja web dostopa? :)
PSS Prenašajo se tudi "poslana" (send) sporočila, nastavimo pravilo. ;)
Potrebno je vklučiti t.i. "recent mode". Kako? Pred uporabniško ime dodaš "recent:", tako, da zadeva izgleda "recent:username@gmail.com".
Za več informacij preberi Using POP on multiple clients or mobile devices.
PS Morda je smiselno uporabljati IMAP protokol in še, kdo hudiča ne uporablja web dostopa? :)
PSS Prenašajo se tudi "poslana" (send) sporočila, nastavimo pravilo. ;)
Wednesday 19 January 2011
Windows Server 2008 Hyper-V parent in 2008 R2 guest
Pri omenjeni konfiguraciji se v dnevniku pojavijo napake:
Description: A storage device in cannot load because it is incompatible with the server virtualization stack. Server version 2.0 Client version 4.2
Log Name: System
Source: VMSMP
Event ID: 26
Level: Error
Computer: 2008SRV.contoso.com
Description: NIC driver on '2008R2-Guest' cannot load because it is incompatible with the server virtualization stack. Server version 2 Client version 196610 (VMID 9A5FAAC3-1F7A-442D-9525-46B39ACE22DB).
O primeru govori članek http://support.microsoft.com/kb/972108.
Povzetek: sporočila lahko ignoriramo parent in chield se naknadno dogovorita za pravo verzija protokola.
Možen je tudi obraten primer. Hyper-V strežnik R2 in guest npr. 2008, primer sporočila:
A storage device in 'Demo_2003SRV' loaded but has a different version from the server.
Server version 4.2 Client version 2.0 (Virtual machine ID 9A5FAAC3-1F7A-442D-9525-46B39ACE22DB).
The device will work, but this is an unsupported configuration.
This means that technical support will not be provided until this problem is resolved.
To fix this problem, upgrade the integration services.
To upgrade, connect to the virtual machine and select Insert Integration Services Setup Disk from the Action menu.
Rešitev: Nadgradnja Integration komponente
Description: A storage device in cannot load because it is incompatible with the server virtualization stack. Server version 2.0 Client version 4.2
Log Name: System
Source: VMSMP
Event ID: 26
Level: Error
Computer: 2008SRV.contoso.com
Description: NIC driver on '2008R2-Guest' cannot load because it is incompatible with the server virtualization stack. Server version 2 Client version 196610 (VMID 9A5FAAC3-1F7A-442D-9525-46B39ACE22DB).
O primeru govori članek http://support.microsoft.com/kb/972108.
Povzetek: sporočila lahko ignoriramo parent in chield se naknadno dogovorita za pravo verzija protokola.
Možen je tudi obraten primer. Hyper-V strežnik R2 in guest npr. 2008, primer sporočila:
A storage device in 'Demo_2003SRV' loaded but has a different version from the server.
Server version 4.2 Client version 2.0 (Virtual machine ID 9A5FAAC3-1F7A-442D-9525-46B39ACE22DB).
The device will work, but this is an unsupported configuration.
This means that technical support will not be provided until this problem is resolved.
To fix this problem, upgrade the integration services.
To upgrade, connect to the virtual machine and select Insert Integration Services Setup Disk from the Action menu.
Rešitev: Nadgradnja Integration komponente
Monday 10 January 2011
Ukazna vrstica - kako pridobiti datum (command prompt date)
Prastaro orodje za samodejno administriranje "ukazne skripte" (batch fajli, command fajli), ki izhajajo še iz časa DOS-a.
Primer, kako pridobimo datum v spremenljivke in ga nato uporabimo npr. za sestavo imena log datoteke, ki nosi datum izvedbve:
@for /f "tokens=4 delims=. " %%c in ('date /T') do set YYYY=%%c
@for /f "tokens=3 delims=. " %%d in ('date /T') do set MM=%%d
@for /f "tokens=2 delims=. " %%e in ('date /T') do set DD=%%e
@ECHO %YYYY%-%MM%-%DD%
@Set LogFile=\Backup%YYYY%-%MM%-%DD%.TXT
robocopy .... >%LogFile%
Dnevnik bi v tem primeru pisali v datoteko z imenom "Backup2011-01-10.TXT".
Primer, kako pridobimo datum v spremenljivke in ga nato uporabimo npr. za sestavo imena log datoteke, ki nosi datum izvedbve:
@for /f "tokens=4 delims=. " %%c in ('date /T') do set YYYY=%%c
@for /f "tokens=3 delims=. " %%d in ('date /T') do set MM=%%d
@for /f "tokens=2 delims=. " %%e in ('date /T') do set DD=%%e
@ECHO %YYYY%-%MM%-%DD%
@Set LogFile=\Backup%YYYY%-%MM%-%DD%.TXT
robocopy .... >%LogFile%
Dnevnik bi v tem primeru pisali v datoteko z imenom "Backup2011-01-10.TXT".
Subscribe to:
Posts (Atom)