lunes, 13 de octubre de 2014

Configure SQL Server Database Mirroring Using SSMS

SQL Server

http://www.mssqltips.com/sqlservertip/2464/configure-sql-server-database-mirroring-using-ssms/



Scenario
I have a need to setup SQL Server Database Mirroring in my environment.  I understand it can be complicated to setup. Can you provide an example on setting up SQL Server Database Mirroring?  Check out this tip for a basic look at how to setup this SQL Server feature.
How to
In this tip I am going to outline my environment and then walk through the process of setting up Database Mirroring.  This will include the configurations, backups, restores and verification process.  Let's jump in.
My test environment consists of two separate VM's running VM Workstation with Windows 2008 R2 Datacenter Edition and SQL Server 2008 R2 Enterprise named appropriately Principal and Mirror. The SQL Server and SQL Server Agent Services accounts are running as domain users (DOMAIN\User). Windows Firewall is OFF for the sake of this example.
I created a database on the Principal SQL Server instance and named it TestMirror. The recovery model is set to FULL RECOVERY.

Mirror1

BACKUP DATABASE TestMirror TO DISK = 'C:\Program Files\Microsoft SQL 
Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\Backup.bak';


BACKUP LOG TestMirror TO DISK = 'C:\Program Files\Microsoft SQL 
Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\Backup.trn'; 

Below are the two files in the file system:


Mirror2

3rd step: Assuming you have the backup folder shared on the Principal Server and you can access it from the Mirror Server, you will need to restore the full backup to the Mirror server with the NORECOVERY option.

RESTORE DATABASE TestMirror FROM DISK = N'\\Principal\Backup\Backup.bak' 
WITH FILE = 1, MOVE N'TestMirror_log' TO 
N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\TestMirror_1.ldf', 
NORECOVERY, NOUNLOAD, STATS = 10;

RESTORE LOG TestMirror FROM DISK = N'\\Principal\Backup\Backup.trn' 
WITH  FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10;


Mirror3

Now it's time to dig down and configure Database Mirroring. From the Principal server, right click the database and choose "Tasks" | "Mirror" or choose "Properties" | "Mirroring".

Mirror4

Click the "Configure Security" button and click "Next >" if the Configure Database Mirroring Security Wizard intro screen appears. The next screen should be the Include Witness Server screen:

Mirror5

This is where you would configure a witness server for your mirroring, but since we're just configuring a basic mirror we will skip this part. However, if you are configuring mirroring in an Enterprise environment it is recommended you configure a witness server because without one you will not have synchronous automatic failover option.
Select "No", then click "Next >" to continue the process.

The next screen will give you options to configure the Principal Server Instance:

Mirror6

Here we will be creating our endpoint, which is a SQL Server object that allows SQL Server to communicate over the network. We will name it Mirroring with a Listener Port of 5022.
Click the "Next >" button to continue.

The next screen will give you options to configure the Mirror Server Instance:

Mirror7

To connect to the Mirror server instance we will need to click the "Connect..." button then select the mirror server and provide the correct credentials:

Mirror8

Once connected, we also notice our endpoint name is Mirroring and we are listening on port 5022.
Click "Next >" and you'll see the Service Accounts screen.

Mirror9

When using Windows Authentication, if the server instances use different accounts, specify the service accounts for SQL Server. These service accounts must all be domain accounts (in the same or trusted domains).
If all the server instances use the same domain account or use certificate-based authentication, leave the fields blank.
Since my service accounts are using the same domain account, I'll leave this blank.
Click "Finish" and you'll see a Complete the Wizard screen that summarizes what we just configured. Click "Finish" one more time.

Mirror10

If you see the big green check mark that means Database Mirroring has been configured correctly. However, just because it is configured correctly doesn't mean that database mirroring is going to start...

Next screen that pops up should be the Start/Do Not Start Mirroring screen:

Mirror11

We're going to click Do Not Start Mirroring just so we can look at the Operating Modes we can use:

Mirror12

Since we didn't specify a witness server we will not get the High Safety with automatic failover option, but we still get the High Performance and High Safety without automatic failover options.
For this example, we'll stick with synchronous high safety without automatic failover so changes on both servers will be synchronized.

Next, click "Start Mirroring" as shown below.

Mirror13

If everything turned out right, Database Mirroring has been started successfully and we are fully synchronized.

Mirror14

Mirror15 Mirror16

If Database mirroring did not start successfully or you received an error here are a few scripts to troubleshoot the situation:

Both servers should be listening on the same port. To verify this, run the following command:
SELECT type_desc, port 
FROM sys.tcp_endpoints;

We are listening on port 5022. This should be the same on the Principal and Mirror servers:
Mirror17

Database mirroring should be started on both servers. To verify this, run the following command:
SELECT state_desc
FROM sys.database_mirroring_endpoints;

The state_desc column on both the Principal and Mirror server should be started:
Mirror18

To start an Endpoint, run the following:
ALTER ENDPOINT 
STATE = STARTED 
AS TCP (LISTENER_PORT = )
FOR database_mirroring (ROLE = ALL);

ROLES should be the same on both the Principal and Mirror Server, to verify this run:
SELECT role 
FROM sys.database_mirroring_endpoints;

Mirror19

To verify the login from the other server has CONNECT permissions run the following:
SELECT EP.name, SP.STATE,
CONVERT(nvarchar(38), suser_name(SP.grantor_principal_id))
AS GRANTOR,
SP.TYPE AS PERMISSION,
CONVERT(nvarchar(46),suser_name(SP.grantee_principal_id))
AS GRANTEE
FROM sys.server_permissions  SP , sys.endpoints EP
WHERE SP.major_id  = EP.endpoint_id
ORDER BY  Permission,grantor, grantee;

Mirror20

You can see here from the State and Permissions column that the user has been Granted Connect permissions.
Next Steps
  • To learn more about the three different operating modes involved in database mirroring check out this previous tip
  • Before implementing database mirroring make sure this is the high availability option you need for you company.Log shippingreplication, and clustering are also high availability options that may bring more benefit than mirroring depending on the needs.
  • Check out all of the Database Mirroring tips.

sábado, 11 de octubre de 2014

Desactivar Thumbs.db en Windows 7

Windows

http://www.alebentelecom.es/servicios-informaticos/faqs/desactivar-thumbsdb-en-windows-7x



Desactivar THUMBS.DB en Windows 7


El archivo Thumbs.db es el encargado de guardar información de las miniaturas de vista previa de los archivos que almacenamos en nuestro ordenador.
Este archivo se genera automáticamente y suele dar muchos problemas a la hora de trabajar con carpetas con grandes volúmenes de imágenes, sobre todo al borrar carpetas o moverlas de sitio, ya que el Sistema Operativo nos indicará que el archivo se encuentra en uso y no puede ser movido o borrado.
Estos archivos no son imprescindibles para el correcto funcionamiento del sistema y podemos borrarlos sin problema, además podremos indicar a nuestro sistema que no queremos que los genere de forma automática, poniendo así solución a tan molesto problema.

Desactivar archivo THUMBS.DB en Windows 7

  • Desde la utilidad "Ejecutar" ejecutaremos "gpedit.msc". Debe abrirse la utilidad "Editor de directivas de grupo Local"
  • Una vez dentro, navegaremos hasta: Configuración de usuario \ Plantillas administrativas  \ Componentes de Windows \ Explorador de Windows
  • Daremos doble clic a "Desactivar almacenamiento en cache de vistas miniaturas en archivos thumbs.db ocultos" y marcaremos la opción "Habilitada
  • Pulsamos "Aceptar" y todo listo, nuestro sistema no generará más archivos Thumbs.db.






Desactivar archivo THUMBS.DB en Windows XP

Lo haremos mediante las Opciones de carpeta.
Nos vamos a un Explorador de Windows (Tecla Windows + E) 

En el menú Herramientas > Opciones. Podemos realizar esto abriendo una ventana Ejecutar (Tecla Windows + R) y escribir: control folders, pulsamos Aceptar. 

Ahora en la ventana de Opciones de carpeta nos vamos a la pestaña: Ver y marcamos: "No alojar en caché las vistas en miniatura". Pulsamos Aceptar y listo.





miércoles, 8 de octubre de 2014

On a computer that has a multicore processor, you may be unable to install SQL Server 2005

SQL Server

http://support.microsoft.com/kb/954835



Collapse imageSymptoms

Consider the following scenario. You try to install Microsoft SQL Server 2005 on a computer that has a multicore processor, and one of the following conditions is true:
  • The ratio between logical processors and physical sockets is not a power of 2. For example, the computer has a single socket together with a triple-core processor.
  • The number of physical cores is not a power of 2.
  • The total number of CPUs is an odd number. For example, there are seven or nine CPUs.
In these scenarios, you cannot install SQL Server 2005.
When the installation fails, the following error message is logged in the Summary.txt file:
The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually."
Note The Summary.txt file is located in the following folder:
%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG
Additionally, an error message that resembles the following is logged in the SQLSetupNum_InstanceName_SQL.log file:
Doing Action: Do_sqlScript
PerfTime Start: Do_sqlScript : Wed Jun 18 08:32:41 2008
Service MSSQLSERVER with parameters '-m SqlSetup -Q -qSQL_Latin1_General_CP1_CI_AS -T4022 -T3659 -T3610 -T4010' is being started at Wed Jun 18 08:32:41 2008
Unable to start service (1053)
Error Code: 0x8007041d (1053)
Windows Error Text: The service did not respond to the start or control request in a timely fashion.
Source File Name: sqlsetuplib\service.cpp
Compiler Timestamp: Fri Sep 16 13:20:12 2005
Function Name: sqls::Service::Start
Source Line Number: 316
Notes
  • Num represents a four-digit number that increases for every installation of SQL Server 2005. InstanceName represents the name of the instance of SQL Server 2005.
  • The SQLSetupNum_InstanceName_SQL.log file is located in the following folder:
    %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files
  • This problem does not occur in Microsoft SQL Server 2008.

Collapse imageWorkaround

To work around this problem, use one of the following methods:

Method 1

Follow these steps before you install SQL Server 2005:
  1. Copy the setup files of the release version of SQL Server 2005 to a folder in a local drive.

    Note You must copy all the setup files that include the Servers folder and the Tools folder to a local drive.
  2. Download the SQL Server 2005 SP2 or SP3 package, and then expand it on the local drive by using the /X parameter. For example, run the following command to expand the package:
    SQLServer2005SP2-KB921896-x64-ENU.exe /X
    For more information about how to obtain SQL Server 2005 SP2 or SP3, click the following article number to view the article in the Microsoft Knowledge Base:
    913089 How to obtain the latest service pack for SQL Server 2005
  3. Note the full paths to the new .msp files in the expanded update package. For example:
    D:\temp\SP2\hotfixsql\files\sqlrun_sql.msp
  4. At the command prompt, run the Setup.exe file from the release version by using the appropriate path to involve the new .msp file in the setup. 

    For example, the following command uses the update package to update the SQL Server Database Engine component to the service pack level:
    D:\temp\Servers\setup.exe HOTFIXPATCH="D:\temp\SQL2005_12Procs\SP2\hotfixsql\files\sqlrun_sql.msp"
    Note  After you complete this step, the installation of SQL Server 2005 is in a configuration that is unsupported until you have applied the SQL Server service pack.
  5. Apply the service pack package by running the setup file(s) in the expanded location. This step applies all service pack components and returns the installation of SQL Server 2005 to a supported state. 

Method 2

Before you install SQL Server 2005, temporarily change the number of logical processors to one. This makes the computer appear to be a single-processor system, and SQL Server 2005 is installed successfully. To do this, follow these steps:

Windows Server 2003

  1. To change the number of logical processors in Windows Server 2003, follow these steps:
    1. Click Start, click Run, type msconfig, and then click OK.
    2. In the System Configuration Utility dialog box, click the BOOT.INI tab.
    3. On the BOOT.INI tab, click Advanced Options.
    4. In the BOOT.INI Advanced Options dialog box, click to select the /NUMPROC= check box.
    5. In the list that is next to the /NUMPROC= check box, click 1, and then click OK.
    6. In the System Configuration Utility dialog box, click OK.
    7. Restart the server.
  2. Install SQL Server 2005.
  3. Install the latest service pack for SQL Server 2005.

    For more information about how to obtain the latest SQL Server 2005 service pack, click the following article number to view the article in the Microsoft Knowledge Base:
    913089 How to obtain the latest service pack for SQL Server 2005
  4. Restart the server by using all the processors. To do this, follow these steps:
    1. Click Start, click Run, type msconfig, and then click OK.
    2. In the System Configuration Utility dialog box, click the General tab.
    3. On the General tab, click Normal Startup - load all device drivers and services, and then click OK.
    4. Restart the server.

Windows Server 2008

  1. To change the number of logical processors in Windows Server 2008, follow these steps::
    1. Click Start, click Run, type msconfig, and then click OK.
    2. In the System Configuration dialog box, click the Boot tab.
    3. On the Boot tab, click Advanced options.
    4. In the BOOT Advanced Options dialog box, click to select the Number of processors check box.
    5. Under the Number of processors check box, click 1, and then click OK.
    6. In the System Configuration dialog box, click OK.
    7. Restart the server.
  2. Install SQL Server 2005.
  3. Install the latest service pack for SQL Server 2005.

    Note You must install SQL Server 2005 Service Pack 2 (SP2) or a later service pack on Windows Server 2008.

    For more information about how to obtain the latest SQL Server 2005 service pack, click the following article number to view the article in the Microsoft Knowledge Base:
    913089 How to obtain the latest service pack for SQL Server 2005
  4. Restart the server by using all the processors. To do this, follow these steps:
    1. Click Start, click Run, type msconfig, and then click OK.
    2. In the System Configuration dialog box, click the General tab.
    3. On the General tab, click Normal startup, and then click OK.
    4. Restart the server.

!!!! Alternate Workaround Steps ¡¡¡¡


The following are conditions in which the common workaround methods are insufficient:
  • At the time that you receive the failure to start SQL Server during setup, you are presented with a Retry option. Now, replace the Sqlservr.exe and Sqlos.dll files into the BINN folder at your install location from a Service Pack 2 (SP2) installation, and then select the Retry option. This enables SQL Server to start and complete the setup. 
    Note You are now in a production situation.
  • Immediately apply SQL Server SP2, and you are back in a supported configuration.

Collapse imageStatus

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in SQL Server 2005 Service Pack 1.

Collapse imageMore information

SQL Server 2005 Setup does not integrate any SQL Server 2005 service packs. To install SQL Server 2005 to a specific service pack level, you must install the release version of SQL Server 2005 first. Then, you must install the required SQL Server 2005 service pack. Therefore, although this problem is fixed in SQL Server 2005 Service Pack 1 (SP1), you still cannot install SQL Server 2005.

SQL Server 2005 Express Edition is a stand-alone package that integrates a specific SQL Server 2005 service pack. When you perform a fresh installation of SQL Server 2005 Express Edition that integrates a specific SQL Server 2005 service pack, SQL Server 2005 Express Edition is running at that service pack level. Therefore, in the scenario that is mentioned in the "Symptoms" section, you can successfully install SQL Server 2005 Express Edition together with the integrated service pack.

To download SQL Server 2005 Express Edition together with the latest SQL Server 2005 service pack, visit the following Microsoft Web site:


For more information, visit the following Microsoft Web site:

Collapse imageProperties


Article ID: 954835 - Last Review: June 21, 2014 - Revision: 10.0

Applies to
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Workgroup Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
Keywords: 
kbsqlsetup kbexpertiseadvanced kbtshoot kbprb KB954835

How-to install Microsoft SQL Server 2005 32-bit on Windows Server 2008 R2 64-bit without warnings

SQL Server

http://amitelman.wordpress.com/2013/01/10/install-sql-server-2005-32-bit-on-windows-server-2008-r2-64-bit/



On default installation Windows Server 2008 R2 (x64) machine you may receive System Configuration Check warnings:
- IIS Feature Requirement (Warning) 
ASP.Net Version Registration Requirement (Warning)
SQL2005OnW2008R2_1
You need install missing components.
Open Server Manager – Start. All Programs. Administrative tools. Server Manager.
On the left tab Click on Roles, then on Add Roles. Click Next. On Server Role screen check Web Server (IIS). Click Next two time until you get into Role Services screen.
In Addition to checked add :
HTTP Redirection
ASP.NET
Windows Authentication
IIS 6 Metabase Compatibility
IIS 6 WMI Compatibility
Click on Next
Click on Install
Run SQL server setup again. If you install 32-Bit SQL on 64-Bit Windows you may get one more Warning message:
ASP.Net Version Registration Requirement (Warning)
ASP.Net Version Registration Requirement 64-bit ASP.Net is Registered. Required 32-bit ASP.Net to install Microsoft Reporting Services 2005(32-bit).
To fix this we need Enable 32-Bit Applications Pool.
Open  Server Manager. Expand Roles, Web Server (IIS), Internet Information Services (IIS) Manager.
On the right side you will see Connections tab. Click on your server. Two more tabs will appear – Application Pools and Actions.  Expand your server by clicking on +. Click on Application Pool. Click on DefaultAppPool.
SQL2005OnW2008R2_2
On Action tab click Set ApplicationPool Deafaults… Change Enable 23-Bit Applications  value to True. OK
SQL2005OnW2008R2_3
Run Setup again. System Configuration Check runs without warnings:
SQL2005OnW2008R2_4
Installation successful.

select @@version