• Fix the principal

    --On the principal

    --create a new cert for the endpoint

    USE master;

    CREATE CERTIFICATE [principal_new_cert]

    WITH SUBJECT = 'mirroring cert',

    START_DATE='07/11/2010', --make sure this is a day prior to the current date

    EXPIRY_DATE='07/12/2020'; --make sure this is set out 10-20 years

    GO

    --backup the cert for the endpoint

    BACKUP CERTIFICATE [principal_new_cert] TO FILE = 'c:\principal_new_cert.cer';

    GO

    --set mirroring to use the new cert

    ALTER ENDPOINT DBMirrorEndPoint FOR DATABASE_MIRRORING (AUTHENTICATION = CERTIFICATE [principal_new_cert])

    GO

    --finally delete the old cert for the endpoint

    DROP CERTIFICATE [old_principal_cert]

    GO

    Fix the mirror

    --On the mirror

    --drop the old cert for the principal login

    DROP CERTIFICATE [old_principal_cert]

    GO

    --create the new cert using the backup you made on the principal server

    CREATE CERTIFICATE [principal_new_cert] AUTHORIZATION PrincipalServerUser

    FROM FILE = 'c:\principal_new_cert.cer'

    GO

    --create a new cert for the endpoint

    USE master;

    CREATE CERTIFICATE [mirror_new_cert]

    WITH SUBJECT = 'mirroring cert',

    START_DATE='07/11/2010', --make sure this is a day prior to the current date

    EXPIRY_DATE='07/12/2020'; --make sure this is set out 10-20 years

    GO

    --backup the new cert for the endpoint

    BACKUP CERTIFICATE [mirror_new_cert] TO FILE = 'c:\mirror_new_cert.cer';

    GO

    --set mirroring to use the new cert

    ALTER ENDPOINT DBMirrorEndPoint FOR DATABASE_MIRRORING (AUTHENTICATION = CERTIFICATE [mirror_new_cert])

    GO

    --finally delete the old cert for the endpoint

    DROP CERTIFICATE [old_mirror_cert]

    Finish the principal

    --Go back to the principal

    --drop the old cert for the mirror login

    DROP CERTIFICATE [old_mirror_cert]

    GO

    --create the new cert using the backup you made on the mirror server

    CREATE CERTIFICATE [mirror_new_cert] AUTHORIZATION MirrorServerUser

    FROM FILE = 'c:\mirror_new_cert.cer'

    GO

    --finally resume the mirroring session for each database

    ALTER DATABASE [mirrored_database_name] SET PARTNER RESUME