Showing posts with label SQL 2005. Show all posts
Showing posts with label SQL 2005. Show all posts

Monday, 9 July 2012

SQL Database Restore Error: Restore failed for Server 'Name'. (Microsoft.SqlServer.Smo) - Exclusive access could not be obtained because the database is in use.

We are in the process of troubleshooting a database corruption issue that happened due to a RAID 1 array failure on an older SBS 2003 R2 server configured with a pair of software RAID 1 arrays.

When we went to restore the database from the most recent .BAK file we always ended up with the following error:

image

Microsoft SQL Server Management Studio

Restore failed for Server 'Name'. (Microsoft.SqlServer.Smo)

Additional Information:
System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)

It took a number of searches to finally come up with the answer:

Following the steps listed by pogo69:

  1. Right-click on the database name
  2. Click on Properties context menu item
  3. Click on Options menu item on the left
  4. In the grid, scroll down to the bottom
  5. Change 'Restrict Access' to SINGLE_USER

Once we ran the above steps we were able to restore the database successfully.

image

Microsoft SQL Server Management Studio

The restore of database 'NAME' completed successfully.

We were then back into our client's LoB.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

*Our original iMac was stolen (previous blog post). We now have a new MacBook Pro courtesy of Vlad Mazek, owner of OWN.

Windows Live Writer

Monday, 23 November 2009

What Version of SQL Is That?

We have a client that needs to update a Line of Business application that is using a SQL 2005 Express instance.

The LoB has a major update coming down the pipe and the product developer has stated that we need to have SQL 2005 SP2 at the minimum to support the newest features in the update.

The following SQL version comes via a screenshot of SQL Server Management Studio Express:

image

Okay, so, now what version and service pack level are we at?

Apparently SP2+Q954606 (GDR):

image

The above screenshot was taken from this site:

The SQLSecurity.com site has an extremely comprehensive list of each version level depending on which SQL patches were installed.

So, we now know that we have SQL 2005 Service Pack 2 installed with Service Pack 3 looming in the near future and that our LoB can be safely updated.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

*All Mac on SBS posts will not be written on a Mac until we replace our now missing iMac! (previous blog post)

Windows Live Writer

Tuesday, 29 September 2009

SQL 2008 Setup and SAP + .NET No Goes

As part of the migration we did last weekend we needed to set up a SQL backend for both SAP and a .NET based application. The .NET app tied their proprietary data as well as SAP data together for a domain user app along with a Web client facing data publishing page.

Essentially their users manage the data in SAP as well as the client stuff found in another database all together with their clients having Web based access to their own data.

So, we discovered a number of important things along the way.

+ SAP will not work if the SAP database resides in SQL 2008. At least the version we were working with which was very recent. ODBC errors happened when trying to connect. When we nuked SQL 2008 and put 2005 on the server and attached the databases in SQL 2005 SAP was happy.

+ The .NET application had some internal structures that refused to run due to the SQL 2008 version. SQL 2005 fixed those errors too.

We placed a copy of the original databases in the appropriate directories before attaching them in SQL 2008. So, after switching to SQL 2005 we were no further behind.

By the way, SQL 2005 would not allow us to attach the databases that were touched by SQL 2008. We always try and work with copies of the original data for situations just like this.

When it came to getting the .NET app, resident on another server, to communicate with SQL, the following port exclusions in the SQL server's Windows Firewall with Advanced Security were needed:
+ The port the SQL instance was on (default is 1433).
+ The SQL Browser port at UDP 1434.

Once we had things straightened out with the SQL version, ports needed, and the user permissions setup within the databases we were good to go.

All servers were running Server 2008 Standard x64 SP2.

Philip

Sent from my SBS Integrated Windows Mobile® phone.
--

ExchangeDefender Message Security provided by MPECS Inc: Click below to verify authenticity

http://www.exchangedefender.com/verify.asp?id=n8U0OdI8015660&from=philipelder@mpecsinc.ca

Friday, 27 February 2009

Configure the Business Contact Manager Database on SQL Server 2005

For those looking to improve their Business Contact Manager’s performance, the BCM database can be installed and configured on SQL Server.

The catch initially was that Outlook and BCM needed to be installed on the machine too. This is not really a good practice for a server.

The BCM team has given us a tool to accomplish the task without the need to install Outlook and BCM on the server: Outlook 2007 with Business Contact Manager: Database Admin Tool.

Note that the database server needs to be SQL 2005 SP2 32bit or SQL Express 2005 SP2 32bit and needs to have .NET 2.x installed.

Some further reading from the source:

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts will not be written on a Mac until we replace our now missing iMac!

Windows Live Writer

Wednesday, 14 January 2009

SBS 2008 - Migrating Practice Creative Suite from SBS 2003

One project we are working on is the move of an existing SBS 2003 domain onto a totally new SBS 2008 setup. The previous SBS 2003 setup was too messed up to even consider a migration, plus we were walking into a totally new server and workstation setup anyway.

One product we are working with in this case is the Thomson Reuters Practice Creative Suite (PCS). It is a product that users use to keep track of their time while working on their client tasks.


Note that, during the Practice CS install routine, install the client software
too as it may be required when testing database connectivity.

Also, install SQL 2005 Express into a new instance leaving the default CREATIVESOLUTION instance name.

The database move was actually quite simple as all that needs to be done is detach the database in Microsoft SQL Server Management Studio Express. Once the database and log file are released, copy them onto a USB hard drive and copy them up to the default CREATIVESOLUTION instance that was created when Practice CS was installed on the new SBS 2008 box.

There are a number of gotchas in this process. One of them is the actual NTFS permissions on the two files once they are in place in the SQL directory.

Since we are talking about SBS 2008 with its own SQL 2005 Express db installed, the default directory will probably be:
C:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Data
The simplest way to line up the correct permissions on the two SQL files is to right click on the CSP_0_Sample.mdf file and click on Properties. Click on the Security tab and then click on the Continue button which will require a UAC acknowledgement.

There should be three sets of permissions with FULL CONTROL set:
  • SYSTEM
  • SQLServer2005MSSQLUser$WIN-XXXX-CREATIVESOLUTIONS
  • Administrators

Duplicate those permissions for the newly copied in database and log files. It is important to do this step first as the attach process will choke if the permissions are incorrectly set with an error about Read-Only and Performing a database recovery" in SQL Server Management Studio Express.

Once the permissions are correctly set on the databases, attach them. Make sure to close SQL Server Management Studio Express (SSMSE) if it is open first. Right click on the SSMSE and Run as administrator. If this step is missed, the database attach will choke.

Okay! We now have a nicely installed set of databases in SSMSE. But, none of the default permissions that Practice needs will be set yet. Verify that the SBS domain admin account is owner of the database within SSMSE by right clicking on the CSP_FIRM#_FIRM# database and clicking on Properties.

If the domain admin does not own the database, then we need to run the SQL 2005 Surface Area tool. Again, right click and Run as Administrator. Click the Add New Administrator link and move the CSP_FIRM#_FIRM# database over to the "Privileges that will be granted to SBSDOMAIN\AdminAccount and click OK.

With the correct permissions set, we need to verify the Users under the Security folder for the CSP_FIRM#_FIRM# database to have dbo (Login name: CreativeSolutionsPracticeCsDatabaseOwner), INFORMATION_SCHEMA, and sys.

The dbo is critical. In our case, the domain admin account was the login setting for the dbo and we were not able to shift to the CreativeSolutionsPracticeCsDatabaseOwner account.

We created a new account called dbo-PCS, set the needed user account as login and give the Database role membership of db_owner.

New dbo-PCS account with ownership set

We now have Practice CS installed on SBS with the requisite reboots, the database has been properly attached, and we have installed Practice CS onto the workstations (no Remote Entry option), and/or laptops (with Remote Entry), a connection attempt can be made. More than likely it will fail.

We need to do the following on the SBS 2008 server itself:

SBS 2008 Firewall Exceptions

We need to set up Inbound rules for the following:

  • TCP 1433
  • UDP 1434
  • SQLBrowser.exe ( ..\90\Shared\sqlbrowser.exe)
  • SQLServer.exe ( ..\MSSQL.X\MSSQL\Binn\sqlserver.exe)

MSSQL.X indicates the SQL 2005 Express instance. If Practice CS is the first product to be installed on SBS 2008 with an additional SQL Instance, then X=2. The SQL application to be exempted needs to be the one that resides in the same folder structure as the Practice databases.

Run the Practice CS client on the server, and a firm logon page should happen.

Now, run Practice CS on a Vista client, and more than likely there will need to be one more firewall rule set up ... but not on the server, in Windows Vista.

Windows Vista Outbound Firewall Rule for Practice CS

Once we created the outbound exception on the Windows Vista client box, we were still seeing a connection error.

There was one more step to the puzzle. On the SBS server, run the client and connect to the firm database. A logon is not required. Click cancel for the logon dialogue box to get to the Practice program, click on Help then About Practice CS. There is a Download Licenses button. Click on this to enter in the necessary particulars for the firm and allow the license files to download.

Once the files have downloaded, the Practice CS client will run a reinstall routine. If Practice CS is installed on all of the network clients already, then they too will run through the reinstall routine.

Once the license files are installed, Practice CS will fire up and the firm's database will be available for login.

Because this was a very time consuming and labourious process, some steps may be missed. Here is an overview of the process:

  1. Detach on original SBS
  2. Install Practice CS including client. Reboots required.
  3. Db and Log File copy to new Practice CS SQL instance directory.
  4. Files permissions set identical to the Practice Sample Db and Log File settings.
  5. Attach in SSMSE (Right click and Run as Administrator to open).
  6. Run SQL Server Surface Area Configuration and set domain admin to CREATIVESOLUTIONS instance.
  7. Set proper permissions for dbo in SSMSE.
  8. Set up SBS 2008 Firewall permissions for two applications and two ports.
  9. Test connection in Practice CS to firm database.
  10. Cancel login and download and install the firm's license files.
  11. Set Outbound program rule in Windows Vista for Practice CS.
  12. Run Practice CS on Vista client and connect to database.

Please comment if anything is caught missing or out of line with the process, and we will update the blog post.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

Saturday, 20 December 2008

SQL 2005 Service Pack 3 is out

Okay, so we are a few days behind on the news! ;)

Microsoft SQL Server 2005 Service Pack 3 is available for download. Please read the list of bugs fixed with the Service Pack.

From there, the What's New in SQL Server 2005 SP3 document discusses what additional features and/or abilities have been added to the product.

There is a different Service Pack for SQL Server 2005 Express: SQL Server 2005 Express Download Page. Note that there is a request to register for the download, but there is a direct link to the download for those who may not want to registered.

Also, as of this writing the download for SQL Server 2005 Express still links to the Service Pack 2 version.

There is no word on the SQL 2005 Service Pack 3 being released via WSUS from what we can see yet.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

Monday, 7 July 2008

SBS - Installing an ACCPAC Database on SQL2005

This process will work for both new and existing MS SQL database setups on ACCPAC.

Note that the methodology is pretty straight foward for a new setup: The process finishes after one has run the ACCPAC Setup Wizard to configure the company.

Our primary focus in this post is a very long struggle to get an existing ACCPAC client migrated to a new SBS installation that upgraded a peer to peer setup.
  1. Create SQLUser in ADUC with a static password and no Exchange attributes
  2. Create SQLUser2 in ADUC with a static password and no Exchange attributes
    • Make sure to follow the SBS password security guidlines for the client's setup when creating the user passwords for these accounts.
    • Note that their passwords must be set to not expire.
    • Depending on the client configuration, further restrictions on these users can be initiated via OU and Group Policy Objects.
  3. Create SQLUser in SQL Server Management Studio --> MySBS --> Security--> Logins and tie it to MySBSDomain\SQLUser
  4. Create blank MYCSYS ACCPAC system Db in SQL2K5 with SQLUser as owner
  5. Double click on the above created SQLUser in SQL2K5 manager and set MYCSYS as the default Database
  6. Create blank MYCDAT ACCPAC data Db ini SQL2K5 with SQLUser as owner
  7. Create SQLUser2 in SQL Server Management Studio --> MySBS --> Security--> Logins
  8. Right click MYCSYS database and Properties
    1. Permissions
    2. Click on MySBSDomain\SQLUser
    3. Verify "Connect" is checked
  9. Click + MYCDAT (repeated for MYCSYS too) --> Security --> Users --> Right Click in the white space under the user list on the right and "New User"
  10. User name: SQLUser2
  11. Login name: MySBSDomain\SQLUser2
  12. Set the Default schema to "dbo"
  13. Leave Schemas owned by this user blank
  14. Set "db_owner" under Database role membership
  15. Click OK (just to repeat: do this for both MYCSYS & MYCDAT database Users)
    • We now have two blank databases to work with that are ready for the ACCPAC setup wizard.
    • If a mistake is made, all we need to do to start over is delete any tables under MYCSYS and MYCDAT --> Tables (click on the first table - NOT THE SYSTEM TABLES FOLDER - then SHIFT + the last table entry, right click and Delete.
  16. For new installations, run the ACCPAC setup wizard and input all of the relevant dates, data, permissions, and users with their passwords.
    • Note that there will be other setup steps that will need to be accomplished such as setting up security on the ACCPAC Database Setup console that are beyond the scope of this post.
  17. For existing installations, keep things relatively simple: set the date as 1/1/200x, currency type, and then Next repeatedly until the process runs through creating the database tables.
  18. Click on ACCPAC Database setup and both MYCSYS & MYCDAT will show up.
  19. Run the ACCPAC Database Load utility to recreate the company data from the last backup made before the last server was downed.
  20. If the Database Load utility somehow does not get all of the up to date data installed, the fix is very simple: Stop the default SQL server instance and copy the following files out of the old ACCPAC data directory:
    • MYCDAT.mdf
    • MYCDAT_log.ldf
    • MYCSYS.mdf
    • MYCSYS_log.ldf
  21. Restart the default SQL instance service
  22. Logon to ACCPAC on the server as the data's admin.
  23. All should be good to go from there to install the software on the workstations and connect to the server.
    • Note that the ACCPAC Database Setup utility on any workstation will muck up the server settings if the MYCSYS and MYCDAT entries are modified/deleted!
  24. ODBC System DSN settings should be taken care of by the ACCPAC install.
After we were finished the above setup steps, we had our client's ACCPAC installation fully functional on the SBS 2003 Premium server with MS SQL 2005 SP1 installed.

If need be, for larger firms, we can initiate the SQL 2K5 install routine to install a dedicated SQL2K5 instance for ACCPAC's purposes prior to performing the above steps.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

Monday, 14 April 2008

SBS + SQL 2005 + SharePoint = SQLVDI Error: Mutex not owned by caller.

On the last number of SBS 2K3 R2 Premium setups we have done, we are seeing the following error:

Critical Errors in Application Log

SQLVDI Event ID: 1
SQLVDI: Loc=DVDSCleanup. Desc=Release(ClientAliveMutex). ErrorCode=(288)Attempt to release mutex not owned by caller. .Process=7364. Thread=6900. Client. Instance=SHAREPOINT. VD=.
The SQL 2005 version on the SBS boxes: 9.00.3054.00. They are currently up to date on their service pack levels.

A quick search turned up the following Microsoft KB article: KB934396 FIX: Error messages and an event may be logged when you use the Virtual Device Interface in SQL Server 2005 or in SQL Server 2000.

We needed to call into Product Support Services for this one:

Microsoft Product Support Services Phone Numbers for North America

All SQL instances must be at Service Pack 2 level before applying this hotfix. If you need to determine what service pack level the SQL install is: MS KB321185: How to identify your SQL Server version and edition.

Please note that there are two versions for the hotfix: x86 and x64. And, deep in mind that the hotfix covers a lot:

Hotfix 934396 x86 File for SQL 2005

Because it is a one size fits all, the x86 download is around 100MB and the x64 download is 139MB. We always request both versions if they exist for any hotfix we are calling in for. Doing this has saved us a further call into PSS for the alternate version on many occasions.

Once the files have been extracted, they definitely need to be placed on the Technician's Thumb Drive for later access.

And, if this is a problem that we see on a regular basis on all of our new SBS 2K3 R2 Premium boxes, then we will be adding this blog post as a To Do item on our SBS Setup Checklist.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

Wednesday, 21 February 2007

SBS 2K3 RTM SP1 R2 Premium - Post install must do - Tame SQL Memory Usage

As soon as the ToDo list is done, and one has installed the Premium Technologies, one must reconfigure the maximum amount of memory that some of the SQL Server and MSDE instances use.

Otherwise, we end up with this:

A gigabyte in use for one SQL instance as well as Allocated Memory messages in your Outlook folder for that client!

BTW, I generally install a minumum of 3 GB in all of our SBS servers. Once everything is configured, I change the Allocated Memory Alert threshold to just over the installed physical memory level. Thus, I won't have to do it later after receiving the continuous e-mail messages. :D

To tame the SQL instance's memory usage do the following:
Right click on your taskbar and bring up the Task Manager.
Click on the Processes Tab.
Click on the Mem Usage category to sort by it, then click it again to bring the highest ones to the top.
If PID is not the second column in your view, click on view and select columns.
Put a check mark beside PID.
Click OK.
Note the PID of the offending SQL instance.
Now, click:
Start-->run-->cmd-->enter.
tasklist /svc
Scroll back up until you see the PID in the list.
To the right of the PID, will be the appropriate instance to go after.
The following screen shot has the rest:



In this case, the offending instance belonged to the Firewall MSDE.

So, we proceed at the command line as follows:

osql -E -S mysbsserver\msfw
sp_configure 'show advanced options',1
reconfigure with override
go

You will get a message that the option has been changed from 0 to 1.

Then, on to:

sp_configure 'max server memory',128
reconfigure with override
go

You will then get a message indicating the maximum allowable memory for that instance has been changed from 2 GB to 128 MB.

It is pretty kewl to watch the memory drop from over a gigabyte to the 128 MB mark almost instantaneously!

Exit out of the osql command shell by typing:

exit [enter]

Done!

For all of our new installs, I place memory restrictions on the following instances by default:

  • MSFW
  • SBSMonitoring
  • WSUS

If the server has less that 2 GB, I tend to be a lot more restrictive than 2 GB to 3 GB, and a lot less restrictive for installations with more than 3 GB of RAM.

Thanks to Susan Bradley's posts here and here where I originally discovered how to deal with this issue.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

Saturday, 3 February 2007

SBS 2K3 R2 Premium - SQL 2005 Error 107 - Report Server Windows

This message was appearing in the application log every minute. This is a fresh SBS 2K3 R2 Premium installation:

It only took one search with the full text of the error to come up with the solution to the problem.

I needed to rework the encryption setup in the SQL Reporting Services Configuration:



Connect to the default instance:


Then, backup, delete, and backup again.



Once I did that process, the error was gone.

We have a few SBS 2K3 R2 Premium installs out there with the number growing.

It is a whole new challenge to get to know SQL 2005! :D

The first source: IPDG3.COM

Which lead to an article on MSDN.

Happy SBSing,

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists.

SBS 2K3 R2 Premium - Upgrading WSS MSDE to SQL 2005

I have pretty much upgraded the default MSDE db instance for Windows SharePoint Services to a full SQL database since I can remember.

On SBS 2K3 RTM and SP1 this was a relatively straight forward upgrade to SQL 2000.

ON SBS 2K3 R2 Premium though, it is not so straight forward to upgrade the instance to a SQL 2005 instance.

There are a number of extra steps that one will need to complete in order to upgrade the database instance.

SmallBizServer.net has the low down on how to accomplish this task. The instructions are chock full of screen shots, so it is very easy to follow.

Microsoft also has its own article on the various types of database instances WSS can run and the upgrade processes for each here. This article also specifies the proper method for the Default install of SQL 2005 Workgroup Edition.

Watch yourself though, any mistakes and it could mean a re-install or recovery!

Happy SBSing,

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists