Archive for the ‘SharePoint’ Category

Oracle 10g trumps SQL Express in table to table update (Part Duex)

Thursday, August 26th, 2010

It’s been a week of pondering since my last post on the 650k row table to table update.  After a bunch of suggestions SQL Express finally met it’s match in Oracle.  Below is the code for the same update using the Oracle MERGE functionality.  To me it looks like the equivalent of the SQL Server join-update functionality.  The statement executes in under 40 seconds with indexes on both the tag and index fields for both tables.

MERGE into FUNCTIONAL_POINT F
USING
(
select L.FL, L.TAG FROM LOCATION L
INNER JOIN FUNCTIONAL_POINT FP
ON FP.TAG=L.TAG
) L
ON ( F.TAG = L.TAG )
WHEN MATCHED THEN UPDATE SET F.FL = L.FL
WHEN NOT MATCHED THEN INSERT ( F.FL ) VALUES ( L.FL );
--NOT MATCHED is never hit, but required for merge statement

The only caveat is that the join must be on a unique field and produce only one result (thus one unique FL per TAG in the above case).

Granted it may take you a few seconds longer to write and add the table indexes I think it is absolutly worth it.  Thanks for my bro for persisting with options to try on Oracle.

SQL Server Express 2008 trumps Oracle 10g in table to table update

Thursday, August 19th, 2010

I’m probably going to get flamed for this one, but I just had to tell someone. I recently had to update an Oracle 10g table field value from another table using a common (inner joinable) field.  Both tables contains 650,000 odd records.  Coming from an MS background I thought it would be easy doing a “join update”. Now I’m the first to admin I’m no Oracle expert, so I did a bit of Googling.  Unfortunately I could not find equivalent functionality for Oracle, just Oracle user posts telling SQL Server type guys you can’t do that, it’s not SQL Server, you have to use … (see Oracle syntax below) – which seemed to me a very inefficient way to update a field.

So I ran this on our Oracle 10g development server:

UPDATE FUNCTIONAL_POINT F SET FL=
(SELECT FL FROM LOCATION WHERE TAG=F.TAG)

After 43 minutes I cancelled the query, exported both tables to my desktop SQL Express 2008 and ran this:

UPDATE FP SET FP.FL=F.FL
FROM FUNCTIONAL_POINT FP
INNER JOIN LOCATION F
ON F.TAG=FP.TAG

After 40 seconds I had updated my 650,000+ records with the value from the other table. Note I did not set up any indexes or done any optimizations.  I re-imported the table to Oracle, all done in around 5 minutes.

Maybe there is a thousand ways to get this done on Oracle as fast that I don’t know of, but coming from an MS background and always being told of the power of Oracle I was very amused.  Now flame away!

Setting SharePoint Email Frequency

Tuesday, September 15th, 2009

Sometimes, especially when you’re a developer, you need to speed up (or slow down) the frequency at which SharePoint checks and sends email. This can be done by using the stsadm tool from the command line. You can check the current frequency by issuing this command:

stsadm -o getproperty -pn job-immediate-alerts -url http://your_sp_site

This will return a value of something like “every 5 minutes between 0 and 59″ which means it’s checked every five minutes.

To adjust the interval for example to 3 minutes, you can issue the following command:

stsadm -o setproperty -pn job-immediate-alerts -url http://your_sp_site -pv "every 3 minutes"

I find it usefull especially when I’m testing email related workflows to set the interval down to 1 minute.  In a production environment this may be a bit intense and depending on the criticality of your SharePoint installation you may even want to set it as low as every 10 minutes.

Custom workflow: Failed on Start (retrying)

Wednesday, September 9th, 2009

I needed to check ut custom workflows for SharePoint so I created a custom MOSS 2007 workflow in Visual Studio 2008 using the SharePoint Sequential Workflow template.  I loosely followed the steps from Phil Wicklunds blog post, obviously adapting it slightly for my needs.  Upon running the workflow I got the (typical) cryptic error for the list item’s workflow “Failed on Start (retrying)“.

So I decided to follow the instructions in the post to the letter.  It worked perfectly! So I tried again to create on of my own, referring back to the instructions and what do you know? Same error again! After a lot of time spent tweaking, changing building deploying, testing deleting list items etc. I found the problem(s).

When I created my workflows I started with the template then renamed the workflow class file to something more descriptive than “Workflow1.cs.  And therein lies the problem!  When you rename the default Workflow.cs file you have to manually rename all references to it! (Even though you get a false sense of security from the dialog that pops up and asks you if you would like to rename all the references to the code element…blah blah blah).

So this is where you need to rename the workflow (in this example I renamed “Workflow1.cs” to “newWorkflow.cs”):

  1. onWorkFlowActivated1 properties (in design view): a) expand CorrelationToken, update the OwnerActivityName property to the new name; b) expand WorkflowProperties and update the Name property to the new name. Save.
  2. Edit the workflow designer file: Expand the newWorkflow.cs node in Solution explorer and double-click newWorkflow.designer.cs.  Expand the “Designer generated code” region update activitybind1.Name and activitybind2.Name to “newWorkflow”. Also check for other references to the original “Workflow1″ value.
  3. Update workflow.xml: change the “CodeBesideClass” property to reflect the updated class name (for example “SharePointWorkflow1.newWorkflow” in my case).

Finallty after spending hours chasing the cryptic error I got it working.  Let this be a lesson on trusing automated features to fix your code!

Please let me know if I missed anything in the list above!

Renaming a MOSS virtual server

Wednesday, September 9th, 2009

I recently had to rename a virtual PC with a MOSS 2007 test environment because of network naming conflicts.  After trawling the web I came up with the steps below.  Start with the steps below before renaming the server (renaming the server is part of the steps).

  • Decide on a new server name :-P (for this example we’ll use OLDSERVER and NEWSERVER as the old and new names for the server).
  • Update all the alternate access mapping URLs to point to the new server name via Central Administration (Central Admin > Operations >Alternate Access Mappings).
  • Run the server rename command from the command prompt (Start>Run…>cmd). If your SharePoint bin folder is not included in the server PATH, then you’ll have to run it from the bin folder (default location is C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN):

stsadm -o renameserver -oldservername OLDSERVER -newservername NEWSERVER

  • Rename the server.
  • Reboot the server.
  • Update the farm credentials by running the stsadm command line tool from the command prompt (Start>Run…>cmd):

stsadm -o updatefarmcredentials -identitytype configurableid -userlogin NEWSERVER\administrator -password adminpassword

  • Reset IIS from the command prompt (Start>Run…>cmd):

iisreset /noforce

  • Check application pool identities in IIS Manager.  Update the application pools that still reference the old server name only.  Leave any application pools running on system accounts unchanged.
  • At this point I did another IIS reset just to make sure everything gets refreshed.

Notes
1. In some cases you may need to rerun the SharePoint configuration wizard to reconfigure SharePoint.  In extreme cases you may have to resort to an in place upgrade via the stsadmin command line tool.
2. These steps were performed on a MOSS 2007 SP1 installation.

Disclaimer:
As mentioned I used it to rename a virtual server in a test environment only.  I do not think renaming a production server is EVER a good idea.  I’m not responsible for any damages or negative impacts these steps may have.