Random

Just another weblog.

Monday, February 22, 2010

mercury rev vs. coldplay

listen to the scientist (2002) by coldplay and listen to the dark is rising by mercury rev. (2002) interesting

posted by sam at 1:55 pm  

Monday, January 4, 2010

Group Policy mgmt won’t open on a 64bit machine?

copy, not move, gpedit.msc into C:\WINDOWS\SysWOW64

posted by sam at 9:27 am  

Wednesday, December 30, 2009

sql server builds

http://sqlserverbuilds.blogspot.com/

posted by sam at 1:12 pm  

Wednesday, December 30, 2009

SQL missing tools

lame lame, but it happens, fix run SqlRun_Tools.msi directly, otherwise the installer won’t reinstall the tools cause it is there. don’t bother trying to rename the 90 folder, that messes things up.

posted by sam at 12:59 pm  

Thursday, December 24, 2009

SQL contd..

So  never delete the c:\windows\installer directory or its contents, you’ll learn how unsuccessful you’ll be at installing a SQL service pack.

See for yourself if your SQL installation is bad, try the SP reinstall and sections will fail due to missing packages. 

HAve maintenance plan failures when creating a new plan?  Invalid column name ‘from_msx’.
Invalid column name ‘has_targets’. (Microsoft SQL Server, Error: 207)

SELECT SERVERPROPERTY(‘ResourceVersion’) as ResourceDB, SERVERPROPERTY(‘ResourceLastUpdateDateTime’) as ResourceDBLastUpdate,

SERVERPROPERTY(‘ProductVersion’) as Ver, SERVERPROPERTY (‘ProductLevel’) as SP;

GO

If your results show a Resource DB version that is different than your SQL Version, then you have a messed up install, probably due to the SP not installing correctly.  Ensure you have your windows\installer directory,  luckily I saved mine to another drive in case I needed it again.  Also check to make sure your permissions are right on where your SQL DBs are at.  Make sure your SQL local groups contain the correct user for which the SQL AGent and server are running as.

Keep your other sys db’s with Master!
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME=data, FILENAME= “R:\sqldata\mssqlsystemresource.mdf”)
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME=log, FILENAME= “S:\sqldata\mssqlsystemresource.ldf”)

posted by sam at 5:38 pm  

Monday, December 14, 2009

Great SQL commands that I live by

Moving a log:

backup the database
shrink the logfile
use sp_detach_db to detach the database
move the logfile to the new drive
use sp_attach_db to reattach the db

Reducing a transaction log that is already in simple mode:

USE DatabaseName
GO
DBCC SHRINKFILE(, 1)
BACKUP LOG WITH TRUNCATE_ONLY
DBCC SHRINKFILE(, 1)
GO

note: if your db has hyphens (-), you need to use  ‘  or you need to use ” depending on command

EXAMPLE:

USE “DB-WITH-019503950-HYPHENS”
GO
DBCC SHRINKFILE(“DB-WITH-019503950-HYPHENS_LOG”, 1)
BACKUP LOG “DB-WITH-019503950-HYPHENS” WITH TRUNCATE_ONLY
DBCC SHRINKFILE(‘DB-WITH-019503950-HYPHENS’ 1)
GO

 

Moving Sys DBs and Logs

NOTE YOUR TARGET DIR FOR NEW SQL SYS DB’S should match the security for NTFS, ie, you need the sqluser group from the local machine added with full control or your startup param will be denied access to the new directory!

start SQL Server together with the -c option, the -m option, and trace flag 3608

In SQL Server Enterprise Manager, right-click the server name, and then click Properties.
On the General tab, click Startup Parameters.
Add the following new parameter:
;–c-m-T3608 at the END of the text

make sure agent is shutdown prior to this and also close out of any connections to the DB, or you will get access denied no matter what ID you use

In 2005,  use SQL Server configuration Manager, choose SQL 2005 Services, click on Advanced, scroll down to startup parameters,

select “Startup Properties” and the following window will pop up

separate entries with a semicolon, so your first entry now is your switch to start in single user mode, quickly and with trace flag 3608:

;–c-m-T3608 at the END of the text

stop and restart SQL, make sure sqlagent is shutdown, check event log for 17658 event ID for the sql server starting in single user mode

 if this fails, use the net stop mssqlserver

NET START MSSQLSERVER /c /m /T3608

after this launch the mgmt console and make sure you close object explorer or you’ll get an error about how many users can login

“SQL SERVER is in SINGLE USER MODE and only one administrator can connect”
By default the object explorer is open and it is considered as one connection so if you click new query it is considered as second connection and hence you get the error. Inorder to avoid the error you need to click the disconnect button in the object explorer pane and then close the object explorer window.Now you could see this window as “No Server Connection”,

choose file/close object explorer

 if you did that and still happens, then you need to ensure that all odbc connections on sql ports are shut down, check your other servers and make sure they  aren’t connecting to the server

Edit the Startup Parameters values to point to the planned location for the master database data and log files, and click OK. Moving the error log file is optional.
The parameter value for the data file must follow the -d parameter and the value for the log file must follow the -l parameter. The following example shows the parameter values for the default location of the master data and log files.

If the planned relocation for the master data and  and S for log files the parameter values would be changed as follows:

-dR:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf;-eF:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG;-lS:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf

  • Stop the instance of SQL Server by right-clicking the instance name and choosing Stop.
  • Move the master.mdf and mastlog.ldf files to the new location.
  • Restart the instance of SQL Server.
  • Verify the file change for the master database by running the following query.
  • SELECT name, physical_name AS CurrentLocation, state_desc
    FROM sys.master_files
    WHERE database_id = DB_ID(‘master’);
    GO
  • Stop and then restart SQL Server.
    Detach the model database by using the following commands:

    use master
    go
    sp_detach_db ‘model’
    go

    Move the Model.mdf and Modellog.ldf files from the default folder to the new folder path.
    Reattach the model database by using the following commands:

    SP_DETACH_DB ‘MSDB’
    GO
    SP_DETACH_DB ‘MODEL’
    GO

    sp_attach_db model, ‘E:\Sqldata\model.mdf’,’E:\Sqldata\modellog.ldf’
    sp_attach_db msdb, ‘E:\Sqldata\msdbdata.mdf’,’E:\Sqldata\msdblog.ldf’

    don’t copy and paste from here, type it out or it won’t translate

    Remove -c -m -T3608 from the startup parameters in SQL Server Enterprise Manager or in SQL Server Configuration Manager.
    Stop and then restart SQL Server. You can verify the change in file locations by using the sp_helpfile stored procedure.

    use model
    go
    sp_helpfile
    go

    all others refer to http://support.microsoft.com/kb/224071

     

     

    MOVING TEMPDB

    use

    master
    goAlter 
     
    database tempdb modify file (name = templog, filename = ’s:\Sqldata\templog.ldf
    go
     Alter
    filename = ’s:\Sqldata\templog.ldf
    go
     Alter
    database tempdb
     
    *** errors in event log after msdb move, even after a full recreate and a move again:
    stop sql agent then ALTER DATABASE [msdb] SET ENABLE_BROKER;
    _____________________________________________________________________________________-
     
     
    <

    posted by sam at 9:44 am  

    Monday, November 30, 2009

    In Visual Studio, editing a connection, you cannot acquire a managed connectionf rom the run-time connection manager

    New ADO.NET connection”, “New”, then from the .Net provider drop down list, choose Odbc data provider, then provide your connection information (either choose from your existing ODBC source, or provide your connection string as DSN=…)

    posted by sam at 1:29 pm  

    Wednesday, November 18, 2009

    Enabling terminal services on a remote computer

    regedit, connect to remote registry

    KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

    locate a REG_DWORD value named fDenyTSConnection. Double-click on fDenyTSConnection and change the value data from 1 (Remote Desktop disabled) to 0 (Remote Desktop enabled).

    posted by sam at 9:44 pm  

    Thursday, October 8, 2009

    asp.net registration with iis

    it helps to know this

    to register ASP.NET:

    Open Command Prompt.
    Change directory as follows:
    For 32-bit machines change to:
    \Microsoft.NET\Framework\\
    For 64-bit machines change to:
    \
    Run the command ‘aspnet_regiis.exe -i’ and press enter.

    posted by sam at 3:24 pm  

    Saturday, October 3, 2009

    UNIX and OS X permissions

    So I tried Unix Service for Windows. Installed it on XP Pro, not sure if you can use this on home edition w/o a reg hack. Once I got it installed I set up a folder to share using the standard folder properties. I had to reboot after installing the software so that the tab would show up.

    It took me hours to figure this out but what I had set wrong was the Anonymous UID and GID was set to a “-2″ I checked on my /etc/passwd file on my os X box and -2 mapped to nobody and as an unprivileged user. That was not good. So I set anonymous GID on the xp box to 0, 0 is what is set to root.

    Voila, I was able to mount the share from os x into windows XP using NFS with full control. Don’t forget the account “ANONYMOUS LOGON” which needs to be added to the “Security” tab of the fileshare on the xp side.

    posted by sam at 8:06 pm  
    Next Page »