Changing databases default locations

By default the location of SQL Server 2005 databases files is C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data.

Changing user databases default locations

After installing SQL Server 2005 you can change the default location for all user databases that will be created on the server, to do it you have just to modify the database default locations on the server property page.

image

or by executing the code above :

USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', REG_SZ, N'E:\UserDB'
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultLog', REG_SZ, N'E:\UserLOG'
GO

Changing system databases default locations

master database

To move the master database files you have to perform the following steps:

  1. Change the startup parameters of SQL Server service using SQL Server Configuration Manager
  2. image
  3. change the path of master.mdf to the new path inside the –d flag
  4. change the path of mastlog.ldf to the new path inside the –l flag
  5. net stop mssqlserver
  6. move the files from the old location to the new location
  7. net start mssqlserver       
msdb database

To move the master database files you have to perform the following steps:

  1. run a command prompt (cmd)
  2. net stop mssqlserver
  3. net start msqlserver /c /m /T3608
  4. run SQLCMD (be sure that all other SQL Server Services are stopped and that there is no application that will try to connect to SQL Server) 
  5. on the Sqlcmd prompt execute the following script : 
    use master
    go
    sp_detach_db 'msdb'
    go



  6. move the msdbdata.mdf and msdblog.ldf files to the new location


  7. net stop mssqlserver


  8. net start mssqlserver


  9. execute the script

      use master
      go
      sp_attach_db 'msdb','<new location>\msdbdata.mdf','<new location>\msdblog.ldf'
      go





tempdb database


To move tempdb database  :




  1. Execute the following SQL script :  

    USE master

    GO


    ALTER DATABASE tempdb


    MODIFY FILE (NAME = 'tempdev',FILENAME = '<new location>\tempdb.mdf')


    GO


    ALTER DATABASE tempdb


    MODIFY FILE (NAME = 'templog',FILENAME = '<new location>\templog.ldf')


    GO




  2. net stop mssqlserver


  3. move tempdb.mdf and templog.ldf files to the new location


  4. net start mssqlserver



model database


to move model database :




  1. run a command prompt


  2. net stop mssqlserver


  3. net start mssqlserver /c /m /T3608


  4. run SQLCMD


  5. detach the model database : 
    use master
    go
    sp_detach_db 'model'
    go



  6. move the model.mdf and modellog.ldf files to the new location


  7. attach the model database :
    use master
    go
    sp_attach_db 'model','<new location>\model.mdf','<new location>\modellog.ldf'
    go



  8. net stop mssqlserver


  9. net start mssqlserver

SSRS 2005 Password Updates

When you change the AD password of the user running the SQL Server Reporting Services 2005 wyou will eperience probelm to restart the SSRS 2005.
What you have to di is :
- Update the password on the service properties under windows services console
- Update the password by using the SSRS configuration tool because the password is also stored internally on the SSRS configuration.

Some SQL Server 2008 features install components of Visual Studio 2008 SP1 and because VS 2008 does not support the execution of VS 2008 and VS 2008 SP1 on the same computer; the setup program of SQL Server 2008 will not be able to complete due to this rule.

to resolve this issue you have to do one of the following actions :

  • install Visual Studio SP1 before SQL Server 2008
  • uninstall Visual Studio 2008, install SQL Server 2008 than Visual Studio 2008 and Visual Studio 2008 SP1
  • install SQL Server 2008 without the following components
    • Management Tools
    • Integration Services
    • BI Development Studio

for more details click here.

Can’t Enable Service Broker On MSDB !

After restoring MSDB database to a different server, you may experience a problem configuring Database Mail feature due to the fact that Service Broker is not enabled on MSDB database and you will not be able to enable it.

Resolution :

to resolve this issue you have to create a new broker by executing the script below :

ALTER DATABASE [MSDB] SET NEW_BROKER WITH ROLLBACK IMMEDIATE

Go

ALTER DATABASE [MSDB] SET NEW_BROKER

Go

ALTER DATABASE [MSDB] SET ENABLE_BROKER

Go

Before upgrading your operating systems to Windows 2008 R2 you have to know which versions of products are supported on this platform.

  1. SQL Server
    1. SQL Server 2005 Service Pack 3 and later
    2. SQL Server 2008 Service Pack 1 and later
    3. SQL Server 2005 Express Edition Service Pack 2
    4. SQL Server 2008 Express RTM
    5. SQL Server 2008 R2 will be supported in H1 2010
  2. Exchange
    1. Exchange 2010 and later version will be supported Q4 2009
  3. Office Servers
    1. Forms Server 2007 Service Pack 2 and later
    2. Groove Server 2007 Service Pack 2 and later
    3. PerformancePoint Server 2007 Service Pack 2 and later will be supported Q1 2010
    4. Project Server 2007 Service Pack 2 and later
    5. SharePoint Server 2007 Service Pack 2 and later              
    6. Search Server 2008 Service Pack 2 and later
    7. Search Server 2008 Express Service Pack 2 and later

for a complete lit of supported products see Microsoft Server Applications Supported on Windows Server 2008 R2

Exchange 2007 and 2010 Coexistence

If you plan to install Exchange 2007 and Exchange 2010 on the same AD infrastructure be careful to install Exchange 2007 firstly because if you upgrade the AD schemas with Exchange 2010 you will not be able to add an Exchange 2007 to your forest.

the order of installation must be :

  1. Exchange 2007
  2. Exchange 2010

When change management is not well implemented on the IT Department, some simple questions become hard to be answered immediately by system administrators, like :

  • Which edition of SQL Server is installed ?
  • What about the last Service Pack applied to the server ?

to answer this questions we can just execute a simple T-SQL query :

SELECT
    ServerProperty('Edition'),
    ServerProperty('ProductLevel'),
    ServerProperty('ProductVersion')

the result of this query is :

image

The first column is Edition, the second is the service pack applied for the instance and the last represent the version number which can help us to determine if there are cumulative updates or security patch that was installed and changed the version number of the product. This information is very important because when you have to restore your system databases you will not be able to restore the master database if the version number of the saved master database is different from the version number of the installed server.

 

Yes, we can install MOSS 2007 on Windows 2008 R2 but we must integrate the SP2 of MOSS 2007 on the source media to use.

Firstly we download all the resources :

  1. Microsoft Office Servers Service Pack 2   
  2. Windows SharePoint Services 3.0 Service Pack 2

NB: you have to download the x86 and x64 binaries 

Copy the RTM sources of SharePoint 2007 to a writable disk and than extract the SP2 of MOSS 2007 and WSS 3.0 on the folder named Updates of the MOSS binaries.

  1. Create a folder MOSSWithSP2 on C:
  2. Copy the MOSS 2007 RTM binaries to C:\MOSSWithSP2
  3. Extract the WSS 3.0 SP2 x86 on the folder C:\MOSSWithSP2\x86\Updates ==> 
  4. wssv3sp2-kb953338-x86-fullfile-en-us.exe /extract:”C:\MOSSWithSP2\x86\Updates

     

  5. Extract the WSS 3.0 SP2 x64 on the folder C:\MOSSWithSP2\x64\Updates ==>  
  6. wssv3sp2-kb953338-x64-fullfile-en-us.exe /extract:”C:\MOSSWithSP2\x64\Updates

     

  7. Extract the MOSS 2007 SP2 x86 on the folder C:\MOSSWithSP2\x86\Updates ==> 
  8. officeserver2007sp2-kb953334-x86-fullfile-en-us.exe /extract:”C:\MOSSWithSP2\x86\Updates”

     

  9. Extract the MOSS 2007 SP2 x64 on the folder C:\MOSSWithSP2\x64\Updates ==> 
  10. officeserver2007sp2-kb953334-x64-fullfile-en-us.exe /extract:”C:\MOSSWithSP2\x64\Updates”

  11. Delete the file wsssetup.dll from C:\MOSSWithSP2\x64\Updates and from C:\MOSSWithSP2\x86\Updates

Now you can use the folder MOSSWithSP2 as installation source to implement MOSS 2007 on Windows 2008 R2.

The size of transaction log file will increase indefinitely if the recovery model of the database is set to Full and we don’t perform Log backups periodically.

With SQL Server Alerts and Jobs we can automate log backups.

  • Create a backup device to store backups
    • From object explorer develop Server Objects
    • Right click Backup Devices
    • Click New Backup Device

 image

    • Give a name and a filename to the backup device

image

    • Click Ok
  • Create an operator to receive notification
    • Right click Operators folder under SQL Server Agent
    • Click New Operator

image

    • Fill the fields of the General tab with the required information

 image

    • Click Ok
  • Create a new Job to backup the transaction log
    • Right click Jibs folder under SQL Server Agent
    • Click New Job

image

    • Name the job on the General tab

image

    • Create a Transact-SQL Script step on the Job with the script : BACKUP LOG ‘DataBaseName’ TO ‘BackupDeviceName’

image

    • On the Notification tab choose the operator to be notified

image

  • Create an Alert based on the performance counter Percent Log Used
    • Right click Alerts folder
    • Click New Alert        

image

    • Configure the Alert with the following values
      • Name : ‘AlertName’
      • Type : SQL Server Performance Counter Alert
      • Object : SQLServer:Databases
      • Counter: Percent Log Used
      • Instance: ‘Database Name’
      • Alert if counter : Is greater than
      • Value : ‘Type a value < 100’

image

    • On the Response tab choose Execute Job as response, select the Job created on the previous steps and select the operator to be notified.

 image

To install SQL Server 2008 on Windows Server 2008 R2 you have just to add the feature .NET Framework 3.5.1, this feature will enable the SQL Server Installer to run.

To verify the system requirements you can use the System configuration checker from the SQL Server Installation Center under the Planning section as illustrated on the figure above.


When you launch the SQL Server Installer you will see on your screen the fallowing message informing you that you have to upgrade your SQL Server installation to Service Pack 1 which is required for the compatibility with Windows Server 2008, so you have to click Execute the program and don't forget to apply the Service Pack 1 of SQL Server 2008 after finishing installation.


After verifying that all system requirements are meet you can start the installation process of SQL Server 2008 from SQL Server Installation Center under the installation Section by clicking on New SQL Server stand-alone installation or add features to an existing installation.


  • When running the installation process ensures that you are using a user account having administrator privileges on the machine or the installation will fail.
  • Depending on the features you will choose to install you will have to configure the Windows Firewall for SQL Server use

Important:


 

  • Installing SQL Server 2008 on a domain controller is not recommended
  • When installing SQL Server 2008 on Windows Server 2008 R2 you have to upgrade it to service pack 1 before use.

Version numbers:


 

SQL Server 2008 RTM: 10.0.1600.22


SQL Server 2008 SP1: 10.0.2531



 


 


 


 


 


 


 


 


 

SQL Server 2000 on Windows 7





Microsoft is announcing Windows 7 for the last quarter of 2009, if you are a SQL Server 2000 user so you are yet on Windows XP. The good news is not that Windows 7 will be compatible with SQL Server 2000 but that the Windows XP Mode in Windows 7 will give you the ability to upgrade your OS to Windows 7 and continue using your SQL Server 2000.



Windows Virtual PC and in addition to deliver capability to run Virtual Machines on Windows 7 will help us to run Virtual Application using Windows XP Mode.



In this article we will explore what are the requirements for this and how we can do it.



Before we begin



Windows Virtual PC requires a CPU with Intel® Virtualization Technology or AMD-V® feature turned on so you have to verify that your hardware meets this requirements and that the feature us enables in the system BIOS.



Windows Virtual PC requires Windows 7 RC that MSDN subscribers and TechNet Plus subscribers can download from Microsoft TechNet Springboard Site.



You can download all needed components from the Windows Virtual PC website :






Components Installation



On your Windows 7 computer install the Windows Virtual PC and then the Windows XP Mode, this will create a Windows XP SP3 Virtual Machine on your hard disk and you will see a new menu group added to your Start menu as illustrated on the figure 1




The Windows Virtual PC menu group will contain three items





  1. Virtual Machines (Ordinateurs virtuels in French)


  2. Virtual Windows XP


  3. Virtual Windows XP Applications


By clicking the Virtual Machines menu you will see the list of the virtual machines configured on your Windows 7 computer and you will be able to manage them as you do it on Virtual PC.



Configuring the Windows XP mode





  1. Start the Windows XP virtual machine by clicking Virtual Windows XP menu item


  2. Install the integration Components on the Virtual machine


  3. Install the RAIL QFE Beta Windows XP SP3 on the Windows XP Virtual Machine


  4. Restart your virtual machine and activate the integration functionality from Tools menu


  5. Install SQL Server 2000 on your Windows XP Virtual machine


  6. Put the Virtual machine in Sleep mode


On your Windows 7 Start menu click Virtual Windows XP Applications under Windows Virtual PC and you will see the group menu for SQL Server 2000.







Enjoy using SQL Server 2000 on your Windows 7 computer.




Hello,

I created this Blog to share with you my experience on some Microsoft products and specially SQL Server.



Your feedback, questions and comments are welcome and will help me to increase this blog utility.



J.Kasraoui