Defrag SharePoint with SQL Server Express

If you are using SharePoint 3.0 with Service Pack 2, Microsoft article 943345 says that defrag occurs automatically – so long as you have the full edition of SQL Server 2005.

If you are using SQL Server Express Edition (SSEE), you can use the script given in that article – but you need to adjust it slightly.

SSEE won’t do an online defrag, so the script needs to be changed to always perform an offline defrag. You also need to find out the name of your content database and include that at the start of the script.

Now all you need to do is take your content database offline (you do that from the Applications Management page in your SharePoint website), and run the script.

The SQL script below is a copy of Microsoft’s script with slight modifications to make it work on SSEE.

use WSS_Content_Database;

    SET NOCOUNT ON
    DECLARE @objectid int
    DECLARE @indexid int
    DECLARE @command varchar(8000)
    DECLARE @baseCommand varchar(8000)
    DECLARE @schemaname sysname
    DECLARE @objectname sysname
    DECLARE @indexname sysname
    DECLARE @currentDdbId int
    SELECT @currentDdbId = DB_ID()

    PRINT CONVERT(nvarchar, GETDATE(), 126) + ': Starting'

    -- Loop over each of the indices
    DECLARE indexesToDefrag CURSOR FOR 
    SELECT 
        i.object_id, 
        i.index_id, 
        i.name
    FROM 
        sys.indexes AS i
    INNER JOIN 
        sys.objects AS o
    ON
        i.object_id = o.object_id
    WHERE 
        i.index_id > 0 AND
        o.type = 'U'

    OPEN indexesToDefrag
    -- Loop through the partitions.
    FETCH NEXT
    FROM
        indexesToDefrag
    INTO 
        @objectid, 
        @indexid,
        @indexname
    WHILE @@FETCH_STATUS = 0
    BEGIN
        -- Lookup the name of the index
        SELECT 
            @schemaname = s.name
        FROM 
            sys.objects AS o
        JOIN 
            sys.schemas AS s
        ON
            s.schema_id = o.schema_id
        WHERE
            o.object_id = @objectid

        PRINT CONVERT(nvarchar, GETDATE(), 126) + ': ' + @schemaname + '.' + @indexname + ' is now being rebuilt.'

        -- Fragmentation is bad enough that it will be more efficient to rebuild the index
        SELECT @baseCommand = 
            ' ALTER INDEX ' + 
                @indexname +
            ' ON ' + 
                @schemaname + '.' + object_name(@objectid) + 
            ' REBUILD WITH (FILLFACTOR = 80, ONLINE = '

        -- Use dynamic sql so this compiles in SQL 2000
        SELECT @command =
               @baseCommand + 'OFF) '

        PRINT CONVERT(nvarchar, GETDATE(), 126) + ': Rebuilding'
        EXEC (@command)
        PRINT CONVERT(nvarchar, GETDATE(), 126) + ': Done'

        FETCH NEXT FROM indexesToDefrag INTO @objectid, @indexid, @indexname
    END
    CLOSE indexesToDefrag
    DEALLOCATE indexesToDefrag
Posted in SharePoint | Tagged , , , | 4 Comments

Free Up Space on Your Eee-PC – Automated Method

Due to a bit of interest in my earlier post on freeing up space on your Eee-PC C drive, I have created a little batch file that automates the process of safely moving your c:\windows\installer folder to another drive.  Use this on Windows XP Pro or Home versions, but don’t use it on Vista as described – things are different on Vista.

This procedure carries some risk, so please read everything carefully.

Before carrying out this procedure, make sure you have done all the easy things first, like disabling your hibernation file, turning off Windows Restore Points, and generally just following any other easy tips you can find. If you still want to free up more space on your C drive, please follow this procedure.

  1. Backup your computer.
  2. Turn off Windows Updates for now (so that the Installer folder does not come in to use while you are working with it).
  3. Download Junction 1.05
  4. Extract and copy junction.exe to c:\windows\system32.
  5. Download the curiously-named SubInACL.
  6. Install SubInACL in its default location.
  7. Download move_win_installer_folder.bat and save it somewhere (like your desktop).
    • By default, your Windows Installer Folder will be moved to your D drive.  If you want, you can edit the batch file and change the d:\junctions part of the line that says set target=d:\junctions. Whatever folder you set here, a sub-folder called installer will be created within it.  The folder does not have to exist already.
  8. Double click on the move_win_installer_folder.bat file to run it.  Note: You may be asked to accept the licence agreement for Junction after you start the batch file.
  9. That’s it!  The batch file will show you the results of its operations.
  10. Turn Windows Updates back on.

If you are technically minded and want to know what the batch file does, see my earlier post which describes the steps that can be carried out manually.

The batch file looks like this…



								
Posted in Windows | Tagged , | 3 Comments

MyNetFone’s Virtual PBX In Review

Overview

MyNetFone’s Virtual PBX offers a good VoIP solution for small offices that don’t want to maintain their own PBX onsite.  This review is based on my real-world experience with it to date.

Extensions, Trunks, and In-Dial Numbers

Each physical phone in your office represents an extension, and each active conversation represents a trunk.  Multiple external callers can call a singular in-dial number at once.  Each incoming or outgoing call will consume one trunk. Internal office calls are free but still consume a trunk.

The number of extensions, trunks, and in-dial numbers can vary independently.  For example, your office could have one in-dial number, two trunks, and four extensions.  In this case, two callers could call your single phone number at the same time and be forwarded through to two of your extensions.  A third caller would not be able to call, however, because that would require an extra trunk.

Pay Per Trunk

The beauty of the MyNetFone Virtual PBX is that you only pay a monthly fee based on the number of trunks you require, rather than on the number of extensions.  You must buy the actual phones from MyNetFone, and they are locked.

Trunk Consumption

With MyNetFone Virtual PBX you subscribe to two or more trunks on a monthly basis.  You might think that with two trunks you would be able to have two conversations going at once, but this is not always the case.  When an incoming call causes one of your phones to ring, that consumes a trunk – even before the phone is picked up.  This means that if one conversation is taking place, and one phone is ringing, no one else will be able to make a phone call – incoming or outgoing.

This is fair enough, but the trouble I have encountered is that the MyNetFone Virtual PBX does not support Group Pickup.  Group Pickup is a feature whereby if your colleagues’ phone is ringing and he is away from his desk, you can answer the call from your own phone just by pressing the group pick-up button.  Since this feature is currently not available, you may workaround it by using Call Groups.  With Call Groups, any number of phones can be assigned to one incoming number.  When the incoming number rings, all the phones in the group ring.

But each ringing phone costs a trunk.

Therefore, the pay by trunk scheme works best if Group Pickup is not essential for you, or if you still find it good value to pay for enough trunks to emulate it with Call Groups.  Or perhaps, MyNetFone might agree to a compromise solution if you ask them.

Some Problems

I have experienced, on a few occasions, a problem where an an external caller is informed that the in-dial number is not connected.  If the caller tries again, the call then succeeds.  In addition, the voicemail to email feature has stopped working, although the voicemails can still be collected by phone.  This latter feature is not of great concern, but the former is.  If the problems can be ironed out, the MyNetFone Virtual PBX will prove to be a worthy choice for small business.

Posted in VoIP | Tagged , , | 2 Comments

Best and Safest Way to Self-Hosted Mail

Connecting Outlook to an Exchange Server is great.  Not only is your mail synchronised on all your devices, but so are your contacts, calendars, and tasks.

For small numbers of staff, it may be cheaper and wiser to have your Exchange server hosted by someone else, but as your staff numbers grow it can become cheaper and faster to host Exchange yourself.

When you host your own mail server (Exchange or otherwise), you need to allow anyone to send mail directly to your server over your (probably ADSL or cable) internet connection.  This presents a problem.  If some rogue computer starts flooding you with email, your internet connection can become swamped, causing problems for your business – especially if you’re using VoIP.

A good solution is to have your public-facing mail server hosted by someone else.  Then this mail server can scan all your mail for viruses before forwarding it to your own mail server at your office.  You can set your firewall to only expose your office mail server to your external mail server, thus preventing the world from being able to access your mail server directly.  Furthermore, the external server can store and forward your mail should your own server, internet connection, or power fail.

The well-known DNS hosting company DynDNS offer a mail relaying service, called MailHop Relay, and it’s very good value.  I have found it to be perfectly reliable with only two minor complaints.  Firstly, incoming attachments are limited to 10 MB.  This is quite quite justifiable for a number of reasons, especially given the price of the service offered, but is none the less seen as a drawback by users.  Secondly, DynDNS offer an elegant control panel enabling various virus and spam blocking services to be enabled or disabled.  Unfortunately, the “Reverse DNS” test – which is a highly effective spam-blocking mechanism – is not respected by the “whitelist” feature.  Therefore, if you ever have a single valid sender fail the Reverse DNS test (which is inevitable really), then you cannot whitelist them and therefore are forced to disable the Reverse DNS test and allow through some of the spam which would otherwise have been caught.  I have pleaded with DynDNS to correct this feature, and although they were responsive, they were unwilling or unable to make this change.  (In fact, they tried to argue that it makes sense the way it is).

But those two minor drawbacks aside, DynDNS’ MailHop relay is otherwise excellent.  It is much better to have your mail filtered by an external server and stored on your behalf should your own server become unavailable, and it also reduces the potential for flooding of your internet connection and internal mail server as well.

Posted in Mail | Tagged , , , | 2 Comments

How to Allocate Channels with Multiple Wireless Access Points

If you are trying to cover a large area with more than one wireless access point, follow these rules to maximise wireless performance and coverage.

  1. Use the same SSID (wireless network name) and password on each access point.  Your wireless clients will automatically connect to the strongest AP and will (eventually) switch over to the other ones as you roam around.  (If your wireless clients can still get a reasonable signal – say two bars or more – they will tend to stick with the same access point though).
  2. Allocate each access point a different channel.  This is the key to reducing interference between the access points and thus allowing maximum throughput and range coverage for each one.
  3. Only use channels 1, 6, and 11 as all the others overlap to some extent.  If you have more than three access points, re-use these three channels keeping same-channel access points as far apart as possible.

As an example - if you have three wireless access points, each should have identical settings for SSID (network name) and password, and each should be using a different channel: 1, 6, and 11.

Posted in Wireless Networking | Tagged , | 1 Comment

Free Up Space on your Eee PC C Drive

If you have a small C drive that’s getting too full, you can move your c:\windows\Installer folder over to another drive to free up a large chunk of space, perhaps in the order of a gigabyte.

Moving the Windows Installer folder can potentially ruin your Windows installation. Please follow the instructions carefully.

You should start by creating a full backup of your computer. If you make a mistake, Windows may delete your Installer folder, rendering certain future installs and updates impossible.

I should also point out that I have only tested this procedure under Windows XP SP3.  Furthermore, there are lower-risk ways to free up space on your netbook C drive which you should do first -notably disabling and removing the hibernation and page files.

Edit: I have now created a batch file to automate the process.  Please see the Automated Method.

The overview of the procedure is as follows:

  1. Copy the c:\windows\Installer folder to another drive.
  2. Delete c:\windows\Installer.
  3. Create an NTFS Junction Point to make the Installer folder appear to be where it usually is.
  4. Set the permissions on the Junction Point and the new folder exactly right so that Windows doesn’t delete them both.

Here are the detailed steps…

  1. Backup your computer.
  2. Turn off Windows Updates (so that the Installer folder does not come in to use while you are working with it).
  3. Download Junction 1.05.  Extract and copy junction.exe to c:\windows\system32 for easy access from the command line.
  4. Copy the c:\windows\Installer folder to its new home on another drive, preserving file attributes and permissions.  I’m using d:\junctions\Installer.
  5. Make an additional copy of your Installer folder somewhere else, as a backup.
  6. On your new Installer folder (d:\junctions\Installer), set the permissions precisely as follows: 
    • Remove inherited permissions.
    • Give local administrators (the group) and system full control.
    • Give everyone read-only access.
    • Remove all other users.
    • Set ownership to the local administrators group.
    • No attributes (e.g. system, hidden, etc.) are required.
  7. Delete the c:\windows\Installer folder completely.
  8. Create a Junction Point using junction.exe that you downloaded earlier
    • junction c:\windows\Installer d:\junctions\Installer
  9. You can use dir /AL within the c:\windows folder to see your junction point shown as such.
  10. Open Windows Explorer and browse to your junction point at c:\windows\Installer.  You should see all the files stored in your target folder.
  11. When you use Explorer to set the folder permissions on c:\windows\Installer, you are setting the permission for the junction point itself.  Set them on the junction point as you did before for the target folder…
    • Remove inherited permissions.
    • Give local administrators (the group) and system full control.
    • Give everyone read-only access.
    • Remove all other users.
    • Set ownership to the local administrators group.
    • No attributes (e.g. system, hidden, etc.) are required.
  12. That’s it!  Now review your permission settings for c:\windows\Installer and d:\windows\Installer and ensure they are exactly as described.
  13. Turn Windows Updates back on, if that’s how you normally have them.
  14. Reboot your machine for certainty that no process anywhere is somehow caching some information about the way the Installer folder was before.
  15. Test that your changes don’t get overwritten by Windows.
 

Testing

The risk with this procedure, as mentioned before, is that if you haven’t set the permissions exactly right, Windows destroys your Installer folder and creates a new one with the right settings.  The point at which this happens appears to be the next time that the Installer folder needs to be accessed.  To test that this isn’t going to happen to you, you need to perform some install / uninstall / repair type operations using installers that actually utilise Windows Installer technology at this level.  Office 2007 is one example.  See if you can add or remove a component from Office or some other application and check that your junction point and target folder still exist afterwards.

Posted in Windows | Tagged , | 1 Comment
Prism IT Sydney | 0432 840 712