Microsoft Premier Support (PFE) Latin America

Este Blog está dedicado a todo aquel interesado en tecnología Microsoft, y con deseos de aprender de la experiencia y vivencias de los PFES de Latinoamerica y del grupo de Incubation Support & Services (ISS)

November, 2012

  • Scheduling SharePoint 2010 backups

    Hello Community,

    After many time of abscense I'm back to continue providing you with more information that can be valuable or useful, this time for SharePoint 2010 beginners that would like to know the new OOB Backup/Restore features and how to schedule backups using Windows scheduled tasks.

    First we need to know and understand SharePoint Central Administration site options

    As we can see on the image above we have 2 categories "Farm Backup and Restore" & "Granular Backup".

    1. The first options are to backup and restore the entire farm
    2. Then we can configure backup options like: Number of threads and backup file path
    3. Also we can check the history for both backups and restores
    4. And finally a shortcut to the timer job status in charge of execute backups or restorations

    Here we have granular backup options now. SharePoint 2010 includes export/import options that was only available through stsadm in MOSS 2007, in order SharePoint administrator can execute a backup of a site, list or document library without PowerShell:

    1. Backing up particular site collections or sites, lists and document libraries
    2. Recover specific information from a content database that does not belong to a valid web application. In this way SharePoint administrator does not need to attach the content database* to the web application and then after recoverying data delete it once content was extracted, options available for this new feature are shown on image below:

    3. Finally a shortcut to review the status of the granular backup

    *ONLY databases that can be explored by option named "Recover data from an unattached content database" are the ones with SharePoint 2010 version. If you want to get information from a MOSS 2007 content database you will need migrate the content database to SharePoint 2010 first using PowerShell.

     

     

     

    Using Windows Scheduled Tasks

    Having scheduled backups are fundamental for SharePoint adminsitrators, most of the times this taks are executed overnight, first of all, to grant data integrity and get the last updated data ,and then to minimize performance impact because of the heavy I/O on disks

    In this section you will find some examples with the correct syntaxis for PowerShell scripts, but first we need to build a .BAT file like this one

    @echo on

    SET SOURCE_SITE=<URL>
    SET DEST=<Path>

    powershell -command <PS1 File>  %SOURCE_SITE% %DEST%
    echo “Backup completed successfully at %DEST%” on %DATE% %TIME% >> <LogFileCustom>

     

    Where:

    <URL> Will be the Site Collection to be backed up

    <Path> Path for the backup file. Drive:\backupintranet\backupintranet.bak

    <LogFileCustom> Log file(Optional) Drive:\backupintranet\backupLog.txt

    <PS1 File> PowerShell script location Drive:\backupintranet\Bckptl.ps1

     

    But, what's inside PS1 file?, we have many options. Before we need to understand that SharePoint Central Administration site only allows us  to make backups of the entire farm or at web application level only, but not for a specific site collection or site, we need to highlight that SharePoint administrator will be able to restore SharePoint objects as fast as possible, rather than restoring the entire content inside the content database that can be 200 GB of size and taking hours to be restored.

    Well PS1 file MUST start with the following line in order to start PowerShell

    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

    What we have for backups:

    Site Collections:

    Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose] (http://technet.microsoft.com/en-us/library/ee748617.aspx)

    Sites, Lists or Document Libraries

    Export-SPWeb -Identity <Site URL> -Path <Path and file name> [-ItemUrl <URL of site, list, or library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose] (http://technet.microsoft.com/en-us/library/ee428301.aspx)

    Never forget that file extensions for sites, lists and document libraries is CMP (Content Migration Package)

     

     

    Farm configuration

    Backup-SPConfigurationDatabase -Directory <BackupFolder> -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> -DatabaseCredentials <WindowsPowerShellCredentialObject> [-Verbose] (http://technet.microsoft.com/en-us/library/ee428320.aspx)

    This last option is a new feature in SharePoint 2010 that allows SharePoint administrator to backup farm CONFIGURATION located in Configuration database, the objective is to restore some configuration settings in a different Configuration database like a DRP SharePoint farm (Disaster Recovery Plan)

     

    If you want to know more backup/restore options and some PowerShell sample scripts for SharePoint 2010 you can check the following technet article:

    http://technet.microsoft.com/en-us/library/ee428315.aspx

    See you soon...!!!

  • Programación de respaldos automatizados para SharePoint 2010

    Hola comunidad,

    Después de mucho tiempo regresamos a continuar con información que puede ser valiosa para ustedes, en esta ocasión para los principiantes de SharePoint 2010 que desean saber las opciones de Respaldo y Restauración que SharePoint 2010 tiene out-of-the-box y como usar las tareas programadas de Windows para calendarizar respaldos.

    Primero entendamos las opciones que tenemos desde la Administración Central de SharePoint

    Como podemos observar en la imagen anterior tenemos 2 categorias "Respaldo y Restauración de la granja" y "Respaldo Granular".

    1. En las primeras opciones podemos respaldar y restaurar la granja en su totalidad.
    2. Podemos configurar opciones de ejecución de respaldos como: El número de hilos para realizar el respaldo y la ubicación del archivo de respaldo
    3. También podemos consultar el histórico de respaldos y restauraciones
    4. Y finalmente un acceso directo al trabajo del temporizador encargado de la ejecución de los respaldo y restauraciones

    Después tenemos las opciones para los respaldos granulares. SharePoint 2010 integra estas opciones que solo estaban disponibles a traves de stsadm en la versión anterior, para que el administrador de la granja de SharePoint pueda en un momento dado ejecutar un respaldo de una lista o biblioteca de documentos sin tener que usar PowerShell:

    1. Respaldos de colecciones de sitios en particular o bien de un sitio dentro de la colección de sitios o una lista o biblioteca de documentos
    2. Recuperar información de una base de datos de contenido que no ha sido adjuntada a una aplicación web válida. De esta manera no requiero tener ninguna estructura de SharePoint para extraer el contenido de una base de datos de contenido* y como lo muestra la imagen abajo el administrador de la granja de SharePoint podrá extraer diferente información

    3. Y finalmente un acceso directo a revisar el estado del respaldo granular

    *Las únicas bases de datos de contenido que pueden ser exploradas por la opción "Recover data from an unattached content database" son las que actualmente sean version SharePoint 2010. Si se desea extraer información de una base de datos de contenido de MOSS 2007 será necesario primero actualizar la base de datos a SharePoint 2010 mediante PowerShell.

     

     

     

     

    Usando las tareas programadas de Windows

    La calendarización de los respaldos será siempre una función fundamental pues la mayoría de los administradores de sistemas programa estas actividades durante la noche, en primer lugar por el impacto que puede existir en los datos a respaldar ya sea para mantener la integridad o para tener en el respaldo la mayor actualización de la información y por otro lado para no afectar el desempeño de las aplicaciónes debido al alto I/O que un respaldo conlleva.

    Esta sección tiene la intención de proveer de algunos ejemplos con la sintaxis apropiada para que cada administrador de SharePoint calendarice sus respaldos.

    Primero es necesario saber que requeriremos de un archivo .bat para la ejecución del respaldo desde PowerShell, por ejemplo:

    @echo on
    SET SOURCE_SITE=<URL>http://intranet
    SET DEST=<Path>
    echo “backup Started at” %DATE% %TIME% >> <LogFileCustom>

    powershell -command <PS1 File>  %SOURCE_SITE% %DEST%
    echo “Backup completed successfully at %DEST%” on %DATE% %TIME% >> <LogFileCustom>
    @echo on

     

    Donde:

    <URL> Será la Colección de sitios a respaldar

    <Path> La ubicación completa incluyendo el nombre del archivo donde se creará el respaldo. Ej.: Drive:\backupintranet\backupintranet.bak

    <LogFileCustom> El archivo de log de los respaldos (Opcional) Ej.: Drive:\backupintranet\backupLog.txt

    <PS1 File> La ubicación del script de PowerShell que será ejecutado para el respaldo. Ej.: Drive:\backupintranet\Bckptl.ps1

     

    Ahora bien que deberá incluir el archivo PS1?, bien pues tenemos varias opciones. De inicio debemos de tomar en cuenta que las opciones del sitio de Administración Central de SharePoint nos permite hacer respaldos a nivel de toda la granja o de aplicación web, pero no de una colección de sitios en particular, siendo importante destacar que haciendo esta clase de respaldos el administrador de SharePoint tendrá la capacidad de restaurar información imporntate en menor tiempo que si lo hiciera restaurando toda la base de datos de contenido, pues ésta podría llegar a medir hasta 200 GB, lo que implicarían horas en una restauración.

    Bien pues el archivo PS1 deberá iniciar con la siguiente línea que permitirá ejecutar la llamada de PowerShell

    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

    Ahora si las opciones para respaldos:

    Colecciones de Sitios:

    Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose] (http://technet.microsoft.com/en-us/library/ee748617.aspx)

    Sitios, Listas o Bibliotecas de documentos

    Export-SPWeb -Identity <Site URL> -Path <Path and file name> [-ItemUrl <URL of site, list, or library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose] (http://technet.microsoft.com/en-us/library/ee428301.aspx)

    Jamás olviden que la extensión de los archivos de respaldos para sitios, listas o bibliotecas de documentos es CMP (Content Migration Package)

     

     

    Configuración de la granja

    Backup-SPConfigurationDatabase -Directory <BackupFolder> -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> -DatabaseCredentials <WindowsPowerShellCredentialObject> [-Verbose] (http://technet.microsoft.com/en-us/library/ee428320.aspx)

    Esta última es una nueva característica que permitirá respaldar cierta configuración almacenada en la base de datos de Configuración de SharePoint, con el objetivo de restaurar dicha configuración en una nueva base de datos de configuración en una nueva granja de SharePoint y reducir el tiempo de creación de una nueva granja, por ejemplo en el caso de granjas para DRP (Disaster Recovery Plan)

     

    Si desean conocer más opciones y ejemplos de scripts de PowerShell para los diferentes objetos de SharePoint 2010 pueden consultar el siguiente contenido:

    http://technet.microsoft.com/en-us/library/ee428315.aspx

    Hasta la próxima...!!!