Thursday, January 30, 2014

SQL - List Last Database Backup Date

There is one server with a bunch of databases with some being backed up. I needed to see which ones were being backed up.

Here is the script I used:

Select as [Database Name], (select max(backup_finish_date) from msdb..backupset 
where type = 'D' and database_name =
) AS [Last Database Backup Date] ,
(select max(backup_finish_date) from msdb..backupset 
where type = 'L' and database_name =
) AS [Last Log Backup Date] 
master.dbo.sysdatabases AS dtb

Monday, January 27, 2014

Backup Nexus Tablet

I figured that if I'm going to be using my tablet for testing out applications then I should back it up before I do anything on it. It was easy to do using the Android SDK.
You will also need to get the Nexus device drivers from ASUS.
Once you've download all of this use the Android Debug Bridge to backup your Nexus.

Here are the sites I used for instructions:
Tech Entice
How-To Geek
Transformer Forums
Android Heat
How to install Nexus 7 drivers on Windows

Monday, January 13, 2014

SQL - List All Triggers In A Database

I needed to get a list of all of the triggers in a database. This is the script that I used:

select as [Table Name], as [Trigger Name], sysM.definition as [Trigger Script] from  sys.tables sysT
inner join sys.objects sysO on sysT.object_id = sysO.parent_object_id
inner join sys.sql_modules sysM on sysO.object_id = sysM.object_id 
where sysO.type ='TR'

Sunday, January 12, 2014

SharePoint 2013 - First Deployment Problems

Set up a SharePoint 2013 server on a Windows 8 virtual machine.
First issue - the VM was set up with dynamic memory allocation. Don't use dynamic memory allocation with a SharePoint VM!

Next issue. You have to run IE as an administrator to go to the SharePoint Central Administration site. If you don't you will get in to the site but you will be missing some functionality such as "Manage services on a server" or you will get "Sorry, this site hasn't been shared with you" messages.

The biggest problem that I had was with the Distributed Cache. Symptoms were: "Cannot start service AppFabricCachingService ..." when executing Start-CacheCluster command. I tried a lot of "solutions" that I found on the web to get the AppFabric Caching Service to start but nothing worked. Finally found the solution to my problem here. Here's what worked for me:
Run PowerShell as an administrator.
Added the SharePoint snap-in to the PowerShell.
Run Remove-SPDistributedCacheServiceInstance on all servers in the farm.
Create a PowerShell file with the following code:

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
#here's the key. we can't provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that have no server attached 

Execute the PowerShell file on all servers using ".\" in front of the name.
Run Add-SPDistributedCacheServiceInstance on all servers.
In Central Administration confirm that the Distributed Cache Service has been started.
If this didn't work, retrace your steps.
See: Manage the Distributed Cache service in SharePoint Server 2013

Thursday, January 2, 2014

Nexus 7 Will Not Start

So, I dropped my Nexus 7. It was in a case, fell maybe 3 feet, and would not start after the fall. I did some research and figured out that it was most likely, and hopefully, caused by a loose battery connector. Following instructions that I found on YouTube, I opened it up and sure enoughh the connector was loose.